summaryrefslogtreecommitdiff
path: root/virtManager/engine.py
diff options
context:
space:
mode:
authorCole Robinson <crobinso@redhat.com>2018-03-16 18:58:11 -0400
committerCole Robinson <crobinso@redhat.com>2018-03-16 19:09:55 -0400
commitdac860e8ce61a367a0b9770fd3bb3d9ef9b1edf2 (patch)
tree0b9bc1bfd43fdcf84ab470cb5c5956ec4424597f /virtManager/engine.py
parentee817c32ceef87362a7b0b48fb52f68af60df264 (diff)
downloadvirt-manager-dac860e8ce61a367a0b9770fd3bb3d9ef9b1edf2.tar.gz
engine: Show modal startup errors if window open fails
Diffstat (limited to 'virtManager/engine.py')
-rw-r--r--virtManager/engine.py46
1 files changed, 16 insertions, 30 deletions
diff --git a/virtManager/engine.py b/virtManager/engine.py
index 62a0fd25..d3303c9b 100644
--- a/virtManager/engine.py
+++ b/virtManager/engine.py
@@ -448,45 +448,29 @@ class vmmEngine(vmmGObject):
def _get_manager(self):
from .manager import vmmManager
- return vmmManager.get_instance(self)
-
- def _show_manager_uri(self, uri):
- manager = self._get_manager()
- manager.set_initial_selection(uri)
- manager.show()
-
- def _show_host_summary(self, uri):
- from .host import vmmHost
- vmmHost.show_instance(self._get_manager(), self._connobjs[uri])
-
- def _show_domain_creator(self, uri):
- from .create import vmmCreate
- vmmCreate.show_instance(self._get_manager(), uri)
-
- def _show_domain_console(self, uri, clistr):
- self._cli_show_vm_helper(uri, clistr, DETAILS_CONSOLE)
-
- def _show_domain_editor(self, uri, clistr):
- self._cli_show_vm_helper(uri, clistr, DETAILS_CONFIG)
-
- def _show_domain_performance(self, uri, clistr):
- self._cli_show_vm_helper(uri, clistr, DETAILS_PERF)
+ return vmmManager.get_instance(None)
def _launch_cli_window(self, uri, show_window, clistr):
try:
logging.debug("Launching requested window '%s'", show_window)
if show_window == self.CLI_SHOW_MANAGER:
- self._show_manager_uri(uri)
+ manager = self._get_manager()
+ manager.set_initial_selection(uri)
+ manager.show()
elif show_window == self.CLI_SHOW_DOMAIN_CREATOR:
- self._show_domain_creator(uri)
+ from .create import vmmCreate
+ # Launch the manager here since there's no way to get
+ # back to it.
+ vmmCreate.show_instance(self._get_manager(), uri)
elif show_window == self.CLI_SHOW_DOMAIN_EDITOR:
- self._show_domain_editor(uri, clistr)
+ self._cli_show_vm_helper(uri, clistr, DETAILS_CONFIG)
elif show_window == self.CLI_SHOW_DOMAIN_PERFORMANCE:
- self._show_domain_performance(uri, clistr)
+ self._cli_show_vm_helper(uri, clistr, DETAILS_PERF)
elif show_window == self.CLI_SHOW_DOMAIN_CONSOLE:
- self._show_domain_console(uri, clistr)
+ self._cli_show_vm_helper(uri, clistr, DETAILS_CONSOLE)
elif show_window == self.CLI_SHOW_HOST_SUMMARY:
- self._show_host_summary(uri)
+ from .host import vmmHost
+ vmmHost.show_instance(None, self._connobjs[uri])
else:
raise RuntimeError("Unknown cli window command '%s'" %
show_window)
@@ -535,7 +519,9 @@ class vmmEngine(vmmGObject):
def _handle_cli_command(self, actionobj, variant):
try:
return self._do_handle_cli_command(actionobj, variant)
- except Exception:
+ except Exception as e:
# In case of cli error, we may need to exit the app
logging.debug("Error handling cli command", exc_info=True)
+ modal = self._can_exit()
+ self.err.show_err(str(e), modal=modal)
self._exit_app_if_no_windows()