
On 05/23/2016 02:35 PM, Jovanka Gulicoska wrote:
Replace VIR_ERROR with virReportError and virReportSystemError --- src/uml/uml_driver.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 923c3f6..fea3575 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -188,8 +188,8 @@ umlAutostartDomain(virDomainObjPtr vm, ret = umlStartVMDaemon(data->conn, data->driver, vm, false); virDomainAuditStart(vm, "booted", ret >= 0); if (ret < 0) { - VIR_ERROR(_("Failed to autostart VM '%s': %s"), - vm->def->name, virGetLastErrorMessage()); + virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to autostart VM '%s': %s"), + vm->def->name, virGetLastErrorMessage()); } else { virObjectEventPtr event = virDomainEventLifecycleNewFromObj(vm, @@ -535,15 +535,15 @@ umlStateInitialize(bool privileged, goto error;
if ((uml_driver->inotifyFD = inotify_init()) < 0) { - VIR_ERROR(_("cannot initialize inotify")); + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("cannot initialize inotify")); goto error; }
if (virFileMakePath(uml_driver->monitorDir) < 0) { char ebuf[1024]; - VIR_ERROR(_("Failed to create monitor directory %s: %s"), - uml_driver->monitorDir, - virStrerror(errno, ebuf, sizeof(ebuf))); + virReportSystemError(errno, _("Failed to create monitor directory %s: %s"), + uml_driver->monitorDir, + virStrerror(errno, ebuf, sizeof(ebuf))); goto error; }
I should have explained more about virReportSystemError :) It has some magic to automatically convert errno to strerror via virStrerror and append it to the message. So the manual invocation of virStrerror here is redundant and would give a double message like: Failed to create monitor directory $dir: $strerror: $strerror So all your virReportSystemError changes should be adjusted to remove the ebuf definition, and look like for example virReportSystemError(errno, _("Failed to create monitor directory %s"), uml_driver->monitorDir); This patch looks fine otherwise though Thanks, Cole