summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael G. Martins <rafael@rafaelmartins.eng.br>2013-11-16 01:36:28 -0200
committerRafael G. Martins <rafael@rafaelmartins.eng.br>2013-11-16 01:36:28 -0200
commit9ff8e5725adb5826e7386ca90ebbe0be8e3442a8 (patch)
treecc4a53ac296fb764063f53d2772fcbbe001d6cae
parentdo not try to kill daemon if it is dead (diff)
downloadkvm-tools-9ff8e5725adb5826e7386ca90ebbe0be8e3442a8.tar.gz
kvm-tools-9ff8e5725adb5826e7386ca90ebbe0be8e3442a8.tar.bz2
kvm-tools-9ff8e5725adb5826e7386ca90ebbe0be8e3442a8.zip
fix config example, comments and error messages
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-conf.example94
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-init-script40
2 files changed, 111 insertions, 23 deletions
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index edee67c..54f089f 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -1,12 +1,88 @@
-VMSOFTWARE=kvm
-MACADDR=52:54:1C:10:34:35
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# DO NOT MODIFY THIS FILE DIRECTLY! CREATE A COPY AND MODIFY THAT INSTEAD!
+
+## Network settings
+
+# MAC address
+#
+# You can generate a new one with this command:
+#
+# echo "52:54:00:$(dd if=/dev/urandom bs=512 count=1 2>/dev/null | md5sum | sed 's/^\(..\)\(..\)\(..\).*$/\1:\2:\3/')"
+#
+MACADDR=52:54:00:10:34:35
+
+# NIC type.
+#
+# Allowed:
+# nat - Automatic qemu NAT network.
+# br - Bridged network. Requires 'net.br0' service up and running.
+# none - No network.
+#
+# Defaults to 'nat'.
+#
+#NIC_TYPE=br
+
+# NIC model.
+#
+# See qemu documentation.
+#
+# Defaults to 'virtio'.
+#
+#NIC_MODEL=
+
+
+## Storage settings
+
+# Disk image
DISKIMAGE=/mnt/kvm/gentoo64.qcow2
-MEMORY=1G
-SMP=4
+
+# Drive model.
+#
+# See qemu documentation.
+#
+# Defaults to 'virtio'.
+#
+#DRIVE_MODEL=
+
+
+## General settings
+
+# RAM memory allocated for the virtual machine
+#
+# Defaults to 512M
+#
+#MEMORY=1G
+
+# Processor cores allocated for the virtual machine.
+#
+# Defaults to 1 core
+#
+#SMP=2
+
+# Foreground settings
+#
+# Allowed:
+# vnc=:24 - Runs VNC at :24
+# sdl=:0 - Runs SDL in X.org server running at :0
+# none - Disables foreground
+#
+# Defaults to 'none'.
+#
FOREGROUND="vnc=:24"
-NIC_MODEL=virtio
-DRIVE_MODEL=virtio
-#OTHER_ARGS="-boot order=dc -cdrom /mnt/archive/gentoo/install-amd64-minimal-20100408.iso"
-OTHER_ARGS=" -boot order=cd -cdrom /mnt/archive/gentoo/systemrescuecd-x86-1.5.6.iso"
-#OTHER_ARGS="-vga std -boot order=dc -cdrom /dev/sdc"
+
+# Low privilege user that runs the virtual machine.
+#
+# Defaults to 'nobody'.
+#DROP_USER=
+
+# Timeout - How many seconds to wait before trying to hard-kill the virtual
+# machine.
+#
+# Defaults to 300 seconds.
+#
#TIMEOUT=60
+
+# Any other qemu options you may want to use
+OTHER_ARGS="-boot order=cd -cdrom /mnt/archive/gentoo.iso"
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 1940a4b..2102cc0 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -1,13 +1,17 @@
#!/sbin/runscript
-# Copyright 2009-2012 Gentoo Foundation
+# Copyright 2009-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# To use this, symlink a target kvm instance to this script.
-# Literally, ln -s qemu /etc/init.d/<vm-type>.<vmname>
-# then have a config named /etc/conf.d/<vm-type>.<vmname>
+# You are not supposed to run this script directly. Create a symlink
+# for the qemu instance you want to run as well as a copy of the
+# configuration file and modify it appropriately like so...
#
-# Allowed vm-types are currently qemu and kvm.
-
+# ln -s qemu /etc/init.d/kvm.myserver
+# cp /etc/conf.d/qemu /etc/conf.d/kvm.myserver
+# nano /etc/conf.d/kvm.myserver
+#
+# where 'kvm' is the virtual machine type ('qemu' and 'kvm' allowed)
+# and 'myserver' is the name of your instance.
VMNAME=${SVCNAME#*.}
VMTYPE=${SVCNAME%.*}
@@ -92,12 +96,24 @@ send_command() {
echo "$@" | ${command} > /dev/null 2>&1
}
-sanity_check() {
+symlink_check() {
if [ "${VMNAME}" = "${SVCNAME}" ]; then
- eerror "You have to create an init script for each vm:"
- eerror " ln -s vm /etc/init.d/vm.vmname"
+ eerror "You are not supposed to run this script directly. Create a symlink"
+ eerror "for the qemu instance you want to run as well as a copy of the"
+ eerror "configuration file and modify it appropriately like so..."
+ eerror
+ eerror " ln -s qemu /etc/init.d/kvm.myserver"
+ eerror " cp /etc/conf.d/qemu /etc/conf.d/kvm.myserver"
+ eerror " `basename "${EDITOR:-nano}"` /etc/conf.d/kvm.myserver"
+ eerror
+ eerror "where 'kvm' is the virtual machine type ('qemu' and 'kvm' allowed)"
+ eerror "and 'myserver' is the name of your instance."
return 1
fi
+}
+
+sanity_check() {
+ symlink_check || return 1
DISKIMAGE=$(readlink -f "${DISKIMAGE}")
if [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then
@@ -183,11 +199,7 @@ start() {
}
reboot() {
- if [ ${VMNAME} = ${SVCNAME} ]; then
- eerror "You have to create an init script for each vm:"
- eerror " ln -s vm /etc/init.d/vm.vmname"
- return 1
- fi
+ symlink_check || return 1
ebegin "Rebooting ${VMNAME}"
send_command system_reset