[PATCH 3/6] vz: handle sourceless cdroms

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

 



From: Mikhail Feoktistov <mfeoktistov@xxxxxxxxxxxxx>

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@xxxxxxxxxxxxx>
---
 src/vz/vz_sdk.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 8691887..7fa9959 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -506,7 +506,7 @@ prlsdkGetDiskInfo(vzConnPtr privconn,
     pret = PrlVmDev_GetFriendlyName(prldisk, buf, &buflen);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    if (virDomainDiskSetSource(disk, buf) < 0)
+    if (strlen(buf) != 0 && virDomainDiskSetSource(disk, buf) < 0)
         goto cleanup;
 
     /* Let physical devices added to CT look like SATA disks */
@@ -3029,11 +3029,13 @@ static int prlsdkAddDisk(vzConnPtr privconn,
     pret = PrlVmDev_SetEmulatedType(sdkdisk, emutype);
     prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetSysName(sdkdisk, disk->src->path);
-    prlsdkCheckRetGoto(pret, cleanup);
+    if (disk->src->path) {
+        pret = PrlVmDev_SetSysName(sdkdisk, disk->src->path);
+        prlsdkCheckRetGoto(pret, cleanup);
 
-    pret = PrlVmDev_SetFriendlyName(sdkdisk, disk->src->path);
-    prlsdkCheckRetGoto(pret, cleanup);
+        pret = PrlVmDev_SetFriendlyName(sdkdisk, disk->src->path);
+        prlsdkCheckRetGoto(pret, cleanup);
+    }
 
     drive = &disk->info.addr.drive;
     if (drive->controller > 0) {
-- 
1.8.3.1

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