create: Disable 'fully allocate' if qcow2 is the default

Since it doesn't support full allocation
This commit is contained in:
Cole Robinson 2014-01-14 16:03:58 -05:00
parent 2bee4a128d
commit 6dd41e6944
2 changed files with 17 additions and 1 deletions

View File

@ -425,7 +425,14 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("config-storage-create").set_active(True)
self.widget("config-storage-size").set_value(8)
self.widget("config-storage-entry").set_text("")
self.widget("config-storage-nosparse").set_active(True)
fmt = self.conn.get_default_storage_format()
can_alloc = fmt in ["raw"]
self.widget("config-storage-nosparse").set_active(can_alloc)
self.widget("config-storage-nosparse").set_sensitive(can_alloc)
self.widget("config-storage-nosparse").set_tooltip_text(
not can_alloc and
(_("Disk format '%s' does not support full allocation.") % fmt) or
"")
self.populate_disk_format_combo(True)
self.populate_disk_bus()

View File

@ -405,6 +405,15 @@ class vmmCreate(vmmGObjectUI):
self.widget("config-storage-entry").set_text("")
self.widget("config-storage-nosparse").set_active(True)
fmt = self.conn.get_default_storage_format()
can_alloc = fmt in ["raw"]
self.widget("config-storage-nosparse").set_active(can_alloc)
self.widget("config-storage-nosparse").set_sensitive(can_alloc)
self.widget("config-storage-nosparse").set_tooltip_text(
not can_alloc and
(_("Disk format '%s' does not support full allocation.") % fmt) or
"")
# Final page
self.widget("summary-customize").set_active(False)