[libvirt PATCH 0/8] Slightly reduce the number of translatable strings

*** BLURB HERE *** Ján Tomko (8): bhyve: fix typo in error message src: unify symlink creation error message bhyve: unify error message for UUID generation vbox: remove unreachable error in virVBoxSnapshotConfLoadVboxFile vbox: remove unreachable error in virVBoxSnapshotConfSaveVboxFile util: xml: remove function names from error messages Unify error message when namespaces are unsupported vbox: unify "unable to get hard disk id" message src/bhyve/bhyve_parse_command.c | 2 +- src/bhyve/bhyve_process.c | 2 +- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- src/qemu/qemu_namespace.c | 2 +- src/util/virprocess.c | 6 +++--- src/util/virxml.c | 6 +++--- src/vbox/vbox_common.c | 4 ++-- src/vbox/vbox_snapshot_conf.c | 11 ----------- 10 files changed, 15 insertions(+), 26 deletions(-) -- 2.39.2

Use the same string as in qemu_process. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/bhyve/bhyve_process.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_process.c b/src/bhyve/bhyve_process.c index eee0c4bf1d..f8f072ff03 100644 --- a/src/bhyve/bhyve_process.c +++ b/src/bhyve/bhyve_process.c @@ -145,7 +145,7 @@ virBhyveProcessStartImpl(struct _bhyveConn *driver, if (unlink(driver->pidfile) < 0 && errno != ENOENT) { virReportSystemError(errno, - _("Cannot remove state PID file %s"), + _("Cannot remove stale PID file %s"), driver->pidfile); goto cleanup; } -- 2.39.2

In some places, one quote got dropped by accident. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/libxl/libxl_driver.c | 2 +- src/lxc/lxc_driver.c | 2 +- src/qemu/qemu_driver.c | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 04e74086e6..07dcfcdc05 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -4651,7 +4651,7 @@ libxlDomainSetAutostart(virDomainPtr dom, int autostart) if (symlink(configFile, autostartLink) < 0) { virReportSystemError(errno, - _("Failed to create symlink '%s to '%s'"), + _("Failed to create symlink '%s' to '%s'"), autostartLink, configFile); goto endjob; } diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index b1d53659d7..d581372b00 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -2481,7 +2481,7 @@ static int lxcDomainSetAutostart(virDomainPtr dom, if (symlink(configFile, autostartLink) < 0) { virReportSystemError(errno, - _("Failed to create symlink '%s to '%s'"), + _("Failed to create symlink '%s' to '%s'"), autostartLink, configFile); goto endjob; } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 891f630e27..09ae893daf 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -8232,7 +8232,7 @@ static int qemuDomainSetAutostart(virDomainPtr dom, if (symlink(configFile, autostartLink) < 0) { virReportSystemError(errno, - _("Failed to create symlink '%s to '%s'"), + _("Failed to create symlink '%s' to '%s'"), autostartLink, configFile); goto endjob; } @@ -18964,7 +18964,7 @@ qemuDomainRenameCallback(virDomainObj *vm, if (symlink(new_dom_cfg_file, new_dom_autostart_link) < 0) { virReportSystemError(errno, - _("Failed to create symlink '%s to '%s'"), + _("Failed to create symlink '%s' to '%s'"), new_dom_autostart_link, new_dom_cfg_file); return -1; } -- 2.39.2

All the other places spell UUID in all caps. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/bhyve/bhyve_parse_command.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bhyve/bhyve_parse_command.c b/src/bhyve/bhyve_parse_command.c index 2a5959ba1d..4b0aaab056 100644 --- a/src/bhyve/bhyve_parse_command.c +++ b/src/bhyve/bhyve_parse_command.c @@ -947,7 +947,7 @@ bhyveParseCommandLineString(const char* nativeConfig, def->virtType = VIR_DOMAIN_VIRT_BHYVE; if (virUUIDGenerate(def->uuid) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Failed to generate uuid")); + _("Failed to generate UUID")); return NULL; } def->id = -1; -- 2.39.2

Both callers in the VirtualBox driver error out if the path can't be fetched via VirtualBox APIs and abort on coversion error from UTF-16 to UTF-8. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/vbox/vbox_snapshot_conf.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c index 2f3f48d688..a6e5fad4d2 100644 --- a/src/vbox/vbox_snapshot_conf.c +++ b/src/vbox/vbox_snapshot_conf.c @@ -576,12 +576,6 @@ virVBoxSnapshotConfLoadVboxFile(const char *filePath, ssize_t searchResultSize = 0; char *currentSnapshotAttribute = NULL; - if (filePath == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Filepath is Null")); - goto cleanup; - } - machineDescription = g_new0(virVBoxSnapshotConfMachine, 1); xml = virXMLParse(filePath, NULL, NULL, NULL, &xPathContext, NULL, false); -- 2.39.2

On 3/18/23 9:38 AM, Ján Tomko wrote:
Both callers in the VirtualBox driver error out if the path can't be fetched via VirtualBox APIs and abort on coversion error
s/coversion/conversion/
from UTF-16 to UTF-8.
Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/vbox/vbox_snapshot_conf.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c index 2f3f48d688..a6e5fad4d2 100644 --- a/src/vbox/vbox_snapshot_conf.c +++ b/src/vbox/vbox_snapshot_conf.c @@ -576,12 +576,6 @@ virVBoxSnapshotConfLoadVboxFile(const char *filePath, ssize_t searchResultSize = 0; char *currentSnapshotAttribute = NULL;
- if (filePath == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Filepath is Null")); - goto cleanup; - } - machineDescription = g_new0(virVBoxSnapshotConfMachine, 1);
xml = virXMLParse(filePath, NULL, NULL, NULL, &xPathContext, NULL, false);

Both callers in the VirtualBox driver handle the error and only call this function with a non-NULL argument. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/vbox/vbox_snapshot_conf.c | 5 ----- 1 file changed, 5 deletions(-) diff --git a/src/vbox/vbox_snapshot_conf.c b/src/vbox/vbox_snapshot_conf.c index a6e5fad4d2..78fb360e1e 100644 --- a/src/vbox/vbox_snapshot_conf.c +++ b/src/vbox/vbox_snapshot_conf.c @@ -952,11 +952,6 @@ virVBoxSnapshotConfSaveVboxFile(virVBoxSnapshotConfMachine *machine, _("Machine is null")); goto cleanup; } - if (filePath == NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Filepath is null")); - goto cleanup; - } xml = xmlNewDoc(BAD_CAST "1.0"); if (!xml) abort(); -- 2.39.2

The function name is already logged, and these can happen only as a result of a programmer error. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/util/virxml.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/util/virxml.c b/src/util/virxml.c index c0789c062c..a84048e14a 100644 --- a/src/util/virxml.c +++ b/src/util/virxml.c @@ -864,7 +864,7 @@ virXPathBoolean(const char *xpath, if ((ctxt == NULL) || (xpath == NULL)) { virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid parameter to virXPathBoolean()")); + "%s", _("Invalid parameter")); return -1; } obj = xmlXPathEval(BAD_CAST xpath, ctxt); @@ -917,7 +917,7 @@ virXPathNode(const char *xpath, if ((ctxt == NULL) || (xpath == NULL)) { virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid parameter to virXPathNode()")); + "%s", _("Invalid parameter")); return NULL; } obj = xmlXPathEval(BAD_CAST xpath, ctxt); @@ -952,7 +952,7 @@ virXPathNodeSet(const char *xpath, if ((ctxt == NULL) || (xpath == NULL)) { virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid parameter to virXPathNodeSet()")); + "%s", _("Invalid parameter")); return -1; } -- 2.39.2

Some helpers used a period at the end, others did not. Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/qemu/qemu_namespace.c | 2 +- src/util/virprocess.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_namespace.c b/src/qemu/qemu_namespace.c index 89d631ee5a..ab50f47821 100644 --- a/src/qemu/qemu_namespace.c +++ b/src/qemu/qemu_namespace.c @@ -1392,7 +1392,7 @@ qemuNamespaceMknodPaths(virDomainObj *vm G_GNUC_UNUSED, bool *created G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", - _("Namespaces are not supported on this platform.")); + _("Namespaces are not supported on this platform")); return -1; } diff --git a/src/util/virprocess.c b/src/util/virprocess.c index 39ca5de811..9143edc868 100644 --- a/src/util/virprocess.c +++ b/src/util/virprocess.c @@ -708,7 +708,7 @@ int virProcessSetNamespaces(size_t nfdlist G_GNUC_UNUSED, int *fdlist G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", - _("Namespaces are not supported on this platform.")); + _("Namespaces are not supported on this platform")); return -1; } #endif @@ -1491,7 +1491,7 @@ int virProcessSetupPrivateMountNS(void) { virReportSystemError(ENOSYS, "%s", - _("Namespaces are not supported on this platform.")); + _("Namespaces are not supported on this platform")); return -1; } @@ -1499,7 +1499,7 @@ int virProcessNamespaceAvailable(unsigned int ns G_GNUC_UNUSED) { virReportSystemError(ENOSYS, "%s", - _("Namespaces are not supported on this platform.")); + _("Namespaces are not supported on this platform")); return -1; } -- 2.39.2

Signed-off-by: Ján Tomko <jtomko@redhat.com> --- src/vbox/vbox_common.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c index 7aed421390..4a4b635fe2 100644 --- a/src/vbox/vbox_common.c +++ b/src/vbox/vbox_common.c @@ -5220,7 +5220,7 @@ vboxSnapshotRedefine(virDomainPtr dom, rc = gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get hardDisk Id")); + _("Unable to get hard disk id")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); @@ -6946,7 +6946,7 @@ vboxDomainSnapshotDeleteMetadataOnly(virDomainSnapshotPtr snapshot) rc = gVBoxAPI.UIMedium.GetId(medium, &parentiid); if (NS_FAILED(rc)) { vboxReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("Unable to get hardDisk Id")); + _("Unable to get hard disk id")); goto cleanup; } gVBoxAPI.UIID.vboxIIDToUtf8(data, &parentiid, &parentUuid); -- 2.39.2

On 3/18/23 9:38 AM, Ján Tomko wrote:
*** BLURB HERE ***
Ján Tomko (8): bhyve: fix typo in error message src: unify symlink creation error message bhyve: unify error message for UUID generation vbox: remove unreachable error in virVBoxSnapshotConfLoadVboxFile vbox: remove unreachable error in virVBoxSnapshotConfSaveVboxFile util: xml: remove function names from error messages Unify error message when namespaces are unsupported vbox: unify "unable to get hard disk id" message
Reviewed-by: Laine Stump <laine@redhat.com> (see typo in commit log message of 4/8)
participants (2)
-
Ján Tomko
-
Laine Stump