qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] Re: VNC Password


From: Anthony Liguori
Subject: Re: [Qemu-devel] Re: VNC Password
Date: Thu, 23 Oct 2008 10:15:35 -0500
User-agent: Thunderbird 2.0.0.17 (X11/20080925)

Volkan YAZICI wrote:
On Thu, 23 Oct 2008, Gerd Hoffmann <address@hidden> writes:
Volkan YAZICI wrote:
On Thu, 23 Oct 2008, "Daniel P. Berrange" <address@hidden> writes:
If you want daemonized instances, and wish to use the monitor, then
rather than using '-monitor stdio', it'd be better to have it connect
to something like a UNIX socket, eg

   -monitor unix:/var/run/qemu/mysock,server
Excuse my ignorance, but when I use above command, qemu types "QEMU
waiting for connection on: /var/run/qemu/monitor.preprod" on the command
line and hangs at that state. Is this something expected?
Yes.  If you don't want that, add ",nowait".

This time it complains with an interesting error message:

  # rlwrap /usr/local/sbin/qemu-preprod
  qemu: could not open monitor device 
'unix:/var/run/qemu/preprod.monitor,nowait'

You need unix:/var/run/qemu/preprod.monitor,server,nowait

I use the following program to send commands to the monitor. You would use it like:

$ qemu-remote /var/run/qemu/preprod.monitor help

Regards,

Anthony Liguori

  # ls -l /var/run/qemu/preprod.monitor
  -rw-r--r-- 1 root root 0 2008-10-23 14:56 /var/run/qemu/preprod.monitor

BTW, how can I connect to the monitor session -- if I can get it right
at last -- that will be pointed by /var/run/qemu/preprod.monitor?
Try "nc localhost:5001" instead.  Qemu listens on the loopback interface
only if you specify display "localhost:1".  netstat should show that.

Umm... Actually, no. I can see it listens on 5901.


Regards.



#!/usr/bin/env python

import socket, sys

if len(sys.argv) < 2:
    print 'Usage: %s SOCKET' % sys.argv[1]
    sys.exit(1)

s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
s.connect(sys.argv[1])
s.sendall('%s\n' % ' '.join(sys.argv[2:]))

buf = ''
while not buf.endswith('\n(qemu) '):
    buf += s.recv(1)

noend = False
buf = ''
while not buf.endswith('\n(qemu) '):
    t = s.recv(1)
    if len(t) == 0:
        noend = True
        break
    buf += t

if not noend:
    buf = buf[:-7]

_, buf = buf.split('\n', 1)

sys.stdout.write(buf)
sys.stdout.flush()

s.close()

reply via email to

[Prev in Thread] Current Thread [Next in Thread]