1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2025-02-09 13:57:27 +03:00

Add missing "%s" format string to constant error messages in libxl driver

Updates the libxl driver code so that it passes "%s" as the format
string whenever raising an error message with a const string.
This commit is contained in:
Jiri Denemark 2012-07-20 13:09:07 +01:00 committed by Daniel P. Berrange
parent 110f08e821
commit d1f8d6edbf
2 changed files with 17 additions and 15 deletions

View File

@ -397,7 +397,7 @@ libxlMakeDomBuildInfo(virDomainDefPtr def, libxl_domain_config *d_config)
* only 32 can be represented. * only 32 can be represented.
*/ */
if (def->maxvcpus > 32 || def->vcpus > 32) { if (def->maxvcpus > 32 || def->vcpus > 32) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("This version of libxenlight only supports 32 " _("This version of libxenlight only supports 32 "
"vcpus per domain")); "vcpus per domain"));
return -1; return -1;
@ -917,13 +917,13 @@ libxlMakeCapabilities(libxl_ctx *ctx)
regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED); regcomp (&xen_cap_rec, xen_cap_re, REG_EXTENDED);
if (libxl_get_physinfo(ctx, &phy_info) != 0) { if (libxl_get_physinfo(ctx, &phy_info) != 0) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to get node physical info from libxenlight")); _("Failed to get node physical info from libxenlight"));
return NULL; return NULL;
} }
if ((ver_info = libxl_get_version_info(ctx)) == NULL) { if ((ver_info = libxl_get_version_info(ctx)) == NULL) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to get version info from libxenlight")); _("Failed to get version info from libxenlight"));
return NULL; return NULL;
} }

View File

@ -168,13 +168,13 @@ libxlDoNodeGetInfo(libxlDriverPrivatePtr driver, virNodeInfoPtr info)
struct utsname utsname; struct utsname utsname;
if (libxl_get_physinfo(&driver->ctx, &phy_info)) { if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("libxl_get_physinfo_info failed")); _("libxl_get_physinfo_info failed"));
return -1; return -1;
} }
if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("libxl_get_version_info failed")); _("libxl_get_version_info failed"));
return -1; return -1;
} }
@ -696,7 +696,7 @@ libxlVmStart(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml", if (libxl_userdata_store(&priv->ctx, domid, "libvirt-xml",
(uint8_t *)dom_xml, strlen(dom_xml) + 1)) { (uint8_t *)dom_xml, strlen(dom_xml) + 1)) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("libxenlight failed to store userdata")); _("libxenlight failed to store userdata"));
goto error; goto error;
} }
@ -1851,13 +1851,13 @@ libxlDoDomainSave(libxlDriverPrivatePtr driver, virDomainObjPtr vm,
hdr.xmlLen = xml_len; hdr.xmlLen = xml_len;
if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) { if (safewrite(fd, &hdr, sizeof(hdr)) != sizeof(hdr)) {
libxlError(VIR_ERR_OPERATION_FAILED, libxlError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to write save file header")); _("Failed to write save file header"));
goto cleanup; goto cleanup;
} }
if (safewrite(fd, xml, xml_len) != xml_len) { if (safewrite(fd, xml, xml_len) != xml_len) {
libxlError(VIR_ERR_OPERATION_FAILED, libxlError(VIR_ERR_OPERATION_FAILED, "%s",
_("Failed to write xml description")); _("Failed to write xml description"));
goto cleanup; goto cleanup;
} }
@ -2250,7 +2250,7 @@ libxlDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
} }
if (!nvcpus) { if (!nvcpus) {
libxlError(VIR_ERR_INVALID_ARG, _("nvcpus is zero")); libxlError(VIR_ERR_INVALID_ARG, "%s", _("nvcpus is zero"));
return -1; return -1;
} }
@ -2813,7 +2813,7 @@ libxlDomainUndefineFlags(virDomainPtr dom,
if (virFileExists(name)) { if (virFileExists(name)) {
if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) { if (flags & VIR_DOMAIN_UNDEFINE_MANAGED_SAVE) {
if (unlink(name) < 0) { if (unlink(name) < 0) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Failed to remove domain managed save image")); _("Failed to remove domain managed save image"));
goto cleanup; goto cleanup;
} }
@ -3179,7 +3179,7 @@ libxlDomainUpdateDeviceConfig(virDomainDefPtr vmdef, virDomainDeviceDefPtr dev)
} }
orig = vmdef->disks[i]; orig = vmdef->disks[i];
if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) { if (!(orig->device == VIR_DOMAIN_DISK_DEVICE_CDROM)) {
libxlError(VIR_ERR_INVALID_ARG, libxlError(VIR_ERR_INVALID_ARG, "%s",
_("this disk doesn't support update")); _("this disk doesn't support update"));
goto cleanup; goto cleanup;
} }
@ -3378,12 +3378,14 @@ libxlNodeGetFreeMemory(virConnectPtr conn)
libxlDriverPrivatePtr driver = conn->privateData; libxlDriverPrivatePtr driver = conn->privateData;
if (libxl_get_physinfo(&driver->ctx, &phy_info)) { if (libxl_get_physinfo(&driver->ctx, &phy_info)) {
libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_physinfo_info failed")); libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("libxl_get_physinfo_info failed"));
return 0; return 0;
} }
if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) { if ((ver_info = libxl_get_version_info(&driver->ctx)) == NULL) {
libxlError(VIR_ERR_INTERNAL_ERROR, _("libxl_get_version_info failed")); libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("libxl_get_version_info failed"));
return 0; return 0;
} }
@ -3621,7 +3623,7 @@ libxlDomainGetSchedulerParametersFlags(virDomainPtr dom,
} }
if (sched_id != XEN_SCHEDULER_CREDIT) { if (sched_id != XEN_SCHEDULER_CREDIT) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Only 'credit' scheduler is supported")); _("Only 'credit' scheduler is supported"));
goto cleanup; goto cleanup;
} }
@ -3707,7 +3709,7 @@ libxlDomainSetSchedulerParametersFlags(virDomainPtr dom,
} }
if (sched_id != XEN_SCHEDULER_CREDIT) { if (sched_id != XEN_SCHEDULER_CREDIT) {
libxlError(VIR_ERR_INTERNAL_ERROR, libxlError(VIR_ERR_INTERNAL_ERROR, "%s",
_("Only 'credit' scheduler is supported")); _("Only 'credit' scheduler is supported"));
goto cleanup; goto cleanup;
} }