aboutsummaryrefslogtreecommitdiff
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
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.
-rwxr-xr-xkvm-creator6
-rwxr-xr-xkvm-manager2
2 files changed, 5 insertions, 3 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
diff --git a/kvm-manager b/kvm-manager
index 40972ce..078fcf3 100755
--- a/kvm-manager
+++ b/kvm-manager
@@ -52,7 +52,7 @@ up() {
chpst -u "$OWNER" mv "$LOGNAME" "$LOGNAME".$(date +%F_%T%z|tr : .)
fi
- exec chpst -u "$OWNER:$OWNERGROUP:kvm" /usr/bin/screen -D -m -L -c /etc/screenrc.kvm-manager -S "$VMNAME" -t "$VMNAME" -s /bin/false /usr/bin/kvm $KVMARGS -nographic -name "$VMNAME" -m "$RAM" -net nic,"macaddr=$MAC" -net "tap,hostname=$VMNAME,ifname=$TAP,script=no,downscript=no" -no-reboot -serial stdio "/dev/mapper/${VGNAME}-$VMNAME"
+ exec chpst -u "$OWNER:$OWNERGROUP:kvm" /usr/bin/screen -D -m -L -c /etc/screenrc.kvm-manager -S "$VMNAME" -t "$VMNAME" -s /bin/false /usr/bin/kvm $KVMARGS -nographic -name "$VMNAME" -m "$RAM" -net nic,"macaddr=$MAC" -net "tap,hostname=$VMNAME,ifname=$TAP,script=no,downscript=no" -no-reboot -serial stdio "$KVMOPTS"
}