diff options
Diffstat (limited to 'kvmx')
-rwxr-xr-x | kvmx | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -167,6 +167,7 @@ function __kvmx_initialize { XPRALOG="$LOG_DIR/xpra" XDMCPLOG="$LOG_DIR/xdmcp" MONITORFILE="$STATE_DIR/monitor" + CONSOLEFILE="$STATE_DIR/console" if [ -e "$STORAGE/ssh/$VM.key" ]; then mkdir -p "$STORAGE/ssh" @@ -378,6 +379,7 @@ function kvmx_up { -device virtserialport,chardev=spicechannel0,name=com.redhat.spice.0 \ -chardev spicevmc,id=spicechannel0,name=vdagent \ -chardev "socket,id=monitor,path=$MONITORFILE,server,nowait" -mon chardev=monitor,mode=readline \ + -chardev "socket,id=serial0,path=$CONSOLEFILE,server" -device isa-serial,chardev=serial0 \ -smp $smp -soundhw ac97 -cpu host -balloon virtio \ -net nic,model=$nic_model \ -net user,hostfwd=tcp:127.0.0.1:$SSH-:22,hostfwd=udp:127.0.0.1:$XDMCP_PORT-:177$hostfwd $qemu_opts &> $LOGFILE < /dev/null & @@ -391,6 +393,16 @@ function kvmx_up { echo $GUEST_DISPLAY > $DISPLAYFILE echo $XDMCP_PORT > $XDMCPPORTFILE + # Thanks kvm-manager code for that portion + local screen_log_args=-L + if dpkg --compare-versions "$screen_version" ge 4.05; then + screen_log_args="-L ./servicelog" + fi + + /usr/bin/screen -D -m $screen_log_args \ + -c $DIRNAME/share/screen/screenrc \ + -S "kvmx-$VM" -t "kvmx-$VM" socat STDIO,raw,echo=0 "UNIX:${CONSOLEFILE},retry=30" & + if [ "$run_spice_client" == "1" ]; then sleep 1 kvmx_spice @@ -1373,6 +1385,7 @@ function kvmx_mv { } # Interface to QEMU monitor +# Thanks kvm-manager for the idea function kvmx_monitor { if ! kvmx_running; then echo "$BASENAME: guest $VM is not running" @@ -1416,6 +1429,21 @@ function kvmx_install { kvm -m $memory -net nic,model=virtio -net user -drive file=$image -cdrom $media } +# Serial console +function kvmx_console { + if ! kvmx_running; then + echo "$BASENAME: guest $VM is not running" + exit 1 + fi + + screen -x kvmx-$VM +} + +# Alias to console +function kvmx_serial { + kvmx_serial $* +} + # Dispatch if type kvmx_$ACTION 2> /dev/null | grep -q "kvmx_$ACTION ()"; then __kvmx_initialize |