aboutsummaryrefslogtreecommitdiffstats
path: root/deploy
diff options
context:
space:
mode:
authorMichal Skalski <mskalski@mirantis.com>2016-07-08 16:14:15 +0000
committerGerrit Code Review <gerrit@172.30.200.206>2016-07-08 16:14:15 +0000
commit7c600840185d9b454c1995e35a9704db823fb5c6 (patch)
tree0ec5e3307add52ae90b08f60f7970d7b33341d5f /deploy
parentf59b4e0786f11e2799990beeaf0e4a148c3572af (diff)
parentdfc83244874060c4052bc3d29c256fa1bd52687d (diff)
Merge changes from topic 'multiple-nics-for-fuel-vm'
* changes: deploy: add support for multiple bridges virtual_fuel: prepare class to allow multiple bridges
Diffstat (limited to 'deploy')
-rwxr-xr-xdeploy/deploy.py10
-rw-r--r--deploy/environments/virtual_fuel.py22
2 files changed, 21 insertions, 11 deletions
diff --git a/deploy/deploy.py b/deploy/deploy.py
index 8064af993..56e5bd583 100755
--- a/deploy/deploy.py
+++ b/deploy/deploy.py
@@ -318,8 +318,8 @@ def parse_arguments():
parser.add_argument('-s', dest='storage_dir', action='store',
default='%s/images' % CWD,
help='Storage Directory [default: images]')
- parser.add_argument('-b', dest='pxe_bridge', action='store',
- default='pxebr',
+ parser.add_argument('-b', dest='pxe_bridge', action='append',
+ default=[],
help='Linux Bridge for booting up the Fuel Master VM '
'[default: pxebr]')
parser.add_argument('-p', dest='fuel_plugins_dir', action='store',
@@ -341,6 +341,9 @@ def parse_arguments():
args = parser.parse_args()
log(args)
+ if not args.pxe_bridge:
+ args.pxe_bridge = ['pxebr']
+
check_file_exists(args.dha_file)
check_dir_exists(os.path.dirname(args.deploy_log))
@@ -355,7 +358,8 @@ def parse_arguments():
check_file_exists(iso_abs_path)
log('Using image directory: %s' % args.storage_dir)
create_dir_if_not_exists(args.storage_dir)
- check_bridge(args.pxe_bridge, args.dha_file)
+ for bridge in args.pxe_bridge:
+ check_bridge(bridge, args.dha_file)
kwargs = {'no_fuel': args.no_fuel, 'fuel_only': args.fuel_only,
diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py
index 2fac98b25..b1a76e479 100644
--- a/deploy/environments/virtual_fuel.py
+++ b/deploy/environments/virtual_fuel.py
@@ -67,22 +67,25 @@ class VirtualFuel(ExecutionEnvironment):
with open(self.temp_vm_file, "wc") as f:
self.vm_xml.write(f, pretty_print=True, xml_declaration=True)
- def set_vm_nic(self):
+ def del_vm_nics(self):
interfaces = self.vm_xml.xpath('/domain/devices/interface')
for interface in interfaces:
interface.getparent().remove(interface)
+
+ def add_vm_nic(self, bridge):
interface = etree.Element('interface')
interface.set('type', 'bridge')
source = etree.SubElement(interface, 'source')
- source.set('bridge', self.pxe_bridge)
+ source.set('bridge', bridge)
model = etree.SubElement(interface, 'model')
model.set('type', 'virtio')
+
devices = self.vm_xml.xpath('/domain/devices')
if devices:
device = devices[0]
device.append(interface)
-
- self.update_vm_template_file()
+ else:
+ err('No devices!')
def create_volume(self, pool, name, su, img_type='qcow2'):
log('Creating image using Libvirt volumes in pool %s, name: %s' %
@@ -121,11 +124,14 @@ class VirtualFuel(ExecutionEnvironment):
disk_size = disk_sizes['fuel']
disk_path = self.create_image(disk_path, disk_size)
- temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name)
- exec_cmd('cp %s %s' % (self.vm_template, temp_vm_file))
- self.set_vm_nic()
+ self.del_vm_nics()
+ for bridge in self.pxe_bridge:
+ self.add_vm_nic(bridge)
+ self.update_vm_template_file()
+
vm_definition_overwrite = self.dha.get_vm_definition('fuel')
- self.define_vm(self.vm_name, temp_vm_file, disk_path,
+
+ self.define_vm(self.vm_name, self.temp_vm_file, disk_path,
vm_definition_overwrite)
def setup_environment(self):