hostnets: Remove QoS viewing/editing
This is fairly niche, and can be reviewed or edited with the XML editor
This commit is contained in:
parent
e25318e037
commit
59873f3876
|
@ -26,22 +26,10 @@
|
|||
<virtualport type='802.1Qbh'>
|
||||
<parameters profileid='test'/>
|
||||
</virtualport>
|
||||
<bandwidth>
|
||||
<inbound average='1000' peak='5000' burst='5120'/>
|
||||
<outbound average='1000' peak='5000' burst='5120'/>
|
||||
</bandwidth>
|
||||
</portgroup>
|
||||
<portgroup name='sales'>
|
||||
<virtualport type='802.1Qbh'>
|
||||
<parameters profileid='salestest'/>
|
||||
</virtualport>
|
||||
<bandwidth>
|
||||
<inbound average='500' peak='2000' burst='2560'/>
|
||||
<outbound average='128' peak='256' burst='256'/>
|
||||
</bandwidth>
|
||||
</portgroup>
|
||||
<bandwidth>
|
||||
<inbound average="1000" peak="5000" burst="5120"/>
|
||||
<outbound average="1000" peak="5000" burst="5120"/>
|
||||
</bandwidth>
|
||||
</network>
|
||||
|
|
|
@ -28,24 +28,12 @@
|
|||
<virtualport type="802.1Qbh">
|
||||
<parameters profileid="test"/>
|
||||
</virtualport>
|
||||
<bandwidth>
|
||||
<inbound average="1000" peak="5000" burst="5120"/>
|
||||
<outbound average="1000" peak="5000" burst="5120"/>
|
||||
</bandwidth>
|
||||
</portgroup>
|
||||
<portgroup name="sales">
|
||||
<virtualport type="802.1Qbh">
|
||||
<parameters profileid="salestest"/>
|
||||
</virtualport>
|
||||
<bandwidth>
|
||||
<inbound average="500" peak="2000" burst="2560"/>
|
||||
<outbound average="128" peak="256" burst="256"/>
|
||||
</bandwidth>
|
||||
</portgroup>
|
||||
<bandwidth>
|
||||
<inbound average="3000" peak="4000" burst="5220"/>
|
||||
<outbound average="2000" peak="3000" burst="5120"/>
|
||||
</bandwidth>
|
||||
<virtualport type="openvswitch"/>
|
||||
<mac address="52:54:00:69:eb:FF"/>
|
||||
<route family="ipv4" address="192.168.8.0" prefix="24" gateway="192.168.8.10"/>
|
||||
|
|
|
@ -1299,15 +1299,6 @@ class XMLParseTest(unittest.TestCase):
|
|||
check("macaddr", None, "52:54:00:69:eb:FF")
|
||||
check("virtualport_type", None, "openvswitch")
|
||||
|
||||
check = self._make_checker(net.bandwidth)
|
||||
check("inbound_average", "1000", "3000")
|
||||
check("inbound_peak", "5000", "4000")
|
||||
check("inbound_burst", "5120", "5220")
|
||||
check("inbound_floor", None, None)
|
||||
check("outbound_average", "1000", "2000")
|
||||
check("outbound_peak", "5000", "3000")
|
||||
check("outbound_burst", "5120", "5120")
|
||||
|
||||
self.assertEqual(len(net.portgroups), 2)
|
||||
check = self._make_checker(net.portgroups[0])
|
||||
check("name", "engineering", "foo")
|
||||
|
|
227
ui/hostnets.ui
227
ui/hostnets.ui
|
@ -531,231 +531,6 @@
|
|||
<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="GtkBox" id="box14">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="net-qos-inbound-enable">
|
||||
<property name="label" translatable="yes">Enable i_nbound QoS</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_net_qos_inbound_enable_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="net-qos-inbound-grid">
|
||||
<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="GtkEntry" id="qos-inbound-peak">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_inbound_peak_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="qos-inbound-burst">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_inbound_burst_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label35">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Average (KiB/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label36">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Burst (KiB):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="qos-inbound-average">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_inbound_average_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label37">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Peak (KiB/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkCheckButton" id="net-qos-outbound-enable">
|
||||
<property name="label" translatable="yes">Enable ou_tbound QoS</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="draw_indicator">True</property>
|
||||
<signal name="toggled" handler="on_net_qos_outbound_enable_toggled" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkGrid" id="net-qos-outbound-grid">
|
||||
<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="GtkEntry" id="qos-outbound-peak">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_outbound_peak_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="qos-outbound-burst">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_outbound_burst_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="qos-outbound-average">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<signal name="changed" handler="on_qos_outbound_average_changed" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label42">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Burst (KiB/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label44">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Peak (KiB/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label45">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">start</property>
|
||||
<property name="label" translatable="yes">Average (KiB/sec):</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">0</property>
|
||||
<property name="top_attach">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</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>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkExpander" id="net-sriov-expander">
|
||||
<property name="visible">True</property>
|
||||
|
@ -855,7 +630,7 @@
|
|||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -21,9 +21,8 @@ from .xmleditor import vmmXMLEditor
|
|||
EDIT_NET_IDS = (
|
||||
EDIT_NET_NAME,
|
||||
EDIT_NET_AUTOSTART,
|
||||
EDIT_NET_QOS,
|
||||
EDIT_NET_XML,
|
||||
) = list(range(4))
|
||||
) = list(range(3))
|
||||
|
||||
|
||||
ICON_RUNNING = "state_running"
|
||||
|
@ -53,22 +52,6 @@ class vmmHostNets(vmmGObjectUI):
|
|||
self._enable_net_apply(EDIT_NET_AUTOSTART)),
|
||||
"on_net_name_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_NAME)),
|
||||
|
||||
"on_qos_inbound_average_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
"on_qos_inbound_peak_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
"on_qos_inbound_burst_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
"on_qos_outbound_average_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
"on_qos_outbound_peak_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
"on_qos_outbound_burst_changed": (lambda *x:
|
||||
self._enable_net_apply(EDIT_NET_QOS)),
|
||||
|
||||
"on_net_qos_inbound_enable_toggled": self._change_qos_cb,
|
||||
"on_net_qos_outbound_enable_toggled": self._change_qos_cb,
|
||||
})
|
||||
|
||||
self._init_ui()
|
||||
|
@ -281,36 +264,6 @@ class vmmHostNets(vmmGObjectUI):
|
|||
routevia = routeaddr + ", gateway=" + routevia
|
||||
self.widget("net-ipv6-route").set_text(routevia or "")
|
||||
|
||||
def _update_qos_widgets(self):
|
||||
enabled = self.widget("net-qos-inbound-enable").get_active()
|
||||
self.widget("net-qos-inbound-grid").set_visible(enabled)
|
||||
|
||||
enabled = self.widget("net-qos-outbound-enable").get_active()
|
||||
self.widget("net-qos-outbound-grid").set_visible(enabled)
|
||||
|
||||
def _populate_qos_state(self, net):
|
||||
qos = net.get_qos()
|
||||
|
||||
def is_inbound():
|
||||
return bool(qos.inbound_average or qos.inbound_peak or
|
||||
qos.inbound_burst or qos.inbound_floor)
|
||||
def is_outbound():
|
||||
return bool(qos.outbound_average or qos.outbound_peak or
|
||||
qos.outbound_burst)
|
||||
|
||||
self.widget("net-qos-inbound-enable").set_active(is_inbound())
|
||||
self.widget("net-qos-outbound-enable").set_active(is_outbound())
|
||||
|
||||
self._update_qos_widgets()
|
||||
|
||||
self.widget("qos-inbound-average").set_text(qos.inbound_average or "")
|
||||
self.widget("qos-inbound-peak").set_text(qos.inbound_peak or "")
|
||||
self.widget("qos-inbound-burst").set_text(qos.inbound_burst or "")
|
||||
|
||||
self.widget("qos-outbound-average").set_text(qos.outbound_average or "")
|
||||
self.widget("qos-outbound-peak").set_text(qos.outbound_peak or "")
|
||||
self.widget("qos-outbound-burst").set_text(qos.outbound_burst or "")
|
||||
|
||||
def _populate_sriov_state(self, net):
|
||||
(is_vf_pool, pf_name, vfs) = net.get_sriov_vf_networks()
|
||||
|
||||
|
@ -366,7 +319,6 @@ class vmmHostNets(vmmGObjectUI):
|
|||
|
||||
self._populate_net_ipv4_state(net)
|
||||
self._populate_net_ipv6_state(net)
|
||||
self._populate_qos_state(net)
|
||||
self._populate_sriov_state(net)
|
||||
|
||||
self._xmleditor.set_xml_from_libvirtobject(net)
|
||||
|
@ -436,32 +388,6 @@ class vmmHostNets(vmmGObjectUI):
|
|||
if EDIT_NET_NAME in self._active_edits:
|
||||
net.define_name(self.widget("net-name").get_text())
|
||||
self.idle_add(self._populate_networks)
|
||||
if EDIT_NET_QOS in self._active_edits:
|
||||
in_qos = self.widget("net-qos-inbound-enable").get_active()
|
||||
out_qos = self.widget("net-qos-outbound-enable").get_active()
|
||||
|
||||
def get_value(name, enabled):
|
||||
if not enabled:
|
||||
return None
|
||||
return self.widget(name).get_text() or None
|
||||
|
||||
args = {}
|
||||
args['inbound_average'] = get_value("qos-inbound-average", in_qos)
|
||||
args['inbound_peak'] = get_value("qos-inbound-peak", in_qos)
|
||||
args['inbound_burst'] = get_value("qos-inbound-burst", in_qos)
|
||||
|
||||
args['outbound_average'] = get_value("qos-outbound-average", out_qos)
|
||||
args['outbound_peak'] = get_value("qos-outbound-peak", out_qos)
|
||||
args['outbound_burst'] = get_value("qos-outbound-burst", out_qos)
|
||||
|
||||
if net.set_qos(**args):
|
||||
self.err.show_err(
|
||||
_("Network could not be updated"),
|
||||
text2=_("This change will take effect when the "
|
||||
"network is restarted"),
|
||||
buttons=Gtk.ButtonsType.OK,
|
||||
dialog_type=Gtk.MessageType.INFO)
|
||||
|
||||
if EDIT_NET_XML in self._active_edits:
|
||||
net.define_xml(self._xmleditor.get_xml())
|
||||
|
||||
|
@ -501,10 +427,6 @@ class vmmHostNets(vmmGObjectUI):
|
|||
def _conn_nets_changed_cb(self, src, connkey):
|
||||
self._populate_networks()
|
||||
|
||||
def _change_qos_cb(self, src):
|
||||
self._enable_net_apply(EDIT_NET_QOS)
|
||||
self._update_qos_widgets()
|
||||
|
||||
def _net_state_changed_cb(self, net):
|
||||
# Update net state inline in the tree model
|
||||
for row in self.widget("net-list").get_model():
|
||||
|
|
|
@ -106,15 +106,6 @@ class vmmNetwork(vmmLibvirtObject):
|
|||
self.refresh_dhcp_leases()
|
||||
return self._leases
|
||||
|
||||
def set_qos(self, **kwargs):
|
||||
xmlobj = self._make_xmlobj_to_define()
|
||||
q = xmlobj.bandwidth
|
||||
for key, val in kwargs.items():
|
||||
setattr(q, key, val)
|
||||
|
||||
self._redefine_xmlobj(xmlobj)
|
||||
return self.is_active()
|
||||
|
||||
def get_uuid(self):
|
||||
return self.get_xmlobj().uuid
|
||||
def get_bridge_device(self):
|
||||
|
@ -125,8 +116,6 @@ class vmmNetwork(vmmLibvirtObject):
|
|||
return self.get_xmlobj().ipv6
|
||||
def get_ipv4_forward_mode(self):
|
||||
return self.get_xmlobj().forward.mode
|
||||
def get_qos(self):
|
||||
return self.get_xmlobj().bandwidth
|
||||
|
||||
def can_pxe(self):
|
||||
return self.get_xmlobj().can_pxe()
|
||||
|
|
|
@ -73,19 +73,6 @@ class _NetworkForward(XMLBuilder):
|
|||
vfs = XMLChildProperty(_NetworkForwardAddress)
|
||||
|
||||
|
||||
class _NetworkBandwidth(XMLBuilder):
|
||||
XML_NAME = "bandwidth"
|
||||
|
||||
inbound_average = XMLProperty("./inbound/@average")
|
||||
inbound_peak = XMLProperty("./inbound/@peak")
|
||||
inbound_burst = XMLProperty("./inbound/@burst")
|
||||
inbound_floor = XMLProperty("./inbound/@floor")
|
||||
|
||||
outbound_average = XMLProperty("./outbound/@average")
|
||||
outbound_peak = XMLProperty("./outbound/@peak")
|
||||
outbound_burst = XMLProperty("./outbound/@burst")
|
||||
|
||||
|
||||
class _NetworkPortgroup(XMLBuilder):
|
||||
XML_NAME = "portgroup"
|
||||
|
||||
|
@ -100,7 +87,7 @@ class Network(XMLBuilder):
|
|||
XML_NAME = "network"
|
||||
_XML_PROP_ORDER = ["ipv6", "name", "uuid", "forward", "virtualport_type",
|
||||
"bridge", "stp", "delay", "domain_name",
|
||||
"macaddr", "ips", "routes", "bandwidth"]
|
||||
"macaddr", "ips", "routes"]
|
||||
|
||||
ipv6 = XMLProperty("./@ipv6", is_yesno=True)
|
||||
name = XMLProperty("./name")
|
||||
|
@ -121,7 +108,6 @@ class Network(XMLBuilder):
|
|||
portgroups = XMLChildProperty(_NetworkPortgroup)
|
||||
ips = XMLChildProperty(_NetworkIP)
|
||||
routes = XMLChildProperty(_NetworkRoute)
|
||||
bandwidth = XMLChildProperty(_NetworkBandwidth, is_single=True)
|
||||
|
||||
|
||||
###################
|
||||
|
|
Loading…
Reference in New Issue