Skip to content
This repository was archived by the owner on Jan 22, 2026. It is now read-only.

Commit 7420f0c

Browse files
committed
virt-install: Add --host-device command.
1 parent 1b38b7e commit 7420f0c

3 files changed

Lines changed: 18 additions & 0 deletions

File tree

man/en/virt-install.pod.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,11 @@ require an C<--os-type> to be specified. Valid values are:
134134

135135
::VARIANT VALUES::
136136

137+
=item --host-device=HOSTDEV
138+
139+
Attach a physical host device to the guest. HOSTDEV is a node device name
140+
as used by libvirt (as shown by 'virsh nodedev-list').
141+
137142
=back
138143

139144
=head2 Full Virtualization specific options

virt-install

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,9 @@ def main():
604604
cli.get_graphics(options.vnc, options.vncport, options.nographics,
605605
options.sdl, options.keymap, guest)
606606

607+
# Set host device info
608+
cli.get_hostdevs(options.hostdevs, guest)
609+
607610
get_extraargs(options.extra, guest)
608611
if options.distro_type:
609612
guest.set_os_type(options.distro_type)

virtinst/cli.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727

2828
import libvirt
2929
import _util
30+
import virtinst
3031
from virtinst import CapabilitiesParser, VirtualNetworkInterface, \
3132
VirtualGraphics, VirtualAudio, User
3233
from virtinst import _virtinst as _
@@ -360,6 +361,15 @@ def get_sound(sound, guest):
360361
if sound:
361362
guest.sound_devs.append(VirtualAudio(model="es1370"))
362363

364+
def get_hostdevs(hostdevs, guest):
365+
if not hostdevs:
366+
return
367+
368+
for devname in hostdevs:
369+
dev = virtinst.VirtualHostDevice.device_from_node(conn=guest.conn,
370+
name=devname)
371+
guest.hostdevs.append(dev)
372+
363373
### Option parsing
364374
def check_before_store(option, opt_str, value, parser):
365375
if len(value) == 0:

0 commit comments

Comments
 (0)