[virt-tools-list] [virt-manager PATCH 5/5] virt-manager: add a new guest feature GIC for AMR guests

Pavel Hrdina phrdina at redhat.com
Fri Jun 10 17:30:40 UTC 2016


Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1334857

Signed-off-by: Pavel Hrdina <phrdina at redhat.com>
---
 ui/details.ui          | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 virtManager/details.py | 36 ++++++++++++++++++++++++++++++++++-
 virtManager/domain.py  |  8 +++++++-
 3 files changed, 93 insertions(+), 2 deletions(-)

diff --git a/ui/details.ui b/ui/details.ui
index 4159f1d..953bd00 100644
--- a/ui/details.ui
+++ b/ui/details.ui
@@ -1200,6 +1200,57 @@ if you know what you are doing.</small></property>
                                             <property name="top_attach">3</property>
                                           </packing>
                                         </child>
+                                        <child>
+                                          <object class="GtkLabel" id="overview-gic-title">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <property name="valign">start</property>
+                                            <property name="label" translatable="yes">_GIC version:</property>
+                                            <property name="use_underline">True</property>
+                                            <property name="ellipsize">middle</property>
+                                            <property name="angle">0.089999999999999997</property>
+                                            <property name="xalign">0</property>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">0</property>
+                                            <property name="top_attach">6</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <object class="GtkBox" id="box19">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">False</property>
+                                            <child>
+                                              <object class="GtkComboBox" id="gic-version">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="halign">start</property>
+                                                <signal name="changed" handler="on_gic_version_changed" swapped="no"/>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">0</property>
+                                              </packing>
+                                            </child>
+                                            <child>
+                                              <object class="GtkLabel" id="gic-version-label">
+                                                <property name="visible">True</property>
+                                                <property name="can_focus">False</property>
+                                                <property name="label">label</property>
+                                              </object>
+                                              <packing>
+                                                <property name="expand">False</property>
+                                                <property name="fill">True</property>
+                                                <property name="position">1</property>
+                                              </packing>
+                                            </child>
+                                          </object>
+                                          <packing>
+                                            <property name="left_attach">1</property>
+                                            <property name="top_attach">6</property>
+                                          </packing>
+                                        </child>
                                       </object>
                                     </child>
                                   </object>
diff --git a/virtManager/details.py b/virtManager/details.py
index 0c369a4..d655a09 100644
--- a/virtManager/details.py
+++ b/virtManager/details.py
@@ -51,6 +51,7 @@ EDIT_MACHTYPE,
 EDIT_FIRMWARE,
 EDIT_DESC,
 EDIT_IDMAP,
+EDIT_GIC,
 
 EDIT_VCPUS,
 EDIT_MAXVCPUS,
@@ -104,7 +105,7 @@ EDIT_FS,
 
 EDIT_HOSTDEV_ROMBAR,
 
-) = range(1, 45)
+) = range(1, 46)
 
 
 # Columns in hw list model
@@ -461,6 +462,7 @@ class vmmDetails(vmmGObjectUI):
             "on_machine_type_changed": lambda *x: self.enable_apply(x, EDIT_MACHTYPE),
             "on_overview_firmware_changed": lambda *x: self.enable_apply(x, EDIT_FIRMWARE),
             "on_overview_chipset_changed": lambda *x: self.enable_apply(x, EDIT_MACHTYPE),
+            "on_gic_version_changed" : lambda *x: self.enable_apply(x, EDIT_GIC),
             "on_idmap_uid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
             "on_idmap_uid_count_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
             "on_idmap_gid_target_changed": lambda *x: self.enable_apply(x, EDIT_IDMAP),
@@ -875,6 +877,26 @@ class vmmDetails(vmmGObjectUI):
         uiutil.set_grid_row_visible(
             self.widget("overview-chipset-title"), show_chipset)
 
+        # GIC version
+        combo = self.widget("gic-version")
+        model = Gtk.ListStore(str, str)
+        combo.set_model(model)
+        model.append([None, _("Hypervisor default")])
+        model.append(["host", "host"])
+        uiutil.init_combo_text_column(combo, 1)
+        combo.set_active(0)
+
+        show_gic = domcaps.supports_gic(self.vm.get_xmlobj())
+
+        if show_gic:
+            for ver in domcaps.get_gic_versions():
+                model.append([ver, ver])
+
+        self.widget("gic-version").set_visible(self.is_customize_dialog)
+        self.widget("gic-version-label").set_visible(not self.is_customize_dialog)
+        uiutil.set_grid_row_visible(
+            self.widget("overview-gic-title"), show_gic)
+
         # Inspection page
         apps_list = self.widget("inspection-apps")
         apps_model = Gtk.ListStore(str, str, str)
@@ -1906,6 +1928,10 @@ class vmmDetails(vmmGObjectUI):
                 kwargs["machine"] = uiutil.get_list_selection(
                     self.widget("machine-type"))
 
+        if self.edited(EDIT_GIC):
+            kwargs['gic'] = uiutil.get_list_selection(
+                self.widget("gic-version"))
+
         if self.edited(EDIT_DESC):
             desc_widget = self.widget("overview-description")
             kwargs["description"] = (
@@ -2342,6 +2368,14 @@ class vmmDetails(vmmGObjectUI):
         elif self.widget("overview-chipset-label").is_visible():
             self.widget("overview-chipset-label").set_text(chipset)
 
+        # GIC version
+        gic_version = self.vm.get_gic_version()
+        if self.widget("gic-version").is_visible():
+            uiutil.set_list_selection(
+                self.widget("gic-version"), gic_version)
+        elif self.widget("gic-version-label").is_visible():
+            self.widget("gic-version-label").set_text(gic_version)
+
         # User namespace idmap setting
         is_container = self.vm.is_container()
         self.widget("idmap-expander").set_visible(is_container)
diff --git a/virtManager/domain.py b/virtManager/domain.py
index 3185cf8..b0db5b4 100644
--- a/virtManager/domain.py
+++ b/virtManager/domain.py
@@ -621,7 +621,8 @@ class vmmDomain(vmmLibvirtObject):
         self._redefine_xmlobj(guest)
 
     def define_overview(self, machine=_SENTINEL, description=_SENTINEL,
-        title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL):
+        title=_SENTINEL, idmap_list=_SENTINEL, loader=_SENTINEL,
+        gic=_SENTINEL):
         guest = self._make_xmlobj_to_define()
         if machine != _SENTINEL:
             guest.os.machine = machine
@@ -657,6 +658,9 @@ class vmmDomain(vmmLibvirtObject):
             else:
                 guest.idmap.clear()
 
+        if gic != _SENTINEL:
+            guest.features.gic_version = gic
+
         self._redefine_xmlobj(guest)
 
     def define_boot(self, boot_order=_SENTINEL, boot_menu=_SENTINEL,
@@ -1181,6 +1185,8 @@ class vmmDomain(vmmLibvirtObject):
         return self.get_xmlobj().os.machine
     def get_idmap(self):
         return self.get_xmlobj().idmap
+    def get_gic_version(self):
+        return self.get_xmlobj().features.gic_version
 
     def get_name_or_title(self):
         title = self.get_title()
-- 
2.8.4




More information about the virt-tools-list mailing list