Add output messages during OVA prepare

This commit is contained in:
Joshua Boniface 2022-10-19 12:58:11 -04:00
parent dff156b2b0
commit e550e39a5a
1 changed files with 10 additions and 0 deletions

View File

@ -282,7 +282,9 @@ class VMBuilderScript(VMBuilder):
import daemon_lib.ceph as pvc_ceph import daemon_lib.ceph as pvc_ceph
# First loop: Create the destination disks # First loop: Create the destination disks
print("Creating destination disk volumes")
for volume in self.vm_data["volumes"]: for volume in self.vm_data["volumes"]:
print(f"Processing volume {volume['volume_name']}")
with open_zk(config) as zkhandler: with open_zk(config) as zkhandler:
success, message = pvc_ceph.add_volume( success, message = pvc_ceph.add_volume(
zkhandler, zkhandler,
@ -297,7 +299,9 @@ class VMBuilderScript(VMBuilder):
) )
# Second loop: Map the destination disks # Second loop: Map the destination disks
print("Mapping destination disk volumes")
for volume in self.vm_data["volumes"]: for volume in self.vm_data["volumes"]:
print(f"Processing volume {volume['volume_name']}")
dst_volume_name = f"{self.vm_name}_{volume['disk_id']}" dst_volume_name = f"{self.vm_name}_{volume['disk_id']}"
dst_volume = f"{volume['pool']}/{dst_volume_name}" dst_volume = f"{volume['pool']}/{dst_volume_name}"
@ -312,7 +316,9 @@ class VMBuilderScript(VMBuilder):
raise ProvisioningError(f"Failed to map volume '{dst_volume}'.") raise ProvisioningError(f"Failed to map volume '{dst_volume}'.")
# Third loop: Map the source disks # Third loop: Map the source disks
print("Mapping source disk volumes")
for volume in self.vm_data["volumes"]: for volume in self.vm_data["volumes"]:
print(f"Processing volume {volume['volume_name']}")
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}"
@ -327,6 +333,7 @@ class VMBuilderScript(VMBuilder):
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 # Fourth loop: Convert the source (usually VMDK) volume to the raw destination volume
print("Converting source disk volumes to raw destination volumes")
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}"
@ -335,6 +342,9 @@ class VMBuilderScript(VMBuilder):
dst_volume = f"{volume['pool']}/{dst_volume_name}" dst_volume = f"{volume['pool']}/{dst_volume_name}"
dst_devpath = f"/dev/rbd/{dst_volume}" dst_devpath = f"/dev/rbd/{dst_volume}"
print(
f"Converting {volume['volume_format']} {src_volume} at {src_devpath} to {dst_volume} at {dst_devpath}"
)
retcode, stdout, stderr = pvc_common.run_os_command( retcode, stdout, stderr = pvc_common.run_os_command(
f"qemu-img convert -C -f {volume['volume_format']} -O raw {src_devpath} {dst_devpath}" f"qemu-img convert -C -f {volume['volume_format']} -O raw {src_devpath} {dst_devpath}"
) )