[PATCH 4/4] vz: cleanup: remove trivial function

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

 



---
 src/vz/vz_sdk.c | 37 +++++++++++++------------------------
 1 file changed, 13 insertions(+), 24 deletions(-)

diff --git a/src/vz/vz_sdk.c b/src/vz/vz_sdk.c
index 1950d53..a271ae6 100644
--- a/src/vz/vz_sdk.c
+++ b/src/vz/vz_sdk.c
@@ -3212,25 +3212,6 @@ int prlsdkDetachNet(vzConnPtr privconn,
     return ret;
 }
 
-static int prlsdkDelDisk(PRL_HANDLE sdkdom, int idx)
-{
-    int ret = -1;
-    PRL_RESULT pret;
-    PRL_HANDLE sdkdisk = PRL_INVALID_HANDLE;
-
-    pret = PrlVmCfg_GetHardDisk(sdkdom, idx, &sdkdisk);
-    prlsdkCheckRetGoto(pret, cleanup);
-
-    pret = PrlVmDev_Remove(sdkdisk);
-    prlsdkCheckRetGoto(pret, cleanup);
-
-    ret = 0;
-
- cleanup:
-    PrlHandle_Free(sdkdisk);
-    return ret;
-}
-
 static int prlsdkAddDisk(vzConnPtr privconn,
                          PRL_HANDLE sdkdom,
                          virDomainDiskDefPtr disk)
@@ -3855,6 +3836,7 @@ prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom)
     PRL_UINT32 hddCount;
     PRL_UINT32 i;
     PRL_HANDLE job;
+    PRL_HANDLE sdkdisk = PRL_INVALID_HANDLE;
 
     job = PrlVm_BeginEdit(sdkdom);
     if (PRL_FAILED(waitJob(job)))
@@ -3864,17 +3846,24 @@ prlsdkDetachDomainHardDisks(PRL_HANDLE sdkdom)
     prlsdkCheckRetGoto(pret, cleanup);
 
     for (i = 0; i < hddCount; ++i) {
-        ret = prlsdkDelDisk(sdkdom, i);
-        if (ret)
-            goto cleanup;
+        pret = PrlVmCfg_GetHardDisk(sdkdom, i, &sdkdisk);
+        prlsdkCheckRetGoto(pret, cleanup);
+
+        pret = PrlVmDev_Remove(sdkdisk);
+        prlsdkCheckRetGoto(pret, cleanup);
+
+        PrlHandle_Free(sdkdisk);
+        sdkdisk = PRL_INVALID_HANDLE;
     }
 
     job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE);
     if (PRL_FAILED(waitJob(job)))
-        ret = -1;
+        goto cleanup;
 
- cleanup:
+    ret = 0;
 
+ cleanup:
+    PrlHandle_Free(sdkdisk);
     return ret;
 }
 
-- 
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]