[PATCH 3/7] conf: Add helper function to look up disk controller model

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

 



---
 src/conf/domain_conf.c   |   17 +++++++++++++++++
 src/conf/domain_conf.h   |    3 +++
 src/libvirt_private.syms |    1 +
 3 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 93501cf..2b68841 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -2503,6 +2503,23 @@ virDomainParseLegacyDeviceAddress(char *devaddr,
 }
 
 int
+virDomainDiskFindControllerModel(virDomainDefPtr def,
+                                 virDomainDiskDefPtr disk,
+                                 int controllerType)
+{
+    int model = -1;
+    int i;
+
+    for (i = 0; i < def->ncontrollers; i++) {
+        if (def->controllers[i]->type == controllerType &&
+            def->controllers[i]->idx == disk->info.addr.drive.controller)
+            model = def->controllers[i]->model;
+    }
+
+    return model;
+}
+
+int
 virDomainDiskDefAssignAddress(virCapsPtr caps, virDomainDiskDefPtr def)
 {
     int idx = virDiskNameToIndex(def->dst);
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 777bccb..fed7cc3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -1729,6 +1729,9 @@ void virDomainGraphicsDefFree(virDomainGraphicsDefPtr def);
 void virDomainInputDefFree(virDomainInputDefPtr def);
 void virDomainDiskDefFree(virDomainDiskDefPtr def);
 void virDomainDiskHostDefFree(virDomainDiskHostDefPtr def);
+int virDomainDiskFindControllerModel(virDomainDefPtr def,
+                                     virDomainDiskDefPtr disk,
+                                     int controllerType);
 void virDomainControllerDefFree(virDomainControllerDefPtr def);
 void virDomainFSDefFree(virDomainFSDefPtr def);
 void virDomainActualNetDefFree(virDomainActualNetDefPtr def);
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 310cd7d..1ecb533 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -302,6 +302,7 @@ virDomainDiskDefFree;
 virDomainDiskDeviceTypeToString;
 virDomainDiskErrorPolicyTypeFromString;
 virDomainDiskErrorPolicyTypeToString;
+virDomainDiskFindControllerModel;
 virDomainDiskIndexByName;
 virDomainDiskInsert;
 virDomainDiskInsertPreAlloced;
-- 
1.7.7.3

--
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]