virt-manager: Add support for fs write policy

This introduces new attribute wrpolicy with only supported
value as immediate. This helps specify whether to skip the
host page cache.

When wrpolicy is specified, meaning when wrpolicy=immediate
a writeback is explicitly initiated for the dirty pages in
the host page cache as part of the guest file write operation

Signed-off-by: Deepak C Shetty <deepakcs@linux.vnet.ibm.com>
This commit is contained in:
Deepak C Shetty 2012-01-19 00:22:02 +05:30 committed by Cole Robinson
parent 79908782bb
commit 256c2a74e6
4 changed files with 128 additions and 30 deletions

View File

@ -329,6 +329,7 @@ class vmmAddHardware(vmmGObjectUI):
VirtualFilesystem.TYPE_TEMPLATE]) VirtualFilesystem.TYPE_TEMPLATE])
simple_store_set("fs-mode-combo", VirtualFilesystem.MOUNT_MODES) simple_store_set("fs-mode-combo", VirtualFilesystem.MOUNT_MODES)
simple_store_set("fs-driver-combo", VirtualFilesystem.DRIVER_TYPES) simple_store_set("fs-driver-combo", VirtualFilesystem.DRIVER_TYPES)
simple_store_set("fs-wrpolicy-combo", VirtualFilesystem.WRPOLICIES)
self.show_pair_combo("fs-type", self.conn.is_openvz()) self.show_pair_combo("fs-type", self.conn.is_openvz())
self.show_check_button("fs-readonly", self.conn.is_qemu()) self.show_check_button("fs-readonly", self.conn.is_qemu())
@ -483,6 +484,7 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("fs-type-combo").set_active(0) self.widget("fs-type-combo").set_active(0)
self.widget("fs-mode-combo").set_active(0) self.widget("fs-mode-combo").set_active(0)
self.widget("fs-driver-combo").set_active(0) self.widget("fs-driver-combo").set_active(0)
self.widget("fs-wrpolicy-combo").set_active(0)
self.widget("fs-source").set_text("") self.widget("fs-source").set_text("")
self.widget("fs-target").set_text("") self.widget("fs-target").set_text("")
self.widget("fs-readonly").set_active(False) self.widget("fs-readonly").set_active(False)
@ -729,6 +731,15 @@ class vmmAddHardware(vmmGObjectUI):
return None return None
return combo.get_model()[combo.get_active()][0] return combo.get_model()[combo.get_active()][0]
def get_config_fs_wrpolicy(self):
name = "fs-wrpolicy-combo"
combo = self.widget(name)
if not combo.get_property("visible"):
return None
return combo.get_model()[combo.get_active()][0]
def get_config_fs_type(self): def get_config_fs_type(self):
name = "fs-type-combo" name = "fs-type-combo"
combo = self.widget(name) combo = self.widget(name)
@ -1039,6 +1050,7 @@ class vmmAddHardware(vmmGObjectUI):
fstype = None fstype = None
show_mode_combo = False show_mode_combo = False
show_driver_combo = False show_driver_combo = False
show_wrpolicy_combo = self.conn.is_qemu()
if idx >= 0 and src.get_property("visible"): if idx >= 0 and src.get_property("visible"):
fstype = src.get_model()[idx][0] fstype = src.get_model()[idx][0]
@ -1054,24 +1066,33 @@ class vmmAddHardware(vmmGObjectUI):
self.widget("fs-source-title").set_use_underline(True) self.widget("fs-source-title").set_use_underline(True)
self.show_pair_combo("fs-mode", show_mode_combo) self.show_pair_combo("fs-mode", show_mode_combo)
self.show_pair_combo("fs-driver", show_driver_combo) self.show_pair_combo("fs-driver", show_driver_combo)
self.show_pair_combo("fs-wrpolicy", show_wrpolicy_combo)
def change_fs_driver(self, src): def change_fs_driver(self, src):
idx = src.get_active() idx = src.get_active()
fsdriver = None fsdriver = None
combo = self.widget("fs-mode-combo") modecombo = self.widget("fs-mode-combo")
label1 = self.widget("fs-mode-title") modelabel1 = self.widget("fs-mode-title")
wrpcombo = self.widget("fs-wrpolicy-combo")
wrplabel1 = self.widget("fs-wrpolicy-title")
if idx >= 0 and src.get_property("visible"): if idx >= 0 and src.get_property("visible"):
fsdriver = src.get_model()[idx][0] fsdriver = src.get_model()[idx][0]
if (fsdriver == virtinst.VirtualFilesystem.DRIVER_PATH or if (fsdriver == virtinst.VirtualFilesystem.DRIVER_PATH or
fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT): fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT):
combo.set_property("visible", True) modecombo.set_property("visible", True)
label1.set_property("visible", True) modelabel1.set_property("visible", True)
else: else:
combo.set_property("visible", False) modecombo.set_property("visible", False)
label1.set_property("visible", False) modelabel1.set_property("visible", False)
if (fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT):
wrpcombo.set_property("visible", False)
wrplabel1.set_property("visible", False)
else:
wrpcombo.set_property("visible", True)
wrplabel1.set_property("visible", True)
@ -1423,6 +1444,7 @@ class vmmAddHardware(vmmGObjectUI):
fstype = self.get_config_fs_type() fstype = self.get_config_fs_type()
readonly = self.get_config_fs_readonly() readonly = self.get_config_fs_readonly()
driver = self.get_config_fs_driver() driver = self.get_config_fs_driver()
wrpolicy = self.get_config_fs_wrpolicy()
if not source: if not source:
return self.err.val_err(_("A filesystem source must be specified")) return self.err.val_err(_("A filesystem source must be specified"))
@ -1445,6 +1467,8 @@ class vmmAddHardware(vmmGObjectUI):
self._dev.readonly = readonly self._dev.readonly = readonly
if driver: if driver:
self._dev.driver = driver self._dev.driver = driver
if wrpolicy:
self._dev.wrpolicy = wrpolicy
except Exception, e: except Exception, e:
return self.err.val_err(_("Filesystem parameter error"), e) return self.err.val_err(_("Filesystem parameter error"), e)

