From 8cd3ed2adb531d2a8db4d281fd3f876130ef483c Mon Sep 17 00:00:00 2001 From: guohliu Date: Wed, 17 Apr 2013 18:22:57 +0800 Subject: Fix powervm driver resize instance error During a resize operation in powervm, the logical volume of the instance will be copied and compressed to a file. Current logic decompresses it twice before copying this file to a new volume which will cause the new instance to not boot properly. Fixes bug #1169848 Change-Id: I91f536919511aafbf7dbe14abbee48dbceb189b2 (cherry picked from commit 5643bd5d9bf17335e109d4b2d93e161f4d12c6f9) --- nova/virt/powervm/operator.py | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'nova/virt/powervm') diff --git a/nova/virt/powervm/operator.py b/nova/virt/powervm/operator.py index 14abac80ba..51554c94b6 100644 --- a/nova/virt/powervm/operator.py +++ b/nova/virt/powervm/operator.py @@ -416,23 +416,24 @@ class PowerVMOperator(object): return disk_info def deploy_from_migrated_file(self, lpar, file_path, size): - # decompress file - gzip_ending = '.gz' - if file_path.endswith(gzip_ending): - raw_file_path = file_path[:-len(gzip_ending)] - else: - raw_file_path = file_path + """Deploy the logical volume and attach to new lpar. - self._operator._decompress_image_file(file_path, raw_file_path) + :param lpar: lar instance + :param file_path: logical volume path + :param size: new size of the logical volume + """ + need_decompress = file_path.endswith('.gz') try: # deploy lpar from file - self._deploy_from_vios_file(lpar, raw_file_path, size) + self._deploy_from_vios_file(lpar, file_path, size, + decompress=need_decompress) finally: # cleanup migrated file - self._operator._remove_file(raw_file_path) + self._operator._remove_file(file_path) - def _deploy_from_vios_file(self, lpar, file_path, size): + def _deploy_from_vios_file(self, lpar, file_path, size, + decompress=True): self._operator.create_lpar(lpar) lpar = self._operator.get_lpar(lpar['name']) instance_id = lpar['lpar_id'] @@ -444,7 +445,8 @@ class PowerVMOperator(object): self._operator.attach_disk_to_vhost(diskName, vhost) # Copy file to device - self._disk_adapter._copy_file_to_device(file_path, diskName) + self._disk_adapter._copy_file_to_device(file_path, diskName, + decompress) self._operator.start_lpar(lpar['name']) -- cgit v1.2.1