Skip to content

Commit c859d39

Browse files
chenhanxiaocrobinso
authored andcommitted
virt-install: introduce vhostuser interface
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 <[email protected]>
1 parent df4babc commit c859d39

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

tests/cli-test-xml/compare/virt-install-many-devices.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,11 @@
214214
<model type="virtio"/>
215215
<address type="spapr-vio" reg="0x500"/>
216216
</interface>
217+
<interface type="vhostuser">
218+
<source type="unix" path="/tmp/vhost1.sock" mode="server"/>
219+
<mac address="00:11:22:33:44:55"/>
220+
<model type="virtio"/>
221+
</interface>
217222
<input type="keyboard" bus="usb"/>
218223
<input type="tablet" bus="usb"/>
219224
<graphics type="sdl" display=":3.4" xauth="/tmp/.Xauthority"/>

tests/clitest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,7 @@ def add_compare(self, cat, args, compfile, **kwargs):
473473
--network bridge=ovsbr,virtualport_type=openvswitch,virtualport_profileid=demo,virtualport_interfaceid=09b11c53-8b5c-4eeb-8f00-d84eaa0aaa3b,link_state=yes \
474474
--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 \
475475
--network user,model=virtio,address.type=spapr-vio,address.reg=0x500 \
476+
--network vhostuser,source_type=unix,source_path=/tmp/vhost1.sock,source_mode=server,model=virtio \
476477
\
477478
--graphics sdl \
478479
--graphics spice,keymap=none \

virtinst/cli.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1992,6 +1992,8 @@ def _parse(self, inst):
19921992
ParserNetwork.add_arg("type", "type", cb=ParserNetwork.set_type_cb)
19931993
ParserNetwork.add_arg("source", "source")
19941994
ParserNetwork.add_arg("source_mode", "source_mode")
1995+
ParserNetwork.add_arg("source_type", "source_type")
1996+
ParserNetwork.add_arg("source_path", "source_path")
19951997
ParserNetwork.add_arg("portgroup", "portgroup")
19961998
ParserNetwork.add_arg("target_dev", "target")
19971999
ParserNetwork.add_arg("model", "model")

virtinst/deviceinterface.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ class VirtualNetworkInterface(VirtualDevice):
132132
TYPE_BRIDGE = "bridge"
133133
TYPE_VIRTUAL = "network"
134134
TYPE_USER = "user"
135+
TYPE_VHOSTUSER = "vhostuser"
135136
TYPE_ETHERNET = "ethernet"
136137
TYPE_DIRECT = "direct"
137138
network_types = [TYPE_BRIDGE, TYPE_VIRTUAL, TYPE_USER, TYPE_ETHERNET,
@@ -272,9 +273,9 @@ def _set_source(self, newsource):
272273
##################
273274

274275
_XML_PROP_ORDER = [
275-
"_bridge", "_network", "_source_dev", "source_mode", "portgroup",
276-
"macaddr", "target_dev", "model", "virtualport",
277-
"filterref", "rom_bar", "rom_file"]
276+
"_bridge", "_network", "_source_dev", "source_type", "source_path",
277+
"source_mode", "portgroup", "macaddr", "target_dev", "model",
278+
"virtualport", "filterref", "rom_bar", "rom_file"]
278279

279280
_bridge = XMLProperty("./source/@bridge", default_cb=_get_default_bridge)
280281
_network = XMLProperty("./source/@network")
@@ -288,6 +289,8 @@ def _set_source(self, newsource):
288289
set_converter=_validate_mac,
289290
default_cb=_get_default_mac)
290291

292+
source_type = XMLProperty("./source/@type")
293+
source_path = XMLProperty("./source/@path")
291294
source_mode = XMLProperty("./source/@mode",
292295
default_cb=_default_source_mode)
293296
portgroup = XMLProperty("./source/@portgroup")

0 commit comments

Comments
 (0)