[PATCH 06/15] Forward Mode 'Hostdev' qemu driver implementation

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

 



Signed-off-by: Shradha Shah <sshah@xxxxxxxxxxxxxx>
---
 src/qemu/qemu_command.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index 6f6c6cd..bb66364 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -24,6 +24,7 @@
 #include <config.h>
 
 #include "qemu_command.h"
+#include "qemu_hostdev.h"
 #include "qemu_capabilities.h"
 #include "qemu_bridge_filter.h"
 #include "cpu/cpu.h"
@@ -5221,12 +5222,38 @@ qemuBuildCommandLine(virConnectPtr conn,
 
             actualType = virDomainNetGetActualType(net);
             if (actualType == VIR_DOMAIN_NET_TYPE_HOSTDEV) {
+                virDomainHostdevDefPtr hostdev = virDomainNetGetActualHostdev(net);
+                virDomainHostdevDefPtr found;
                 /* type='hostdev' interfaces are handled in codepath
                  * for standard hostdev (NB: when there is a network
                  * with <forward mode='hostdev', there will need to be
                  * code here that adds the newly minted hostdev to the
                  * hostdevs array).
                  */
+                if (qemuAssignDeviceHostdevAlias(def,
+                                                 hostdev,
+                                                 (def->nhostdevs-1)) < 0) {
+                    virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                    _("Could not assign alias to Net Hostdev"));
+                    goto error;
+                }
+                
+                if (virDomainHostdevFind(def,
+                                         hostdev,
+                                         &found) < 0) {
+                    if (virDomainHostdevInsert(def, 
+                                               hostdev) < 0) {
+                        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                        _("Hostdev not inserted into the array"));
+                        goto error;
+                    }
+                    if (qemuPrepareHostdevPCIDevices(driver, def->name, def->uuid, 
+                                                     &hostdev, 1) < 0) {
+                        virReportError(VIR_ERR_INTERNAL_ERROR, "%s",
+                                        _("Prepare Hostdev PCI Devices failed"));
+                        goto error;
+                    } 
+                }
                 continue;
             }
 
-- 
1.7.4.4


--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]