hostnets: Remove route UI label

This is an uncommon configuration. Users can see
the details in the XML editor

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-08-21 11:40:15 -04:00
parent d0e725f439
commit 766d7c47c3
3 changed files with 5 additions and 89 deletions

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<!-- Generated with glade 3.36.0 -->
<interface>
<requires lib="gtk+" version="3.22"/>
<object class="GtkBox" id="top-box">
@ -267,18 +267,6 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="net-ipv4-route">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;network-addr&gt; via &lt;gateway-addr&gt;</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox13">
<property name="visible">True</property>
@ -351,18 +339,6 @@
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="net-ipv4-route-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Static Route:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
</child>
<child type="label">
@ -418,19 +394,6 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="net-ipv6-route">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">&lt;network-addr&gt; via &lt;gateway-addr&gt;</property>
<property name="selectable">True</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkBox" id="hbox6">
<property name="visible">True</property>
@ -503,18 +466,6 @@
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="net-ipv6-route-label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Static Route:</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
</object>
</child>
<child type="label">

View File

@ -193,9 +193,7 @@ class vmmHostNets(vmmGObjectUI):
curnet and curnet.get_connkey() or None)
def _populate_net_ipv4_state(self, net):
(netstr,
(dhcpstart, dhcpend),
(routeaddr, routevia)) = net.get_ipv4_network()
(netstr, (dhcpstart, dhcpend)) = net.get_ipv4_network()
self.widget("net-ipv4-expander").set_visible(bool(netstr))
if not netstr:
@ -213,16 +211,8 @@ class vmmHostNets(vmmGObjectUI):
self.widget("net-ipv4-dhcp-range").set_text(dhcpstr)
self.widget("net-ipv4-network").set_text(netstr)
uiutil.set_grid_row_visible(
self.widget("net-ipv4-route"), bool(routevia))
if routevia:
routevia = routeaddr + ", gateway=" + routevia
self.widget("net-ipv4-route").set_text(routevia or "")
def _populate_net_ipv6_state(self, net):
(netstr,
(dhcpstart, dhcpend),
(routeaddr, routevia)) = net.get_ipv6_network()
(netstr, (dhcpstart, dhcpend)) = net.get_ipv6_network()
self.widget("net-ipv6-expander").set_visible(bool(netstr))
self.widget("net-ipv6-forwarding-icon").set_from_stock(
@ -243,12 +233,6 @@ class vmmHostNets(vmmGObjectUI):
self.widget("net-ipv6-dhcp-range").set_text(dhcpstr)
self.widget("net-ipv6-network").set_text(netstr or "")
uiutil.set_grid_row_visible(
self.widget("net-ipv6-route"), bool(routevia))
if routevia:
routevia = routeaddr + ", gateway=" + routevia
self.widget("net-ipv6-route").set_text(routevia or "")
def _populate_net_state(self, net):
active = net.is_active()

View File

@ -117,23 +117,6 @@ class vmmNetwork(vmmLibvirtObject):
def get_ipv4_forward_mode(self):
return self.get_xmlobj().forward.mode
def _get_static_route(self, family):
xmlobj = self.get_xmlobj()
route = None
for r in xmlobj.routes:
if (r.family == family or (family == "ipv4" and not r.family)):
route = r
break
if not route:
return [None, None]
routeAddr = _make_addr_str(route.address, route.prefix, route.netmask)
routeVia = str(ipaddress.ip_address(str(route.gateway)))
if not routeAddr or not routeVia:
return [None, None]
return [routeAddr, routeVia]
def _get_network(self, family):
dhcpstart = None
dhcpend = None
@ -167,11 +150,9 @@ class vmmNetwork(vmmLibvirtObject):
return [ret, dhcp]
def get_ipv4_network(self):
ret = self._get_network("ipv4")
return ret + [self._get_static_route("ipv4")]
return self._get_network("ipv4")
def get_ipv6_network(self):
ret = self._get_network("ipv6")
return ret + [self._get_static_route("ipv6")]
return self._get_network("ipv6")
def pretty_forward_mode(self):
mode = self.xmlobj.forward.mode