aboutsummaryrefslogtreecommitdiff
path: root/kvm-creator
diff options
context:
space:
mode:
authorJamie McClelland <jm@mayfirst.org>2009-10-12 11:06:07 -0400
committerJamie McClelland <jm@mayfirst.org>2009-10-12 11:06:07 -0400
commit6c532de11cb38d4d85a4692dbc531031d6840aa4 (patch)
tree6d3be22963b663bae37bea24ed1ea760ace1568c /kvm-creator
parentce60078a6c70a8ea6b30405b4c1709a8e4800a98 (diff)
downloadkvm-manager-6c532de11cb38d4d85a4692dbc531031d6840aa4.tar.gz
kvm-manager-6c532de11cb38d4d85a4692dbc531031d6840aa4.tar.bz2
breaking out the name of the disk and placing it in a env file
called kvmopts which is passed directly to kvm command.
Diffstat (limited to 'kvm-creator')
-rwxr-xr-xkvm-creator6
1 files changed, 4 insertions, 2 deletions
diff --git a/kvm-creator b/kvm-creator
index ff51243..8cb34fc 100755
--- a/kvm-creator
+++ b/kvm-creator
@@ -12,6 +12,7 @@ NAME="$1"
VG="$2"
SIZE="${3:-3G}"
RAM="${4:-512}"
+DISK="/dev/mapper/${VG}-${NAME}"
[ "$CMD" == "create" ] && [ ! -d /etc/sv/kvm ] && mkdir /etc/sv/kvm
@@ -60,7 +61,7 @@ validate() {
[ "$?" -eq 0 ] && die "The group '$NAME' already exists."
[ -d /home/"$NAME" ] && die "The directory '/home/$NAME' already exists."
[ -d /etc/sv/kvm/"$NAME" ] && die "The directory '/etc/sv/kvm/$NAME' already exists."
- [ -d /dev/mapper/${VG}-${NAME} ] && die "The logical volume $NAME already exists."
+ [ -e $DISK ] && die "The logical volume $NAME already exists."
}
@@ -101,13 +102,14 @@ EOF
echo "$TAP" > "/etc/sv/kvm/$NAME/env/TAP"
echo "$RAM" > "/etc/sv/kvm/$NAME/env/RAM"
echo "$MAC" > "/etc/sv/kvm/$NAME/env/MAC"
+ echo "$DISK" > "/etc/sv/kvm/$NAME/env/KVMOPTS"
}
demo() {
validate
- for foo in NAME VG TAP RAM MAC SIZE ; do
+ for foo in NAME VG TAP RAM MAC SIZE DISK ; do
echo "$foo : ${!foo}"
done