# HG changeset patch
# User Kaitlin Rupert <karupert(a)us.ibm.com>
# Date 1238534753 25200
# Node ID 91ecd86e3c8799eb3b0cac91b9716c1fb6b782a9
# Parent 47050ea54020ae7dfd3ae0f936ef9bfea052d70c
Add ability to delete a virtual network pools
Signed-off-by: Kaitlin Rupert <karupert(a)us.ibm.com>
diff -r 47050ea54020 -r 91ecd86e3c87 libxkutil/pool_parsing.c
--- a/libxkutil/pool_parsing.c Tue Mar 03 19:36:36 2009 -0300
+++ b/libxkutil/pool_parsing.c Tue Mar 31 14:25:53 2009 -0700
@@ -83,6 +83,38 @@
return ret;
}
+int destroy_pool(virConnectPtr conn, const char *name, int res_type)
+{
+ int ret = 0;
+
+ if (res_type == CIM_RES_TYPE_NET) {
+
+ virNetworkPtr ptr = virNetworkLookupByName(conn, name);
+ if (ptr == NULL) {
+ CU_DEBUG("Virtual network %s is not defined", name);
+ return ret;
+ }
+
+ if (virNetworkDestroy(ptr) != 0) {
+ CU_DEBUG("Unable to destroy virtual network");
+ goto err1;
+ }
+
+ if (virNetworkUndefine(ptr) != 0) {
+ CU_DEBUG("Unable to undefine virtual network");
+ goto err1;
+ }
+
+ ret = 1;
+
+ err1:
+ virNetworkFree(ptr);
+ }
+
+
+ return ret;
+}
+
/*
* Local Variables:
* mode: C
diff -r 47050ea54020 -r 91ecd86e3c87 libxkutil/pool_parsing.h
--- a/libxkutil/pool_parsing.h Tue Mar 03 19:36:36 2009 -0300
+++ b/libxkutil/pool_parsing.h Tue Mar 31 14:25:53 2009 -0700
@@ -47,6 +47,7 @@
void cleanup_virt_pool(struct virt_pool **pool);
int define_pool(virConnectPtr conn, const char *xml, int res_type);
+int destroy_pool(virConnectPtr conn, const char *name, int res_type);
#endif