From 032dd0cf21a509978931f47cfe2aca13a1f493f7 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Sat, 1 Feb 2014 18:59:10 -0500 Subject: [PATCH] clone: Show destination host if on a remote connection (bz 881099) --- ui/clone.ui | 75 +++++++++++++++++++++++++++------------ virtManager/clone.py | 5 +++ virtManager/connection.py | 3 +- virtinst/connection.py | 5 ++- 4 files changed, 60 insertions(+), 28 deletions(-) diff --git a/ui/clone.ui b/ui/clone.ui index b6b1e74a..9068446d 100644 --- a/ui/clone.ui +++ b/ui/clone.ui @@ -91,23 +91,11 @@ False 12 - + True False - 3 - - - True - False - 0 - Create a clone based on: - - - False - True - 0 - - + 6 + 6 True @@ -116,14 +104,58 @@ orig name - True - True - 1 + 1 + 0 + 1 + 1 + + + + + True + False + 0 + Create clone based on: + + + 0 + 0 + 1 + 1 + + + + + True + False + 1 + Destination host: + + + 0 + 1 + 1 + 1 + + + + + True + False + 0 + dest host + 0 + + + 1 + 1 + 1 + 1 - False + True True 0 @@ -139,7 +171,7 @@ False 3 2 - 18 + 12 10 @@ -747,9 +779,6 @@ like change passwords or static IPs, please see the virt-sysprep(1) tool.</sp 0 - - - diff --git a/virtManager/clone.py b/virtManager/clone.py index 0ee89c49..869c99e1 100644 --- a/virtManager/clone.py +++ b/virtManager/clone.py @@ -26,6 +26,7 @@ from gi.repository import Gtk from gi.repository import Gdk # pylint: enable=E0611 +from virtManager import uiutil from virtManager.baseclass import vmmGObjectUI from virtManager.asyncjob import vmmAsyncJob from virtManager.storagebrowse import vmmStorageBrowser @@ -234,6 +235,10 @@ class vmmCloneVM(vmmGObjectUI): self.widget("clone-orig-name").set_text(cd.original_guest) self.widget("clone-new-name").set_text(cd.clone_name) + uiutil.set_grid_row_visible( + self.widget("clone-dest-host"), self.conn.is_remote()) + self.widget("clone-dest-host").set_text(self.conn.get_hostname()) + # We need to determine which disks fail (and why). self.storage_list, self.target_list = self.check_all_storage() diff --git a/virtManager/connection.py b/virtManager/connection.py index b2cef45e..aadf442e 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -308,8 +308,7 @@ class vmmConnection(vmmGObject): return hostname[0:offset] return hostname - def get_hostname(self, resolveLocal=False): - ignore = resolveLocal + def get_hostname(self): try: return self.get_qualified_hostname() except: diff --git a/virtinst/connection.py b/virtinst/connection.py index a1f08f1b..4a2e9ed8 100644 --- a/virtinst/connection.py +++ b/virtinst/connection.py @@ -297,9 +297,8 @@ class VirtualConnection(object): return self._fake_pretty_name def is_remote(self): - if (hasattr(self, "_virtinst__fake_conn_remote") or - self._urisplits[2]): - return True + return (hasattr(self, "_virtinst__fake_conn_remote") or + self._urisplits[2]) def get_uri_hostname(self): return self._urisplits[2] or "localhost"