From 5c2a8cf8b97dc02875050c3d17df29dfd63cf8cd Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 24 Apr 2024 10:55:56 +0200 Subject: [PATCH 1/4] vm_image_util: add IMAGE_DISK_EXTENSION variable This variable allows to override the disk extension which is initially based on the DISK_FORMAT. Signed-off-by: Mathieu Tortuyaux --- build_library/vm_image_util.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index 214bc2d179..e9bc4d31c0 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -110,6 +110,9 @@ IMG_DEFAULT_FS_HOOK= # May be raw, qcow2 (qemu), or vmdk (vmware, virtualbox) IMG_DEFAULT_DISK_FORMAT=raw +# Extension to set before the compression extension. +IMG_DEFAULT_DISK_EXTENSION= + # Name of the partition layout from disk_layout.json IMG_DEFAULT_DISK_LAYOUT=base @@ -421,6 +424,11 @@ _dst_path() { # Get the proper disk format extension. _disk_ext() { local disk_format=$(_get_vm_opt DISK_FORMAT) + local disk_extension=$(_get_vm_opt DISK_EXTENSION) + if [[ -n ${disk_extension} ]]; then + echo "${disk_extension}" + return 0 + fi case ${disk_format} in raw) echo bin;; qcow2) echo img;; From 9f02c8d2624c6641f437ae3d2650a04e879a2113 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 24 Apr 2024 10:56:54 +0200 Subject: [PATCH 2/4] vm_image_util: produce qcow2 images for Scaleway For importing Scaleway images, extension needs to be '.qcow2' See: https://www.scaleway.com/en/docs/compute/instances/how-to/snapshot-import-export-feature/ > Make sure that the QCOW / QCOW2 image file you want to import, > uses the file extension .qcow or .qcow2 to avoid issues while importing the image. Signed-off-by: Mathieu Tortuyaux --- build_library/release_util.sh | 2 +- build_library/vm_image_util.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build_library/release_util.sh b/build_library/release_util.sh index c1e518c7cd..faa84425f3 100644 --- a/build_library/release_util.sh +++ b/build_library/release_util.sh @@ -101,7 +101,7 @@ compress_disk_images() { # We want to compress images, but we also want to remove the uncompressed files # from the list of uploadable files. for filename in "${local_files_to_evaluate[@]}"; do - if [[ "${filename}" =~ \.(img|bin|vdi|vhd|vhdx|vmdk)$ ]]; then + if [[ "${filename}" =~ \.(img|bin|vdi|vhd|vhdx|vmdk|qcow[2]?)$ ]]; then # Parse the formats as an array. This will yield an extra empty # array element at the end. readarray -td, FORMATS<<<"${FLAGS_image_compression_formats}," diff --git a/build_library/vm_image_util.sh b/build_library/vm_image_util.sh index e9bc4d31c0..9a6e89df1f 100644 --- a/build_library/vm_image_util.sh +++ b/build_library/vm_image_util.sh @@ -313,6 +313,7 @@ IMG_scaleway_DISK_LAYOUT=vm IMG_scaleway_OEM_PACKAGE=common-oem-files IMG_scaleway_OEM_USE=scaleway IMG_scaleway_OEM_SYSEXT=oem-scaleway +IMG_scaleway_DISK_EXTENSION=qcow2 ########################################################### From 9dfcbe201bc5daf40f1a4ba98ec042e3b4bc703e Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 24 Apr 2024 15:19:55 +0200 Subject: [PATCH 3/4] ci-automation/vm: do not compress Scaleway images Signed-off-by: Mathieu Tortuyaux --- ci-automation/vms.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci-automation/vms.sh b/ci-automation/vms.sh index 33e655fefe..02754fa3eb 100644 --- a/ci-automation/vms.sh +++ b/ci-automation/vms.sh @@ -138,6 +138,8 @@ function _vm_build_impl() { COMPRESSION_FORMAT="bz2,none" elif [[ "${format}" =~ ^(hyperv|hyperv_vhdx)$ ]];then COMPRESSION_FORMAT="zip" + elif [[ "${format}" =~ ^(scaleway)$ ]];then + COMPRESSION_FORMAT="none" fi ./run_sdk_container -n "${vms_container}" -C "${packages_image}" \ -v "${vernum}" \ From 0a7819a5f0bc5f6dd41ba14799c6447690077902 Mon Sep 17 00:00:00 2001 From: Mathieu Tortuyaux Date: Wed, 24 Apr 2024 15:23:23 +0200 Subject: [PATCH 4/4] changelog: add entry Signed-off-by: Mathieu Tortuyaux --- changelog/changes/2024-04-24-scaleway.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/changes/2024-04-24-scaleway.md diff --git a/changelog/changes/2024-04-24-scaleway.md b/changelog/changes/2024-04-24-scaleway.md new file mode 100644 index 0000000000..aa69be0413 --- /dev/null +++ b/changelog/changes/2024-04-24-scaleway.md @@ -0,0 +1 @@ +- Scaleway: images are now provided directly as `.qcow2` to ease the import on Scaleway ([scripts#1953](https://github.com/flatcar/scripts/pull/1953))