[virt-tools-list] [PATCH] Update the default disk name when changing guest name

Cédric Bosdonnat cbosdonnat at suse.com
Fri Jun 5 08:16:30 UTC 2015


When creating a guest with a default disk, the disk name is computed
only once at the begining of the dialog. This patch listens for changes
of the guest name field and updates the default disk name accordingly.
---
 ui/create.ui          | 1 +
 virtManager/create.py | 7 +++++++
 2 files changed, 8 insertions(+)

diff --git a/ui/create.ui b/ui/create.ui
index 0fa28b3..c8cd7e9 100644
--- a/ui/create.ui
+++ b/ui/create.ui
@@ -2122,6 +2122,7 @@ is not yet supported.</small></property>
                                         <property name="halign">start</property>
                                         <property name="width_chars">25</property>
                                         <signal name="activate" handler="on_create_vm_name_activate" swapped="no"/>
+                                        <signal name="changed" handler="on_create_vm_name_changed" swapped="no"/>
                                       </object>
                                       <packing>
                                         <property name="left_attach">1</property>
diff --git a/virtManager/create.py b/virtManager/create.py
index 8401a7a..289bc1f 100644
--- a/virtManager/create.py
+++ b/virtManager/create.py
@@ -117,6 +117,7 @@ class vmmCreate(vmmGObjectUI):
             "on_create_pages_switch_page": self.page_changed,
 
             "on_create_vm_name_activate": self.forward,
+            "on_create_vm_name_changed": self.name_changed,
             "on_create_conn_changed": self.conn_changed,
             "on_method_changed": self.method_changed,
             "on_config_machine_changed": self.machine_changed,
@@ -1074,6 +1075,12 @@ class vmmCreate(vmmGObjectUI):
 
 
     # Listeners
+    def name_changed(self, src):
+        if self.is_default_storage():
+            self.guest.name = self.get_config_name()
+            self.validate_storage_page()
+            self.populate_summary()
+
     def conn_changed(self, src):
         uri = uiutil.get_list_selection(src)
         conn = None
-- 
2.1.4




More information about the virt-tools-list mailing list