diff --git a/src/vz/vz_driver.c b/src/vz/vz_driver.c index 4f52bc77cae3a6845ec3ec5165966bf69937574f..74e1f5dc334d3d8f454170370004316d3b8498ef 100644 --- a/src/vz/vz_driver.c +++ b/src/vz/vz_driver.c @@ -180,6 +180,9 @@ vzDomainDefPostParse(virDomainDefPtr def ATTRIBUTE_UNUSED, if (vzCheckUnsupportedDisks(def, opaque) < 0) return -1; + if (vzCheckUnsupportedControllers(def, opaque) < 0) + return -1; + return 0; } diff --git a/src/vz/vz_utils.c b/src/vz/vz_utils.c index 601c5573ddc89c609af461e88334939ea68fad6e..cca58ec764bd45b07c300ecae42d39a309ec2819 100644 --- a/src/vz/vz_utils.c +++ b/src/vz/vz_utils.c @@ -48,6 +48,15 @@ static virDomainDiskBus vz7DiskBuses[] = {VIR_DOMAIN_DISK_BUS_IDE, VIR_DOMAIN_DISK_BUS_SCSI, VIR_DOMAIN_DISK_BUS_LAST}; +static virDomainControllerType vz6ControllerTypes[] = {VIR_DOMAIN_CONTROLLER_TYPE_SCSI, + VIR_DOMAIN_CONTROLLER_TYPE_IDE, + VIR_DOMAIN_CONTROLLER_TYPE_SATA, + VIR_DOMAIN_CONTROLLER_TYPE_LAST}; + +static virDomainControllerType vz7ControllerTypes[] = {VIR_DOMAIN_CONTROLLER_TYPE_SCSI, + VIR_DOMAIN_CONTROLLER_TYPE_IDE, + VIR_DOMAIN_CONTROLLER_TYPE_LAST}; + /** * vzDomObjFromDomain: * @domain: Domain pointer that has to be looked up @@ -199,10 +208,14 @@ vzInitCaps(unsigned long vzVersion, vzCapabilities *vzCaps) vzCaps->ctDiskFormat = VIR_STORAGE_FILE_PLOOP; vzCaps->vmDiskFormat = VIR_STORAGE_FILE_PLOOP; vzCaps->diskBuses = vz6DiskBuses; + vzCaps->controllerTypes = vz6ControllerTypes; + vzCaps->scsiControllerModel = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC; } else { vzCaps->ctDiskFormat = VIR_STORAGE_FILE_PLOOP; vzCaps->vmDiskFormat = VIR_STORAGE_FILE_QCOW2; vzCaps->diskBuses = vz7DiskBuses; + vzCaps->controllerTypes = vz7ControllerTypes; + vzCaps->scsiControllerModel = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VIRTIO_SCSI; } } @@ -427,3 +440,38 @@ vzCheckUnsupportedDisks(virDomainDefPtr def, vzCapabilitiesPtr vzCaps) } return 0; } + +int +vzCheckUnsupportedControllers(virDomainDefPtr def, vzCapabilitiesPtr vzCaps) +{ + size_t i, j; + virDomainControllerDefPtr controller; + + for (i = 0; i < def->ncontrollers; i++) { + controller = def->controllers[i]; + + for (j = 0; vzCaps->controllerTypes[j] != VIR_DOMAIN_CONTROLLER_TYPE_LAST; j++) { + if (controller->type == vzCaps->controllerTypes[j]) + break; + } + + if (vzCaps->controllerTypes[j] == VIR_DOMAIN_CONTROLLER_TYPE_LAST) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported controller type %s"), + virDomainControllerTypeToString(controller->type)); + return -1; + } + + if (controller->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI && + controller->model != -1 && + controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO && + controller->model != vzCaps->scsiControllerModel) { + + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Unsupported SCSI controller model %s"), + virDomainControllerModelSCSITypeToString(controller->model)); + return -1; + } + } + return 0; +} diff --git a/src/vz/vz_utils.h b/src/vz/vz_utils.h index 851322f748be11c6ed38db2fb6c5456672838985..88e74fc58267cf2289d36acbe7842ce53e76c172 100644 --- a/src/vz/vz_utils.h +++ b/src/vz/vz_utils.h @@ -54,6 +54,8 @@ struct _vzCapabilities { virStorageFileFormat vmDiskFormat; virStorageFileFormat ctDiskFormat; virDomainDiskBus *diskBuses; + virDomainControllerType *controllerTypes; + virDomainControllerModelSCSI scsiControllerModel; }; typedef struct _vzCapabilities vzCapabilities; typedef struct _vzCapabilities *vzCapabilitiesPtr; @@ -113,6 +115,9 @@ vzInitVersion(vzConnPtr privconn); int vzCheckUnsupportedDisks(virDomainDefPtr def, vzCapabilitiesPtr vzCaps); +int +vzCheckUnsupportedControllers(virDomainDefPtr def, + vzCapabilitiesPtr vzCaps); # define PARALLELS_BLOCK_STATS_FOREACH(OP) \ OP(rd_req, VIR_DOMAIN_BLOCK_STATS_READ_REQ, "read_requests") \