]> xenbits.xensource.com Git - libvirt.git/commitdiff
vz: handle sourceless cdroms
authorMikhail Feoktistov <mfeoktistov@virtuozzo.com>
Fri, 8 Apr 2016 07:41:33 +0000 (10:41 +0300)
committerMaxim Nestratov <mnestratov@virtuozzo.com>
Tue, 17 May 2016 10:35:28 +0000 (13:35 +0300)
SDK handles empty cdroms all right. We just need to
pass "" instead of NULL (not setting is good too).

However we can get problems here. Disk detaching treats source
as ids. Fortunately disk detaching is not supported for cdroms
yet and for hard disks we can not get empty source - this is prohibitited
by xml parsing code.

Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Signed-off-by: Maxim Nestratov <mnestratov@virtuozzo.com>
src/vz/vz_sdk.c

index b321d39df0a29678cb02c0837df4ad1a8ecd050c..e373748efe4b23f84bc89dee2c7cadadabb31969 100644 (file)
@@ -3216,11 +3216,13 @@ static int prlsdkAddDisk(vzDriverPtr driver,
     pret = PrlVmDev_SetEmulatedType(sdkdisk, emutype);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetSysName(sdkdisk, path);
-    prlsdkCheckRetGoto(pret, cleanup);
+    if (disk->src->path) {
+        pret = PrlVmDev_SetSysName(sdkdisk, path);
+        prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetFriendlyName(sdkdisk, path);
-    prlsdkCheckRetGoto(pret, cleanup);
+        pret = PrlVmDev_SetFriendlyName(sdkdisk, path);
+        prlsdkCheckRetGoto(pret, cleanup);
+    }
 
     drive = &disk->info.addr.drive;
     if (drive->controller > 0) {