[virt-tools-list] [PATCH] Activate the default console in all cases

Cole Robinson crobinso at redhat.com
Tue Jan 27 18:45:14 UTC 2015


On 01/23/2015 08:11 AM, Cédric Bosdonnat wrote:
> If the Details page of a container is show when hitting the Run button,
> switching back to the Console page, doesn't show the text console. By
> updating the default console even if the Console page isn't show we
> won't have this anymore.
> ---
>  virtManager/details.py | 2 --
>  1 file changed, 2 deletions(-)
> 
> diff --git a/virtManager/details.py b/virtManager/details.py
> index ddcacae..aa10912 100644
> --- a/virtManager/details.py
> +++ b/virtManager/details.py
> @@ -1345,8 +1345,6 @@ class vmmDetails(vmmGObjectUI):
>  
>      def activate_default_console_page(self):
>          pages = self.widget("details-pages")
> -        if pages.get_current_page() != DETAILS_PAGE_CONSOLE:
> -            return
>          self.console.activate_default_console_page()
>  
>      # activate_* are called from engine.py via CLI options
> 

Thanks for the patch. Though this has the side effect of always switching the
details window focus to the console page when a VM is started, which could be
jarring, like if the VM starts behind the users back while he's looking at VM
details. But indeed we should still ensure the console page is pointing at the
correct bits when the user switches back. I added some additional bits to this
change and pushed it:

commit f815c988aa275a72acf4461a7966548cf235590f
Author: Cole Robinson <crobinso at redhat.com>
Date:   Tue Jan 27 13:39:23 2015 -0500

    details: When VM is run, always update console page

    If we were focused on the VM details page for a container, then clicked
    'Run', the console page wouldn't be switched to view the serial console.
    Make that work, but continue to not switch focus away from the current
    non-console page.

    Based on Cédric's patch here:
http://www.redhat.com/archives/virt-tools-list/2015-January/msg00078.html

diff --git a/virtManager/details.py b/virtManager/details.py
index ddcacae..fe75d47 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -1345,9 +1345,14 @@ class vmmDetails(vmmGObjectUI):

     def activate_default_console_page(self):
         pages = self.widget("details-pages")
-        if pages.get_current_page() != DETAILS_PAGE_CONSOLE:
-            return
+
+        # console.activate_default_console_page() will as a side effect
+        # switch to DETAILS_PAGE_CONSOLE. However this code path is triggered
+        # when the user runs a VM while they are focused on the details page,
+        # and we don't want to switch pages out from under them.
+        origpage = pages.get_current_page()
         self.console.activate_default_console_page()
+        pages.set_current_page(origpage)

     # activate_* are called from engine.py via CLI options
     def activate_default_page(self):




More information about the virt-tools-list mailing list