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

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

 



Cole Robinson wrote:
> 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.
> 

Updated patch which unbreaks the case when no host-devices are specified.

Thanks,
Cole
# HG changeset patch
# User Cole Robinson <crobinso@xxxxxxxxxx>
# Node ID 4958acae035259fe0cc2b85d127b49cdd103686b
# Parent  17e1c491f429e984e96fb61ca6ae17be4d1e285c
virt-install: Add --host-device command.

diff -r 17e1c491f429 -r 4958acae0352 man/en/virt-install.pod
--- a/man/en/virt-install.pod	Mon Mar 02 10:40:55 2009 -0500
+++ b/man/en/virt-install.pod	Mon Mar 02 16:38:51 2009 -0500
@@ -279,6 +279,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 17e1c491f429 -r 4958acae0352 virt-install
--- a/virt-install	Mon Mar 02 10:40:55 2009 -0500
+++ b/virt-install	Mon Mar 02 16:38:51 2009 -0500
@@ -354,6 +354,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."))
@@ -604,6 +607,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 17e1c491f429 -r 4958acae0352 virtinst/cli.py
--- a/virtinst/cli.py	Mon Mar 02 10:40:55 2009 -0500
+++ b/virtinst/cli.py	Mon Mar 02 16:38:51 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,15 @@
     if sound:
         guest.sound_devs.append(VirtualAudio(model="es1370"))
 
+def get_hostdevs(hostdevs, guest):
+    if not hostdevs:
+        return
+
+    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