[libvirt] [PATCH v2 3/4] vmware: Add more descriptive error message on Find failure

John Ferlan posted 4 patches 7 years, 1 month ago
[libvirt] [PATCH v2 3/4] vmware: Add more descriptive error message on Find failure
Posted by John Ferlan 7 years, 1 month ago
If vmwareDomainLookupByID or vmwareDomainLookupByName fails
to find a vm, let's be a bit more descriptive by providing
the failing id or name in the error message.

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

diff --git a/src/vmware/vmware_driver.c b/src/vmware/vmware_driver.c
index 6c81e5feaa..d17fdfe3be 100644
--- a/src/vmware/vmware_driver.c
+++ b/src/vmware/vmware_driver.c
@@ -841,7 +841,8 @@ vmwareDomainLookupByID(virConnectPtr conn, int id)
     vmwareDriverUnlock(driver);
 
     if (!vm) {
-        virReportError(VIR_ERR_NO_DOMAIN, NULL);
+        virReportError(VIR_ERR_NO_DOMAIN,
+                       _("no domain with matching id '%d'"), id);
         goto cleanup;
     }
 
@@ -900,7 +901,8 @@ vmwareDomainLookupByName(virConnectPtr conn, const char *name)
     vmwareDriverUnlock(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 3/4] vmware: Add more descriptive error message on Find failure
Posted by Pavel Hrdina 7 years ago
On Mon, Apr 02, 2018 at 09:16:39AM -0400, John Ferlan wrote:
> If vmwareDomainLookupByID or vmwareDomainLookupByName fails
> to find a vm, let's be a bit more descriptive by providing
> the failing id or name in the error message.
> 
> Signed-off-by: John Ferlan <jferlan@redhat.com>
> ---
>  src/vmware/vmware_driver.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

Reviewed-by: Pavel Hrdina <phrdina@redhat.com>
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list