提交 8631bdc0 编写于 作者: M Marc-André Lureau 提交者: Daniel Veillard

Rename virDomainControllerModel to virDomainControllerModelSCSI

Since we are about to add USB controller support let's remove the
ambiguity
上级 329f907b
......@@ -196,7 +196,7 @@ VIR_ENUM_IMPL(virDomainController, VIR_DOMAIN_CONTROLLER_TYPE_LAST,
"virtio-serial",
"ccid")
VIR_ENUM_IMPL(virDomainControllerModel, VIR_DOMAIN_CONTROLLER_MODEL_LAST,
VIR_ENUM_IMPL(virDomainControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto",
"buslogic",
"lsilogic",
......@@ -2456,6 +2456,16 @@ no_memory:
}
static int
virDomainControllerModelTypeFromString(const virDomainControllerDefPtr def,
const char *model)
{
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
return virDomainControllerModelSCSITypeFromString(model);
return -1;
}
/* Parse the XML definition for a controller
* @param node XML nodeset to parse for controller definition
*/
......@@ -2493,7 +2503,7 @@ virDomainControllerDefParseXML(xmlNodePtr node,
model = virXMLPropString(node, "model");
if (model) {
if ((def->model = virDomainControllerModelTypeFromString(model)) < 0) {
if ((def->model = virDomainControllerModelTypeFromString(def, model)) < 0) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown model type '%s'"), model);
goto error;
......@@ -8729,6 +8739,16 @@ virDomainDiskDefFormat(virBufferPtr buf,
return 0;
}
static const char *
virDomainControllerModelTypeToString(virDomainControllerDefPtr def,
int model)
{
if (def->type == VIR_DOMAIN_CONTROLLER_TYPE_SCSI)
return virDomainControllerModelSCSITypeToString(model);
return NULL;
}
static int
virDomainControllerDefFormat(virBufferPtr buf,
virDomainControllerDefPtr def,
......@@ -8744,7 +8764,7 @@ virDomainControllerDefFormat(virBufferPtr buf,
}
if (def->model != -1) {
model = virDomainControllerModelTypeToString(def->model);
model = virDomainControllerModelTypeToString(def, def->model);
if (!model) {
virDomainReportError(VIR_ERR_INTERNAL_ERROR,
......
......@@ -258,14 +258,14 @@ enum virDomainControllerType {
};
enum virDomainControllerModel {
VIR_DOMAIN_CONTROLLER_MODEL_AUTO,
VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068,
VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI,
enum virDomainControllerModelSCSI {
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068,
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI,
VIR_DOMAIN_CONTROLLER_MODEL_LAST
VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST
};
typedef struct _virDomainVirtioSerialOpts virDomainVirtioSerialOpts;
......@@ -1676,7 +1676,7 @@ VIR_ENUM_DECL(virDomainDiskIo)
VIR_ENUM_DECL(virDomainIoEventFd)
VIR_ENUM_DECL(virDomainVirtioEventIdx)
VIR_ENUM_DECL(virDomainController)
VIR_ENUM_DECL(virDomainControllerModel)
VIR_ENUM_DECL(virDomainControllerModelSCSI)
VIR_ENUM_DECL(virDomainFS)
VIR_ENUM_DECL(virDomainFSAccessMode)
VIR_ENUM_DECL(virDomainNet)
......
......@@ -412,16 +412,16 @@ esxAutodetectSCSIControllerModel(virDomainDiskDefPtr def, int *model,
if (STRCASEEQ(vmDiskFileInfo->controllerType,
"VirtualBusLogicController")) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC;
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC;
} else if (STRCASEEQ(vmDiskFileInfo->controllerType,
"VirtualLsiLogicController")) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC;
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
} else if (STRCASEEQ(vmDiskFileInfo->controllerType,
"VirtualLsiLogicSASController")) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068;
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068;
} else if (STRCASEEQ(vmDiskFileInfo->controllerType,
"ParaVirtualSCSIController")) {
*model = VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI;
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI;
} else {
ESX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Found unexpected controller model '%s' for disk '%s'"),
......
......@@ -248,8 +248,8 @@ virDomainConfigFile;
virDomainControllerDefFree;
virDomainControllerInsert;
virDomainControllerInsertPreAlloced;
virDomainControllerModelTypeFromString;
virDomainControllerModelTypeToString;
virDomainControllerModelSCSITypeFromString;
virDomainControllerModelSCSITypeToString;
virDomainControllerTypeToString;
virDomainCpuSetFormat;
virDomainCpuSetParse;
......
......@@ -483,8 +483,8 @@ def->parallels[0]...
/* directly map the virDomainControllerModel to virVMXSCSIControllerModel,
* this is good enough for now because all virDomainControllerModel values
* are actually SCSI controller models in the ESX case */
VIR_ENUM_DECL(virVMXSCSIControllerModel)
VIR_ENUM_IMPL(virVMXSCSIControllerModel, VIR_DOMAIN_CONTROLLER_MODEL_LAST,
VIR_ENUM_DECL(virVMXControllerModelSCSI)
VIR_ENUM_IMPL(virVMXControllerModelSCSI, VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LAST,
"auto", /* just to match virDomainControllerModel, will never be used */
"buslogic",
"lsilogic",
......@@ -1040,7 +1040,7 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
*tmp = c_tolower(*tmp);
}
model = virDomainControllerModelTypeFromString(disk->driverName);
model = virDomainControllerModelSCSITypeFromString(disk->driverName);
if (model < 0) {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
......@@ -1068,7 +1068,7 @@ virVMXHandleLegacySCSIDiskDriverName(virDomainDefPtr def,
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Inconsistent SCSI controller model ('%s' is not '%s') "
"for SCSI controller index %d"), disk->driverName,
virDomainControllerModelTypeToString(controller->model),
virDomainControllerModelSCSITypeToString(controller->model),
controller->idx);
return -1;
}
......@@ -1120,7 +1120,7 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def,
continue;
}
if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_AUTO &&
if (controller->model == VIR_DOMAIN_CONTROLLER_MODEL_SCSI_AUTO &&
ctx->autodetectSCSIControllerModel != NULL) {
count = 0;
......@@ -1157,15 +1157,15 @@ virVMXGatherSCSIControllers(virVMXContext *ctx, virDomainDefPtr def,
}
if (controller->model != -1 &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068 &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI) {
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 &&
controller->model != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI) {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Expecting domain XML attribute 'model' of entry "
"'controller' to be 'buslogic' or 'lsilogic' or "
"'lsisas1068' or 'vmpvscsi' but found '%s'"),
virDomainControllerModelTypeToString(controller->model));
virDomainControllerModelSCSITypeToString(controller->model));
goto cleanup;
}
......@@ -1869,13 +1869,13 @@ virVMXParseSCSIController(virConfPtr conf, int controller, bool *present,
*tmp = c_tolower(*tmp);
}
*virtualDev = virVMXSCSIControllerModelTypeFromString(virtualDev_string);
*virtualDev = virVMXControllerModelSCSITypeFromString(virtualDev_string);
if (*virtualDev == -1 ||
(*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_BUSLOGIC &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_LSISAS1068 &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_VMPVSCSI)) {
(*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_BUSLOGIC &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSISAS1068 &&
*virtualDev != VIR_DOMAIN_CONTROLLER_MODEL_SCSI_VMPVSCSI)) {
VMX_ERROR(VIR_ERR_INTERNAL_ERROR,
_("Expecting VMX entry '%s' to be 'buslogic' or 'lsilogic' "
"or 'lsisas1068' or 'pvscsi' but found '%s'"),
......@@ -3088,7 +3088,7 @@ virVMXFormatConfig(virVMXContext *ctx, virCapsPtr caps, virDomainDefPtr def,
if (scsi_virtualDev[i] != -1) {
virBufferAsprintf(&buffer, "scsi%d.virtualDev = \"%s\"\n", i,
virVMXSCSIControllerModelTypeToString
virVMXControllerModelSCSITypeToString
(scsi_virtualDev[i]));
}
}
......
......@@ -143,7 +143,7 @@ static int
testAutodetectSCSIControllerModel(virDomainDiskDefPtr def ATTRIBUTE_UNUSED,
int *model, void *opaque ATTRIBUTE_UNUSED)
{
*model = VIR_DOMAIN_CONTROLLER_MODEL_LSILOGIC;
*model = VIR_DOMAIN_CONTROLLER_MODEL_SCSI_LSILOGIC;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册