Is it possible to configure virt-manager (libvirt) so that when an operator opens the GUI to add a disk, the default value for "Cache mode" is "none"?
Asked
Active
Viewed 98 times
-2
-
I found some informations here: https://github.com/OpenNebula/docs/blob/master/source/administration/virtualization/kvmg.rst Unfortunately it's related to OpenNebula as you can see, and it seems that the parameter DEFAULT_ATTACH_CACHE does not exist in libvirt ... Still searching for a solution :) – EBAH Mar 28 '15 at 10:11
-
I think there is no way other than change code in virt-manager: https://git.fedorahosted.org/cgit/virt-manager.git/commit/?id=fb7868db19a0f9b6e6a09fa6ebd264261a2e5e5f – EBAH Mar 28 '15 at 22:44
1 Answers
0
As stated in my comment before the only way I found was to modify the source code of virt-manager (0.9.5, not the last release). So after downloading from git, opening uihelpers.py I changed some part of code as follows:
def build_cache_combo(vm, combo, no_default=False):
ignore = vm
dev_model = gtk.ListStore(str, str)
combo.set_model(dev_model)
text = gtk.CellRendererText()
combo.pack_start(text, True)
combo.add_attribute(text, 'text', 1)
dev_model.set_sort_column_id(0, gtk.SORT_ASCENDING)
combo.set_active(-1)
# for m in virtinst.VirtualDisk.cache_types:
# dev_model.append([m, m])
i_foo=0 #added
for m in virtinst.VirtualDisk.cache_types:
i_foo += 1 #added
dev_model.append([m, m])
if m == "none": #added
i_none=i_foo #added
if not no_default:
dev_model.append([None, "default"])
# combo.set_active(0)
combo.set_active(i_none) #added
This is the first time I'm working with python, have mercy if you find some conceptual mistake.
![](../../users/profiles/193625.webp)
EBAH
- 11
- 4