418
418
def deploy_from_migrated_file(self, lpar, file_path, size):
421
if file_path.endswith(gzip_ending):
422
raw_file_path = file_path[:-len(gzip_ending)]
424
raw_file_path = file_path
419
"""Deploy the logical volume and attach to new lpar.
426
self._operator._decompress_image_file(file_path, raw_file_path)
421
:param lpar: lar instance
422
:param file_path: logical volume path
423
:param size: new size of the logical volume
425
need_decompress = file_path.endswith('.gz')
429
428
# deploy lpar from file
430
self._deploy_from_vios_file(lpar, raw_file_path, size)
429
self._deploy_from_vios_file(lpar, file_path, size,
430
decompress=need_decompress)
432
432
# cleanup migrated file
433
self._operator._remove_file(raw_file_path)
433
self._operator._remove_file(file_path)
435
def _deploy_from_vios_file(self, lpar, file_path, size):
435
def _deploy_from_vios_file(self, lpar, file_path, size,
436
437
self._operator.create_lpar(lpar)
437
438
lpar = self._operator.get_lpar(lpar['name'])
438
439
instance_id = lpar['lpar_id']
444
445
self._operator.attach_disk_to_vhost(diskName, vhost)
446
447
# Copy file to device
447
self._disk_adapter._copy_file_to_device(file_path, diskName)
448
self._disk_adapter._copy_file_to_device(file_path, diskName,
449
451
self._operator.start_lpar(lpar['name'])