[virt-tools-list] [PATCH v2 virt-manager] cli: Add --network mtu.size=X option

Anya Harter aharter at redhat.com
Wed Jun 6 14:07:46 UTC 2018


This maps to interface XML like:

    <interface>
      <mtu size='X'/>
    </interface>

Signed-off-by: Anya Harter <aharter at redhat.com>
---
 tests/cli-test-xml/compare/virt-install-many-devices.xml | 1 +
 tests/clitest.py                                         | 2 +-
 virtinst/cli.py                                          | 2 ++
 virtinst/devices/interface.py                            | 4 +++-
 4 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/tests/cli-test-xml/compare/virt-install-many-devices.xml b/tests/cli-test-xml/compare/virt-install-many-devices.xml
index f9c7f1b5..8ffb6948 100644
--- a/tests/cli-test-xml/compare/virt-install-many-devices.xml
+++ b/tests/cli-test-xml/compare/virt-install-many-devices.xml
@@ -210,6 +210,7 @@
       <virtualport type="802.1Qbg">
         <parameters managerid="12" typeid="1193046" typeidversion="1" instanceid="09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b"/>
       </virtualport>
+      <mtu size="1500"/>
       <boot order="1"/>
     </interface>
     <interface type="user">
diff --git a/tests/clitest.py b/tests/clitest.py
index a62a9105..eb4d4dee 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -482,7 +482,7 @@ c.add_compare(""" \
 --network user,mac=12:34:56:78:11:22,portgroup=foo,link_state=down,rom_bar=on,rom_file=/tmp/foo \
 --network bridge=foobar,model=virtio,driver_name=qemu,driver_queues=3 \
 --network bridge=ovsbr,virtualport_type=openvswitch,virtualport_profileid=demo,virtualport_interfaceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,link_state=yes \
---network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1,trustGuestRxFilters=yes \
+--network type=direct,source=eth5,source_mode=vepa,target=mytap12,virtualport_type=802.1Qbg,virtualport_managerid=12,virtualport_typeid=1193046,virtualport_typeidversion=1,virtualport_instanceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,boot_order=1,trustGuestRxFilters=yes,mtu.size=1500 \
 --network user,model=virtio,address.type=spapr-vio,address.reg=0x500 \
 --network vhostuser,source_type=unix,source_path=/tmp/vhost1.sock,source_mode=server,model=virtio \
 \
diff --git a/virtinst/cli.py b/virtinst/cli.py
index a2624e66..038f4b11 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -2219,6 +2219,8 @@ ParserNetwork.add_arg("driver_queues", "driver_queues")
 ParserNetwork.add_arg("rom_file", "rom_file")
 ParserNetwork.add_arg("rom_bar", "rom_bar", is_onoff=True)
 
+ParserNetwork.add_arg("mtu_size", "mtu.size")
+
 # For 802.1Qbg
 ParserNetwork.add_arg("virtualport.type", "virtualport_type")
 ParserNetwork.add_arg("virtualport.managerid", "virtualport_managerid")
diff --git a/virtinst/devices/interface.py b/virtinst/devices/interface.py
index b7963d56..289472d0 100644
--- a/virtinst/devices/interface.py
+++ b/virtinst/devices/interface.py
@@ -261,7 +261,7 @@ class DeviceInterface(Device):
     _XML_PROP_ORDER = [
         "_bridge", "_network", "_source_dev", "source_type", "source_path",
         "source_mode", "portgroup", "macaddr", "target_dev", "model",
-        "virtualport", "filterref", "rom_bar", "rom_file"]
+        "virtualport", "filterref", "rom_bar", "rom_file", "mtu_size"]
 
     _bridge = XMLProperty("./source/@bridge", default_cb=_get_default_bridge)
     _network = XMLProperty("./source/@network")
@@ -292,6 +292,8 @@ class DeviceInterface(Device):
     rom_bar = XMLProperty("./rom/@bar", is_onoff=True)
     rom_file = XMLProperty("./rom/@file")
 
+    mtu_size = XMLProperty("./mtu/@size", is_int=True)
+
 
     #############
     # Build API #
-- 
2.17.1




More information about the virt-tools-list mailing list