Looks ok to me

Best,
Maxim Nestratov

От: Dmitry Guryanov
Отправлено: ‎10.‎12.‎2014 17:30
Кому: libvir-list@redhat.com
Копия: Alexander Burluka; Maxim Nestratov; Dmitry Guryanov
Тема: [PATCH 3/3] parallels: use disk name to set disk index

Use guest disk name to determine disk position on
bus, because Openstack/nova don't set virDomainDeviceInfo.

Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com>
---
 src/parallels/parallels_sdk.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index e2a1e6c..c85e6d9 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2467,6 +2467,7 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk)
     int ret = -1;
     PRL_VM_DEV_EMULATION_TYPE emutype;
     PRL_MASS_STORAGE_INTERFACE_TYPE sdkbus;
+    int idx;
 
     if (prlsdkCheckDiskUnsupportedParams(disk) < 0)
         return -1;
@@ -2535,7 +2536,14 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk)
     pret = PrlVmDev_SetIfaceType(sdkdisk, sdkbus);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetStackIndex(sdkdisk, disk->info.addr.drive.target);
+    idx = virDiskNameToIndex(disk->dst);
+    if (idx < 0) {
+        virReportError(VIR_ERR_INTERNAL_ERROR,
+                       _("unsupported disk type '%s'"), disk->dst);
+        goto cleanup;
+    }
+
+    pret = PrlVmDev_SetStackIndex(sdkdisk, idx);
     prlsdkCheckRetGoto(pret, cleanup);
 
     switch (disk->cachemode) {
--
1.9.3