Commit e847cd15 authored by glucas's avatar glucas

ganeti/create-vm-arn: missing condition and few clarifications

parent eaa1f37d
#!/bin/bash
# Copyright (C) 2015-2016 Alsace Réseau Neutre
# Copyright (C) 2015-2017 Alsace Réseau Neutre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
......@@ -47,9 +47,9 @@ Usage: $(basename $0) -n name [-d size] [-r size] [-4 IPv4prefixe(s)] [-6 IPv6p
-r <memory-size> Memory size in MB (default: $ram)
-4 <ipv4> IPv4 route(s) (optional)
-6 <ipv6> IPv6 route(s) (optional)
-s <suite> Debian suite to install (wheezy, jessie, ...) (default: $suite)
-s <suite> Debian suite to install (wheezy, jessie, ...) (default: $suite, valid: jessie)
-k <file> SSH public key to allow for root login (optional)
-i <file> ISO to boot on (optional)
-i <file> ISO to boot on (absolute path) (optional)
EOF
......@@ -72,13 +72,14 @@ while getopts "s:n:d:r:4:6:k:i:" opt; do
done
# check inputs
[ "$suite" = 'jessie' ] || show_usage 'Invalid suite'
[ "$suite" = 'jessie' ] || show_usage 'Invalid Debian suite'
[ -n "$name" ] || show_usage 'Name empty'
[ "$disk" -ge 2 ] || show_usage 'Disk too small'
[ "$ram" -ge 128 ] || show_usage 'Too few RAM'
# should be sufficient…
[[ -z "$ipv4" || "$ipv4" =~ ^([0-9]{1,3}.){3}[0-9]{1,3}/[0-9]{1,2}( |$) ]] || show_usage 'Invalid IPv4'
[[ -z "$ipv6" || "$ipv6" =~ ^([0-9a-fA-F]{0,4}:){1,7}[0-9a-fA-F]{1,4}/[0-9]{1,3}( |$) ]] || show_usage 'Invalid IPv6'
[[ -z "$iso" || "$iso" =~ ^/ ]] || show_usage 'ISO must be an absolute path'
# create config dir
......@@ -87,7 +88,7 @@ gnt-cluster command --failure-only mkdir -p "$VMCONFDIR"
# VNC
# No VNC for internal VM
# For internal VM, VNC is only open on localhost. Please use ssh -L
vnc='-H kvm:vnc_bind_address=127.0.0.1'
# Generate VNC password for VPS
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment