diff options
17 files changed, 21 insertions, 18 deletions
diff --git a/deploy/dha_adapters/libvirt_adapter.py b/deploy/dha_adapters/libvirt_adapter.py index c65dab554..85913ac9e 100644 --- a/deploy/dha_adapters/libvirt_adapter.py +++ b/deploy/dha_adapters/libvirt_adapter.py @@ -95,9 +95,12 @@ class LibvirtAdapter(HardwareAdapter): sources = disk.xpath('source') for source in sources: disk_file = source.get('file') - disk_size = exec_cmd('ls -l %s' % disk_file).split()[4] + disk_size = exec_cmd('qemu-img info ' + '%s |grep \"virtual size:\"' + % disk_file).split()[2] delete(disk_file) - exec_cmd('fallocate -l %s %s' % (disk_size, disk_file)) + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_file, + disk_size)) def node_eject_iso(self, node_id): vm_name = self.get_node_property(node_id, 'libvirtName') diff --git a/deploy/environments/libvirt_environment.py b/deploy/environments/libvirt_environment.py index c8a2ef529..2a09117bc 100644 --- a/deploy/environments/libvirt_environment.py +++ b/deploy/environments/libvirt_environment.py @@ -40,7 +40,7 @@ class LibvirtEnvironment(ExecutionEnvironment): 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)) + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) def create_vms(self): temp_dir = tempfile.mkdtemp() diff --git a/deploy/environments/virtual_fuel.py b/deploy/environments/virtual_fuel.py index 89a82c078..0e7f27365 100644 --- a/deploy/environments/virtual_fuel.py +++ b/deploy/environments/virtual_fuel.py @@ -55,7 +55,7 @@ class VirtualFuel(ExecutionEnvironment): disk_path = '%s/%s.raw' % (self.storage_dir, vm_name) disk_sizes = self.dha.get_disks() disk_size = disk_sizes['fuel'] - exec_cmd('fallocate -l %s %s' % (disk_size, disk_path)) + exec_cmd('qemu-img create -f qcow2 %s %s' % (disk_path, disk_size)) temp_vm_file = '%s/%s' % (temp_dir, vm_name) exec_cmd('cp %s %s' % (vm_template, temp_vm_file)) self.set_vm_nic(temp_vm_file) diff --git a/deploy/templates/ericsson/virtual_environment/noha/vms/compute.xml b/deploy/templates/ericsson/virtual_environment/noha/vms/compute.xml index 063b23d98..6fb37432a 100644 --- a/deploy/templates/ericsson/virtual_environment/noha/vms/compute.xml +++ b/deploy/templates/ericsson/virtual_environment/noha/vms/compute.xml @@ -48,7 +48,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/ericsson/virtual_environment/noha/vms/controller.xml b/deploy/templates/ericsson/virtual_environment/noha/vms/controller.xml index d30a95dcf..cf62fbce2 100644 --- a/deploy/templates/ericsson/virtual_environment/noha/vms/controller.xml +++ b/deploy/templates/ericsson/virtual_environment/noha/vms/controller.xml @@ -48,7 +48,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/ericsson/virtual_environment/noha/vms/fuel.xml b/deploy/templates/ericsson/virtual_environment/noha/vms/fuel.xml index a693c96f9..31e84798b 100644 --- a/deploy/templates/ericsson/virtual_environment/noha/vms/fuel.xml +++ b/deploy/templates/ericsson/virtual_environment/noha/vms/fuel.xml @@ -56,7 +56,7 @@ <readonly/> </disk> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcwo2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/hardware_environment/vms/ericsson_montreal_lab/fuel.xml b/deploy/templates/hardware_environment/vms/ericsson_montreal_lab/fuel.xml index 7d06f2d60..b55b16e5f 100644 --- a/deploy/templates/hardware_environment/vms/ericsson_montreal_lab/fuel.xml +++ b/deploy/templates/hardware_environment/vms/ericsson_montreal_lab/fuel.xml @@ -35,7 +35,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <target dev='vda' bus='virtio'/> </disk> <disk type='block' device='cdrom'> diff --git a/deploy/templates/hardware_environment/vms/fuel.xml b/deploy/templates/hardware_environment/vms/fuel.xml index e3e3f80bb..72c15b577 100644 --- a/deploy/templates/hardware_environment/vms/fuel.xml +++ b/deploy/templates/hardware_environment/vms/fuel.xml @@ -35,7 +35,7 @@ <devices> <emulator>/usr/libexec/qemu-kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <target dev='vda' bus='virtio'/> </disk> <disk type='block' device='cdrom'> diff --git a/deploy/templates/intel/virtual_environment/noha/vms/compute.xml b/deploy/templates/intel/virtual_environment/noha/vms/compute.xml index 063b23d98..6fb37432a 100644 --- a/deploy/templates/intel/virtual_environment/noha/vms/compute.xml +++ b/deploy/templates/intel/virtual_environment/noha/vms/compute.xml @@ -48,7 +48,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/intel/virtual_environment/noha/vms/controller.xml b/deploy/templates/intel/virtual_environment/noha/vms/controller.xml index d30a95dcf..cf62fbce2 100644 --- a/deploy/templates/intel/virtual_environment/noha/vms/controller.xml +++ b/deploy/templates/intel/virtual_environment/noha/vms/controller.xml @@ -48,7 +48,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/intel/virtual_environment/noha/vms/fuel.xml b/deploy/templates/intel/virtual_environment/noha/vms/fuel.xml index a693c96f9..67cccbb1e 100644 --- a/deploy/templates/intel/virtual_environment/noha/vms/fuel.xml +++ b/deploy/templates/intel/virtual_environment/noha/vms/fuel.xml @@ -56,7 +56,7 @@ <readonly/> </disk> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment/vms/compute.xml b/deploy/templates/virtual_environment/vms/compute.xml index fa4ef5d8d..f794b651a 100644 --- a/deploy/templates/virtual_environment/vms/compute.xml +++ b/deploy/templates/virtual_environment/vms/compute.xml @@ -21,7 +21,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment/vms/controller.xml b/deploy/templates/virtual_environment/vms/controller.xml index 50950db17..44dd5b655 100644 --- a/deploy/templates/virtual_environment/vms/controller.xml +++ b/deploy/templates/virtual_environment/vms/controller.xml @@ -21,7 +21,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment/vms/fuel.xml b/deploy/templates/virtual_environment/vms/fuel.xml index 86892eb7e..bf8f3e288 100644 --- a/deploy/templates/virtual_environment/vms/fuel.xml +++ b/deploy/templates/virtual_environment/vms/fuel.xml @@ -29,7 +29,7 @@ <readonly/> </disk> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment_noha/vms/compute.xml b/deploy/templates/virtual_environment_noha/vms/compute.xml index fa4ef5d8d..f794b651a 100644 --- a/deploy/templates/virtual_environment_noha/vms/compute.xml +++ b/deploy/templates/virtual_environment_noha/vms/compute.xml @@ -21,7 +21,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment_noha/vms/controller.xml b/deploy/templates/virtual_environment_noha/vms/controller.xml index 50950db17..44dd5b655 100644 --- a/deploy/templates/virtual_environment_noha/vms/controller.xml +++ b/deploy/templates/virtual_environment_noha/vms/controller.xml @@ -21,7 +21,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <source file='disk.raw'/> <target dev='vda' bus='virtio'/> </disk> diff --git a/deploy/templates/virtual_environment_noha/vms/fuel.xml b/deploy/templates/virtual_environment_noha/vms/fuel.xml index 2d2596310..3e7576945 100644 --- a/deploy/templates/virtual_environment_noha/vms/fuel.xml +++ b/deploy/templates/virtual_environment_noha/vms/fuel.xml @@ -24,7 +24,7 @@ <devices> <emulator>/usr/bin/kvm</emulator> <disk type='block' device='cdrom'> - <driver name='qemu' type='raw'/> + <driver name='qemu' type='qcow2'/> <target dev='hdc' bus='ide'/> <readonly/> </disk> |