On 04/23/2015 09:37 PM, Maxim Nestratov wrote:
Signed-off-by: Maxim Nestratov <mnestratov@xxxxxxxxxxxxx>
---
src/parallels/parallels_sdk.c | 65 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 65 insertions(+), 0 deletions(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c
index d54f894..5e6e21c 100644
--- a/src/parallels/parallels_sdk.c
+++ b/src/parallels/parallels_sdk.c
@@ -2844,6 +2844,25 @@ static void prlsdkDelNet(parallelsConnPtr privconn, virDomainNetDefPtr net)
PrlHandle_Free(vnet);
}
+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(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk, bool bootDisk)
{
PRL_RESULT pret;
@@ -3042,6 +3061,52 @@ prlsdkAttachVolume(virConnectPtr conn,
}
static int
+prlsdkGetDiskIndex(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk)
+{
+ int idx = -1;
+ char *buf = NULL;
+ PRL_UINT32 buflen = 0;
+ PRL_RESULT pret;
+ PRL_UINT32 hddCount;
+ PRL_UINT32 i;
+ PRL_HANDLE hdd = PRL_INVALID_HANDLE;
+
+ pret = PrlVmCfg_GetHardDisksCount(sdkdom, &hddCount);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ for (i = 0; i < hddCount; ++i) {
+
+ pret = PrlVmCfg_GetHardDisk(sdkdom, i, &hdd);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ pret = PrlVmDev_GetFriendlyName(hdd, 0, &buflen);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ if (VIR_ALLOC_N(buf, buflen) < 0)
+ goto cleanup;
+
+ pret = PrlVmDev_GetFriendlyName(hdd, buf, &buflen);
+ prlsdkCheckRetGoto(pret, cleanup);
+
+ if (STRNEQ(disk->src->path, buf)) {
+
+ PrlHandle_Free(hdd);
+ hdd = PRL_INVALID_HANDLE;
+ VIR_FREE(buf);
+ continue;
+ }
+
+ VIR_FREE(buf);
+ idx = i;
+ break;
+ }
+
+ cleanup:
+ PrlHandle_Free(hdd);
+ return idx;
+}
+
+static int
prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs)
{
PRL_RESULT pret;
Looks good to me, ACKed and pushed, thanks!
--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list