diff options
author | Lingxian Kong <anlin.kong@gmail.com> | 2020-06-12 23:42:17 +1200 |
---|---|---|
committer | Lingxian Kong <anlin.kong@gmail.com> | 2020-06-12 23:43:12 +1200 |
commit | 775abab528f7505209f20dd184b7ba18be7f9351 (patch) | |
tree | 4e67230469b70df63fdce6a2d87b9cbb64d58d3b | |
parent | 8d9b938a5596db02d42090104f58a53d6aa4bdde (diff) | |
download | trove-775abab528f7505209f20dd184b7ba18be7f9351.tar.gz |
Support image type for guest image building
Change-Id: I8d640c47f00446d7f912ece9892b17585cde3add
(cherry picked from commit 428e3644f8770a608f6e4dfc617f45f6e17cb685)
-rw-r--r-- | doc/source/admin/building_guest_images.rst | 6 | ||||
-rw-r--r-- | integration/scripts/functions_qemu | 4 | ||||
-rwxr-xr-x | integration/scripts/trovestack | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/doc/source/admin/building_guest_images.rst b/doc/source/admin/building_guest_images.rst index abac6bec..b76dcd71 100644 --- a/doc/source/admin/building_guest_images.rst +++ b/doc/source/admin/building_guest_images.rst @@ -141,7 +141,7 @@ The trove guest agent image could be created by running the following command: guest_os_release=xenial dev_mode=true guest_username=ubuntu - imagepath=$HOME/images/trove-${guest_os}-${guest_os_release}-${datastore_type} + imagepath=$HOME/images/trove-${guest_os}-${guest_os_release}-${datastore_type}.qcow2 * ``dev_mode=true`` is mainly for testing purpose for trove developers and it's necessary to build the image on the trove controller host, because the host @@ -165,6 +165,10 @@ The trove guest agent image could be created by running the following command: repository, by default it's master, use other branches as needed such as stable/train. +* The image type can be easily changed by specifying a different image file + extension, e.g. to build a raw image, you can specify + ``$your-image-name.raw`` as the ``imagepath`` parameter. + For example, in order to build a MySQL image for Ubuntu Xenial operating system in development mode: diff --git a/integration/scripts/functions_qemu b/integration/scripts/functions_qemu index f43078d9..ccc4e795 100644 --- a/integration/scripts/functions_qemu +++ b/integration/scripts/functions_qemu @@ -13,13 +13,14 @@ function build_vm() { local dev_mode=$4 local guest_username=$5 local image_output=$6 + local image_type=${image_output##*.} + local working_dir=$(dirname ${image_output}) local elementes="base vm" local trove_elements_path=${PATH_TROVE}/integration/scripts/files/elements local GUEST_IMAGETYPE=${GUEST_IMAGETYPE:-"qcow2"} local GUEST_IMAGESIZE=${GUEST_IMAGESIZE:-4} local GUEST_CACHEDIR=${GUEST_CACHEDIR:-"$HOME/.cache/image-create"} - local working_dir=$(dirname ${image_output}) export GUEST_USERNAME=${guest_username} @@ -79,6 +80,7 @@ function build_vm() { disk-image-create -x \ -a amd64 \ -o ${image_output} \ + -t ${image_type} \ -t ${GUEST_IMAGETYPE} \ --image-size ${GUEST_IMAGESIZE} \ --image-cache ${GUEST_CACHEDIR} \ diff --git a/integration/scripts/trovestack b/integration/scripts/trovestack index 74f91fef..a6435cd1 100755 --- a/integration/scripts/trovestack +++ b/integration/scripts/trovestack @@ -781,7 +781,7 @@ function cmd_build_image() { if [[ -z "$output" ]]; then image_name="trove-datastore-${IMAGE_GUEST_OS}-${IMAGE_GUEST_RELEASE}-${IMAGE_DATASTORE_TYPE}" image_folder=$HOME/images - output="${image_folder}/${image_name}" + output="${image_folder}/${image_name}.qcow2" fi # Always rebuild the image. sudo rm -f $output |