[libvirt] [PATCH 01/10] parallels: support NULL virDomainVideoAccelDefPtr

I support if virDomainVideoAccelDefPtr is NULL it means default values for video acceleration. So we don't need to report error. --- src/parallels/parallels_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 0b05bc1..0980f50 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2029,7 +2029,7 @@ static int prlsdkCheckVideoUnsupportedParams(virDomainDefPtr def) return -1; } - if (v->accel == NULL || v->accel->support2d || v->accel->support3d) { + if (v->accel != NULL && (v->accel->support2d || v->accel->support3d)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server doesn't support " "setting video acceleration parameters.")); -- 2.1.0

It seems file format is usually specified event for real block devices. So report that file format is raw in virDomainGetXMLDesc and add checks for proper file format to prlsdkAddDisk. --- src/parallels/parallels_sdk.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 0980f50..af0dcda 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -476,6 +476,7 @@ prlsdkGetDiskInfo(PRL_HANDLE prldisk, virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_PLOOP); } else { virDomainDiskSetType(disk, VIR_STORAGE_TYPE_BLOCK); + virDomainDiskSetFormat(disk, VIR_STORAGE_FILE_RAW); } if (isCdrom) @@ -2486,13 +2487,24 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk) if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK && virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_PLOOP) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("Invalid disk format: %d"), disk->src->type); + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid format of " + "disk %s, Parallels Cloud Server supports only " + "images in ploop format."), disk->src->path); goto cleanup; } emutype = PDT_USE_IMAGE_FILE; } else { + if (disk->device == VIR_DOMAIN_DISK_DEVICE_DISK && + (virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_RAW && + virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_NONE && + virDomainDiskGetFormat(disk) != VIR_STORAGE_FILE_AUTO)) { + + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid format " + "of disk %s, it should be either not set, or set " + "to raw or auto."), disk->src->path); + goto cleanup; + } emutype = PDT_USE_REAL_DEVICE; } -- 2.1.0