View File

@ -3183,6 +3183,9 @@ class vmmDetails(vmmGObjectUI):
self.show_pair("fs-mode", False) self.show_pair("fs-mode", False)
self.widget("fs-driver").set_text(dev.driver or _("Default")) self.widget("fs-driver").set_text(dev.driver or _("Default"))
self.widget("fs-wrpolicy").set_text(dev.wrpolicy or _("Default"))
self.widget("fs-source").set_text(dev.source) self.widget("fs-source").set_text(dev.source)
self.widget("fs-target").set_text(dev.target) self.widget("fs-target").set_text(dev.target)
if dev.readonly: if dev.readonly:

View File

@ -2164,6 +2164,50 @@ access in the guest.</property>
<property name="bottom_attach">3</property> <property name="bottom_attach">3</property>
</packing> </packing>
</child> </child>
<child>
<widget class="GtkLabel" id="fs-wrpolicy-title">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">_Write Policy:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">fs-wrpolicy-combo</property>
</widget>
<packing>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox12">
<property name="visible">True</property>
<child>
<widget class="GtkComboBox" id="fs-wrpolicy-combo">
<property name="visible">True</property>
</widget>
<packing>
<property name="expand">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-wrpolicy-label">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Default</property>
</widget>
<packing>
<property name="position">1</property>
</packing>
</child>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
</packing>
</child>
<child> <child>
<widget class="GtkLabel" id="fs-source-title"> <widget class="GtkLabel" id="fs-source-title">
<property name="visible">True</property> <property name="visible">True</property>
@ -2173,8 +2217,8 @@ access in the guest.</property>
<property name="mnemonic_widget">fs-source</property> <property name="mnemonic_widget">fs-source</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
@ -2187,8 +2231,8 @@ access in the guest.</property>
<property name="mnemonic_widget">fs-target</property> <property name="mnemonic_widget">fs-target</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
</packing> </packing>
</child> </child>
@ -2201,8 +2245,8 @@ access in the guest.</property>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">6</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2217,8 +2261,8 @@ access in the guest.</property>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">5</property> <property name="top_attach">6</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">7</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -2253,8 +2297,8 @@ access in the guest.</property>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">3</property> <property name="top_attach">4</property>
<property name="bottom_attach">4</property> <property name="bottom_attach">5</property>
</packing> </packing>
</child> </child>
</widget> </widget>

View File

@ -5753,10 +5753,10 @@ I/O:</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="label65"> <widget class="GtkLabel" id="fs-wrpolicy-title">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Source:</property> <property name="label" translatable="yes">Write Policy:</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">3</property> <property name="top_attach">3</property>
@ -5766,14 +5766,14 @@ I/O:</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="fs-readonly-title"> <widget class="GtkLabel" id="label65">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label" translatable="yes">Readonly:</property> <property name="label" translatable="yes">Source:</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">5</property> <property name="top_attach">4</property>
<property name="bottom_attach">6</property> <property name="bottom_attach">5</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@ -5785,8 +5785,21 @@ I/O:</property>
<property name="label" translatable="yes">Target:</property> <property name="label" translatable="yes">Target:</property>
</widget> </widget>
<packing> <packing>
<property name="top_attach">4</property> <property name="top_attach">5</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">6</property>
<property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-readonly-title">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label" translatable="yes">Readonly Filesystem:</property>
</widget>
<packing>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">GTK_FILL</property> <property name="x_options">GTK_FILL</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
@ -5820,11 +5833,10 @@ I/O:</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="fs-source"> <widget class="GtkLabel" id="fs-wrpolicy">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label">label</property> <property name="label">label</property>
<property name="ellipsize">end</property>
</widget> </widget>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
@ -5835,7 +5847,22 @@ I/O:</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="fs-readonly"> <widget class="GtkLabel" id="fs-source">
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="label">label</property>
<property name="ellipsize">end</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="y_options">GTK_FILL</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="fs-target">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label">label</property> <property name="label">label</property>
@ -5850,7 +5877,7 @@ I/O:</property>
</packing> </packing>
</child> </child>
<child> <child>
<widget class="GtkLabel" id="fs-target"> <widget class="GtkLabel" id="fs-readonly">
<property name="visible">True</property> <property name="visible">True</property>
<property name="xalign">0</property> <property name="xalign">0</property>
<property name="label">label</property> <property name="label">label</property>
@ -5859,8 +5886,8 @@ I/O:</property>
<packing> <packing>
<property name="left_attach">1</property> <property name="left_attach">1</property>
<property name="right_attach">2</property> <property name="right_attach">2</property>
<property name="top_attach">4</property> <property name="top_attach">6</property>
<property name="bottom_attach">5</property> <property name="bottom_attach">7</property>
<property name="y_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property>
</packing> </packing>
</child> </child>