提交 97841dd9 编写于 作者: M Mikhail Feoktistov 提交者: Maxim Nestratov

vz: check supported controllers

Because Vz6 supports SCSI(BUSLOGIC), IDE and SATA controllers only and
Vz7 supports SCSI(VIRTIO_SCSI) and IDE only we add list of supported
controllers and scsi models to vzCapabilities structure.
When a new  connection opens, we select proper capabilities values according
to Virtuozzo version and check them in XMLPostParse.
Signed-off-by: NMaxim Nestratov <mnestratov@virtuozzo.com>
上级 1de787b0
......@@ -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;
}
......
......@@ -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;
}
......@@ -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") \
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册