1 |
commit: 6504680272d7437330c628922a02fdad65dc37b0 |
2 |
Author: Brian Harring <ferringb <AT> chromium <DOT> org> |
3 |
AuthorDate: Sat Apr 14 07:15:18 2012 +0000 |
4 |
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Apr 14 21:26:07 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=65046802 |
7 |
|
8 |
readlink -f DISKIMAGE earlier, and start better using openrc capabilties. |
9 |
|
10 |
--- |
11 |
.../qemu-init-scripts/files/qemu-init-script | 19 ++++++++++--------- |
12 |
1 files changed, 10 insertions(+), 9 deletions(-) |
13 |
|
14 |
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script |
15 |
index ba9aae3..0fbfec4 100644 |
16 |
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script |
17 |
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script |
18 |
@@ -56,23 +56,24 @@ sanity_check() { |
19 |
eerror "You have to create an init script for each vm:" |
20 |
eerror " ln -s vm /etc/init.d/vm.vmname" |
21 |
return 1 |
22 |
- elif [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then |
23 |
+ fi |
24 |
+ DISKIMAGE=$(readlink -f "${DISKIMAGE}") |
25 |
+ if [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then |
26 |
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'" |
27 |
return 1; |
28 |
fi |
29 |
discern_vm_binary |
30 |
} |
31 |
|
32 |
+start_pre() { |
33 |
+ checkpath -d --owner root:root --mode 0644 "${PIDFILE%/*}" \ |
34 |
+ "${MONITOR%/*}" |
35 |
+} |
36 |
+ |
37 |
+ |
38 |
start() { |
39 |
sanity_check || return 1 |
40 |
|
41 |
- img=$(readlink -f "${DISKIMAGE}") |
42 |
- [ -z "$img" ] && { |
43 |
- eerror "couldn't find ${DISKIMAGE}" |
44 |
- return 1; |
45 |
- } |
46 |
- |
47 |
- mkdir -p "${PIDFILE%/*}" "${MONITOR%/*}" |
48 |
ebegin "creating qtap ${QTAP:-(auto allocating one)}" |
49 |
if [ -n "$QTAP" ]; then |
50 |
qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}" |
51 |
@@ -91,7 +92,7 @@ start() { |
52 |
--pidfile ${PIDFILE} \ |
53 |
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \ |
54 |
-runas ${DROP_USER} -name ${VMNAME} \ |
55 |
- -drive file="$img",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \ |
56 |
+ -drive file="$DISKIMAGE",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \ |
57 |
-net nic,model=${NIC_MODEL:-virtio},macaddr=${MACADDR} -net tap,ifname=${QTAP},script=no \ |
58 |
${DISABLE_KVM:---enable-kvm} \ |
59 |
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS} |