For SCSI and SATA devices controller and unit are used to specify drive address. For IDE devices - bus specifies IDE bus, becase usually there are 2 IDE buses on IDE controller. Parallels SDK allows to set drive position by calling PrlVmDev_SetStackIndex. Since PCS VMs have only one controller of each type, for SATA and SCSI devices it simple means position on bus, for IDE devices - 2 * bus_number + position_on_bus. This patch fixes mapping from libvirt's disk->info.addr.drive to parallels's 'StackIndex'. --- src/parallels/parallels_sdk.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index af0dcda..83a28b7 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2467,6 +2467,8 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk) int ret = -1; PRL_VM_DEV_EMULATION_TYPE emutype; PRL_MASS_STORAGE_INTERFACE_TYPE sdkbus; + int idx; + virDomainDeviceDriveAddressPtr drive; if (prlsdkCheckDiskUnsupportedParams(disk) < 0) return -1; @@ -2517,15 +2519,27 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk) pret = PrlVmDev_SetFriendlyName(sdkdisk, disk->src->path); prlsdkCheckRetGoto(pret, cleanup); + drive = &disk->info.addr.drive; + if (drive->controller > 0) { + /* We have only one controller of each type */ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid drive " + "address of disk %s, Parallels Cloud Server has " + "only one controller."), disk->src->path); + goto cleanup; + } + switch (disk->bus) { case VIR_DOMAIN_DISK_BUS_IDE: sdkbus = PMS_IDE_DEVICE; + idx = 2 * drive->bus + drive->unit; break; case VIR_DOMAIN_DISK_BUS_SCSI: sdkbus = PMS_SCSI_DEVICE; + idx = drive->unit; break; case VIR_DOMAIN_DISK_BUS_SATA: sdkbus = PMS_SATA_DEVICE; + idx = drive->unit; break; default: virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", @@ -2537,7 +2551,7 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk) pret = PrlVmDev_SetIfaceType(sdkdisk, sdkbus); prlsdkCheckRetGoto(pret, cleanup); - pret = PrlVmDev_SetStackIndex(sdkdisk, disk->info.addr.drive.target); + pret = PrlVmDev_SetStackIndex(sdkdisk, idx); prlsdkCheckRetGoto(pret, cleanup); switch (disk->cachemode) { -- 2.1.0

--- src/parallels/parallels_sdk.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 83a28b7..fd20e1b 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -877,12 +877,14 @@ prlsdkAddVNCInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) gr->data.vnc.autoport = (vncMode == PRD_AUTO); gr->type = VIR_DOMAIN_GRAPHICS_TYPE_VNC; gr->data.vnc.port = port; - gr->data.vnc.keymap = NULL; gr->data.vnc.socket = NULL; gr->data.vnc.auth.passwd = NULL; gr->data.vnc.auth.expires = false; gr->data.vnc.auth.connected = 0; + if (VIR_STRDUP(gr->data.vnc.keymap, "en-us") < 0) + goto error; + if (VIR_ALLOC(gr->listens) < 0) goto error; @@ -1952,7 +1954,7 @@ static int prlsdkCheckGraphicsUnsupportedParams(virDomainDefPtr def) return -1; } - if (gr->data.vnc.keymap != 0) { + if (gr->data.vnc.keymap != NULL && !STREQ(gr->data.vnc.keymap, "en-us")) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server doesn't support " "keymap setting for VNC graphics.")); -- 2.1.0

--- src/parallels/parallels_sdk.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index fd20e1b..f244d75 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2088,7 +2088,8 @@ static int prlsdkCheckSerialUnsupportedParams(virDomainChrDefPtr chr) static int prlsdkCheckNetUnsupportedParams(virDomainNetDefPtr net) { - if (net->type != VIR_DOMAIN_NET_TYPE_NETWORK) { + if (net->type != VIR_DOMAIN_NET_TYPE_NETWORK && + net->type != VIR_DOMAIN_NET_TYPE_BRIDGE) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Specified network adapter type is not " "supported by Parallels Cloud Server.")); @@ -2137,13 +2138,13 @@ static int prlsdkCheckNetUnsupportedParams(virDomainNetDefPtr net) return -1; } - if (net->filter) { +/* if (net->filter) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting network filter is not " "supported by parallels driver.")); return -1; } - +*/ if (net->bandwidth) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Setting network bandwidth is not " @@ -2442,11 +2443,16 @@ static int prlsdkAddNet(PRL_HANDLE sdkdom, virDomainNetDefPtr net) pret = PrlVmDevNet_SetMacAddress(sdknet, macstr); prlsdkCheckRetGoto(pret, cleanup); - if (STREQ(net->data.network.name, PARALLELS_ROUTED_NETWORK_NAME)) { - pret = PrlVmDev_SetEmulatedType(sdknet, PNA_ROUTED); - prlsdkCheckRetGoto(pret, cleanup); - } else { - pret = PrlVmDevNet_SetVirtualNetworkId(sdknet, net->data.network.name); + if (net->type == VIR_DOMAIN_NET_TYPE_NETWORK) { + if (STREQ(net->data.network.name, PARALLELS_ROUTED_NETWORK_NAME)) { + pret = PrlVmDev_SetEmulatedType(sdknet, PNA_ROUTED); + prlsdkCheckRetGoto(pret, cleanup); + } else { + pret = PrlVmDevNet_SetVirtualNetworkId(sdknet, net->data.network.name); + prlsdkCheckRetGoto(pret, cleanup); + } + } else if (net->type == VIR_DOMAIN_NET_TYPE_BRIDGE) { + pret = PrlVmDevNet_SetVirtualNetworkId(sdknet, "__undefined__"); prlsdkCheckRetGoto(pret, cleanup); } -- 2.1.0

