[virt-tools-list] [PATCH virt-manager 5/5] virtManager: show QoS information for a network
Giuseppe Scrivano
gscrivan at redhat.com
Wed Jun 25 11:05:50 UTC 2014
Add UI elements to display QoS settings in the network details.
Closes: https://bugzilla.redhat.com/show_bug.cgi?id=1089117
Signed-off-by: Giuseppe Scrivano <gscrivan at redhat.com>
---
ui/host.ui | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++
virtManager/host.py | 19 +++++++++++
virtManager/network.py | 2 ++
3 files changed, 106 insertions(+)
diff --git a/ui/host.ui b/ui/host.ui
index e1e2088..b474121 100644
--- a/ui/host.ui
+++ b/ui/host.ui
@@ -1091,6 +1091,91 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkExpander" id="net-qos-expander">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkGrid" id="table8">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="row_spacing">5</property>
+ <property name="column_spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="net-qos-inbound">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="net-qos-outbound">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label">label</property>
+ <property name="selectable">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label35">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Inbound:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label36">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Outbound:</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label38">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes"><b>QoS configuration</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
</object>
</child>
</object>
diff --git a/virtManager/host.py b/virtManager/host.py
index 4166929..d84e3b3 100644
--- a/virtManager/host.py
+++ b/virtManager/host.py
@@ -615,6 +615,24 @@ class vmmHost(vmmGObjectUI):
routevia = routeaddr + ", gateway=" + routevia
self.widget("net-ipv6-route").set_text(routevia or "")
+ def _populate_qos_state(self, net):
+ qos = net.get_qos()
+ visible = qos and (qos.is_inbound() or qos.is_outbound())
+ self.widget("net-qos-expander").set_visible(visible)
+ if not visible:
+ return
+
+ uiutil.set_grid_row_visible(self.widget("net-qos-inbound"),
+ qos.is_inbound())
+ uiutil.set_grid_row_visible(self.widget("net-qos-outbound"),
+ qos.is_outbound())
+
+ desc = qos.pretty_desc(outbound=False)
+ self.widget("net-qos-inbound").set_text(desc)
+
+ desc = qos.pretty_desc(inbound=False)
+ self.widget("net-qos-outbound").set_text(desc)
+
def populate_net_state(self, net):
active = net.is_active()
@@ -644,6 +662,7 @@ class vmmHost(vmmGObjectUI):
self._populate_net_ipv4_state(net)
self._populate_net_ipv6_state(net)
+ self._populate_qos_state(net)
def reset_net_state(self):
diff --git a/virtManager/network.py b/virtManager/network.py
index 163a0c0..86d1a13 100644
--- a/virtManager/network.py
+++ b/virtManager/network.py
@@ -143,6 +143,8 @@ class vmmNetwork(vmmLibvirtObject):
return self.get_xmlobj().forward.mode
def pretty_forward_mode(self):
return self.get_xmlobj().forward.pretty_desc()
+ def get_qos(self):
+ return self.get_xmlobj().bandwidth
def can_pxe(self):
return self.get_xmlobj().can_pxe()
--
1.9.3
More information about the virt-tools-list
mailing list