On Fri, 2015-06-05 at 18:00 -0400, Cole Robinson wrote: > On 06/05/2015 05:55 PM, Cole Robinson wrote: > > On 06/05/2015 04:16 AM, Cédric Bosdonnat wrote: > >> 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 > >> > > > > I don't think we should do this in a listener, and instead should invoke it > > from the final page validation() somehow. > > > > Consider if you have a pre-existing disk image > > /var/lib/libvirt/images/test.qcow2 that is unused by any VM. Apply this patch, > > go to the end of a new VM creation, start changing the name from 'generic' to > > 'test-vm'. When you type 'test', a dialog immediately pops up asking if you > > want to reuse test.qcow2... but you hadn't finished typing yet. > > > > Actually I just tested this with .git and couldn't reproduce the root issue, > can you describe exactly how to reproduce, or provide virt-manager --debug for it? Oh indeed, I just tested with the brand new 1.2.1 and its already fixed in there... just ignore my patch then. -- Cedric _______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list