summaryrefslogtreecommitdiff
path: root/nova/virt
diff options
context:
space:
mode:
authorguohliu <guohliu@cn.ibm.com>2013-04-17 18:22:57 +0800
committerRuby Loo <rloo@yahoo-inc.com>2013-05-14 15:16:56 +0000
commit8cd3ed2adb531d2a8db4d281fd3f876130ef483c (patch)
tree4c9b4986c64931af17e5b1be56971e7e3ae1dc3e /nova/virt
parent0f6deca9dc548c6c76373bf0c062b88f1ff68260 (diff)
downloadnova-8cd3ed2adb531d2a8db4d281fd3f876130ef483c.tar.gz
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)
Diffstat (limited to 'nova/virt')
-rw-r--r--nova/virt/powervm/operator.py24
1 files changed, 13 insertions, 11 deletions
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'])