virtManager: Drop macvtap 'source mode' UI

Some related bits were discussed here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

"""
  * macvtap is kinda problematic in general because it doesn't provide
    out of the box host<->guest communication, and it requires a
    special XML option just to get working ipv6. Users that know they
    want it usually know this distinction, but if someone chooses it
    without understanding the implications it can cause confusion.
    This puts it hovering the intermediate/advanced user line which
    makes me want to not advertise it as prominently as we currently do,
    with an explicit list of host interfaces
"""

Part of this is that the only source_mode that will work in a useful
way for the vast majority of users is mode=bridge. Any of the other
modes either require special hardware, permissions, or other
configuration. Default to bridge mode. The XML editor is there for
anyone that knows they need something different

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2020-01-25 18:05:30 -05:00
parent 4c3c53f773
commit 227d6982ae
4 changed files with 4 additions and 64 deletions

View File

@ -277,10 +277,6 @@ class AddHardware(uiutils.UITestCase):
tab = self._select_hw(addhw, "Network", "network-tab")
src.click()
tab.find_fuzzy("macvtap", "menu item").click()
mode = tab.find_fuzzy("Source mode:", "combo box")
mode.click_combo_entry()
self.assertTrue(mode.find("Bridge", "menu item").selected)
self.pressKey("Escape")
finish.click()
uiutils.check_in_loop(lambda: details.active)

View File

@ -239,10 +239,6 @@ class Details(uiutils.UITestCase):
tab.find_fuzzy("macvtap", "menu item").bring_on_screen().click()
tab.find("Device model:", "combo box").click_combo_entry()
tab.find("rtl8139", "menu item").click()
mode = tab.find_fuzzy("Source mode:", "combo box")
mode.click_combo_entry()
self.assertTrue(mode.find("Bridge", "menu item").selected)
self.pressKey("Escape")
appl.click()
uiutils.check_in_loop(lambda: not appl.sensitive)

View File

@ -22,21 +22,6 @@
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">False</property>
<property name="label" translatable="yes">Source m_ode:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">net-source-mode</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="net-bridge-name">
<property name="visible">True</property>
@ -92,25 +77,6 @@
<property name="width">2</property>
</packing>
</child>
<child>
<object class="GtkComboBox" id="net-source-mode">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="hexpand">True</property>
<property name="has_entry">True</property>
<signal name="changed" handler="on_net_source_mode_changed" swapped="no"/>
<child internal-child="entry">
<object class="GtkEntry" id="combobox-entry">
<property name="can_focus">True</property>
</object>
</child>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkBox" id="box2">
<property name="visible">True</property>

View File

@ -78,7 +78,6 @@ class vmmNetworkList(vmmGObjectUI):
self.builder.connect_signals({
"on_net_source_changed": self._on_net_source_changed,
"on_net_source_mode_changed": self._emit_changed,
"on_net_bridge_name_changed": self._emit_changed,
})
@ -116,18 +115,6 @@ class vmmNetworkList(vmmGObjectUI):
combo.add_attribute(text, 'text', NET_ROW_LABEL)
combo.add_attribute(text, 'sensitive', NET_ROW_SENSITIVE)
combo = self.widget("net-source-mode")
# [xml value, label]
model = Gtk.ListStore(str, str)
combo.set_model(model)
uiutil.init_combo_text_column(combo, 1)
model.append(["bridge", _("Bridge")])
model.append(["vepa", "VEPA"])
model.append(["private", _("Private")])
model.append(["passthrough", _("Passthrough")])
combo.set_active(0)
self.conn.connect("net-added", self._repopulate_network_list)
self.conn.connect("net-removed", self._repopulate_network_list)
self.conn.connect("interface-added", self._repopulate_network_list)
@ -340,8 +327,10 @@ class vmmNetworkList(vmmGObjectUI):
net_src = self.widget("net-bridge-name").get_text() or None
mode = None
if self.widget("net-source-mode").is_visible():
mode = uiutil.get_list_selection(self.widget("net-source-mode"))
is_direct = (net_type == virtinst.DeviceInterface.TYPE_DIRECT)
if is_direct:
# This is generally the safest and most featureful default
mode = "bridge"
return net_type, net_src, mode
@ -375,7 +364,6 @@ class vmmNetworkList(vmmGObjectUI):
net_warn.set_tooltip_text(net_err or "")
self.widget("net-bridge-name").set_text("")
self.widget("net-source-mode").set_active(0)
def set_dev(self, net):
self.reset_state()
@ -390,9 +378,6 @@ class vmmNetworkList(vmmGObjectUI):
source = net.network
nettype = "network"
source_mode = net.source_mode
uiutil.set_list_selection(self.widget("net-source-mode"), source_mode)
# Find the matching row in the net list
combo = self.widget("net-source")
rowiter = None
@ -460,11 +445,8 @@ class vmmNetworkList(vmmGObjectUI):
nettype = row[NET_ROW_TYPE]
is_direct = (nettype == virtinst.DeviceInterface.TYPE_DIRECT)
uiutil.set_grid_row_visible(self.widget("net-source-mode"), is_direct)
uiutil.set_grid_row_visible(
self.widget("net-macvtap-warn-box"), is_direct)
if is_direct and self.widget("net-source-mode").get_active() == -1:
self.widget("net-source-mode").set_active(0)
show_bridge = row[NET_ROW_MANUAL]
uiutil.set_grid_row_visible(