
On 12/10/14 14:30, Dmitry Guryanov wrote:
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> --- src/parallels/parallels_sdk.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/src/parallels/parallels_sdk.c b/src/parallels/parallels_sdk.c index 0980f50..e2a1e6c 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) @@ -2493,6 +2494,15 @@ static int prlsdkAddDisk(PRL_HANDLE sdkdom, virDomainDiskDefPtr disk)
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)) {
Incorrect indentation.
+ + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Invalid disk format: %d"), disk->src->type);
This error message looks misleading. How about "Invalid format of disk '%s'" disk->src->path ? Also the same error message is a few lines above so it's probably worth a separate cleanup.
+ goto cleanup; + } emutype = PDT_USE_REAL_DEVICE; }
I'll fix the indentation before pushing. Peter