diff --git a/README.md b/README.md index 99307c38..f0bfc260 100644 --- a/README.md +++ b/README.md @@ -158,6 +158,7 @@ The following image types are currently available via the `--type` argument: | `vmdk` | [VMDK](https://en.wikipedia.org/wiki/VMDK) usable in vSphere, among others | | `anaconda-iso` | An unattended Anaconda installer that installs to the first disk found. | | `raw` | Unformatted [raw disk](https://en.wikipedia.org/wiki/Rawdisk). | +| `vhd` | [vhd](https://en.wikipedia.org/wiki/VHD_(file_format)) usable in Virtual PC, among others | ## 💾 Target architecture diff --git a/bib/cmd/bootc-image-builder/build_type.go b/bib/cmd/bootc-image-builder/build_type.go index 23fa73a1..e5bb398f 100644 --- a/bib/cmd/bootc-image-builder/build_type.go +++ b/bib/cmd/bootc-image-builder/build_type.go @@ -18,6 +18,7 @@ var supportedImageTypes = map[string]BuildType{ "qcow2": BuildTypeDisk, "raw": BuildTypeDisk, "vmdk": BuildTypeDisk, + "vhd": BuildTypeDisk, "anaconda-iso": BuildTypeISO, "iso": BuildTypeISO, } diff --git a/bib/cmd/bootc-image-builder/main.go b/bib/cmd/bootc-image-builder/main.go index f88ea795..327023be 100644 --- a/bib/cmd/bootc-image-builder/main.go +++ b/bib/cmd/bootc-image-builder/main.go @@ -437,7 +437,9 @@ func cmdBuild(cmd *cobra.Command, args []string) error { exports = append(exports, "image") case "vmdk": exports = append(exports, "vmdk") - + case "vhd": + // should we make "vhd" just an alias for "vpc" everywhere? + exports = append(exports, "vpc") case "anaconda-iso", "iso": exports = append(exports, "bootiso") default: diff --git a/test/test_build.py b/test/test_build.py index ae1db04e..8895a484 100644 --- a/test/test_build.py +++ b/test/test_build.py @@ -134,6 +134,7 @@ def build_images(shared_tmpdir, build_container, request, force_aws_upload): "ami": pathlib.Path(output_path) / "image/disk.raw", "raw": pathlib.Path(output_path) / "image/disk.raw", "vmdk": pathlib.Path(output_path) / "vmdk/disk.vmdk", + "vhd": pathlib.Path(output_path) / "vpc/disk.vhd", "anaconda-iso": pathlib.Path(output_path) / "bootiso/install.iso", } assert len(artifact) == len(set(tc.image for tc in gen_testcases("all"))), \ @@ -453,7 +454,7 @@ def test_iso_installs(image_type): @pytest.mark.parametrize("images", gen_testcases("multidisk"), indirect=["images"]) def test_multi_build_request(images): artifacts = set() - expected = {"disk.qcow2", "disk.raw", "disk.vmdk"} + expected = {"disk.qcow2", "disk.raw", "disk.vhd", "disk.vmdk"} for result in images: filename = os.path.basename(result.img_path) assert result.img_path.exists() diff --git a/test/testcases.py b/test/testcases.py index 1157111d..277bafd7 100644 --- a/test/testcases.py +++ b/test/testcases.py @@ -4,10 +4,10 @@ import platform # disk image types can be build from a single manifest -DISK_IMAGE_TYPES = ("qcow2", "raw", "vmdk") +DISK_IMAGE_TYPES = ["qcow2", "raw", "vmdk", "vhd"] # supported images that can be booted in a cloud -CLOUD_BOOT_IMAGE_TYPES = ("ami",) +CLOUD_BOOT_IMAGE_TYPES = ["ami"] @dataclasses.dataclass @@ -88,7 +88,7 @@ def gen_testcases(what): # pylint: disable=too-many-return-statements return [ klass(image=img) for klass in (TestCaseCentos, TestCaseFedora) - for img in ("ami", "anaconda-iso", "qcow2", "raw", "vmdk") + for img in CLOUD_BOOT_IMAGE_TYPES + DISK_IMAGE_TYPES + ["anaconda-iso"] ] if what == "multidisk": # single test that specifies all image types