Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new image type:vdh support in bootc image builder #5903

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions provider/bootc_image_builder/bootc_image_build_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -838,6 +838,21 @@ def cleanup_aws_ami_and_snapshot(params):
aws_utils.delete_aws_ami_snapshot_id(params)


def convert_vhd_to_qcow2(params):
"""
Convert vhd disk format into qcow2

@param params: one dictionary wrapping various parameter
Comment on lines +841 to +845
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing return converted_image_path instruction here.

"""
original_image_path = params.get('vm_disk_image_path')
converted_image_path = original_image_path.replace("vhd", "qcow2")
LOG.debug(f"converted vhd to qcow2 output is : {converted_image_path}")

convert_cmd = f"qemu-img convert -p -f vpc -O qcow2 {original_image_path} {converted_image_path}"
process.run(convert_cmd, shell=True, verbose=True, ignore_status=False)
return converted_image_path


def get_baseurl_from_repo_file(repo_file_path):
"""
One method to get compose url from current repository file
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
container_url = "localhost/bootc:eln"
local_container = "yes"
build_container = "registry.stage.redhat.io/rhel9/rhel-bootc:rhel-9.4"
rhel_9.5_nightly_bib:
rhel_9.5_nightly_bib, upstream_bib:
build_container = "registry.stage.redhat.io/rhel9/rhel-bootc:rhel-9.5"
rhel_10.0_bib:
build_container = "registry.stage.redhat.io/rhel10-beta/rhel-bootc:rhel-10.0-beta"
Expand Down Expand Up @@ -158,3 +158,8 @@
disk_image_type = "raw"
output_sub_folder = "image"
output_name = "disk.raw"
- vhd:
disk_image_type = "vhd"
output_sub_folder = "vpc"
output_name = "disk.vhd"
only upstream_bib
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
container_url = "localhost/bootc:eln"
local_container = "yes"
build_container = "registry.stage.redhat.io/rhel9/rhel-bootc:rhel-9.4"
rhel_9.5_nightly_bib:
rhel_9.5_nightly_bib, upstream_bib:
build_container = "registry.stage.redhat.io/rhel9/rhel-bootc:rhel-9.5"
fips_enable = "yes"
rhel_10.0_bib:
Expand Down Expand Up @@ -168,3 +168,8 @@
disk_image_type = "raw"
output_sub_folder = "image"
output_name = "disk.raw"
- vhd:
disk_image_type = "vhd"
output_sub_folder = "vpc"
output_name = "disk.vhd"
only upstream_bib
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ def update_bib_env_info(params, test):
params.update({'vm_disk_image_path': full_path_dest})
params.update({'vm_name_bootc': disk_name})

if params.get("disk_image_type") == "vhd":
converted_image_from_vhd_qcow2 = bib_utils.convert_vhd_to_qcow2(params)
params.update({'vm_disk_image_path': converted_image_from_vhd_qcow2})

iso_install_path = os.path.join(libvirt_base_folder, f"{disk_name}_{firmware}.qcow2")
params.update({'iso_install_path': iso_install_path})
cleanup_files.append(iso_install_path)
Expand Down Expand Up @@ -128,7 +132,7 @@ def run(test, params, env):
update_bib_env_info(params, test)
if disk_image_type in ["vmdk"]:
bib_utils.create_and_start_vmware_vm(params)
elif disk_image_type in ["qcow2", "raw", "anaconda-iso"]:
elif disk_image_type in ["qcow2", "raw", "anaconda-iso", "vhd"]:
bib_utils.create_qemu_vm(params, env, test)
elif disk_image_type in ["ami"]:
if len(aws_config_dict) != 0:
Expand Down
Loading