From 3d7b436102772e5e9e146e45e8d52210ce7498b5 Mon Sep 17 00:00:00 2001 From: Pavel Raiskup Date: Wed, 22 Oct 2014 13:57:12 +0200 Subject: controller/get_machine: allow specifying name of VM * get_machine: New option --name and variable $opt_name. --- controller/get_machine | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'controller/get_machine') diff --git a/controller/get_machine b/controller/get_machine index 7d4e619..7121114 100755 --- a/controller/get_machine +++ b/controller/get_machine @@ -18,6 +18,7 @@ Options: --distro=NAME Distro name, like fedora --distro-version=VERSION E.g. 20 for Fedora 20 --openstack-instance=ID + --name=NAME Name of the machine EOHELP test -n "$1" && exit "$1" } @@ -42,14 +43,14 @@ get_ip() ) -longopts="distro:,distro-version:,openstack-instance:" +longopts="distro:,distro-version:,openstack-instance:,name:" ARGS=$(getopt -o "" -l "help,$longopts" -n "$0" -- "$@") \ || exit 1 eval set -- "$ARGS" while true; do case "$1" in - --distro|--distro-version|--openstack-instance) + --distro|--distro-version|--openstack-instance|--name) opt=$(sed -e 's/^--//' -e 's/[^[a-zA-Z0-9]/_/g'<<<"$1") eval "opt_$opt=\"${2,,}\"" shift 2 @@ -74,10 +75,11 @@ flavor=${os_flavor_ids[$image_version]} test -z "$image" && die "no image for '$image_version'" test -z "$flavor" && die "no flavor for '$image_version'" +test -z "$opt_name" && opt_name="testing-$image" info "booting machine $image_version from $image" -machine=$(boot "testing-$image" "$image" "$flavor") +machine=$(boot "$opt_name" "$image" "$flavor") info "machine id: $machine" -- cgit