[PATCH 3/3]: Add virt-install --host-device command

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add a --host-device command to virt-install. It takes a libvirt nodedev
name as it's only argument, and attaches the associated device to the
new VM.

Thanks,
Cole
# HG changeset patch
# User Cole Robinson <crobinso@xxxxxxxxxx>
# Node ID d1a254a2477e4577e6f26fe38c90e78315bec73e
# Parent  624895ec659067a0204eef702150839fa77ad01e
virt-install: Add --host-device command.

diff -r 624895ec6590 -r d1a254a2477e man/en/virt-install.pod
--- a/man/en/virt-install.pod	Sun Mar 01 21:42:13 2009 -0500
+++ b/man/en/virt-install.pod	Sun Mar 01 21:42:32 2009 -0500
@@ -272,6 +272,11 @@
 Request that the virtual console be configured to run with a non-English
 keyboard layout.
 
+=item --host-device=HOSTDEV
+
+Attach a physical host device to the guest. HOSTDEV is a node device name
+as used by libvirt (as shown by 'virsh nodedev-list').
+
 =item  --accelerate
 
 When installing a QEMU guest, make use of the KVM or KQEMU kernel acceleration
diff -r 624895ec6590 -r d1a254a2477e virt-install
--- a/virt-install	Sun Mar 01 21:42:13 2009 -0500
+++ b/virt-install	Sun Mar 01 21:42:32 2009 -0500
@@ -350,6 +350,9 @@
     geng.add_option("", "--cpuset", type="string", dest="cpuset",
                     action="callback", callback=cli.check_before_store,
                     help=_("Set which physical CPUs Domain can use."))
+    geng.add_option("", "--host-device", type="string", dest="hostdevs",
+                    action="callback", callback=cli.check_before_append,
+                    help=_("Physical host device to attach to the domain."))
     parser.add_option_group(geng)
 
     fulg = OptionGroup(parser, _("Full Virtualization specific options."))
@@ -600,6 +603,9 @@
     cli.get_graphics(options.vnc, options.vncport, options.nographics,
                      options.sdl, options.keymap, guest)
 
+    # Set host device info
+    cli.get_hostdevs(options.hostdevs, guest)
+
     get_extraargs(options.extra, guest)
 
     # and now for the full-virt vs paravirt specific questions
diff -r 624895ec6590 -r d1a254a2477e virtinst/cli.py
--- a/virtinst/cli.py	Sun Mar 01 21:42:13 2009 -0500
+++ b/virtinst/cli.py	Sun Mar 01 21:42:32 2009 -0500
@@ -27,6 +27,7 @@
 
 import libvirt
 import _util
+import virtinst
 from virtinst import CapabilitiesParser, VirtualNetworkInterface, \
                      VirtualGraphics, VirtualAudio, User
 from virtinst import _virtinst as _
@@ -360,6 +361,13 @@
     if sound:
         guest.sound_devs.append(VirtualAudio(model="es1370"))
 
+def get_hostdevs(hostdevs, guest):
+
+    for devname in hostdevs:
+        dev = virtinst.VirtualHostDevice.device_from_node(conn=guest.conn,
+                                                          name=devname)
+        guest.hostdevs.append(dev)
+
 ### Option parsing
 def check_before_store(option, opt_str, value, parser):
     if len(value) == 0:
_______________________________________________
et-mgmt-tools mailing list
et-mgmt-tools@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/et-mgmt-tools

[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux