[et-mgmt-tools] [PATCH] waiting VNC port number take2

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

 



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@xxxxxxxxxxxxxx>

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"):


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux