[virt-tools-list] [PATCH virt-manager] virtManager, host: warn user for unapplied changes
Giuseppe Scrivano
gscrivan at redhat.com
Mon Jul 28 09:10:55 UTC 2014
Cole Robinson <crobinso at redhat.com> writes:
>> @@ -377,11 +387,15 @@ class vmmHost(vmmGObjectUI):
>> def page_changed(self, src, child, pagenum):
>> ignore = src
>> ignore = child
>> + self.confirm_changes()
>> if pagenum == 1:
>> + self.repopulate_networks()
>> self.conn.schedule_priority_tick(pollnet=True)
>> elif pagenum == 2:
>> + self.repopulate_storage_volumes()
>> self.conn.schedule_priority_tick(pollpool=True)
>> elif pagenum == 3:
>> + self.repopulate_interfaces()
>> self.conn.schedule_priority_tick(polliface=True)
>>
>
> What's this for?
this is to fix the case when the user switches from page A to page B and
choose No when asked to save changes. Next time page A is visited,
these repopulate_* force the configuration to be reloaded.
>> def refresh_resources(self, ignore=None):
>> @@ -485,7 +499,7 @@ class vmmHost(vmmGObjectUI):
>> except Exception, e:
>> self.err.show_err(_("Error launching network wizard: %s") % str(e))
>>
>> - def net_apply(self, src_ignore):
>> + def net_apply(self):
>> net = self.current_network()
>> if net is None:
>> return
>> @@ -532,15 +546,28 @@ class vmmHost(vmmGObjectUI):
>> self.disable_net_apply()
>>
>> def disable_net_apply(self):
>> - self.active_edits = []
>> + for i in [EDIT_NET_NAME, EDIT_NET_AUTOSTART, EDIT_NET_QOS]:
>> + if i in self.active_edits:
>> + self.active_edits.remove(i)
>> self.widget("net-apply").set_sensitive(False)
>
> This is going to get out of date fast. I'd say do something like:
>
> EDIT_NET_IDS = (
> EDIT_NET_FOO,
> ...) = range(5)
>
> EDIT_STORAGE_IDS = (
> ...) = range(100, 101)
>
> And then use those named tuples to implement just one disable_apply handler
> that doesn't list the EDIT_* bits explicitly.
ok, thanks, I will make this change and repost a new version.
Regards,
Giuseppe
More information about the virt-tools-list
mailing list