summaryrefslogtreecommitdiffstats
path: root/fuel/deploy/environments
diff options
context:
space:
mode:
Diffstat (limited to 'fuel/deploy/environments')
-rw-r--r--fuel/deploy/environments/__init__.py9
-rw-r--r--fuel/deploy/environments/execution_environment.py17
-rw-r--r--fuel/deploy/environments/libvirt_environment.py30
-rw-r--r--fuel/deploy/environments/virtual_fuel.py11
4 files changed, 55 insertions, 12 deletions
diff --git a/fuel/deploy/environments/__init__.py b/fuel/deploy/environments/__init__.py
index c274feb..fb73157 100644
--- a/fuel/deploy/environments/__init__.py
+++ b/fuel/deploy/environments/__init__.py
@@ -1 +1,8 @@
-__author__ = 'eszicse'
+###############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# szilard.cserey@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
diff --git a/fuel/deploy/environments/execution_environment.py b/fuel/deploy/environments/execution_environment.py
index 4f612a6..63be5cd 100644
--- a/fuel/deploy/environments/execution_environment.py
+++ b/fuel/deploy/environments/execution_environment.py
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# szilard.cserey@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+
from lxml import etree
import common
@@ -10,6 +20,7 @@ check_dir_exists = common.check_dir_exists
check_file_exists = common.check_file_exists
check_if_root = common.check_if_root
+
class ExecutionEnvironment(object):
def __init__(self, storage_dir, dha_file, root_dir):
@@ -54,8 +65,8 @@ class ExecutionEnvironment(object):
uuid.getparent().remove(uuid)
disks = vm_xml.xpath('/domain/devices/disk')
for disk in disks:
- if (disk.get('type') == 'file'
- and disk.get('device') == 'disk'):
+ if (disk.get('type') == 'file' and
+ disk.get('device') == 'disk'):
sources = disk.xpath('source')
for source in sources:
disk.remove(source)
@@ -64,4 +75,4 @@ class ExecutionEnvironment(object):
disk.append(source)
with open(temp_vm_file, 'w') as f:
vm_xml.write(f, pretty_print=True, xml_declaration=True)
- exec_cmd('virsh define %s' % temp_vm_file) \ No newline at end of file
+ exec_cmd('virsh define %s' % temp_vm_file)
diff --git a/fuel/deploy/environments/libvirt_environment.py b/fuel/deploy/environments/libvirt_environment.py
index e156fd2..785eeca 100644
--- a/fuel/deploy/environments/libvirt_environment.py
+++ b/fuel/deploy/environments/libvirt_environment.py
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# szilard.cserey@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+
from lxml import etree
import glob
@@ -11,7 +21,6 @@ check_dir_exists = common.check_dir_exists
check_file_exists = common.check_file_exists
check_if_root = common.check_if_root
-NET_DIR = 'libvirt/networks'
class LibvirtEnvironment(ExecutionEnvironment):
@@ -19,17 +28,18 @@ class LibvirtEnvironment(ExecutionEnvironment):
super(LibvirtEnvironment, self).__init__(
storage_dir, dha_file, root_dir)
self.dea = dea
- self.network_dir = '%s/%s' % (self.root_dir, NET_DIR)
+ self.network_dir = '%s/%s' % (self.root_dir,
+ self.dha.get_virt_net_conf_dir())
self.node_ids = self.dha.get_all_node_ids()
self.net_names = self.collect_net_names()
def create_storage(self, node_id, disk_path, disk_sizes):
if node_id == self.fuel_node_id:
- disk_size = disk_sizes['fuel']
+ disk_size = disk_sizes['fuel']
else:
- roles = self.dea.get_node_role(node_id)
- role = 'controller' if 'controller' in roles else 'compute'
- disk_size = disk_sizes[role]
+ roles = self.dea.get_node_role(node_id)
+ role = 'controller' if 'controller' in roles else 'compute'
+ disk_size = disk_sizes[role]
exec_cmd('fallocate -l %s %s' % (disk_size, disk_path))
def create_vms(self):
@@ -48,6 +58,10 @@ class LibvirtEnvironment(ExecutionEnvironment):
self.define_vm(vm_name, temp_vm_file, disk_path)
exec_cmd('rm -fr %s' % temp_dir)
+ def start_vms(self):
+ for node_id in self.node_ids:
+ self.dha.node_power_on(node_id)
+
def create_networks(self):
for net_file in glob.glob('%s/*' % self.network_dir):
exec_cmd('virsh net-define %s' % net_file)
@@ -82,11 +96,11 @@ class LibvirtEnvironment(ExecutionEnvironment):
self.delete_vm(node_id)
def setup_environment(self):
- check_if_root()
check_dir_exists(self.network_dir)
self.cleanup_environment()
- self.create_vms()
self.create_networks()
+ self.create_vms()
+ self.start_vms()
def cleanup_environment(self):
self.delete_vms()
diff --git a/fuel/deploy/environments/virtual_fuel.py b/fuel/deploy/environments/virtual_fuel.py
index f8b6791..cb8be63 100644
--- a/fuel/deploy/environments/virtual_fuel.py
+++ b/fuel/deploy/environments/virtual_fuel.py
@@ -1,3 +1,13 @@
+###############################################################################
+# Copyright (c) 2015 Ericsson AB and others.
+# szilard.cserey@ericsson.com
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+###############################################################################
+
+
from lxml import etree
import common
@@ -8,6 +18,7 @@ log = common.log
check_file_exists = common.check_file_exists
check_if_root = common.check_if_root
+
class VirtualFuel(ExecutionEnvironment):
def __init__(self, storage_dir, pxe_bridge, dha_file, root_dir):