[libvirt] [PATCH v2 4/5] uml: Add more specific error message on failed FindBy call

John Ferlan posted 5 patches 7 years, 1 month ago
[libvirt] [PATCH v2 4/5] uml: Add more specific error message on failed FindBy call
Posted by John Ferlan 7 years, 1 month ago
Rather than an empty failed to find, let's provide a bit more
knowledge about what we failed to find by using the name string
or the id value.

Signed-off-by: John Ferlan <jferlan@redhat.com>
---
 src/uml/uml_driver.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c
index ad526a1e6b..b81da7cb2e 100644
--- a/src/uml/uml_driver.c
+++ b/src/uml/uml_driver.c
@@ -1393,7 +1393,8 @@ static virDomainPtr umlDomainLookupByID(virConnectPtr conn,
     umlDriverUnlock(driver);
 
     if (!vm) {
-        virReportError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("no domain with matching id '%d'"), id);
         goto cleanup;
     }
 
@@ -1441,7 +1442,8 @@ static virDomainPtr umlDomainLookupByName(virConnectPtr conn,
     umlDriverUnlock(driver);
 
     if (!vm) {
-        virReportError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("no domain with matching name '%s'"), name);
         goto cleanup;
     }
 
-- 
2.13.6

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 4/5] uml: Add more specific error message on failed FindBy call
Posted by Daniel P. Berrangé 7 years ago
On Mon, Apr 02, 2018 at 09:06:15AM -0400, John Ferlan wrote:
> Rather than an empty failed to find, let's provide a bit more
> knowledge about what we failed to find by using the name string
> or the id value.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/uml/uml_driver.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list