summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Harring <ferringb@chromium.org>2012-04-14 00:15:18 -0700
committerBrian Harring <ferringb@chromium.org>2012-04-14 14:26:07 -0700
commit6504680272d7437330c628922a02fdad65dc37b0 (patch)
tree39d4f75ce9365b17dfc1212d9059e5f144acca21 /app-emulation/qemu-init-scripts/files/qemu-init-script
parentupdate the checkout url to use gentoo's repo rather than ferringbs private space (diff)
downloadkvm-tools-6504680272d7437330c628922a02fdad65dc37b0.tar.gz
kvm-tools-6504680272d7437330c628922a02fdad65dc37b0.tar.bz2
kvm-tools-6504680272d7437330c628922a02fdad65dc37b0.zip
readlink -f DISKIMAGE earlier, and start better using openrc capabilties.
Diffstat (limited to 'app-emulation/qemu-init-scripts/files/qemu-init-script')
-rw-r--r--app-emulation/qemu-init-scripts/files/qemu-init-script19
1 files changed, 10 insertions, 9 deletions
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index ba9aae3..0fbfec4 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -56,23 +56,24 @@ sanity_check() {
eerror "You have to create an init script for each vm:"
eerror " ln -s vm /etc/init.d/vm.vmname"
return 1
- elif [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then
+ fi
+ DISKIMAGE=$(readlink -f "${DISKIMAGE}")
+ if [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'"
return 1;
fi
discern_vm_binary
}
+start_pre() {
+ checkpath -d --owner root:root --mode 0644 "${PIDFILE%/*}" \
+ "${MONITOR%/*}"
+}
+
+
start() {
sanity_check || return 1
- img=$(readlink -f "${DISKIMAGE}")
- [ -z "$img" ] && {
- eerror "couldn't find ${DISKIMAGE}"
- return 1;
- }
-
- mkdir -p "${PIDFILE%/*}" "${MONITOR%/*}"
ebegin "creating qtap ${QTAP:-(auto allocating one)}"
if [ -n "$QTAP" ]; then
qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}"
@@ -91,7 +92,7 @@ start() {
--pidfile ${PIDFILE} \
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
- -drive file="$img",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
+ -drive file="$DISKIMAGE",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
-net nic,model=${NIC_MODEL:-virtio},macaddr=${MACADDR} -net tap,ifname=${QTAP},script=no \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS}