diff options
-rw-r--r-- | controller/bin/dtf-get-machine.in | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/controller/bin/dtf-get-machine.in b/controller/bin/dtf-get-machine.in index 2a668b3..b0036d6 100644 --- a/controller/bin/dtf-get-machine.in +++ b/controller/bin/dtf-get-machine.in @@ -13,6 +13,7 @@ info() opt_openstack_instance="$DTF_OPENSTACK_DEFAULT_ID" opt_distro=fedora opt_distro_version=20 +opt_separate_volume= function show_help() { @@ -27,6 +28,7 @@ Options: --openstack-instance=ID --name=NAME Name of the machine --quite Print only the VM IP address to stdout + --separate-volume=SIZE Create separate volume EOHELP test -n "$1" && exit "$1" } @@ -34,8 +36,18 @@ test -n "$1" && exit "$1" boot() ( set -o pipefail + + image_params=() + + if test -n "$4"; then + image_params+=(--block-device) + image_params+=('source=image,id='"$2"',dest=volume,size='"$4"',shutdown=preserve,bootindex=0') + else + image_params+=(--image "$2") + fi + nova boot "$1" --poll \ - --image "$2" \ + "${image_params[@]}" \ --flavor "$3" \ --security-groups "$os_security_group" \ --key-name "$os_keypair" \ @@ -51,14 +63,14 @@ get_ip() ) -longopts="distro:,distro-version:,openstack-instance:,name:,quiet" +longopts="distro:,distro-version:,openstack-instance:,name:,separate-volume:,quiet" ARGS=$(getopt -o "" -l "help,$longopts" -n "$0" -- "$@") \ || exit 1 eval set -- "$ARGS" while true; do case "$1" in - --distro|--distro-version|--openstack-instance|--name) + --distro|--distro-version|--openstack-instance|--name|--separate-volume) opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") eval "opt_$opt=\"${2,,}\"" shift 2 @@ -105,7 +117,7 @@ test -z "$opt_name" && opt_name="testing-$image" info "booting machine $image_version from $image" -machine=$(boot "$opt_name" "$image" "$flavor") || exit 1 +machine=$(boot "$opt_name" "$image" "$flavor" "$opt_separate_volume") || exit 1 info "machine id: $machine" get_ip "$machine" |