[virt-tools-list] [PATCH] virt-manager: only show appropriate security driver details

Marc Deslauriers marc.deslauriers at canonical.com
Tue Mar 1 02:25:54 UTC 2011


Hello,

When libvirt is used with AppArmor or with no security driver,
virt-manager shouldn't show SELinux specific options on the VM overview
page.

Thanks,

Marc.

# HG changeset patch
# User Marc Deslauriers <marc.deslauriers at ubuntu.com>
# Date 1298946168 18000
# Node ID 23a7ec7f4348ca11e4ea94ddfe768a98ebe72a48
# Parent  134adf33f6f4d3d600568b175fb8d37a0762285f
Only show appropriate security driver details

diff -r 134adf33f6f4 -r 23a7ec7f4348 src/virtManager/details.py
--- a/src/virtManager/details.py	Thu Feb 24 11:38:40 2011 -0500
+++ b/src/virtManager/details.py	Mon Feb 28 21:22:48 2011 -0500
@@ -1938,15 +1938,21 @@
 
         if caps.host.secmodel and caps.host.secmodel.model:
             semodel = caps.host.secmodel.model
-
self.window.get_widget("security-type-box").set_sensitive(bool(semodel))
+
         self.window.get_widget("security-model").set_text(semodel or
_("None"))
 
-        if self.vm.get_seclabel()[1] == "static":
-            self.window.get_widget("security-static").set_active(True)
+        if not semodel or semodel == "apparmor":
+            self.window.get_widget("security-type-box").hide()
+            self.window.get_widget("security-type-label").hide()
         else:
-            self.window.get_widget("security-dynamic").set_active(True)
-
-        self.window.get_widget("security-label").set_text(vmlabel)
+
self.window.get_widget("security-type-box").set_sensitive(bool(semodel))
+
+            if self.vm.get_seclabel()[1] == "static":
+
self.window.get_widget("security-static").set_active(True)
+            else:
+
self.window.get_widget("security-dynamic").set_active(True)
+
+            self.window.get_widget("security-label").set_text(vmlabel)
 
     def refresh_stats_page(self):
         def _dsk_rx_tx_text(rx, tx, unit):
diff -r 134adf33f6f4 -r 23a7ec7f4348 src/vmm-details.glade
--- a/src/vmm-details.glade	Thu Feb 24 11:38:40 2011 -0500
+++ b/src/vmm-details.glade	Mon Feb 28 21:22:48 2011 -0500
@@ -1559,7 +1559,7 @@
                                               </packing>
                                             </child>
                                             <child>
-                                              <widget class="GtkLabel"
id="label515">
+                                              <widget class="GtkLabel"
id="security-type-label">
                                                 <property
name="visible">True</property>
                                                 <property
name="xalign">1</property>
                                                 <property
name="yalign">0</property>





More information about the virt-tools-list mailing list