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@xxxxxxxxxxxxxxxxxx> --- src/virtManager/addhardware.py | 36 +++++++++++++++++++---- src/virtManager/details.py | 3 ++ src/vmm-add-hardware.glade | 64 ++++++++++++++++++++++++++++++++++------ src/vmm-details.glade | 55 ++++++++++++++++++++++++++-------- 4 files changed, 128 insertions(+), 30 deletions(-) diff --git a/src/virtManager/addhardware.py b/src/virtManager/addhardware.py index 8687c1f..a61dec2 100644 --- a/src/virtManager/addhardware.py +++ b/src/virtManager/addhardware.py @@ -329,6 +329,7 @@ class vmmAddHardware(vmmGObjectUI): VirtualFilesystem.TYPE_TEMPLATE]) simple_store_set("fs-mode-combo", VirtualFilesystem.MOUNT_MODES) 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_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-mode-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-target").set_text("") self.widget("fs-readonly").set_active(False) @@ -729,6 +731,15 @@ class vmmAddHardware(vmmGObjectUI): return None 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): name = "fs-type-combo" combo = self.widget(name) @@ -1039,6 +1050,7 @@ class vmmAddHardware(vmmGObjectUI): fstype = None show_mode_combo = False show_driver_combo = False + show_wrpolicy_combo = self.conn.is_qemu() if idx >= 0 and src.get_property("visible"): fstype = src.get_model()[idx][0] @@ -1054,24 +1066,33 @@ class vmmAddHardware(vmmGObjectUI): self.widget("fs-source-title").set_use_underline(True) self.show_pair_combo("fs-mode", show_mode_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): idx = src.get_active() fsdriver = None - combo = self.widget("fs-mode-combo") - label1 = self.widget("fs-mode-title") + modecombo = self.widget("fs-mode-combo") + 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"): fsdriver = src.get_model()[idx][0] if (fsdriver == virtinst.VirtualFilesystem.DRIVER_PATH or fsdriver == virtinst.VirtualFilesystem.DRIVER_DEFAULT): - combo.set_property("visible", True) - label1.set_property("visible", True) + modecombo.set_property("visible", True) + modelabel1.set_property("visible", True) else: - combo.set_property("visible", False) - label1.set_property("visible", False) + modecombo.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() readonly = self.get_config_fs_readonly() driver = self.get_config_fs_driver() + wrpolicy = self.get_config_fs_wrpolicy() if not source: return self.err.val_err(_("A filesystem source must be specified")) @@ -1445,6 +1467,8 @@ class vmmAddHardware(vmmGObjectUI): self._dev.readonly = readonly if driver: self._dev.driver = driver + if wrpolicy: + self._dev.wrpolicy = wrpolicy except Exception, e: return self.err.val_err(_("Filesystem parameter error"), e) diff --git a/src/virtManager/details.py b/src/virtManager/details.py index 8081cd5..670e3f7 100644 --- a/src/virtManager/details.py +++ b/src/virtManager/details.py @@ -3183,6 +3183,9 @@ class vmmDetails(vmmGObjectUI): self.show_pair("fs-mode", False) 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-target").set_text(dev.target) if dev.readonly: diff --git a/src/vmm-add-hardware.glade b/src/vmm-add-hardware.glade index f19b727..c800ab6 100644 --- a/src/vmm-add-hardware.glade +++ b/src/vmm-add-hardware.glade @@ -2165,6 +2165,50 @@ access in the guest.</property> </packing> </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> <widget class="GtkLabel" id="fs-source-title"> <property name="visible">True</property> <property name="xalign">0</property> @@ -2173,8 +2217,8 @@ access in the guest.</property> <property name="mnemonic_widget">fs-source</property> </widget> <packing> - <property name="top_attach">3</property> - <property name="bottom_attach">4</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="x_options">GTK_FILL</property> </packing> </child> @@ -2187,8 +2231,8 @@ access in the guest.</property> <property name="mnemonic_widget">fs-target</property> </widget> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_attach">5</property> + <property name="bottom_attach">6</property> <property name="x_options">GTK_FILL</property> </packing> </child> @@ -2201,8 +2245,8 @@ access in the guest.</property> <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="top_attach">5</property> + <property name="bottom_attach">6</property> </packing> </child> <child> @@ -2217,8 +2261,8 @@ access in the guest.</property> <packing> <property name="left_attach">1</property> <property name="right_attach">2</property> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">6</property> + <property name="bottom_attach">7</property> </packing> </child> <child> @@ -2253,8 +2297,8 @@ access in the guest.</property> <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> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> </packing> </child> </widget> diff --git a/src/vmm-details.glade b/src/vmm-details.glade index 77c644e..f0a9cf8 100644 --- a/src/vmm-details.glade +++ b/src/vmm-details.glade @@ -5753,10 +5753,10 @@ I/O:</property> </packing> </child> <child> - <widget class="GtkLabel" id="label65"> + <widget class="GtkLabel" id="fs-wrpolicy-title"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Source:</property> + <property name="label" translatable="yes">Write Policy:</property> </widget> <packing> <property name="top_attach">3</property> @@ -5766,14 +5766,14 @@ I/O:</property> </packing> </child> <child> - <widget class="GtkLabel" id="fs-readonly-title"> + <widget class="GtkLabel" id="label65"> <property name="visible">True</property> <property name="xalign">0</property> - <property name="label" translatable="yes">Readonly:</property> + <property name="label" translatable="yes">Source:</property> </widget> <packing> - <property name="top_attach">5</property> - <property name="bottom_attach">6</property> + <property name="top_attach">4</property> + <property name="bottom_attach">5</property> <property name="x_options">GTK_FILL</property> <property name="y_options">GTK_FILL</property> </packing> @@ -5785,8 +5785,21 @@ I/O:</property> <property name="label" translatable="yes">Target:</property> </widget> <packing> - <property name="top_attach">4</property> - <property name="bottom_attach">5</property> + <property name="top_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="y_options">GTK_FILL</property> </packing> @@ -5820,11 +5833,10 @@ I/O:</property> </packing> </child> <child> - <widget class="GtkLabel" id="fs-source"> + <widget class="GtkLabel" id="fs-wrpolicy"> <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> @@ -5835,7 +5847,22 @@ I/O:</property> </packing> </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="xalign">0</property> <property name="label">label</property> @@ -5850,7 +5877,7 @@ I/O:</property> </packing> </child> <child> - <widget class="GtkLabel" id="fs-target"> + <widget class="GtkLabel" id="fs-readonly"> <property name="visible">True</property> <property name="xalign">0</property> <property name="label">label</property> @@ -5859,8 +5886,8 @@ I/O:</property> <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="top_attach">6</property> + <property name="bottom_attach">7</property> <property name="y_options">GTK_FILL</property> </packing> </child>