--- src/conf/domain_conf.c | 3 ++- src/conf/domain_conf.h | 1 + src/qemu/qemu_command.c | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ec45b8c..2f577be 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -374,7 +374,8 @@ VIR_ENUM_IMPL(virDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST, "path", "handle", "loop", - "nbd") + "nbd", + "ploop") VIR_ENUM_IMPL(virDomainFSAccessMode, VIR_DOMAIN_FS_ACCESSMODE_LAST, "passthrough", diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index e10b3c5..12e7656 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -791,6 +791,7 @@ typedef enum { VIR_DOMAIN_FS_DRIVER_TYPE_HANDLE, VIR_DOMAIN_FS_DRIVER_TYPE_LOOP, VIR_DOMAIN_FS_DRIVER_TYPE_NBD, + VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP, VIR_DOMAIN_FS_DRIVER_TYPE_LAST } virDomainFSDriverType; diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 48bdf4e..fdf51fb 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -151,6 +151,7 @@ VIR_ENUM_IMPL(qemuDomainFSDriver, VIR_DOMAIN_FS_DRIVER_TYPE_LAST, "local", "handle", NULL, + NULL, NULL); VIR_ENUM_DECL(qemuNumaPolicy) -- 2.1.0

--- src/parallels/parallels_sdk.c | 63 ++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 60 insertions(+), 3 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index f244d75..ed77238 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -535,6 +535,55 @@ prlsdkGetDiskInfo(PRL_HANDLE prldisk, } static int +prlsdkGetFSInfo(PRL_HANDLE prldisk, + virDomainFSDefPtr fs) +{ + char *buf = NULL; + PRL_UINT32 buflen = 0; + PRL_RESULT pret; + int ret = -1; + + fs->type = VIR_DOMAIN_FS_TYPE_FILE; + fs->fsdriver = VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP; + fs->accessmode = VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH; + fs->wrpolicy = VIR_DOMAIN_FS_WRPOLICY_DEFAULT; + fs->format = VIR_STORAGE_FILE_PLOOP; + + fs->readonly = false; + fs->symlinksResolved = false; + + pret = PrlVmDev_GetImagePath(prldisk, NULL, &buflen); + prlsdkCheckRetGoto(pret, cleanup); + + if (VIR_ALLOC_N(buf, buflen) < 0) + goto cleanup; + + pret = PrlVmDev_GetImagePath(prldisk, buf, &buflen); + prlsdkCheckRetGoto(pret, cleanup); + + fs->src = buf; + buf = NULL; + + pret = PrlVmDevHd_GetMountPoint(prldisk, NULL, &buflen); + prlsdkCheckRetGoto(pret, cleanup); + + if (VIR_ALLOC_N(buf, buflen) < 0) + goto cleanup; + + pret = PrlVmDevHd_GetMountPoint(prldisk, buf, &buflen); + prlsdkCheckRetGoto(pret, cleanup); + + fs->dst = buf; + buf = NULL; + + ret = 0; + + cleanup: + VIR_FREE(buf); + return ret; +} + +static int prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) { PRL_RESULT pret; @@ -542,6 +591,7 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) PRL_UINT32 i; PRL_HANDLE hdd = PRL_INVALID_HANDLE; virDomainDiskDefPtr disk = NULL; + virDomainFSDefPtr fs; pret = PrlVmCfg_GetHardDisksCount(sdkdom, &hddCount); prlsdkCheckRetGoto(pret, error); @@ -551,9 +601,15 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) prlsdkCheckRetGoto(pret, error); if (IS_CT(def)) { - /* TODO: convert info about disks in container - * to virDomainFSDef structs */ - VIR_WARN("Skipping disk information for container"); + + if (VIR_ALLOC(fs) < 0) + goto error; + + if (prlsdkGetFSInfo(hdd, fs) < 0) + goto error; + + if (virDomainFSInsert(def, fs) < 0) + goto error; PrlHandle_Free(hdd); hdd = PRL_INVALID_HANDLE; @@ -577,6 +633,7 @@ prlsdkAddDomainHardDisksInfo(PRL_HANDLE sdkdom, virDomainDefPtr def) error: PrlHandle_Free(hdd); virDomainDiskDefFree(disk); + virDomainFSDefFree(fs); return -1; } -- 2.1.0

--- src/parallels/parallels_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index ed77238..ad69346 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2728,7 +2728,7 @@ prlsdkApplyConfig(virConnectPtr conn, ret = prlsdkDoApplyConfig(sdkdom, new); if (ret == 0) { - job = PrlVm_Commit(sdkdom); + job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) ret = -1; } -- 2.1.0

