1 From: Josep Puigdemont <josep.puigdemont@enea.com>
2 Date: Wed, 4 May 2016 14:27:23 +0200
3 Subject: [PATCH] virtual_fuel: factor out image creation into a method
5 Signed-off-by: Josep Puigdemont <josep.puigdemont@enea.com>
7 deploy/environments/virtual_fuel.py | 7 ++++++-
8 1 file changed, 6 insertions(+), 1 deletion(-)
10 diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py
11 index 966bb91..82c4e47 100644
12 --- a/deploy/environments/virtual_fuel.py
13 +++ b/deploy/environments/virtual_fuel.py
14 @@ -51,15 +51,20 @@ class VirtualFuel(ExecutionEnvironment):
15 with open(temp_vm_file, 'w') as f:
16 vm_xml.write(f, pretty_print=True, xml_declaration=True)
18 + def create_image(self, disk_path, disk_size):
19 + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size))
22 vm_template = '%s/%s' % (self.root_dir,
23 self.dha.get_node_property(
24 self.fuel_node_id, 'libvirtTemplate'))
25 check_file_exists(vm_template)
27 disk_path = '%s/%s.raw' % (self.storage_dir, self.vm_name)
28 disk_sizes = self.dha.get_disks()
29 disk_size = disk_sizes['fuel']
30 - exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size))
31 + self.create_image(disk_path, disk_size)
33 temp_vm_file = '%s/%s' % (self.temp_dir, self.vm_name)
34 exec_cmd('cp %s %s' % (vm_template, temp_vm_file))
35 self.set_vm_nic(temp_vm_file)