[PATCH] vz: getting bus type for containers

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

 



We should query bus type for containers too, like for VM.
In openstack we add volume disk like SCSI, so we can't
hardcode SATA bus.
---
 src/vz/vz_sdk.c | 32 +++++++++++++-------------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index f81b320..c4a1c3d 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -47,7 +47,7 @@ VIR_LOG_INIT("parallels.sdk");
 static PRL_HANDLE
 prlsdkFindNetByMAC(PRL_HANDLE sdkdom, virMacAddrPtr mac);
 static PRL_HANDLE
-prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool isCt);
+prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk);
 
 /*
  * Log error description
@@ -547,7 +547,7 @@ prlsdkAddDomainVideoInfoVm(PRL_HANDLE sdkdom, virDomainDefPtr def)
 }
 
 static int
-prlsdkGetDiskId(PRL_HANDLE disk, bool isCt, int *bus, char **dst)
+prlsdkGetDiskId(PRL_HANDLE disk, int *bus, char **dst)
 {
     PRL_RESULT pret;
     PRL_UINT32 pos, ifType;
@@ -555,13 +555,8 @@ prlsdkGetDiskId(PRL_HANDLE disk, bool isCt, int *bus, char **dst)
     pret = PrlVmDev_GetStackIndex(disk, &pos);
     prlsdkCheckRetExit(pret, -1);
 
-    /* Let physical devices added to CT look like SATA disks */
-    if (isCt) {
-        ifType = PMS_SATA_DEVICE;
-    } else {
-        pret = PrlVmDev_GetIfaceType(disk, &ifType);
-        prlsdkCheckRetExit(pret, -1);
-    }
+    pret = PrlVmDev_GetIfaceType(disk, &ifType);
+    prlsdkCheckRetExit(pret, -1);
 
     switch (ifType) {
     case PMS_IDE_DEVICE:
@@ -632,7 +627,7 @@ prlsdkGetDiskInfo(vzDriverPtr driver,
     if (*buf != '\0' && virDomainDiskSetSource(disk, buf) < 0)
         goto cleanup;
 
-    if (prlsdkGetDiskId(prldisk, isCt, &disk->bus, &disk->dst) < 0)
+    if (prlsdkGetDiskId(prldisk, &disk->bus, &disk->dst) < 0)
         goto cleanup;
 
     if (virDiskNameToBusDeviceIndex(disk, &busIdx, &devIdx) < 0)
@@ -1598,7 +1593,7 @@ prlsdkBootOrderCheck(PRL_HANDLE sdkdom, PRL_DEVICE_TYPE sdkType, int sdkIndex,
             goto cleanup;
         }
 
-        if (prlsdkGetDiskId(dev, false, &bus, &dst) < 0)
+        if (prlsdkGetDiskId(dev, &bus, &dst) < 0)
             goto cleanup;
 
         if (!(bus == disk->bus && STREQ(disk->dst, dst)))
@@ -3409,7 +3404,6 @@ prlsdkFindNetByMAC(PRL_HANDLE sdkdom, virMacAddrPtr mac)
 static int prlsdkConfigureDisk(vzDriverPtr driver,
                                PRL_HANDLE sdkdom,
                                virDomainDiskDefPtr disk,
-                               bool isCt,
                                bool create)
 {
     PRL_RESULT pret;
@@ -3432,7 +3426,7 @@ static int prlsdkConfigureDisk(vzDriverPtr driver,
         pret = PrlVmCfg_CreateVmDev(sdkdom, devType, &sdkdisk);
         prlsdkCheckRetGoto(pret, cleanup);
     } else {
-        sdkdisk = prlsdkGetDisk(sdkdom, disk, isCt);
+        sdkdisk = prlsdkGetDisk(sdkdom, disk);
         if (sdkdisk == PRL_INVALID_HANDLE)
             return -1;
     }
@@ -3499,7 +3493,7 @@ static int prlsdkConfigureDisk(vzDriverPtr driver,
 }
 
 static PRL_HANDLE
-prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool isCt)
+prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk)
 {
     PRL_RESULT pret;
     PRL_UINT32 num;
@@ -3521,7 +3515,7 @@ prlsdkGetDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool isCt)
         pret = PrlVmCfg_GetDevByType(sdkdom, devType, i, &sdkdisk);
         prlsdkCheckRetGoto(pret, error);
 
-        if (prlsdkGetDiskId(sdkdisk, isCt, &bus, &dst) < 0)
+        if (prlsdkGetDiskId(sdkdisk, &bus, &dst) < 0)
             goto error;
 
         if (disk->bus == bus && STREQ(disk->dst, dst)) {
@@ -3560,7 +3554,7 @@ prlsdkAttachDevice(vzDriverPtr driver,
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_DISK:
         if (prlsdkConfigureDisk(driver, privdom->sdkdom,
-                                dev->data.disk, IS_CT(dom->def), true) < 0)
+                                dev->data.disk, true) < 0)
             return -1;
 
         break;
@@ -3618,7 +3612,7 @@ prlsdkDetachDevice(vzDriverPtr driver,
 
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_DISK:
-        sdkdev = prlsdkGetDisk(privdom->sdkdom, dev->data.disk, IS_CT(dom->def));
+        sdkdev = prlsdkGetDisk(privdom->sdkdom, dev->data.disk);
         if (sdkdev == PRL_INVALID_HANDLE)
             goto cleanup;
 
@@ -3688,7 +3682,7 @@ prlsdkUpdateDevice(vzDriverPtr driver,
     switch (dev->type) {
     case VIR_DOMAIN_DEVICE_DISK:
         if (prlsdkConfigureDisk(driver, privdom->sdkdom, dev->data.disk,
-                                IS_CT(dom->def), false) < 0)
+                                false) < 0)
             return -1;
 
         break;
@@ -3981,7 +3975,7 @@ prlsdkDoApplyConfig(vzDriverPtr driver,
 
     for (i = 0; i < def->ndisks; i++) {
         if (prlsdkConfigureDisk(driver, sdkdom, def->disks[i],
-                                IS_CT(def), true) < 0)
+                                true) < 0)
             goto error;
     }
 
-- 
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]