[PATCH] virNetworkLookup* functions should raise VIR_ERR_NO_NETWORK

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This small patch changes the virNetworkLookup* functions so that they raise VIR_ERR_NO_NETWORK in the case where the network cannot be found (as opposed to some other error).

It requires the VIR_ERR_NO_DOMAIN patches (see previous thread) to be applied first, or at least patch #1 from that series.

Rich.

--
Emerging Technologies, Red Hat - http://et.redhat.com/~rjones/
Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod
Street, Windsor, Berkshire, SL4 1TE, United Kingdom.  Registered in
England and Wales under Company Registration No. 03798903
diff -uprN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-domain-lookup-2/src/libvirt.c libvirt-network-lookup/src/libvirt.c
--- libvirt-domain-lookup-2/src/libvirt.c	2007-07-03 12:44:09.000000000 +0100
+++ libvirt-network-lookup/src/libvirt.c	2007-07-04 10:26:19.000000000 +0100
@@ -2330,7 +2330,8 @@ virConnectListDefinedNetworks(virConnect
  *
  * Try to lookup a network on the given hypervisor based on its name.
  *
- * Returns a new network object or NULL in case of failure
+ * Returns a new network object or NULL in case of failure.  If the
+ * domain cannot be found, then VIR_ERR_NO_NETWORK error is raised.
  */
 virNetworkPtr
 virNetworkLookupByName(virConnectPtr conn, const char *name)
@@ -2358,7 +2359,8 @@ virNetworkLookupByName(virConnectPtr con
  *
  * Try to lookup a network on the given hypervisor based on its UUID.
  *
- * Returns a new network object or NULL in case of failure
+ * Returns a new network object or NULL in case of failure.  If the
+ * domain cannot be found, then VIR_ERR_NO_NETWORK error is raised.
  */
 virNetworkPtr
 virNetworkLookupByUUID(virConnectPtr conn, const unsigned char *uuid)
@@ -2386,7 +2388,8 @@ virNetworkLookupByUUID(virConnectPtr con
  *
  * Try to lookup a network on the given hypervisor based on its UUID.
  *
- * Returns a new network object or NULL in case of failure
+ * Returns a new network object or NULL in case of failure.  If the
+ * domain cannot be found, then VIR_ERR_NO_NETWORK error is raised.
  */
 virNetworkPtr
 virNetworkLookupByUUIDString(virConnectPtr conn, const char *uuidstr)
diff -uprN --exclude=CVS --exclude=.git --exclude='*.pem' --exclude=demoCA --exclude=.gitignore --exclude='*.orig' --exclude='*.bak' libvirt-domain-lookup-2/src/qemu_driver.c libvirt-network-lookup/src/qemu_driver.c
--- libvirt-domain-lookup-2/src/qemu_driver.c	2007-07-04 10:21:04.000000000 +0100
+++ libvirt-network-lookup/src/qemu_driver.c	2007-07-04 10:28:36.000000000 +0100
@@ -2180,7 +2180,7 @@ static virNetworkPtr qemudNetworkLookupB
     virNetworkPtr net;
 
     if (!network) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no network with matching uuid");
+        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, "no network with matching uuid");
         return NULL;
     }
 
@@ -2198,7 +2198,7 @@ static virNetworkPtr qemudNetworkLookupB
     virNetworkPtr net;
 
     if (!network) {
-        qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR, "no network with matching name");
+        qemudReportError(conn, NULL, NULL, VIR_ERR_NO_NETWORK, "no network with matching name");
         return NULL;
     }
 

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

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

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]