cpu: Update format strings in translated messages

Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Jiri Denemark 2023-03-09 11:28:13 +01:00
parent 5f354d5cc0
commit e0fd806363
6 changed files with 83 additions and 92 deletions

View File

@ -64,7 +64,7 @@ cpuGetSubDriver(virArch arch)
} }
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("'%s' architecture is not supported by CPU driver"), _("'%1$s' architecture is not supported by CPU driver"),
virArchToString(arch)); virArchToString(arch));
return NULL; return NULL;
} }
@ -81,7 +81,7 @@ cpuGetSubDriverByName(const char *name)
} }
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU driver '%s' does not exist"), _("CPU driver '%1$s' does not exist"),
name); name);
return NULL; return NULL;
} }
@ -156,7 +156,7 @@ virCPUCompare(virArch arch,
if (!driver->compare) { if (!driver->compare) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot compare CPUs of %s architecture"), _("cannot compare CPUs of %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return VIR_CPU_COMPARE_ERROR; return VIR_CPU_COMPARE_ERROR;
} }
@ -210,7 +210,7 @@ cpuDecode(virCPUDef *cpu,
if (driver->decode == NULL) { if (driver->decode == NULL) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot decode CPU data for %s architecture"), _("cannot decode CPU data for %1$s architecture"),
virArchToString(cpu->arch)); virArchToString(cpu->arch));
return -1; return -1;
} }
@ -266,7 +266,7 @@ cpuEncode(virArch arch,
if (driver->encode == NULL) { if (driver->encode == NULL) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot encode CPU data for %s architecture"), _("cannot encode CPU data for %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return -1; return -1;
} }
@ -417,7 +417,7 @@ virCPUGetHost(virArch arch,
case VIR_CPU_TYPE_GUEST: case VIR_CPU_TYPE_GUEST:
if (nodeInfo) { if (nodeInfo) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("cannot set topology for CPU type '%s'"), _("cannot set topology for CPU type '%1$s'"),
virCPUTypeToString(type)); virCPUTypeToString(type));
return NULL; return NULL;
} }
@ -427,7 +427,7 @@ virCPUGetHost(virArch arch,
case VIR_CPU_TYPE_AUTO: case VIR_CPU_TYPE_AUTO:
case VIR_CPU_TYPE_LAST: case VIR_CPU_TYPE_LAST:
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("unsupported CPU type: %s"), _("unsupported CPU type: %1$s"),
virCPUTypeToString(type)); virCPUTypeToString(type));
return NULL; return NULL;
} }
@ -450,7 +450,7 @@ virCPUGetHost(virArch arch,
virArchToString(arch)); virArchToString(arch));
} else { } else {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot detect host CPU model for %s architecture"), _("cannot detect host CPU model for %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return NULL; return NULL;
} }
@ -524,12 +524,12 @@ virCPUBaseline(virArch arch,
for (i = 0; i < ncpus; i++) { for (i = 0; i < ncpus; i++) {
if (!cpus[i]) { if (!cpus[i]) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("invalid CPU definition at index %zu"), i); _("invalid CPU definition at index %1$zu"), i);
return NULL; return NULL;
} }
if (!cpus[i]->model) { if (!cpus[i]->model) {
virReportError(VIR_ERR_INVALID_ARG, virReportError(VIR_ERR_INVALID_ARG,
_("no CPU model specified at index %zu"), i); _("no CPU model specified at index %1$zu"), i);
return NULL; return NULL;
} }
} }
@ -542,7 +542,7 @@ virCPUBaseline(virArch arch,
if (!driver->baseline) { if (!driver->baseline) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot compute baseline CPU of %s architecture"), _("cannot compute baseline CPU of %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return NULL; return NULL;
} }
@ -614,7 +614,7 @@ virCPUUpdate(virArch arch,
if (!driver->update) { if (!driver->update) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot update guest CPU for %s architecture"), _("cannot update guest CPU for %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return -1; return -1;
} }
@ -701,7 +701,7 @@ virCPUCheckFeature(virArch arch,
if (!driver->checkFeature) { if (!driver->checkFeature) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot check guest CPU feature for %s architecture"), _("cannot check guest CPU feature for %1$s architecture"),
virArchToString(arch)); virArchToString(arch));
return -1; return -1;
} }
@ -738,7 +738,7 @@ virCPUCheckForbiddenFeatures(virCPUDef *guest, const virCPUDef *host)
continue; continue;
virReportError(VIR_ERR_CPU_INCOMPATIBLE, virReportError(VIR_ERR_CPU_INCOMPATIBLE,
_("Host CPU provides forbidden feature '%s'"), _("Host CPU provides forbidden feature '%1$s'"),
guest->features[i].name); guest->features[i].name);
return -1; return -1;
} }
@ -772,7 +772,7 @@ virCPUDataCheckFeature(const virCPUData *data,
if (!driver->dataCheckFeature) { if (!driver->dataCheckFeature) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot check guest CPU feature for %s architecture"), _("cannot check guest CPU feature for %1$s architecture"),
virArchToString(data->arch)); virArchToString(data->arch));
return -1; return -1;
} }
@ -802,7 +802,7 @@ virCPUDataFormat(const virCPUData *data)
if (!driver->dataFormat) { if (!driver->dataFormat) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot format %s CPU data"), _("cannot format %1$s CPU data"),
virArchToString(data->arch)); virArchToString(data->arch));
return NULL; return NULL;
} }
@ -862,7 +862,7 @@ virCPUData *virCPUDataParseNode(xmlNodePtr node)
return NULL; return NULL;
if (!driver->dataParse) { if (!driver->dataParse) {
virReportError(VIR_ERR_NO_SUPPORT, _("cannot parse %s CPU data"), arch); virReportError(VIR_ERR_NO_SUPPORT, _("cannot parse %1$s CPU data"), arch);
return NULL; return NULL;
} }
@ -988,14 +988,14 @@ virCPUTranslate(virArch arch,
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("CPU model %s is not supported by hypervisor"), _("CPU model %1$s is not supported by hypervisor"),
cpu->model); cpu->model);
return -1; return -1;
} }
if (!driver->translate) { if (!driver->translate) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot translate CPU model %s to a supported model"), _("cannot translate CPU model %1$s to a supported model"),
cpu->model); cpu->model);
return -1; return -1;
} }
@ -1177,7 +1177,7 @@ virCPUDataAddFeature(virCPUData *cpuData,
if (!driver->dataAddFeature) { if (!driver->dataAddFeature) {
virReportError(VIR_ERR_NO_SUPPORT, virReportError(VIR_ERR_NO_SUPPORT,
_("cannot add guest CPU feature for %s architecture"), _("cannot add guest CPU feature for %1$s architecture"),
virArchToString(cpuData->arch)); virArchToString(cpuData->arch));
return -1; return -1;
} }

View File

@ -252,7 +252,7 @@ virCPUarmMapFeatureParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
if (virCPUarmMapFeatureFind(map, name)) { if (virCPUarmMapFeatureFind(map, name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU feature %s already defined"), name); _("CPU feature %1$s already defined"), name);
return -1; return -1;
} }
@ -307,7 +307,7 @@ virCPUarmVendorParse(xmlXPathContextPtr ctxt,
if (virCPUarmVendorFindByName(map, vendor->name)) { if (virCPUarmVendorFindByName(map, vendor->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU vendor %s already defined"), _("CPU vendor %1$s already defined"),
vendor->name); vendor->name);
return -1; return -1;
} }
@ -318,7 +318,7 @@ virCPUarmVendorParse(xmlXPathContextPtr ctxt,
if (virCPUarmVendorFindByID(map, vendor->value)) { if (virCPUarmVendorFindByID(map, vendor->value)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU vendor value 0x%2llx already defined"), _("CPU vendor value 0x%1$2llx already defined"),
vendor->value); vendor->value);
return -1; return -1;
} }
@ -373,7 +373,7 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt,
if (virCPUarmModelFind(map, model->name)) { if (virCPUarmModelFind(map, model->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU model %s already defined"), _("CPU model %1$s already defined"),
model->name); model->name);
return -1; return -1;
} }
@ -386,7 +386,7 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt,
if (!(model->vendor = virCPUarmVendorFindByName(map, vendor))) { if (!(model->vendor = virCPUarmVendorFindByName(map, vendor))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown vendor %s referenced by CPU model %s"), _("Unknown vendor %1$s referenced by CPU model %2$s"),
vendor, model->name); vendor, model->name);
return -1; return -1;
} }
@ -394,7 +394,7 @@ virCPUarmModelParse(xmlXPathContextPtr ctxt,
if (!(pvrNode = virXPathNode("./pvr", ctxt))) { if (!(pvrNode = virXPathNode("./pvr", ctxt))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing PVR information for CPU model %s"), _("Missing PVR information for CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
@ -520,8 +520,7 @@ virCPUarmCompare(virCPUDef *host,
if (failIncompatible) { if (failIncompatible) {
virReportError(VIR_ERR_CPU_INCOMPATIBLE, virReportError(VIR_ERR_CPU_INCOMPATIBLE,
_("Host CPU model does not match required CPU " _("Host CPU model does not match required CPU vendor %1$s or(and) model %2$s"),
"vendor %s or(and) model %s"),
NULLSTR(cpu->vendor), NULLSTR(cpu->model)); NULLSTR(cpu->vendor), NULLSTR(cpu->model));
return VIR_CPU_COMPARE_ERROR; return VIR_CPU_COMPARE_ERROR;
} }
@ -546,7 +545,7 @@ virCPUarmValidateFeatures(virCPUDef *cpu)
if (!virCPUarmMapFeatureFind(map, feature->name)) { if (!virCPUarmMapFeatureFind(map, feature->name)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown CPU feature: %s"), _("unknown CPU feature: %1$s"),
feature->name); feature->name);
return -1; return -1;
} }
@ -635,14 +634,14 @@ virCPUarmDecode(virCPUDef *cpu,
if (!(model = virCPUarmModelFindByPVR(map, cpuData->pvr))) { if (!(model = virCPUarmModelFindByPVR(map, cpuData->pvr))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Cannot find CPU model with PVR 0x%03llx"), _("Cannot find CPU model with PVR 0x%1$03llx"),
cpuData->pvr); cpuData->pvr);
return -1; return -1;
} }
if (!virCPUModelIsAllowed(model->name, models)) { if (!virCPUModelIsAllowed(model->name, models)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("CPU model %s is not supported by hypervisor"), _("CPU model %1$s is not supported by hypervisor"),
model->name); model->name);
return -1; return -1;
} }
@ -652,7 +651,7 @@ virCPUarmDecode(virCPUDef *cpu,
if (cpuData->vendor_id && if (cpuData->vendor_id &&
!(vendor = virCPUarmVendorFindByID(map, cpuData->vendor_id))) { !(vendor = virCPUarmVendorFindByID(map, cpuData->vendor_id))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Cannot find CPU vendor with vendor id 0x%02llx"), _("Cannot find CPU vendor with vendor id 0x%1$02llx"),
cpuData->vendor_id); cpuData->vendor_id);
return -1; return -1;
} }

