Move conversion to install() step

Seems more clear to me than doing it in prepare()
This commit is contained in:
Joshua Boniface 2022-10-19 13:09:29 -04:00
parent 41eccb9c7d
commit 729481126c
1 changed files with 10 additions and 11 deletions

View File

@ -333,8 +333,16 @@ class VMBuilderScript(VMBuilder):
if not success: if not success:
raise ProvisioningError(f"Failed to map volume '{src_volume}'.") raise ProvisioningError(f"Failed to map volume '{src_volume}'.")
# Fourth loop: Convert the source (usually VMDK) volume to the raw destination volume def install(self):
print("Converting source disk volumes to raw destination volumes") """
install(): Perform the installation
Convert the mapped source volumes to the mapped destination volumes
"""
# Run any imports first
import daemon_lib.common as pvc_common
for volume in self.vm_data["volumes"]: for volume in self.vm_data["volumes"]:
src_volume_name = volume["volume_name"] src_volume_name = volume["volume_name"]
src_volume = f"{volume['pool']}/{src_volume_name}" src_volume = f"{volume['pool']}/{src_volume_name}"
@ -354,15 +362,6 @@ class VMBuilderScript(VMBuilder):
f"Failed to convert {volume['volume_format']} volume '{src_volume}' to raw volume '{dst_volume}' with qemu-img: {stderr}" f"Failed to convert {volume['volume_format']} volume '{src_volume}' to raw volume '{dst_volume}' with qemu-img: {stderr}"
) )
def install(self):
"""
install(): Perform the installation
Noop for OVA deploys as no further tasks are performed.
"""
pass
def cleanup(self): def cleanup(self):
""" """
cleanup(): Perform any cleanup required due to prepare()/install() cleanup(): Perform any cleanup required due to prepare()/install()