* [gentoo-commits] proj/kvm-tools:ferringb commit in: app-emulation/qemu-init-scripts/files/
2012-08-24 4:18 [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/ Brian Harring
@ 2012-04-14 23:48 ` Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-04-14 23:48 UTC (permalink / raw
To: gentoo-commits
commit: 31456f30cea2efd5246da9185cbce28e15024cd4
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 20:58:08 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 23:47:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=31456f30
Make networking a bit more configurable via NIC_TYPE.
This can be:
None
No networking at all.
br
bridge mode; NIC_NET_DEPS if set is the networking needed.
nat
Qemu user stack; NIC model is honored, but qemu itself spins up
a dhcp server and nats connections out on it's own. For most users
this is likely what they'll be using- thus this is now the default.
---
.../qemu-init-scripts/files/qemu-init-script | 50 ++++++++++++++------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 0fbfec4..23b12ef 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -42,7 +42,17 @@ export KVM_USER=${KVM_USER:-"root"}
extra_commands="reboot"
depend() {
- need net.br0
+ if [ "$VMNAME" = "$SVCNAME" ]; then
+ return 0
+ fi
+
+ sanity_check || return 1
+
+ case "$NIC_TYPE" in
+ br)
+ need ${NIC_NET_DEPS-net.br0}
+ ;;
+ esac
}
send_command() {
@@ -57,12 +67,14 @@ sanity_check() {
eerror " ln -s vm /etc/init.d/vm.vmname"
return 1
fi
+
DISKIMAGE=$(readlink -f "${DISKIMAGE}")
if [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'"
return 1;
fi
discern_vm_binary
+ NIC_TYPE=${NIC_TYPE:-nat}
}
start_pre() {
@@ -70,22 +82,30 @@ start_pre() {
"${MONITOR%/*}"
}
-
start() {
sanity_check || return 1
- ebegin "creating qtap ${QTAP:-(auto allocating one)}"
- if [ -n "$QTAP" ]; then
- qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}"
- else
- QTAP=$(qtap-manipulate create -u "${DROP_USER}")
- if [ 0 != $? ]; then
- eerror "failed to create qtap interface"
- return 1
+ local NIC_COMMAND=( -net "nic,model=${NIC_MODEL:-virtio},macaddr=${MACADDR}" -net )
+
+ if [ "${NIC_TYPE}" = "br" ]; then
+ ebegin "creating qtap ${QTAP:-(auto allocating one)}"
+ if [ -n "$QTAP" ]; then
+ qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}"
+ else
+ QTAP=$(qtap-manipulate create -u "${DROP_USER}")
+ if [ 0 != $? ]; then
+ eerror "failed to create qtap interface"
+ return 1
+ fi
fi
+ echo "${QTAP}" > ${QTAP_FILE}
+ eend $?
+ NIC_COMMAND[${#NIC_COMMAND[@]}]="tap,ifname=${QTAP},script=no"
+ elif [ "${NIC_TYPE}" = "none" ]; then
+ NIC_COMMAND=( -net none )
+ else
+ NIC_COMMAND[${#NIC_COMMAND[@]}]=user
fi
- echo "${QTAP}" > ${QTAP_FILE}
- eend $?
ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} at VNC port${VNC}"
start-stop-daemon --start "${VM_BINARY}" \
@@ -93,13 +113,15 @@ start() {
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
-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 \
+ "${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS}
ret=$?
- if [ "0" != "${ret}" ]; then
+
+ if [ "0" != "${ret}" -a -n "${QTAP}" ]; then
qtap-manipulate destroy ${QTAP}
fi
+
eend ${ret}
}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2012-08-24 4:18 Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: 6504680272d7437330c628922a02fdad65dc37b0
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 07:15:18 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 21:26:07 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=65046802
readlink -f DISKIMAGE earlier, and start better using openrc capabilties.
---
.../qemu-init-scripts/files/qemu-init-script | 19 ++++++++++---------
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}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2012-08-24 4:18 Brian Harring
2012-04-14 23:48 ` [gentoo-commits] proj/kvm-tools:ferringb " Brian Harring
0 siblings, 1 reply; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: 31456f30cea2efd5246da9185cbce28e15024cd4
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 20:58:08 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 23:47:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=31456f30
Make networking a bit more configurable via NIC_TYPE.
This can be:
None
No networking at all.
br
bridge mode; NIC_NET_DEPS if set is the networking needed.
nat
Qemu user stack; NIC model is honored, but qemu itself spins up
a dhcp server and nats connections out on it's own. For most users
this is likely what they'll be using- thus this is now the default.
---
.../qemu-init-scripts/files/qemu-init-script | 50 ++++++++++++++------
1 files changed, 36 insertions(+), 14 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 0fbfec4..23b12ef 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -42,7 +42,17 @@ export KVM_USER=${KVM_USER:-"root"}
extra_commands="reboot"
depend() {
- need net.br0
+ if [ "$VMNAME" = "$SVCNAME" ]; then
+ return 0
+ fi
+
+ sanity_check || return 1
+
+ case "$NIC_TYPE" in
+ br)
+ need ${NIC_NET_DEPS-net.br0}
+ ;;
+ esac
}
send_command() {
@@ -57,12 +67,14 @@ sanity_check() {
eerror " ln -s vm /etc/init.d/vm.vmname"
return 1
fi
+
DISKIMAGE=$(readlink -f "${DISKIMAGE}")
if [ ! -f "${DISKIMAGE}" -a ! -b "${DISKIMAGE}" ]; then
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'"
return 1;
fi
discern_vm_binary
+ NIC_TYPE=${NIC_TYPE:-nat}
}
start_pre() {
@@ -70,22 +82,30 @@ start_pre() {
"${MONITOR%/*}"
}
-
start() {
sanity_check || return 1
- ebegin "creating qtap ${QTAP:-(auto allocating one)}"
- if [ -n "$QTAP" ]; then
- qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}"
- else
- QTAP=$(qtap-manipulate create -u "${DROP_USER}")
- if [ 0 != $? ]; then
- eerror "failed to create qtap interface"
- return 1
+ local NIC_COMMAND=( -net "nic,model=${NIC_MODEL:-virtio},macaddr=${MACADDR}" -net )
+
+ if [ "${NIC_TYPE}" = "br" ]; then
+ ebegin "creating qtap ${QTAP:-(auto allocating one)}"
+ if [ -n "$QTAP" ]; then
+ qtap-manipulate create_specific "${QTAP}" -u "${DROP_USER}"
+ else
+ QTAP=$(qtap-manipulate create -u "${DROP_USER}")
+ if [ 0 != $? ]; then
+ eerror "failed to create qtap interface"
+ return 1
+ fi
fi
+ echo "${QTAP}" > ${QTAP_FILE}
+ eend $?
+ NIC_COMMAND[${#NIC_COMMAND[@]}]="tap,ifname=${QTAP},script=no"
+ elif [ "${NIC_TYPE}" = "none" ]; then
+ NIC_COMMAND=( -net none )
+ else
+ NIC_COMMAND[${#NIC_COMMAND[@]}]=user
fi
- echo "${QTAP}" > ${QTAP_FILE}
- eend $?
ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} at VNC port${VNC}"
start-stop-daemon --start "${VM_BINARY}" \
@@ -93,13 +113,15 @@ start() {
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
-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 \
+ "${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS}
ret=$?
- if [ "0" != "${ret}" ]; then
+
+ if [ "0" != "${ret}" -a -n "${QTAP}" ]; then
qtap-manipulate destroy ${QTAP}
fi
+
eend ${ret}
}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2012-08-24 4:18 Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: a17438dd07a0d237ce9763f1a6c5a37de3ba0c2b
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 23:01:14 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 23:47:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=a17438dd
output the start-stop-daemon command to make debugging easier
---
.../qemu-init-scripts/files/qemu-init-script | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 9880a7b..63c662c 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -161,7 +161,7 @@ start() {
fi
ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} ${FOREGROUND:+at ${FOREGROUND}}"
- start-stop-daemon \
+ set -- start-stop-daemon \
--start "${VM_BINARY}" \
--pidfile ${PIDFILE} \
"${ss_args[@]}" \
@@ -173,6 +173,8 @@ start() {
"${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${OTHER_ARGS}
+ einfo "invoking ${@}"
+ "${@}"
ret=$?
if [ "0" != "${ret}" -a -n "${QTAP}" ]; then
qtap-manipulate destroy ${QTAP}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2012-08-24 4:18 Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: 471f96ec4b93b9b303e2b7c7eee388c8a0e8ab72
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 21:02:22 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 23:47:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=471f96ec
Protect against ',' in DISKIMAGE pathways.
---
.../qemu-init-scripts/files/qemu-init-script | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 23b12ef..a42e866 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -112,7 +112,7 @@ start() {
--pidfile ${PIDFILE} \
-- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
- -drive file="$DISKIMAGE",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
+ -drive file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
"${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
2012-04-14 23:48 [gentoo-commits] proj/kvm-tools:ferringb " Brian Harring
@ 2012-08-24 4:18 ` Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: 1798441957485d5243aa4968ef183d28461b5093
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Sat Apr 14 22:54:32 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Sat Apr 14 23:47:58 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=17984419
Make foreground controllable.
This deprecates the VNC option in favour of `FOREGROUND=vnc=:1`; in the
process it makes turning off the display (none mode), and sdl mode
possible.
For sdl mode, it tries to rely on DISPLAY and XAUTHORITY to work. In
my local usage, this *does* work, but wouldn't surprise me if there are
other configurations where this doesn't (patches welcome).
---
.../qemu-init-scripts/files/qemu-init-script | 68 ++++++++++++++++++--
1 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index a42e866..9880a7b 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -16,6 +16,8 @@ PIDFILE=/var/run/vm/${SVCNAME}.pid
MONITOR=/var/run/vm/${SVCNAME}.monitor
QTAP_FILE=/var/run/vm/${SVCNAME}.qtap
+ENABLE_SDL=
+
discern_vm_binary() {
case "$VMTYPE" in
kvm)
@@ -32,6 +34,35 @@ discern_vm_binary() {
return 0
}
+discern_foreground() {
+ if [ -n "$VNC" ]; then
+ ewarn "VNC option is going away; set FOREGROUND=vnc${VNC} instead"
+ FOREGROUND="vnc=${VNC}"
+ fi
+ case "${FOREGROUND:-none}" in
+ vnc*)
+ VNC=${VNC#*=}
+ if [ -z "$VNC" ]; then
+ eerror "FOREGROUND vnc is incorrectly set; must specify an address (:1 for example)"
+ return 1
+ fi
+ ;;
+ sdl*)
+ ENABLE_SDL=${FOREGROUND#*=}
+ if [ -z "${ENABLE_SDL}" ]; then
+ eerror "FOREGROUND sdl is incorrectly set; must specify a DISPLAY address"
+ return 1
+ fi
+ ;;
+ none)
+ ;;
+ *)
+ eerror "Unknown FOREGROUND setting: $FOREGROUND"
+ return 1
+ ;;
+ esac
+ return 0
+}
DROP_USER=${DROP_USER:-nobody}
MEMORY=${MEMORY:-512M}
@@ -73,8 +104,10 @@ sanity_check() {
eerror "couldn't find \$DISKIMAGE '$DISKIMAGE'"
return 1;
fi
- discern_vm_binary
+ discern_vm_binary || return 1
NIC_TYPE=${NIC_TYPE:-nat}
+
+ discern_foreground || return 1
}
start_pre() {
@@ -107,17 +140,40 @@ start() {
NIC_COMMAND[${#NIC_COMMAND[@]}]=user
fi
- ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} at VNC port${VNC}"
- start-stop-daemon --start "${VM_BINARY}" \
+ local ss_args=( )
+ local vm_args=( -daemonize )
+
+ if [ -n "${ENABLE_SDL}" ]; then
+ ss_args[${#ss_args[@]}]=--env
+ ss_args[${#ss_args[@]}]="DISPLAY=${ENABLE_SDL}"
+ ss_args[${#ss_args[@]}]=--env
+ local user_home=`getent passwd ${DROP_USER:-root} | cut -d: -f6`
+ ss_args[${#ss_args[@]}]="XAUTHORITY=$user_home/.Xauthority"
+ vm_args[${#vm_args[@]}]=-display
+ vm_args[${#vm_args[@]}]=sdl
+ elif [ -n "$VNC" ]; then
+ vm_args[${#vm_args[@]}]=-display
+ vm_args[${#vm_args[@]}]=vnc
+ vm_args[${#vm_args[@]}]="${VNC}"
+ else
+ vm_args[${#vm_args[@]}]=-display
+ vm_args[${#vm_args[@]}]=none
+ fi
+
+ ebegin "Starting ${VM_BINARY##*/} for ${VMNAME} ${FOREGROUND:+at ${FOREGROUND}}"
+ start-stop-daemon \
+ --start "${VM_BINARY}" \
--pidfile ${PIDFILE} \
- -- -daemonize -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
+ "${ss_args[@]}" \
+ -- \
+ "${vm_args[@]}" \
+ -pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
-drive file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
"${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
- ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${VNC:+-vnc ${VNC}} ${OTHER_ARGS}
+ ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${OTHER_ARGS}
ret=$?
-
if [ "0" != "${ret}" -a -n "${QTAP}" ]; then
qtap-manipulate destroy ${QTAP}
fi
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2012-08-24 4:18 Brian Harring
0 siblings, 0 replies; 20+ messages in thread
From: Brian Harring @ 2012-08-24 4:18 UTC (permalink / raw
To: gentoo-commits
commit: 844455dd67786195ce2353ccb40255b907c4b16d
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Fri Aug 24 04:18:06 2012 +0000
Commit: Brian Harring <ferringb <AT> gentoo <DOT> org>
CommitDate: Fri Aug 24 04:18:06 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=844455dd
Pull in a fix from rafaelmartins for dealing w/ multiple qtaps.
---
.../qemu-init-scripts/files/qtap-manipulate | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qtap-manipulate b/app-emulation/qemu-init-scripts/files/qtap-manipulate
index 426bc78..41ab0ca 100644
--- a/app-emulation/qemu-init-scripts/files/qtap-manipulate
+++ b/app-emulation/qemu-init-scripts/files/qtap-manipulate
@@ -12,9 +12,7 @@ has() {
}
find_available_node() {
- local val=$(ifconfig -a | grep -i ^qtap | cut -d ' ' -f1)
- # Strip off ifconfig appended ':'
- val="${val%:}"
+ local val=$(ifconfig -a | grep -i ^qtap | cut -d: -f1)
local pos=0
while has qtap${pos} $val; do
pos=$(( $pos + 1 ))
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2013-11-16 4:21 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2013-11-16 4:21 UTC (permalink / raw
To: gentoo-commits
commit: b2e940c4023f5a92bf59d2a14137106b816dec95
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Nov 16 02:36:20 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Nov 16 02:36:20 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=b2e940c4
fix FOREGROUND=vnc usage
---
app-emulation/qemu-init-scripts/files/qemu-conf.example | 2 +-
app-emulation/qemu-init-scripts/files/qemu-init-script | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 46f8274..edee67c 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -3,7 +3,7 @@ MACADDR=52:54:1C:10:34:35
DISKIMAGE=/mnt/kvm/gentoo64.qcow2
MEMORY=1G
SMP=4
-VNC=:24
+FOREGROUND="vnc=:24"
NIC_MODEL=virtio
DRIVE_MODEL=virtio
#OTHER_ARGS="-boot order=dc -cdrom /mnt/archive/gentoo/install-amd64-minimal-20100408.iso"
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 4bc8bc0..e8ca078 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -36,12 +36,12 @@ discern_vm_binary() {
discern_foreground() {
if [ -n "$VNC" ]; then
- ewarn "VNC option is going away; set FOREGROUND=vnc${VNC} instead"
+ ewarn "VNC option is going away; set FOREGROUND=\"vnc=${VNC}\" instead"
FOREGROUND="vnc=${VNC}"
fi
case "${FOREGROUND:-none}" in
vnc*)
- VNC=${VNC#*=}
+ VNC=${FOREGROUND#*=}
if [ -z "$VNC" ]; then
eerror "FOREGROUND vnc is incorrectly set; must specify an address (:1 for example)"
return 1
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2013-11-16 4:21 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2013-11-16 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 46095dd199d0c0ef916c854a1575f02786477fdf
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Nov 16 01:26:01 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Nov 16 01:26:01 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=46095dd1
s,/var/run,/run/g
---
app-emulation/qemu-init-scripts/files/qemu-init-script | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index eb66149..4bc8bc0 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -12,9 +12,9 @@
VMNAME=${SVCNAME#*.}
VMTYPE=${SVCNAME%.*}
VM_BINARY=
-PIDFILE=/var/run/vm/${SVCNAME}.pid
-MONITOR=/var/run/vm/${SVCNAME}.monitor
-QTAP_FILE=/var/run/vm/${SVCNAME}.qtap
+PIDFILE=/run/vm/${SVCNAME}.pid
+MONITOR=/run/vm/${SVCNAME}.monitor
+QTAP_FILE=/run/vm/${SVCNAME}.qtap
ENABLE_SDL=
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2013-11-16 4:21 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2013-11-16 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 9ff8e5725adb5826e7386ca90ebbe0be8e3442a8
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Nov 16 03:36:28 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Nov 16 03:36:28 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=9ff8e572
fix config example, comments and error messages
---
.../qemu-init-scripts/files/qemu-conf.example | 94 +++++++++++++++++++---
.../qemu-init-scripts/files/qemu-init-script | 40 +++++----
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
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2013-11-16 4:21 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2013-11-16 4:21 UTC (permalink / raw
To: gentoo-commits
commit: 604784b8ba4e8f699506977345010065fd6a6eea
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Nov 16 02:50:15 2013 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Sat Nov 16 02:50:15 2013 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/kvm-tools.git;a=commit;h=604784b8
do not try to kill daemon if it is dead
---
app-emulation/qemu-init-scripts/files/qemu-init-script | 14 +++++++++-----
1 file changed, 9 insertions(+), 5 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index e8ca078..1940a4b 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -222,11 +222,15 @@ stop() {
fi
ebegin "Stopping ${VM_BINARY##*/} for ${VMNAME}"
- start-stop-daemon --stop "${VM_BINARY}" \
- --user "${DROP_USER}" \
- --pidfile "${PIDFILE}" \
- --quiet
- eend $?
+ if kill -0 "${pid}" > /dev/null 2>&1; then
+ start-stop-daemon --stop "${VM_BINARY}" \
+ --user "${DROP_USER}" \
+ --pidfile "${PIDFILE}" \
+ --quiet
+ eend $?
+ else
+ eend 0 # no need to kill process if it is dead :P
+ fi
local qtap
[ -s "${QTAP_FILE}" ] && qtap=$(cat "${QTAP_FILE}")
if [ -n "$qtap" ]; then
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-02-03 22:27 Rafael Martins
0 siblings, 0 replies; 20+ messages in thread
From: Rafael Martins @ 2016-02-03 22:27 UTC (permalink / raw
To: gentoo-commits
commit: c675b29dbc3f9b53b21e8998c3b0172932c7bd11
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Dec 12 13:42:12 2015 +0000
Commit: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org>
CommitDate: Sat Dec 12 13:42:12 2015 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=c675b29d
added DRIVE_FORMAT
app-emulation/qemu-init-scripts/files/qemu-conf.example | 8 ++++++++
app-emulation/qemu-init-scripts/files/qemu-init-script | 2 +-
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 54f089f..58beaf7 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -46,6 +46,14 @@ DISKIMAGE=/mnt/kvm/gentoo64.qcow2
#
#DRIVE_MODEL=
+# Drive format.
+#
+# See qemu documentation,
+#
+# Defaults to autodetection.
+#
+#DRIVE_FORMAT=
+
## General settings
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 2102cc0..4eeb42b 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -184,7 +184,7 @@ start() {
"${vm_args[@]}" \
-pidfile ${PIDFILE} -monitor unix:${MONITOR},server,nowait \
-runas ${DROP_USER} -name ${VMNAME} \
- -drive file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none} \
+ -drive file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none}${DRIVE_FORMAT:+,format=${DRIVE_FORMAT}} \
"${NIC_COMMAND[@]}" \
${DISABLE_KVM:---enable-kvm} \
${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${OTHER_ARGS}
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-02-03 22:27 Rafael Martins
0 siblings, 0 replies; 20+ messages in thread
From: Rafael Martins @ 2016-02-03 22:27 UTC (permalink / raw
To: gentoo-commits
commit: e8fedc2eba3ffdb13b5b1c9c958aede829a96d3f
Author: Rafael G. Martins <rafael <AT> rafaelmartins <DOT> eng <DOT> br>
AuthorDate: Sat Dec 12 13:45:06 2015 +0000
Commit: Rafael Martins <rafaelmartins <AT> gentoo <DOT> org>
CommitDate: Sat Dec 12 13:45:06 2015 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=e8fedc2e
typo
app-emulation/qemu-init-scripts/files/qemu-conf.example | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 58beaf7..d797519 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -48,7 +48,7 @@ DISKIMAGE=/mnt/kvm/gentoo64.qcow2
# Drive format.
#
-# See qemu documentation,
+# See qemu documentation.
#
# Defaults to autodetection.
#
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: 41b7cec34068d42fce55e40091637eea90cc00b1
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 24 19:54:10 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 19:54:10 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=41b7cec3
Migrate from ifconfig commands to ip commands
Some systems may have the ifconfig compatibility scripts diabled.
This uses all ip commands instead.
app-emulation/qemu-init-scripts/files/qtap-manipulate | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qtap-manipulate b/app-emulation/qemu-init-scripts/files/qtap-manipulate
index 41ab0ca..bf89dcb 100644
--- a/app-emulation/qemu-init-scripts/files/qtap-manipulate
+++ b/app-emulation/qemu-init-scripts/files/qtap-manipulate
@@ -12,9 +12,9 @@ has() {
}
find_available_node() {
- local val=$(ifconfig -a | grep -i ^qtap | cut -d: -f1)
+ local val=$(ip addr | grep -i '.*: qtap' | cut -d: -f2)
local pos=0
- while has qtap${pos} $val; do
+ while has qtap${pos} ${val##*()}; do
pos=$(( $pos + 1 ))
done
echo qtap${pos}
@@ -25,12 +25,13 @@ create_node() {
shift
tunctl -b -t "${qtap}" "$@" > /dev/null || die "tunctl failed"
brctl addif br0 "${qtap}" || die "brctl failed"
- ifconfig "${qtap}" up 0.0.0.0 promisc || die "ifconfig failed"
+ ip link set "${qtap}" up || die "ip link set ${qtap} failed"
+ ip link set "${qtap}" promisc on || die "ip link set ${qtap} promiscuos mode failed"
}
destroy_node() {
issue=
- ifconfig ${1} down || { echo "ifconfig failed";issue=1; }
+ ip link set ${1} down || { echo "ip link set ${1} down failed";issue=1; }
brctl delif br0 ${1} || { echo "brctl failed";issue=2; }
tunctl -d ${1} > /dev/null || { echo "tunctl failed";issue=3;}
[ -n "${issue}" ] && exit $(( $issue ))
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: 36f3367425ac807ddb9ddcd3970fb11a8e986e40
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 24 20:18:22 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 20:18:22 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=36f33674
Add live-usb image example
app-emulation/qemu-init-scripts/files/qemu-conf.example | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index d6c00b8..d3f2c77 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -105,4 +105,13 @@ FOREGROUND="vnc=:24"
#TIMEOUT=60
# Any other qemu options you may want to use
+# live cd example
OTHER_ARGS="-boot order=cd -cdrom /mnt/archive/gentoo.iso"
+
+# live-usb image install example, with optional boot menu, adjust the format type as needed
+# Note, initial run with an empty primary drive, initial boot fails,
+# reboot it (send Cntl-Alt-delete), use the F12 option and select the second drive, after installation
+# the primary drive should boot automatically
+#OTHER_ARGS="-drive if=virtio,file=/path/to/usb.img,format=raw,cache=writeback,media=disk -boot menu=on"
+
+
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: a1e2f28626d2dd3ffe89b9a61ca9f7994774d8dd
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 24 20:07:23 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Feb 24 20:07:23 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=a1e2f286
Add missing DRIVE_CACHE setting to the example
Add additional note for zfs filesystems.
app-emulation/qemu-init-scripts/files/qemu-conf.example | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index d797519..d6c00b8 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -54,6 +54,18 @@ DISKIMAGE=/mnt/kvm/gentoo64.qcow2
#
#DRIVE_FORMAT=
+# Drive cache type.
+#
+# See qemu documentation.
+#
+# Note for zfs filesystems
+# ensure you have set zfs
+# # zfs set primarycache=all ${tank}
+# set DRIVE_CACHE=writeback
+#
+# Defaults to none.
+#
+#DRIVE_CACHE=
## General settings
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: a968d725358b1fd45022dc278bcca35fc9244686
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 21:09:19 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 21:09:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=a968d725
Add MACHINE, CPU, ENABLE_KVM options
ENABLE_KVM replaces the DISABLE_KVM option that was present only in the init script. It did not have a corresponding conf.d option example.
MACHINE allows for the specifcation of the system to emulate.
CPU allows setting the specific cpu to emulate.
.../qemu-init-scripts/files/qemu-conf.example | 18 ++++++++++++++++++
app-emulation/qemu-init-scripts/files/qemu-init-script | 6 ++++--
2 files changed, 22 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index 6ccd6fc..acdebcb 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -81,6 +81,24 @@ DISKIMAGE=/mnt/kvm/gentoo64.qcow2
## General settings
+# The machine type to use
+# see qemu help
+# default is Standard PC (i440FX + PIIX, 1996)
+#
+#MACHINE="q35"
+
+# Enable/diasble kvm
+#
+# null value == disabled
+# non null value == enabled
+#
+ENABLE_KVM=1
+
+# cpu option
+# see qemu help
+#
+#CPU=host
+
# RAM memory allocated for the virtual machine
#
# Defaults to 512M
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index ff42d78..1ca9670 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -186,8 +186,10 @@ start() {
-runas ${DROP_USER} -name ${VMNAME} \
-drive file="${DISKIMAGE//,/,,}",if=${DRIVE_MODEL:-virtio},cache=${DRIVE_CACHE:-none}${DRIVE_FORMAT:+,format=${DRIVE_FORMAT}} \
"${NIC_COMMAND[@]}" \
- ${DISABLE_KVM:---enable-kvm} \
- ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} ${OTHER_ARGS}
+ ${ENABLE_KVM:+--enable-kvm} ${CPU:+-cpu ${CPU}} \
+ ${MACHINE:+-M ${MACHINE}} \
+ ${MEMORY:+-m ${MEMORY}} ${SMP:+-smp ${SMP}} \
+ ${OTHER_ARGS}
einfo "invoking ${@}"
"${@}"
ret=$?
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: 6d4b300fccb371ab4f0032cdfdd7d18ff24ea956
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Fri Feb 26 21:57:59 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Fri Feb 26 21:57:59 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=6d4b300f
TIMEOUT: remove duplicate default settings
Whenever this part of teh code runs, it has already been defauted. No need to default it again.
app-emulation/qemu-init-scripts/files/qemu-init-script | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 1ca9670..f8773c9 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -215,7 +215,7 @@ stop() {
send_command system_powerdown
eend $?
- ebegin "waiting up to ${TIMEOUT:-60} seconds for it to die"
+ ebegin "waiting up to ${TIMEOUT} seconds for it to die"
local pid
[ -s "${PIDFILE}" ] && pid=$(cat "${PIDFILE}")
if [ -z "$pid" ]; then
@@ -224,7 +224,7 @@ stop() {
eend 1
else
local ret=1
- for x in $(seq 0 ${TIMEOUT:-60}); do
+ for x in $(seq 0 ${TIMEOUT}); do
if kill -0 "${pid}" > /dev/null 2>&1; then
sleep 1s
continue
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-22 23:38 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-22 23:38 UTC (permalink / raw
To: gentoo-commits
commit: e113eedd01f8d113251bfdbc28a0e6009cd69bad
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 25 21:04:19 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Thu Feb 25 21:04:19 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=e113eedd
Update the binary determination code
Make the new binary configurable.
This allows multiple different vm targets using this same script.
app-emulation/qemu-init-scripts/files/qemu-conf.example | 12 ++++++++++++
app-emulation/qemu-init-scripts/files/qemu-init-script | 8 ++++----
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index d3f2c77..6ccd6fc 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -3,6 +3,18 @@
# DO NOT MODIFY THIS FILE DIRECTLY! CREATE A COPY AND MODIFY THAT INSTEAD!
+# VMTYPE is auto determined via the file prefix
+# ie: kvm.myserver would yield VMTYPE=kvm
+# the two types allowed are: qemu, kvm
+
+# Machine type
+#
+# The specific qemu binary type
+# eg. for VMTYPE=kvm, then /usr/bin/qemu-system-${QEMU_TYPE}
+# eg. for VMTYPE=qemu, then /usr/bin/qemu-${QEMU_TYPE}
+# QEMU_TYPE="x86_64"
+QEMU_TYPE="x86_64"
+
## Network settings
# MAC address
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
index 4eeb42b..ff42d78 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -19,17 +19,17 @@ VM_BINARY=
PIDFILE=/run/vm/${SVCNAME}.pid
MONITOR=/run/vm/${SVCNAME}.monitor
QTAP_FILE=/run/vm/${SVCNAME}.qtap
-
ENABLE_SDL=
discern_vm_binary() {
case "$VMTYPE" in
kvm)
- VM_BINARY=`type -p qemu-kvm`
- [ -z "$VM_BINARY" ] && VM_BINARY=`type -p kvm`
+ VM_BINARY=$(which "qemu-system-${QEMU_TYPE}")
+ [ -z "$VM_BINARY" ] && eerror "Failed to find the binary for qemu-system-${QEMU_TYPE}"
;;
qemu)
- VM_BINARY=`type -p qemu`
+ VM_BINARY=$(which "qemu-${QEMU_TYPE}")
+ [ -z "$VM_BINARY" ] && eerror "Failed to find the binary for qemu-${QEMU_TYPE}"
;;
*)
eerror "Failed to discern the binary for $VMTYPE"
^ permalink raw reply related [flat|nested] 20+ messages in thread
* [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/
@ 2016-03-23 17:55 Brian Dolbec
0 siblings, 0 replies; 20+ messages in thread
From: Brian Dolbec @ 2016-03-23 17:55 UTC (permalink / raw
To: gentoo-commits
commit: 329d2f3956245bc9451a492dad52fc98c880847b
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Wed Mar 23 00:27:35 2016 +0000
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
CommitDate: Wed Mar 23 00:27:35 2016 +0000
URL: https://gitweb.gentoo.org/proj/kvm-tools.git/commit/?id=329d2f39
Add version info and functions
app-emulation/qemu-init-scripts/files/qemu-conf.example | 2 ++
app-emulation/qemu-init-scripts/files/qemu-init-script | 9 ++++++++-
app-emulation/qemu-init-scripts/files/qtap-manipulate | 11 +++++++++++
3 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/app-emulation/qemu-init-scripts/files/qemu-conf.example b/app-emulation/qemu-init-scripts/files/qemu-conf.example
index acdebcb..4911597 100644
--- a/app-emulation/qemu-init-scripts/files/qemu-conf.example
+++ b/app-emulation/qemu-init-scripts/files/qemu-conf.example
@@ -1,6 +1,8 @@
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
+# VERSION: 0.3.0
+
# DO NOT MODIFY THIS FILE DIRECTLY! CREATE A COPY AND MODIFY THAT INSTEAD!
# VMTYPE is auto determined via the file prefix
diff --git a/app-emulation/qemu-init-scripts/files/qemu-init-script b/app-emulation/qemu-init-scripts/files/qemu-init-script
old mode 100644
new mode 100755
index f8773c9..937ddfe
--- a/app-emulation/qemu-init-scripts/files/qemu-init-script
+++ b/app-emulation/qemu-init-scripts/files/qemu-init-script
@@ -13,6 +13,8 @@
# where 'kvm' is the virtual machine type ('qemu' and 'kvm' allowed)
# and 'myserver' is the name of your instance.
+VERSION="0.3.0"
+
VMNAME=${SVCNAME#*.}
VMTYPE=${SVCNAME%.*}
VM_BINARY=
@@ -74,7 +76,7 @@ TIMEOUT=${TIMEOUT:-300}
SMP=${SMP:-1}
export KVM_USER=${KVM_USER:-"root"}
-extra_commands="reboot"
+extra_commands="reboot version"
depend() {
if [ "$VMNAME" = "$SVCNAME" ]; then
@@ -253,3 +255,8 @@ stop() {
eend $?
fi
}
+
+version() {
+ echo "qemu-init-scripts version: ${VERSION}"
+}
+
diff --git a/app-emulation/qemu-init-scripts/files/qtap-manipulate b/app-emulation/qemu-init-scripts/files/qtap-manipulate
old mode 100644
new mode 100755
index bf89dcb..53ab346
--- a/app-emulation/qemu-init-scripts/files/qtap-manipulate
+++ b/app-emulation/qemu-init-scripts/files/qtap-manipulate
@@ -2,6 +2,8 @@
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public Licens
+VERSION="0.3.0"
+
has() {
local desired=$1 x
shift
@@ -47,6 +49,7 @@ usage() {
echo "create-specific qtap-name [ -u user ] [ -g group ]"
echo "create [ -u user ] [ -g group ]"
echo "destroy qtap-name"
+ echo "version"
echo
}
@@ -55,6 +58,10 @@ usage_die() {
die "$@"
}
+show_version() {
+ echo "qtap-manipulate version: ${VERSION}"
+}
+
create_user=
create_group=
@@ -110,8 +117,12 @@ case "$1" in
create_node "$qtap"
$output_qtap && echo "$qtap"
;;
+ version)
+ show_version
+ ;;
*)
usage_die "Unknown command $1"
;;
esac
exit 0
+
^ permalink raw reply related [flat|nested] 20+ messages in thread
end of thread, other threads:[~2016-03-23 17:55 UTC | newest]
Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-24 4:18 [gentoo-commits] proj/kvm-tools:master commit in: app-emulation/qemu-init-scripts/files/ Brian Harring
2012-04-14 23:48 ` [gentoo-commits] proj/kvm-tools:ferringb " Brian Harring
-- strict thread matches above, loose matches on Subject: below --
2016-03-23 17:55 [gentoo-commits] proj/kvm-tools:master " Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-03-22 23:38 Brian Dolbec
2016-02-03 22:27 Rafael Martins
2016-02-03 22:27 Rafael Martins
2013-11-16 4:21 Brian Dolbec
2013-11-16 4:21 Brian Dolbec
2013-11-16 4:21 Brian Dolbec
2013-11-16 4:21 Brian Dolbec
2012-08-24 4:18 Brian Harring
2012-08-24 4:18 Brian Harring
2012-08-24 4:18 Brian Harring
2012-08-24 4:18 Brian Harring
2012-04-14 23:48 [gentoo-commits] proj/kvm-tools:ferringb " Brian Harring
2012-08-24 4:18 ` [gentoo-commits] proj/kvm-tools:master " Brian Harring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox