virt-install: add --network type=hostdev,source.address.X= pci options

This just covers the common PCI case with these new options

source.address.type=
source.address.domain=
source.address.bus=
source.address.slot=
source.address.function=

Signed-off-by: Cole Robinson <crobinso@redhat.com>
This commit is contained in:
Cole Robinson 2024-11-11 14:25:25 -05:00
parent 315b340fc4
commit 300f934cae
4 changed files with 24 additions and 1 deletions

View File

@ -626,6 +626,13 @@
<range start="2022" to="22"/>
</portForward>
</interface>
<interface type="hostdev">
<mac address="00:11:22:33:44:55"/>
<model type="virtio"/>
<source>
<address type="pci" domain="0" bus="0" slot="7" function="0"/>
</source>
</interface>
<smartcard mode="passthrough" type="spicevmc"/>
<smartcard mode="host" type="tcp"/>
<smartcard mode="passthrough" type="spicevmc"/>

View File

@ -652,6 +652,7 @@ source.reservations.managed=no,source.reservations.source.type=unix,source.reser
--network user,address.type=ccw,address.cssid=0xfe,address.ssid=0,address.devno=01,boot.order=15,boot.loadparm=SYSTEM1
--network model=vmxnet3
--network backend.type=passt,backend.logFile=/tmp/foo.log,portForward0.proto=tcp,portForward0.address=192.168.10.10,portForward0.dev=eth0,portForward0.range0.start=4000,portForward0.range0.end=5000,portForward0.range0.to=10000,portForward0.range0.exclude=no,portForward0.range1.start=6000,portForward1.proto=tcp,portForward1.range0.start=2022,portForward1.range0.to=22
--network type=hostdev,source.address.type=pci,source.address.domain=0x0,source.address.bus=0x00,source.address.slot=0x07,source.address.function=0x0
--graphics sdl

View File

@ -3930,11 +3930,18 @@ class ParserNetwork(VirtCLIParser):
cls.add_arg("backend.type", "backend.type")
cls.add_arg("backend.logFile", "backend.logFile")
cls.add_arg("trustGuestRxFilters", "trustGuestRxFilters", is_onoff=True)
cls.add_arg("source", "source")
cls.add_arg("source.mode", "source_mode")
cls.add_arg("source.type", "source_type")
cls.add_arg("source.path", "source_path")
cls.add_arg("source.portgroup", "portgroup")
cls.add_arg("source.address.type", "source_address.type")
cls.add_arg("source.address.domain", "source_address.domain")
cls.add_arg("source.address.bus", "source_address.bus")
cls.add_arg("source.address.slot", "source_address.slot")
cls.add_arg("source.address.function", "source_address.function")
cls.add_arg("target.dev", "target_dev")
cls.add_arg("model.type", "model")
cls.add_arg("mac.address", "macaddr", cb=cls.set_mac_cb)

View File

@ -7,7 +7,7 @@
import os
import random
from .device import Device
from .device import Device, DeviceAddress
from ..logger import log
from ..xmlbuilder import XMLBuilder, XMLChildProperty, XMLProperty
@ -167,6 +167,10 @@ class _PortForward(XMLBuilder):
range = XMLChildProperty(_PortForwardRange)
class _DeviceInterfaceSourceAddress(DeviceAddress):
pass
class DeviceInterface(Device):
XML_NAME = "interface"
@ -284,6 +288,10 @@ class DeviceInterface(Device):
source_type = XMLProperty("./source/@type")
source_path = XMLProperty("./source/@path")
source_mode = XMLProperty("./source/@mode")
source_address = XMLChildProperty(_DeviceInterfaceSourceAddress,
is_single=True,
relative_xpath="./source")
portgroup = XMLProperty("./source/@portgroup")
model = XMLProperty("./model/@type")
target_dev = XMLProperty("./target/@dev")