From 729481126c839c35c9170fc1e7f22376e7923b83 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Wed, 19 Oct 2022 13:09:29 -0400 Subject: [PATCH] Move conversion to install() step Seems more clear to me than doing it in prepare() --- .../provisioner/examples/script/2-ova.py | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/api-daemon/provisioner/examples/script/2-ova.py b/api-daemon/provisioner/examples/script/2-ova.py index 2ee22381..47bfe963 100644 --- a/api-daemon/provisioner/examples/script/2-ova.py +++ b/api-daemon/provisioner/examples/script/2-ova.py @@ -333,8 +333,16 @@ class VMBuilderScript(VMBuilder): if not success: raise ProvisioningError(f"Failed to map volume '{src_volume}'.") - # Fourth loop: Convert the source (usually VMDK) volume to the raw destination volume - print("Converting source disk volumes to raw destination volumes") + def install(self): + """ + 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"]: src_volume_name = volume["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}" ) - def install(self): - """ - install(): Perform the installation - - Noop for OVA deploys as no further tasks are performed. - """ - - pass - def cleanup(self): """ cleanup(): Perform any cleanup required due to prepare()/install()