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

Michal Privoznik mprivozn at redhat.com
Thu Oct 18 12:26:56 UTC 2018


Instead of plain printf(), report proper libvirt error.

Signed-off-by: Michal Privoznik <mprivozn at 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




More information about the libvir-list mailing list