[et-mgmt-tools] [PATCH] waiting VNC port number take2
Hugh Brock
hbrock at redhat.com
Thu Mar 1 15:28:16 UTC 2007
Saori Fukuta wrote:
> Hi,
>
> On Fri, 23 Feb 2007 12:00:05 +0000 "Daniel P. Berrange" wrote:
>
>>>> - Once the above fix in libvirt is done, we can make virt-install do
>>>> a loop like the one you have below, but instead of looking in xenstore
>>>> it will look at the port in the XML - waiting for it to change from '-1'
>>>> to an actual port number
>>> You are right, I will consider again as you pointed out.
>> Excellant.
>
> I made a patch for current libvirt(revision 1.420) that fixed following:
> revision 1.417
> date: 2007/02/27 15:22:13; author: berrange; state: Exp; lines:+7 -0
> Don't hardcode port=5900+domid for new xend
>
> Signed-off-by: Saori Fukuta <fukuta.saori at jp.fujitsu.com>
>
> Thanks,
> Saori Fukuta.
>
> Index: virt-install
> ===================================================================
> diff -r 1776ef836bf6 virt-install
> --- a/virt-install Wed Feb 28 07:47:31 2007 -0500
> +++ b/virt-install Thu Mar 01 23:26:17 2007 +0900
> @@ -313,11 +313,19 @@ def get_xml_string(dom, path):
> return None
>
> def vnc_console(dom):
> - import time; time.sleep(2) # FIXME: ugh.
> - vncport = get_xml_string(dom,
> - "/domain/devices/graphics[@type='vnc']/@port")
> - if vncport == None:
> - vncport = 5900 + dom.ID()
> + import time;
> + num = 0
> + while num < ( 40 / 0.25 ): # 40 seconds, .25 second sleeps
> + vncport = get_xml_string(dom,
> + "/domain/devices/graphics[@type='vnc']/@port")
> + if vncport == '-1':
> + num += 1
> + time.sleep(0.25)
> + else:
> + break
> + if vncport == '-1' or vncport is None:
> + print >> sys.stderr, "Unable to connect to graphical console; vncport number is not found."
> + return None
> vncport = int(vncport)
> vnchost = "localhost"
> if not os.path.exists("/usr/bin/vncviewer"):
>
Thank you Saori-san. Patch applied:
changeset: 114:5a1190f54c80
tag: tip
user: "Hugh O. Brock <hbrock at redhat.com>"
date: Thu Mar 01 10:24:34 2007 -0500
summary: Make the vnc port number acquisition sane. Specifically,
sleep in .25 second increments for 40 seconds while waiting for the
guest's vnc server to wake up. Patch from Saori Fukuta
<fukuta-dot-saori-at-jp-dot-fujitsu-dot-com>.
--Hugh
--
Red Hat Virtualization Group http://redhat.com/virtualization
Hugh Brock | virt-manager http://virt-manager.org
hbrock at redhat.com | virtualization library http://libvirt.org
More information about the et-mgmt-tools
mailing list