[RFC PATCH v2 REBASE 09/18] conf: Enable cold-plug of a mediated device

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

 



This merely introduces virDomainHostdevMatchSubsysMediatedDev method that
is supposed to check whether device being cold-plugged does not already
exist in the domain configuration.

Signed-off-by: Erik Skultety <eskultet@xxxxxxxxxx>
---
 src/conf/domain_conf.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 1fdab6a..3df7576 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -14273,6 +14273,19 @@ virDomainHostdevMatchSubsysSCSIiSCSI(virDomainHostdevDefPtr first,
 }
 
 static int
+virDomainHostdevMatchSubsysMediatedDev(virDomainHostdevDefPtr a,
+                                       virDomainHostdevDefPtr b)
+{
+    virDomainHostdevSubsysMediatedDevPtr src_a = &a->source.subsys.u.mdev;
+    virDomainHostdevSubsysMediatedDevPtr src_b = &b->source.subsys.u.mdev;
+
+    if (STREQ(src_a->uuidstr, src_b->uuidstr))
+        return 1;
+
+    return 0;
+}
+
+static int
 virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
                             virDomainHostdevDefPtr b)
 {
@@ -14303,6 +14316,7 @@ virDomainHostdevMatchSubsys(virDomainHostdevDefPtr a,
         else
             return 0;
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_MDEV:
+        return virDomainHostdevMatchSubsysMediatedDev(a, b);
     case VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_LAST:
         return 0;
     }
-- 
2.10.2

--
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]
  Powered by Linux