[libvirt] [PATCH v3 0/3] parallels: a set of fixes for nova

Hello, This 3 patches fix different things, used by nova. Dmitry Guryanov (3): parallels: support NULL virDomainVideoAccelDefPtr parallels: set format for real disk devices parallels: fix usage of disk->info.addr.drive structure src/parallels/parallels_sdk.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) -- 2.1.0

NULL value of virDomainVideoAccelDefPtr means default values for video acceleration, so don't report error in this case. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- 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. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- Changes in v3: * fixed indentation * fixed error messages 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'. Signed-off-by: Dmitry Guryanov <dguryanov@parallels.com> --- Changes in v3: * This is a new patch, because previous one was wrong. 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

On 15.12.2014 13:47, Dmitry Guryanov wrote:
Hello,
This 3 patches fix different things, used by nova.
Dmitry Guryanov (3): parallels: support NULL virDomainVideoAccelDefPtr parallels: set format for real disk devices parallels: fix usage of disk->info.addr.drive structure
src/parallels/parallels_sdk.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
ACKed and pushed. Michal

On Monday 15 December 2014 17:53:09 Michal Privoznik wrote:
On 15.12.2014 13:47, Dmitry Guryanov wrote:
Hello,
This 3 patches fix different things, used by nova.
Dmitry Guryanov (3): parallels: support NULL virDomainVideoAccelDefPtr parallels: set format for real disk devices parallels: fix usage of disk->info.addr.drive structure
src/parallels/parallels_sdk.c | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-)
ACKed and pushed.
Thanks!
Michal
-- Dmitry Guryanov
participants (2)
-
Dmitry Guryanov
-
Michal Privoznik