View File

@ -47,7 +47,7 @@ loadData(const char *mapfile,
if (n > 0 && !callback) { if (n > 0 && !callback) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unexpected element '%s' in CPU map '%s'"), element, mapfile); _("Unexpected element '%1$s' in CPU map '%2$s'"), element, mapfile);
return -1; return -1;
} }
@ -56,7 +56,7 @@ loadData(const char *mapfile,
if (!(name = virXMLPropString(nodes[i], "name"))) { if (!(name = virXMLPropString(nodes[i], "name"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find %s name in CPU map '%s'"), element, mapfile); _("cannot find %1$s name in CPU map '%2$s'"), element, mapfile);
return -1; return -1;
} }
VIR_DEBUG("Load %s name %s", element, name); VIR_DEBUG("Load %s name %s", element, name);
@ -173,7 +173,7 @@ int cpuMapLoad(const char *arch,
if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) { if ((ctxt->node = virXPathNode(xpath, ctxt)) == NULL) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("cannot find CPU map for %s architecture"), arch); _("cannot find CPU map for %1$s architecture"), arch);
return -1; return -1;
} }

View File

@ -110,7 +110,7 @@ ppc64CheckCompatibilityMode(const char *host_model,
virStrToLong_i(tmp, NULL, 10, &compat) < 0 || virStrToLong_i(tmp, NULL, 10, &compat) < 0 ||
compat < 6 || compat > 10) { compat < 6 || compat > 10) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown compatibility mode %s"), _("Unknown compatibility mode %1$s"),
compat_mode); compat_mode);
return VIR_CPU_COMPARE_ERROR; return VIR_CPU_COMPARE_ERROR;
} }
@ -246,7 +246,7 @@ ppc64ModelFromCPU(const virCPUDef *cpu,
if (!(model = ppc64ModelFind(map, cpu->model))) { if (!(model = ppc64ModelFind(map, cpu->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), cpu->model); _("Unknown CPU model %1$s"), cpu->model);
return NULL; return NULL;
} }
@ -286,7 +286,7 @@ ppc64VendorParse(xmlXPathContextPtr ctxt G_GNUC_UNUSED,
if (ppc64VendorFind(map, vendor->name)) { if (ppc64VendorFind(map, vendor->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU vendor %s already defined"), vendor->name); _("CPU vendor %1$s already defined"), vendor->name);
return -1; return -1;
} }
@ -313,7 +313,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
if (ppc64ModelFind(map, model->name)) { if (ppc64ModelFind(map, model->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU model %s already defined"), model->name); _("CPU model %1$s already defined"), model->name);
return -1; return -1;
} }
@ -321,14 +321,14 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
vendor = virXPathString("string(./vendor/@name)", ctxt); vendor = virXPathString("string(./vendor/@name)", ctxt);
if (!vendor) { if (!vendor) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid vendor element in CPU model %s"), _("Invalid vendor element in CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
if (!(model->vendor = ppc64VendorFind(map, vendor))) { if (!(model->vendor = ppc64VendorFind(map, vendor))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown vendor %s referenced by CPU model %s"), _("Unknown vendor %1$s referenced by CPU model %2$s"),
vendor, model->name); vendor, model->name);
return -1; return -1;
} }
@ -336,7 +336,7 @@ ppc64ModelParse(xmlXPathContextPtr ctxt,
if ((n = virXPathNodeSet("./pvr", ctxt, &nodes)) <= 0) { if ((n = virXPathNodeSet("./pvr", ctxt, &nodes)) <= 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing PVR information for CPU model %s"), _("Missing PVR information for CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
@ -428,7 +428,7 @@ ppc64Compute(virCPUDef *host,
VIR_DEBUG("CPU arch %s does not match host arch", VIR_DEBUG("CPU arch %s does not match host arch",
virArchToString(cpu->arch)); virArchToString(cpu->arch));
if (message) if (message)
*message = g_strdup_printf(_("CPU arch %s does not match host arch"), *message = g_strdup_printf(_("CPU arch %1$s does not match host arch"),
virArchToString(cpu->arch)); virArchToString(cpu->arch));
return VIR_CPU_COMPARE_INCOMPATIBLE; return VIR_CPU_COMPARE_INCOMPATIBLE;
@ -440,8 +440,7 @@ ppc64Compute(virCPUDef *host,
VIR_DEBUG("host CPU vendor does not match required CPU vendor %s", VIR_DEBUG("host CPU vendor does not match required CPU vendor %s",
cpu->vendor); cpu->vendor);
if (message) { if (message) {
*message = g_strdup_printf(_("host CPU vendor does not match required " *message = g_strdup_printf(_("host CPU vendor does not match required CPU vendor %1$s"),
"CPU vendor %s"),
cpu->vendor); cpu->vendor);
} }
@ -497,8 +496,7 @@ ppc64Compute(virCPUDef *host,
VIR_DEBUG("host CPU model does not match required CPU model %s", VIR_DEBUG("host CPU model does not match required CPU model %s",
guest_model->name); guest_model->name);
if (message) { if (message) {
*message = g_strdup_printf(_("host CPU model does not match required " *message = g_strdup_printf(_("host CPU model does not match required CPU model %1$s"),
"CPU model %s"),
guest_model->name); guest_model->name);
} }
@ -554,14 +552,14 @@ ppc64DriverDecode(virCPUDef *cpu,
if (!(model = ppc64ModelFindPVR(map, data->data.ppc64.pvr[0].value))) { if (!(model = ppc64ModelFindPVR(map, data->data.ppc64.pvr[0].value))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Cannot find CPU model with PVR 0x%08x"), _("Cannot find CPU model with PVR 0x%1$08x"),
data->data.ppc64.pvr[0].value); data->data.ppc64.pvr[0].value);
return -1; return -1;
} }
if (!virCPUModelIsAllowed(model->name, models)) { if (!virCPUModelIsAllowed(model->name, models)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("CPU model %s is not supported by hypervisor"), _("CPU model %1$s is not supported by hypervisor"),
model->name); model->name);
return -1; return -1;
} }
@ -687,7 +685,7 @@ virCPUppc64Baseline(virCPUDef **cpus,
if (!(model = ppc64ModelFind(map, cpus[0]->model))) { if (!(model = ppc64ModelFind(map, cpus[0]->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), cpus[0]->model); _("Unknown CPU model %1$s"), cpus[0]->model);
return NULL; return NULL;
} }
@ -716,15 +714,14 @@ virCPUppc64Baseline(virCPUDef **cpus,
if (!(vnd = ppc64VendorFind(map, cpus[i]->vendor))) { if (!(vnd = ppc64VendorFind(map, cpus[i]->vendor))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Unknown CPU vendor %s"), cpus[i]->vendor); _("Unknown CPU vendor %1$s"), cpus[i]->vendor);
return NULL; return NULL;
} }
if (model->vendor) { if (model->vendor) {
if (model->vendor != vnd) { if (model->vendor != vnd) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("CPU vendor %s of model %s differs from " _("CPU vendor %1$s of model %2$s differs from vendor %3$s"),
"vendor %s"),
model->vendor->name, model->name, model->vendor->name, model->name,
vnd->name); vnd->name);
return NULL; return NULL;

View File

@ -53,7 +53,7 @@ virCPUs390Update(virCPUDef *guest,
if (guest->mode == VIR_CPU_MODE_CUSTOM) { if (guest->mode == VIR_CPU_MODE_CUSTOM) {
if (guest->match == VIR_CPU_MATCH_MINIMUM) { if (guest->match == VIR_CPU_MATCH_MINIMUM) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("match mode %s not supported"), _("match mode %1$s not supported"),
virCPUMatchTypeToString(guest->match)); virCPUMatchTypeToString(guest->match));
} else { } else {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
@ -94,8 +94,7 @@ virCPUs390ValidateFeatures(virCPUDef *cpu)
for (i = 0; i < cpu->nfeatures; i++) { for (i = 0; i < cpu->nfeatures; i++) {
if (cpu->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) { if (cpu->features[i].policy == VIR_CPU_FEATURE_OPTIONAL) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("only cpu feature policies 'require' and " _("only cpu feature policies 'require' and 'disable' are supported for %1$s"),
"'disable' are supported for %s"),
cpu->features[i].name); cpu->features[i].name);
return -1; return -1;
} }

View File

@ -681,7 +681,7 @@ virCPUx86VendorToData(const char *vendor,
if (strlen(vendor) != VENDOR_STRING_LENGTH) { if (strlen(vendor) != VENDOR_STRING_LENGTH) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU vendor string '%s'"), vendor); _("Invalid CPU vendor string '%1$s'"), vendor);
return -1; return -1;
} }
@ -946,14 +946,14 @@ x86VendorParse(xmlXPathContextPtr ctxt,
if (x86VendorFind(map, vendor->name)) { if (x86VendorFind(map, vendor->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU vendor %s already defined"), vendor->name); _("CPU vendor %1$s already defined"), vendor->name);
return -1; return -1;
} }
string = virXPathString("string(@string)", ctxt); string = virXPathString("string(@string)", ctxt);
if (!string) { if (!string) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing vendor string for CPU vendor %s"), _("Missing vendor string for CPU vendor %1$s"),
vendor->name); vendor->name);
return -1; return -1;
} }
@ -990,7 +990,7 @@ x86FeatureInData(const char *name,
if (!(feature = x86FeatureFind(map, name)) && if (!(feature = x86FeatureFind(map, name)) &&
!(feature = x86FeatureFindInternal(name))) { !(feature = x86FeatureFindInternal(name))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown CPU feature %s"), name); _("unknown CPU feature %1$s"), name);
return -1; return -1;
} }
@ -1113,13 +1113,13 @@ x86ParseDataItemList(virCPUx86Data *cpudata,
if (virXMLNodeNameEqual(node, "cpuid")) { if (virXMLNodeNameEqual(node, "cpuid")) {
if (x86ParseCPUID(node, &item) < 0) { if (x86ParseCPUID(node, &item) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid cpuid[%zu]"), i); _("Invalid cpuid[%1$zu]"), i);
return -1; return -1;
} }
} else { } else {
if (x86ParseMSR(node, &item) < 0) { if (x86ParseMSR(node, &item) < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid msr[%zu]"), i); _("Invalid msr[%1$zu]"), i);
return -1; return -1;
} }
} }
@ -1149,7 +1149,7 @@ x86FeatureParse(xmlXPathContextPtr ctxt,
if (x86FeatureFind(map, feature->name)) { if (x86FeatureFind(map, feature->name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("CPU feature %s already defined"), feature->name); _("CPU feature %1$s already defined"), feature->name);
return -1; return -1;
} }
@ -1348,7 +1348,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
(policy == VIR_CPU_FEATURE_REQUIRE || policy == -1)) { (policy == VIR_CPU_FEATURE_REQUIRE || policy == -1)) {
if (!(model = x86ModelFind(map, cpu->model))) { if (!(model = x86ModelFind(map, cpu->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), cpu->model); _("Unknown CPU model %1$s"), cpu->model);
return NULL; return NULL;
} }
@ -1372,7 +1372,7 @@ x86ModelFromCPU(const virCPUDef *cpu,
if (!(feature = x86FeatureFind(map, cpu->features[i].name))) { if (!(feature = x86FeatureFind(map, cpu->features[i].name))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU feature %s"), cpu->features[i].name); _("Unknown CPU feature %1$s"), cpu->features[i].name);
return NULL; return NULL;
} }
@ -1460,7 +1460,7 @@ x86ModelParseDecode(virCPUx86Model *model,
if (!(decode_node = virXPathNode("./decode", ctxt))) { if (!(decode_node = virXPathNode("./decode", ctxt))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("missing decode element in CPU model %s"), _("missing decode element in CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
@ -1496,14 +1496,14 @@ x86ModelParseAncestor(virCPUx86Model *model,
name = virXPathString("string(./model/@name)", ctxt); name = virXPathString("string(./model/@name)", ctxt);
if (!name) { if (!name) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing ancestor's name in CPU model %s"), _("Missing ancestor's name in CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
if (!(ancestor = x86ModelFind(map, name))) { if (!(ancestor = x86ModelFind(map, name))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Ancestor model %s not found for CPU model %s"), _("Ancestor model %1$s not found for CPU model %2$s"),
name, model->name); name, model->name);
return -1; return -1;
} }
@ -1543,7 +1543,7 @@ x86ModelParseSignatures(virCPUx86Model *model,
rc = virXPathUInt("string(@family)", ctxt, &sig->family); rc = virXPathUInt("string(@family)", ctxt, &sig->family);
if (rc < 0 || sig->family == 0) { if (rc < 0 || sig->family == 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature family in model %s"), _("Invalid CPU signature family in model %1$s"),
model->name); model->name);
return -1; return -1;
} }
@ -1551,7 +1551,7 @@ x86ModelParseSignatures(virCPUx86Model *model,
rc = virXPathUInt("string(@model)", ctxt, &sig->model); rc = virXPathUInt("string(@model)", ctxt, &sig->model);
if (rc < 0) { if (rc < 0) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid CPU signature model in model %s"), _("Invalid CPU signature model in model %1$s"),
model->name); model->name);
return -1; return -1;
} }
@ -1580,14 +1580,14 @@ x86ModelParseVendor(virCPUx86Model *model,
vendor = virXPathString("string(./vendor/@name)", ctxt); vendor = virXPathString("string(./vendor/@name)", ctxt);
if (!vendor) { if (!vendor) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Invalid vendor element in CPU model %s"), _("Invalid vendor element in CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
if (!(model->vendor = x86VendorFind(map, vendor))) { if (!(model->vendor = x86VendorFind(map, vendor))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown vendor %s referenced by CPU model %s"), _("Unknown vendor %1$s referenced by CPU model %2$s"),
vendor, model->name); vendor, model->name);
return -1; return -1;
} }
@ -1618,14 +1618,14 @@ x86ModelParseFeatures(virCPUx86Model *model,
if (!(ftname = virXMLPropString(nodes[i], "name"))) { if (!(ftname = virXMLPropString(nodes[i], "name"))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Missing feature name for CPU model %s"), _("Missing feature name for CPU model %1$s"),
model->name); model->name);
return -1; return -1;
} }
if (!(feature = x86FeatureFind(map, ftname))) { if (!(feature = x86FeatureFind(map, ftname))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Feature %s required by CPU model %s not found"), _("Feature %1$s required by CPU model %2$s not found"),
ftname, model->name); ftname, model->name);
return -1; return -1;
} }
@ -1660,7 +1660,7 @@ x86ModelParse(xmlXPathContextPtr ctxt,
if (x86ModelFind(map, name)) { if (x86ModelFind(map, name)) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Multiple definitions of CPU model '%s'"), name); _("Multiple definitions of CPU model '%1$s'"), name);
return -1; return -1;
} }
@ -1857,7 +1857,7 @@ x86Compute(virCPUDef *host,
VIR_DEBUG("CPU arch %s does not match host arch", VIR_DEBUG("CPU arch %s does not match host arch",
virArchToString(cpu->arch)); virArchToString(cpu->arch));
if (message) { if (message) {
*message = g_strdup_printf(_("CPU arch %s does not match host arch"), *message = g_strdup_printf(_("CPU arch %1$s does not match host arch"),
virArchToString(cpu->arch)); virArchToString(cpu->arch));
} }
return VIR_CPU_COMPARE_INCOMPATIBLE; return VIR_CPU_COMPARE_INCOMPATIBLE;
@ -1869,8 +1869,7 @@ x86Compute(virCPUDef *host,
VIR_DEBUG("host CPU vendor does not match required CPU vendor %s", VIR_DEBUG("host CPU vendor does not match required CPU vendor %s",
cpu->vendor); cpu->vendor);
if (message) { if (message) {
*message = g_strdup_printf(_("host CPU vendor does not match required " *message = g_strdup_printf(_("host CPU vendor does not match required CPU vendor %1$s"),
"CPU vendor %s"),
cpu->vendor); cpu->vendor);
} }
@ -2196,7 +2195,7 @@ x86Decode(virCPUDef *cpu,
STREQ(candidate->name, preferred[0])) { STREQ(candidate->name, preferred[0])) {
if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) { if (cpu->fallback != VIR_CPU_FALLBACK_ALLOW) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("CPU model %s is not supported by hypervisor"), _("CPU model %1$s is not supported by hypervisor"),
preferred[0]); preferred[0]);
return -1; return -1;
} else { } else {
@ -2379,7 +2378,7 @@ x86Encode(virArch arch,
if (cpu->vendor && !(v = x86VendorFind(map, cpu->vendor))) { if (cpu->vendor && !(v = x86VendorFind(map, cpu->vendor))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("CPU vendor %s not found"), cpu->vendor); _("CPU vendor %1$s not found"), cpu->vendor);
return -1; return -1;
} }
@ -2840,7 +2839,7 @@ virCPUx86Baseline(virCPUDef **cpus,
outputVendor = false; outputVendor = false;
} else if (!(vendor = x86VendorFind(map, cpus[0]->vendor))) { } else if (!(vendor = x86VendorFind(map, cpus[0]->vendor))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Unknown CPU vendor %s"), cpus[0]->vendor); _("Unknown CPU vendor %1$s"), cpus[0]->vendor);
return NULL; return NULL;
} }
@ -2862,7 +2861,7 @@ virCPUx86Baseline(virCPUDef **cpus,
if (cpus[i]->vendor && model->vendor && if (cpus[i]->vendor && model->vendor &&
STRNEQ(cpus[i]->vendor, model->vendor->name)) { STRNEQ(cpus[i]->vendor, model->vendor->name)) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("CPU vendor %s of model %s differs from vendor %s"), _("CPU vendor %1$s of model %2$s differs from vendor %3$s"),
model->vendor->name, model->name, cpus[i]->vendor); model->vendor->name, model->name, cpus[i]->vendor);
return NULL; return NULL;
} }
@ -2879,7 +2878,7 @@ virCPUx86Baseline(virCPUDef **cpus,
if (!vendor) { if (!vendor) {
if (!(vendor = x86VendorFind(map, vn))) { if (!(vendor = x86VendorFind(map, vn))) {
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("Unknown CPU vendor %s"), vn); _("Unknown CPU vendor %1$s"), vn);
return NULL; return NULL;
} }
} else if (STRNEQ(vendor->name, vn)) { } else if (STRNEQ(vendor->name, vn)) {
@ -3008,7 +3007,7 @@ virCPUx86Update(virCPUDef *guest,
if (!(guestModel = x86ModelFind(map, guest->model))) { if (!(guestModel = x86ModelFind(map, guest->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("Unknown CPU model %s"), guest->model); _("Unknown CPU model %1$s"), guest->model);
return -1; return -1;
} }
@ -3097,18 +3096,15 @@ virCPUx86UpdateLive(virCPUDef *cpu,
if (added || removed) { if (added || removed) {
if (added && removed) if (added && removed)
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("guest CPU doesn't match specification: " _("guest CPU doesn't match specification: extra features: %1$s, missing features: %2$s"),
"extra features: %s, missing features: %s"),
added, removed); added, removed);
else if (added) else if (added)
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("guest CPU doesn't match specification: " _("guest CPU doesn't match specification: extra features: %1$s"),
"extra features: %s"),
added); added);
else else
virReportError(VIR_ERR_OPERATION_FAILED, virReportError(VIR_ERR_OPERATION_FAILED,
_("guest CPU doesn't match specification: " _("guest CPU doesn't match specification: missing features: %1$s"),
"missing features: %s"),
removed); removed);
return -1; return -1;
} }
@ -3218,7 +3214,7 @@ virCPUx86ExpandFeatures(virCPUDef *cpu)
if (!(model = x86ModelFind(map, cpu->model))) { if (!(model = x86ModelFind(map, cpu->model))) {
virReportError(VIR_ERR_INTERNAL_ERROR, virReportError(VIR_ERR_INTERNAL_ERROR,
_("unknown CPU model %s"), cpu->model); _("unknown CPU model %1$s"), cpu->model);
return -1; return -1;
} }
@ -3293,7 +3289,7 @@ virCPUx86ValidateFeatures(virCPUDef *cpu)
for (i = 0; i < cpu->nfeatures; i++) { for (i = 0; i < cpu->nfeatures; i++) {
if (!x86FeatureFind(map, cpu->features[i].name)) { if (!x86FeatureFind(map, cpu->features[i].name)) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
_("unknown CPU feature: %s"), _("unknown CPU feature: %1$s"),
cpu->features[i].name); cpu->features[i].name);
return -1; return -1;
} }