[et-mgmt-tools] [PATCH] Fix connection with the console when the domain is created

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

 



Hi

When virt-mangager is set the following configuration and VM is created,
the console is not displayed automatically long time. 
(it displays "The console is currently unavailable")

1. Set "Status monitoring" to long time.(ex: 60 seconds).
2. Set "Automatically open consoles" to "For new domains".

This patch fixes it by waiting start of the console.(like virt-install)

Note:
  # 5 seconds, .25 second sleeps
  --> 5   : Virt-manager waits only for short time.(5 seconds)
            Because virt-manager have a means to connect with a console
            easily again. (unlike virt-install)
      .25 : Virt-manager matches with virt-install


Signed-off-by: Masayuki Sunou <fj1826dm@xxxxxxxxxxxxxxxxx>

Thanks,
Masayuki Sunou.

--------------------------------------------------------------------------------
diff -r 27ad8c7fbc3e src/virtManager/create.py
--- a/src/virtManager/create.py	Thu May 24 16:49:13 2007 -0400
+++ b/src/virtManager/create.py	Wed Jun 06 16:17:15 2007 +0900
@@ -637,13 +637,22 @@ class vmmCreate(gobject.GObject):
         self.connection.tick(noStatsUpdate=True)
 
         if self.config.get_console_popup() == 1:
-            # user has requested console on new created vms only
-            vm = self.connection.get_vm(guest.uuid)
-            (gtype, host, port) = vm.get_graphics_console()
-            if gtype == "vnc":
-                self.emit("action-show-console", self.connection.get_uri(), guest.uuid)
-            else:
-                self.emit("action-show-terminal", self.connection.get_uri(), guest.uuid)
+            import time
+            num = 0
+            while num < ( 5 / 0.25 ): # 5 seconds, .25 second sleeps
+                # user has requested console on new created vms only
+                vm = self.connection.get_vm(guest.uuid)
+                (gtype, host, port) = vm.get_graphics_console()
+                if gtype == "vnc":
+                    if port == -1:
+                        num += 1
+                        time.sleep(0.25)
+                        continue
+                    self.emit("action-show-console", self.connection.get_uri(), guest.uuid)
+                    break
+                else:
+                    self.emit("action-show-terminal", self.connection.get_uri(), guest.uuid)
+                    break
         self.close()
 
     def do_install(self, guest, asyncjob):
diff -r 27ad8c7fbc3e src/virtManager/domain.py
--- a/src/virtManager/domain.py	Thu May 24 16:49:13 2007 -0400
+++ b/src/virtManager/domain.py	Wed Jun 06 16:17:15 2007 +0900
@@ -430,6 +430,7 @@ class vmmDomain(gobject.GObject):
         return os.access(tty, os.R_OK | os.W_OK)
 
     def get_graphics_console(self):
+        self.xml = None;
         type = self.get_xml_string("/domain/devices/graphics/@type")
         port = None
         if type == "vnc":


[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