[virt-tools-list] [virt-manager PATCH] virt-install: introduce vhostuser interface
Chen Hanxiao
chen_han_xiao at 126.com
Sat Aug 27 05:41:38 UTC 2016
From: Chen Hanxiao <chenhanxiao at gmail.com>
Add support to interface type 'vhostuser' by:
--network vhostuser,source_type=unix,source_path=/tmp/vhost1.sock,source_mode=server,model=virtio
Signed-off-by: Chen Hanxiao <chenhanxiao at gmail.com>
---
tests/cli-test-xml/compare/virt-xml-edit-simple-network.xml | 6 +++---
tests/clitest.py | 1 +
virtinst/cli.py | 2 ++
virtinst/deviceinterface.py | 9 ++++++---
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/tests/cli-test-xml/compare/virt-xml-edit-simple-network.xml b/tests/cli-test-xml/compare/virt-xml-edit-simple-network.xml
index 9464976..fd70f78 100644
--- a/tests/cli-test-xml/compare/virt-xml-edit-simple-network.xml
+++ b/tests/cli-test-xml/compare/virt-xml-edit-simple-network.xml
@@ -2,10 +2,10 @@
<target dir="/bar/baz"/>
</filesystem>
- <interface type="network">
-- <mac address="22:22:33:54:32:10"/>
++ <interface type="vhostuser">
+ <mac address="22:22:33:54:32:10"/>
- <source network="default"/>
-+ <interface type="bridge">
-+ <source bridge="br0"/>
++ <source network="default" type="unix" path="/tmp/vhost1.sock" mode="server"/>
<target dev="testnet0"/>
- <model type="e1000"/>
+ <model type="virtio"/>
diff --git a/tests/clitest.py b/tests/clitest.py
index b63a7a0..bc1af33 100644
--- a/tests/clitest.py
+++ b/tests/clitest.py
@@ -848,6 +848,7 @@ c.add_compare("--pm suspend_to_mem=yes,suspend_to_disk=no", "edit-simple-pm")
c.add_compare("--disk /dev/zero,perms=ro,startup_policy=optional", "edit-simple-disk")
c.add_compare("--disk path=", "edit-simple-disk-remove-path")
c.add_compare("--network source=br0,type=bridge,model=virtio,mac=", "edit-simple-network")
+c.add_compare("--network vhostuser,source_type=unix,source_path=/tmp/vhost1.sock,source_mode=server,model=virtio", "edit-simple-network")
c.add_compare("--graphics tlsport=5902,keymap=ja", "edit-simple-graphics", compare_check="1.3.5") # compare_check=new graphics listen output
c.add_compare("--graphics listen=none", "edit-graphics-listen-none", compare_check="2.0.0") # compare_check=graphics listen=none support
c.add_compare("--controller index=15,model=lsilogic", "edit-simple-controller")
diff --git a/virtinst/cli.py b/virtinst/cli.py
index 73a16bd..43f0a29 100644
--- a/virtinst/cli.py
+++ b/virtinst/cli.py
@@ -1992,6 +1992,8 @@ _add_device_address_args(ParserNetwork)
ParserNetwork.add_arg("type", "type", cb=ParserNetwork.set_type_cb)
ParserNetwork.add_arg("source", "source")
ParserNetwork.add_arg("source_mode", "source_mode")
+ParserNetwork.add_arg("source_type", "source_type")
+ParserNetwork.add_arg("source_path", "source_path")
ParserNetwork.add_arg("portgroup", "portgroup")
ParserNetwork.add_arg("target_dev", "target")
ParserNetwork.add_arg("model", "model")
diff --git a/virtinst/deviceinterface.py b/virtinst/deviceinterface.py
index 6b5b527..29447c1 100644
--- a/virtinst/deviceinterface.py
+++ b/virtinst/deviceinterface.py
@@ -132,6 +132,7 @@ class VirtualNetworkInterface(VirtualDevice):
TYPE_BRIDGE = "bridge"
TYPE_VIRTUAL = "network"
TYPE_USER = "user"
+ TYPE_VHOSTUSER = "vhostuser"
TYPE_ETHERNET = "ethernet"
TYPE_DIRECT = "direct"
network_types = [TYPE_BRIDGE, TYPE_VIRTUAL, TYPE_USER, TYPE_ETHERNET,
@@ -272,9 +273,9 @@ class VirtualNetworkInterface(VirtualDevice):
##################
_XML_PROP_ORDER = [
- "_bridge", "_network", "_source_dev", "source_mode", "portgroup",
- "macaddr", "target_dev", "model", "virtualport",
- "filterref", "rom_bar", "rom_file"]
+ "_bridge", "_network", "_source_dev", "source_type", "source_path",
+ "source_mode", "portgroup", "macaddr", "target_dev", "model",
+ "virtualport", "filterref", "rom_bar", "rom_file"]
_bridge = XMLProperty("./source/@bridge", default_cb=_get_default_bridge)
_network = XMLProperty("./source/@network")
@@ -288,6 +289,8 @@ class VirtualNetworkInterface(VirtualDevice):
set_converter=_validate_mac,
default_cb=_get_default_mac)
+ source_type = XMLProperty("./source/@type")
+ source_path = XMLProperty("./source/@path")
source_mode = XMLProperty("./source/@mode",
default_cb=_default_source_mode)
portgroup = XMLProperty("./source/@portgroup")
--
1.8.3.1
More information about the virt-tools-list
mailing list