--- src/parallels/parallels_sdk.c | 118 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 116 insertions(+), 2 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index ad69346..127d2bb 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -1921,8 +1921,14 @@ prlsdkCheckUnsupportedParams(PRL_HANDLE sdkdom, virDomainDefPtr def) return -1; } - if (def->nfss != 0 || - def->nsounds != 0 || def->nhostdevs != 0 || + if (!IS_CT(def) && def->nfss !=0) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Filesystems in VMs are not supported " + "by parallels driver")); + return -1; + } + + if (def->nsounds != 0 || def->nhostdevs != 0 || def->nredirdevs != 0 || def->nsmartcards != 0 || def->nparallels || def->nchannels != 0 || def->nleases != 0 || def->nhubs != 0) { @@ -2341,6 +2347,60 @@ static int prlsdkCheckDiskUnsupportedParams(virDomainDiskDefPtr disk) return 0; } +static int prlsdkCheckFSUnsupportedParams(virDomainFSDefPtr fs) +{ + if (fs->type != VIR_DOMAIN_FS_TYPE_FILE) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only file based filesystems are " + "supported by parallels driver.")); + return -1; + } + + if (fs->fsdriver != VIR_DOMAIN_FS_DRIVER_TYPE_PLOOP) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only ploop fs driver is " + "supported by parallels driver.")); + return -1; + } + + if (fs->accessmode != VIR_DOMAIN_FS_ACCESSMODE_PASSTHROUGH) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Changing fs access mode is not " + "supported by parallels driver.")); + return -1; + } + + if (fs->wrpolicy != VIR_DOMAIN_FS_WRPOLICY_DEFAULT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Changing fs write policy is not " + "supported by parallels driver.")); + return -1; + } + + if (fs->format != VIR_STORAGE_FILE_PLOOP) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Only ploop disk images are " + "supported by parallels driver.")); + return -1; + } + + if (fs->readonly) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting readonly for filesystems is " + "supported by parallels driver.")); + return -1; + } + + if (fs->space_hard_limit || fs->space_soft_limit) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Setting fs quotas is not " + "supported by parallels driver.")); + return -1; + } + + return 0; +} + static int prlsdkApplyGraphicsParams(PRL_HANDLE sdkdom, virDomainDefPtr def) { virDomainGraphicsDefPtr gr; @@ -2644,6 +2704,55 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk) } static int +prlsdkAddFS(PRL_HANDLE sdkdom, virDomainFSDefPtr fs) +{ + PRL_RESULT pret; + PRL_HANDLE sdkdisk = PRL_INVALID_HANDLE; + PRL_HANDLE job; + int ret = -1; + + if (prlsdkCheckFSUnsupportedParams(fs) < 0) + return -1; + + pret = PrlVmCfg_CreateVmDev(sdkdom, PDE_HARD_DISK, &sdkdisk); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetEnabled(sdkdisk, 1); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetConnected(sdkdisk, 1); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetEmulatedType(sdkdisk, PDT_USE_IMAGE_FILE); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetSysName(sdkdisk, fs->src); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetImagePath(sdkdisk, fs->src); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDev_SetFriendlyName(sdkdisk, fs->src); + prlsdkCheckRetGoto(pret, cleanup); + + pret = PrlVmDevHd_SetMountPoint(sdkdisk, fs->dst); + prlsdkCheckRetGoto(pret, cleanup); + + /* FIXME: this code must be removed when + * FIXME: issue PSBM-30586 + * FIXME: will be fixed. + */ + job = PrlVmDev_CreateImage(sdkdisk, PRL_FALSE, PRL_TRUE); + if (PRL_FAILED(waitJob(job, JOB_INFINIT_WAIT_TIMEOUT))) + ret = -1; + else + ret = 0; + + cleanup: + PrlHandle_Free(sdkdisk); + return ret; +} +static int prlsdkDoApplyConfig(PRL_HANDLE sdkdom, virDomainDefPtr def) { @@ -2701,6 +2810,11 @@ prlsdkDoApplyConfig(PRL_HANDLE sdkdom, goto error; } + for (i = 0; i < def->nfss; i++) { + if (prlsdkAddFS(sdkdom, def->fss[i]) < 0) + goto error; + } + return 0; error: -- 2.1.0

--- src/parallels/parallels_sdk.c | 79 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 127d2bb..05b1049 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2899,14 +2899,27 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def) PRL_HANDLE result = PRL_INVALID_HANDLE; PRL_RESULT pret; int ret = -1; + int useTemplate = 0; + unsigned int i; + char uuidstr[VIR_UUID_STRING_BUFLEN + 2]; - if (def->nfss && (def->nfss > 1 || - def->fss[0]->type != VIR_DOMAIN_FS_TYPE_TEMPLATE)) { - - virReportError(VIR_ERR_INVALID_ARG, "%s", - _("There must be no more than 1 template FS for " - "container creation")); - return -1; + if (def->nfss > 1) { + /* Check all filesystems */ + for (i = 0; i < def->nfss; i++) { + if (def->fss[i]->type != VIR_DOMAIN_FS_TYPE_FILE) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Unsupported filesystem type.")); + return -1; + } + } + } else if (def->nfss == 1) { + if (def->fss[0]->type == VIR_DOMAIN_FS_TYPE_TEMPLATE) { + useTemplate = 1; + } else if (def->fss[0]->type != VIR_DOMAIN_FS_TYPE_FILE) { + virReportError(VIR_ERR_INVALID_ARG, "%s", + _("Unsupported filesystem type.")); + return -1; + } } confParam.nVmType = PVT_CT; @@ -2920,9 +2933,55 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def) pret = PrlResult_GetParamByIndex(result, 0, &sdkdom); prlsdkCheckRetGoto(pret, cleanup); - if (def->nfss == 1) { + /* + * FIXME: This code must be replaced with the + * FIXME: commented code below after fixing + * FIXME: issue PSBM-30586. + */ + if (useTemplate) { pret = PrlVmCfg_SetOsTemplate(sdkdom, def->fss[0]->src); prlsdkCheckRetGoto(pret, cleanup); + + ret = prlsdkDoApplyConfig(sdkdom, def); + if (ret) + goto cleanup; + + job = PrlVm_RegEx(sdkdom, "", PACF_NON_INTERACTIVE_MODE); + if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) + ret = -1; + } else { + if (prlsdkClearDevices(sdkdom) < 0) + goto cleanup; + + prlsdkUUIDFormat(def->uuid, uuidstr); + + pret = PrlVmCfg_SetUuid(sdkdom, uuidstr); + prlsdkCheckRetGoto(pret, cleanup); + + job = PrlVm_RegEx(sdkdom, "", PACF_NON_INTERACTIVE_MODE); + if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) + goto cleanup; + + job = PrlVm_BeginEdit(sdkdom); + if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) + goto cleanup; + + ret = prlsdkDoApplyConfig(sdkdom, def); + if (ret) + goto cleanup; + + job = PrlVm_CommitEx(sdkdom, PVCF_DETACH_HDD_BUNDLE); + if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) + ret = -1; + + ret = 0; + } + +/* + if (useTemplate) { + pret = PrlVmCfg_SetOsTemplate(sdkdom, def->fss[0]->src); + prlsdkCheckRetGoto(pret, cleanup); + } ret = prlsdkDoApplyConfig(sdkdom, def); @@ -2933,9 +2992,11 @@ prlsdkCreateCt(virConnectPtr conn, virDomainDefPtr def) if (PRL_FAILED(waitJob(job, privconn->jobTimeout))) ret = -1; +*/ + cleanup: PrlHandle_Free(sdkdom); - return -1; + return ret; } int -- 2.1.0

On Thursday 11 December 2014 22:07:08 Dmitry Guryanov wrote: Sorry. I've sent too many patches. Patches 4-10 should be reworked. Please, check only first 3 patches.
I support if virDomainVideoAccelDefPtr is NULL it means default values for video acceleration. So we don't need to report error. --- src/parallels/parallels_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 0b05bc1..0980f50 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2029,7 +2029,7 @@ static int prlsdkCheckVideoUnsupportedParams(virDomainDefPtr def) return -1; }
- if (v->accel == NULL || v->accel->support2d || v->accel->support3d) { + if (v->accel != NULL && (v->accel->support2d || v->accel->support3d)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server doesn't support " "setting video acceleration parameters."));
-- Dmitry Guryanov

On Thursday 11 December 2014 22:07:08 Dmitry Guryanov wrote: Please, ignore this series, I've resent needed patches :)
I support if virDomainVideoAccelDefPtr is NULL it means default values for video acceleration. So we don't need to report error. --- src/parallels/parallels_sdk.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 0b05bc1..0980f50 100644 --- a/src/parallels/parallels_sdk.c +++ b/src/parallels/parallels_sdk.c @@ -2029,7 +2029,7 @@ static int prlsdkCheckVideoUnsupportedParams(virDomainDefPtr def) return -1; }
- if (v->accel == NULL || v->accel->support2d || v->accel->support3d) { + if (v->accel != NULL && (v->accel->support2d || v->accel->support3d)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", _("Parallels Cloud Server doesn't support " "setting video acceleration parameters."));
-- Dmitry Guryanov
participants (1)
-
Dmitry Guryanov