summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch
diff options
context:
space:
mode:
authorAlexandru Avadanii <Alexandru.Avadanii@enea.com>2016-05-31 22:34:54 +0200
committerAlexandru Avadanii <Alexandru.Avadanii@enea.com>2016-06-04 16:04:52 +0000
commite7e2d84bec0d404057bce203f9c90231360e88ee (patch)
tree43e54e897217da67906580991c3c7f0a110250e8 /patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch
parent70f2caa773fc5f0e2b1154a5c095665375f02666 (diff)
Rebase: deploy related patch series.
After change "common.py: catch stderr in exec_cmd" [1] and other unrelated changes were merged upstream, we need to rebase the complete deploy related series. While we're at it, re-export Fuel@OPNFV patches in Armband. [1] https://gerrit.opnfv.org/gerrit/#/c/14561/ Change-Id: Icbc8261c2e24e4b29e8f5f2bc83db6829219129a
Diffstat (limited to 'patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch')
-rw-r--r--patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch75
1 files changed, 75 insertions, 0 deletions
diff --git a/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch b/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch
new file mode 100644
index 00000000..f2e21e24
--- /dev/null
+++ b/patches/opnfv-fuel/0008-virtual_fuel-prepare-class-to-allow-multiple-bridges.patch
@@ -0,0 +1,75 @@
+From: Josep Puigdemont <josep.puigdemont@enea.com>
+Date: Fri, 20 May 2016 10:23:45 +0200
+Subject: [PATCH] virtual_fuel: prepare class to allow multiple bridges
+
+The VirtualFuel class has now two new methods:
+
+ del_vm_nics: Deletes all interfaces from the VM.
+
+ add_vm_nic: Adds a NIC to the VM, attached to the specified bridge.
+
+The following method has been deleted:
+
+ set_vm_nic: implemented with the two new methods
+
+Apart from the deleted method, no functionality has been changed. This
+is just a small but necessary step towards adding support for supporting
+more than one bridge in the fuel VM.
+
+Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
+---
+ deploy/environments/virtual_fuel.py | 21 +++++++++++++--------
+ 1 file changed, 13 insertions(+), 8 deletions(-)
+
+diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py
+index 7dc9720..5a86c97 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,13 @@ 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(temp_vm_file)
++ self.del_vm_nics()
++ self.add_vm_nic(self.pxe_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):