Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
addstorage: Drop explicit sparse option
This made more sense when raw was the disk image default, but nowadays
we use qcow2 which doesn't even support non-sparse, so the UI is always
disabled.

If the user changed their preference to raw, it still doesn't make much
sense to show the option, since they are likely using raw for performance
in which case they are going to want to preallocate anyways.

So just default to sparse=False. If users want to override it, they can
do it via custom created storage.
  • Loading branch information
crobinso committed Sep 13, 2015
1 parent a51c126 commit 15a6a7e
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 109 deletions.
128 changes: 48 additions & 80 deletions ui/addstorage.ui
Expand Up @@ -25,7 +25,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">config-storage-select</property>
<child>
<object class="GtkLabel" id="label123">
<property name="visible">True</property>
Expand Down Expand Up @@ -108,51 +107,6 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkCheckButton" id="config-storage-nosparse">
<property name="label" translatable="yes">_Allocate entire disk now</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_underline">True</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkImage" id="config-storage-nosparse-info">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Fully allocating storage may take longer now, but the OS install phase will be quicker.

Skipping allocation can also cause space issues on the host machine, if the maximum image size exceeds available storage space.

Tip: Storage format qcow2 and qed do not support full allocation.</property>
<property name="stock">gtk-info</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
Expand All @@ -173,13 +127,28 @@ Tip: Storage format qcow2 and qed do not support full allocation.</property>
<object class="GtkHBox" id="hbox9">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">6</property>
<child>
<object class="GtkRadioButton" id="config-storage-select">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">config-storage-create</property>
<signal name="toggled" handler="on_config_storage_select_toggled" swapped="no"/>
<child>
<object class="GtkLabel" id="label124">
Expand All @@ -188,7 +157,6 @@ Tip: Storage format qcow2 and qed do not support full allocation.</property>
<property name="label" translatable="yes">Select _managed or other existing storage</property>
<property name="use_markup">True</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">config-storage-select</property>
</object>
</child>
</object>
Expand All @@ -198,47 +166,47 @@ Tip: Storage format qcow2 and qed do not support full allocation.</property>
<property name="position">0</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="config-storage-browse-box">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="config-storage-browse">
<property name="label" translatable="yes">Bro_wse...</property>
<object class="GtkHBox" id="config-storage-browse-box">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_config_storage_browse_clicked" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="config-storage-browse-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">config-storage-browse</property>
<property name="sensitive">False</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkButton" id="config-storage-browse">
<property name="label" translatable="yes">Bro_wse...</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="use_underline">True</property>
<signal name="clicked" handler="on_config_storage_browse_clicked" swapped="no"/>
<child internal-child="accessible">
<object class="AtkObject" id="config-storage-browse-atkobject">
<property name="AtkObject::accessible-name" translatable="yes">config-storage-browse</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="config-storage-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="config-storage-entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
Expand Down
24 changes: 5 additions & 19 deletions virtManager/addstorage.py
Expand Up @@ -182,18 +182,8 @@ def reset_state(self):
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)
self.widget("config-storage-create-box").set_sensitive(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
"")

storage_tooltip = None

can_storage = (not self.conn.is_remote() or
Expand Down Expand Up @@ -252,9 +242,8 @@ def path_exists(p):
def is_default_storage(self):
return self.widget("config-storage-create").get_active()

def validate_storage(self, vmname,
path=None, size=None, sparse=None,
device="disk", fmt=None, collidelist=None):
def validate_storage(self, vmname, path=None,
device="disk", collidelist=None, fmt=None):
collidelist = collidelist or []
use_storage = self.widget("config-storage-box").is_sensitive()
is_default = self.is_default_storage()
Expand All @@ -275,11 +264,8 @@ def validate_storage(self, vmname,
readonly = True

try:
if size is None and sparse is None:
size = uiutil.spin_get_helper(
self.widget("config-storage-size"))
sparse = (
not self.widget("config-storage-nosparse").get_active())
size = uiutil.spin_get_helper(
self.widget("config-storage-size"))
if path is None:
if is_default:
path = self.get_default_path(vmname, collidelist)
Expand All @@ -298,7 +284,7 @@ def validate_storage(self, vmname,
pool = disk.get_parent_pool()
vol_install = virtinst.VirtualDisk.build_vol_install(
disk.conn, os.path.basename(disk.path), pool,
size, sparse, fmt=fmt or None)
size, sparse=False, fmt=fmt or None)
disk.set_vol_install(vol_install)

if not fmt:
Expand Down
10 changes: 0 additions & 10 deletions virtManager/create.py
Expand Up @@ -414,16 +414,6 @@ def _populate_media_model(media_model, urls):
self._addstorage.reset_state()
self._addstorage.widget("config-storage-create").set_active(True)
self._addstorage.widget("config-storage-entry").set_text("")
self._addstorage.widget("config-storage-nosparse").set_active(True)

fmt = self.conn.get_default_storage_format()
can_alloc = fmt in ["raw"]
self._addstorage.widget("config-storage-nosparse").set_active(can_alloc)
self._addstorage.widget("config-storage-nosparse").set_sensitive(can_alloc)
self._addstorage.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)
Expand Down

0 comments on commit 15a6a7e

Please sign in to comment.