diff options
| -rwxr-xr-x | create-guest-with-cloudinit | 11 | 
1 files changed, 6 insertions, 5 deletions
diff --git a/create-guest-with-cloudinit b/create-guest-with-cloudinit index 8258f11..41d8b00 100755 --- a/create-guest-with-cloudinit +++ b/create-guest-with-cloudinit @@ -12,7 +12,6 @@ VARDIR='/var/lib/libvirt/cloudinit'  SCRIPTDIR='/usr/local/bin/leap_cloudadmin'  KVM_URI='qemu:///system' -  # overwrite defaults  [ -e $CONFIG] && . $CONFIG @@ -20,6 +19,7 @@ KVM_URI='qemu:///system'  # swapsize is swapsize of the base image  SWAPSIZE=4  MIN_DISKSIZE=10 +size=$MIN_DISKSIZE  fail() { [ $# -eq 0 ] || echo "$@"; exit 1; }  bad_usage() { usage 1>&2; [ $# -eq 0 ] || fail "$@"; exit 1; } @@ -27,13 +27,13 @@ bad_usage() { usage 1>&2; [ $# -eq 0 ] || fail "$@"; exit 1; }  usage() {         cat <<EOF -Usage: ${0##*/} [ $options ] guest_name +Usage: ${0##*/} -s ..  guest_name    Creates a new guest VM using cloud-init to utilize nocloud.    options:      -h             show usage -    -s size        disk size in GB, including $SWAPSIZE GB swap. Minimal value is $MIN_DISKSIZE GB. +    -s size        disk size in GB, including $SWAPSIZE GB swap. Defaults to minimal value of $MIN_DISKSIZE GB.  EOF  } @@ -56,12 +56,12 @@ while [ $# -ne 0 ]; do         shift;  done -  [ $# -lt 1 ] && bad_usage "must provide guest name"  [ $# -gt 1 ] && bad_usage "too many arguments"  [ $size -lt $MIN_DISKSIZE ] && bad_usage "Minimal disk size is 10 GB !" +  # requirements  echo "mtools_skip_check=1">~/.mtoolsrc  [ -e $VARDIR ] || ( mkdir $VARDIR ; chown libvirt-qemu $VARDIR ) @@ -77,7 +77,8 @@ userdata="$ETC/$vmname-user-data"  echo  echo "Creating guest VM $vmname with size: $size GB, using $userdata for clound-init" -echo +echo "OK ? <Ctrl-C> to abort, <enter> to resume." +read enter  # is a VM with the same name defined ?  virsh dominfo $vmname > /dev/null 2>&1  | 
