[libvirt] [snmp PATCH 18/20] libvirtSnmp: Report libvirt errors if no domain is found

Michal Privoznik posted 20 patches 5 years, 5 months ago
[libvirt] [snmp PATCH 18/20] libvirtSnmp: Report libvirt errors if no domain is found
Posted by Michal Privoznik 5 years, 5 months ago
Instead of plain printf(), report proper libvirt error.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/libvirtSnmp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/libvirtSnmp.c b/src/libvirtSnmp.c
index 2f2f406..c334967 100644
--- a/src/libvirtSnmp.c
+++ b/src/libvirtSnmp.c
@@ -322,7 +322,7 @@ libvirtSnmpCreate(unsigned char *uuid, int state)
     }
 
     if (!(dom = virDomainLookupByUUID(conn, uuid))) {
-        printf("Cannot find domain to create\n");
+        printLibvirtError("No such domain");
         return -1;
     }
 
@@ -344,7 +344,7 @@ libvirtSnmpDestroy(unsigned char *uuid)
     int ret = -1;
 
     if (!(dom = virDomainLookupByUUID(conn, uuid))) {
-        printf("Cannot find domain to destroy\n");
+        printLibvirtError("No such domain");
         return -1;
     }
 
@@ -366,7 +366,7 @@ libvirtSnmpChangeState(unsigned char *uuid, int newstate, int oldstate)
     int ret = -1;
 
     if (!(dom = virDomainLookupByUUID(conn, uuid))) {
-        printf("Cannot find domain to change\n");
+        printLibvirtError("No such domain");
         return 1;
     }
 
-- 
2.18.1

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