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

[Xen-changelog] [xen-unstable] Added a destroy method for each object. Based upon the code for VM.destroy



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Node ID eccbf694ba0bdd6579e626f6aa72dd8e77083a84
# Parent  e3d42ea643b0f08b1675dcb46a0ea9ca59ccbd08
Added a destroy method for each object.  Based upon the code for VM.destroy
by Jim Fehlig.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 tools/libxen/include/xen_host.h     |    7 +++++++
 tools/libxen/include/xen_host_cpu.h |    7 +++++++
 tools/libxen/include/xen_network.h  |    7 +++++++
 tools/libxen/include/xen_pif.h      |    7 +++++++
 tools/libxen/include/xen_sr.h       |    7 +++++++
 tools/libxen/include/xen_user.h     |    7 +++++++
 tools/libxen/include/xen_vbd.h      |    7 +++++++
 tools/libxen/include/xen_vdi.h      |    7 +++++++
 tools/libxen/include/xen_vif.h      |    7 +++++++
 tools/libxen/include/xen_vm.h       |    9 +++++++++
 tools/libxen/include/xen_vtpm.h     |    7 +++++++
 tools/libxen/src/xen_host.c         |   14 ++++++++++++++
 tools/libxen/src/xen_host_cpu.c     |   14 ++++++++++++++
 tools/libxen/src/xen_network.c      |   14 ++++++++++++++
 tools/libxen/src/xen_pif.c          |   14 ++++++++++++++
 tools/libxen/src/xen_sr.c           |   14 ++++++++++++++
 tools/libxen/src/xen_user.c         |   14 ++++++++++++++
 tools/libxen/src/xen_vbd.c          |   14 ++++++++++++++
 tools/libxen/src/xen_vdi.c          |   14 ++++++++++++++
 tools/libxen/src/xen_vif.c          |   14 ++++++++++++++
 tools/libxen/src/xen_vm.c           |   28 ++++++++++++++--------------
 tools/libxen/src/xen_vtpm.c         |   14 ++++++++++++++
 22 files changed, 233 insertions(+), 14 deletions(-)

diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_host.h
--- a/tools/libxen/include/xen_host.h   Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_host.h   Thu Nov 09 11:37:35 2006 +0000
@@ -175,6 +175,13 @@ xen_host_create(xen_session *session, xe
 
 
 /**
+ * Destroy the specified host instance.
+ */
+extern bool
+xen_host_destroy(xen_session *session, xen_host host);
+
+
+/**
  * Get all the host instances with the given label.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_host_cpu.h
--- a/tools/libxen/include/xen_host_cpu.h       Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_host_cpu.h       Thu Nov 09 11:37:35 2006 +0000
@@ -174,6 +174,13 @@ xen_host_cpu_create(xen_session *session
 
 
 /**
+ * Destroy the specified host_cpu instance.
+ */
+extern bool
+xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu);
+
+
+/**
  * Get the uuid field of the given host_cpu.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_network.h
--- a/tools/libxen/include/xen_network.h        Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_network.h        Thu Nov 09 11:37:35 2006 +0000
@@ -173,6 +173,13 @@ xen_network_create(xen_session *session,
 
 
 /**
+ * Destroy the specified network instance.
+ */
+extern bool
+xen_network_destroy(xen_session *session, xen_network network);
+
+
+/**
  * Get all the network instances with the given label.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_pif.h
--- a/tools/libxen/include/xen_pif.h    Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_pif.h    Thu Nov 09 11:37:35 2006 +0000
@@ -176,6 +176,13 @@ xen_pif_create(xen_session *session, xen
 
 
 /**
+ * Destroy the specified PIF instance.
+ */
+extern bool
+xen_pif_destroy(xen_session *session, xen_pif pif);
+
+
+/**
  * Get the uuid field of the given PIF.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_sr.h
--- a/tools/libxen/include/xen_sr.h     Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_sr.h     Thu Nov 09 11:37:35 2006 +0000
@@ -174,6 +174,13 @@ xen_sr_create(xen_session *session, xen_
 
 
 /**
+ * Destroy the specified SR instance.
+ */
+extern bool
+xen_sr_destroy(xen_session *session, xen_sr sr);
+
+
+/**
  * Get all the SR instances with the given label.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_user.h
--- a/tools/libxen/include/xen_user.h   Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_user.h   Thu Nov 09 11:37:35 2006 +0000
@@ -167,6 +167,13 @@ xen_user_create(xen_session *session, xe
 
 
 /**
+ * Destroy the specified user instance.
+ */
+extern bool
+xen_user_destroy(xen_session *session, xen_user user);
+
+
+/**
  * Get the uuid field of the given user.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_vbd.h
--- a/tools/libxen/include/xen_vbd.h    Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_vbd.h    Thu Nov 09 11:37:35 2006 +0000
@@ -177,6 +177,13 @@ xen_vbd_create(xen_session *session, xen
 
 
 /**
+ * Destroy the specified VBD instance.
+ */
+extern bool
+xen_vbd_destroy(xen_session *session, xen_vbd vbd);
+
+
+/**
  * Get the uuid field of the given VBD.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_vdi.h
--- a/tools/libxen/include/xen_vdi.h    Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_vdi.h    Thu Nov 09 11:37:35 2006 +0000
@@ -180,6 +180,13 @@ xen_vdi_create(xen_session *session, xen
 
 
 /**
+ * Destroy the specified VDI instance.
+ */
+extern bool
+xen_vdi_destroy(xen_session *session, xen_vdi vdi);
+
+
+/**
  * Get all the VDI instances with the given label.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_vif.h
--- a/tools/libxen/include/xen_vif.h    Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_vif.h    Thu Nov 09 11:37:35 2006 +0000
@@ -177,6 +177,13 @@ xen_vif_create(xen_session *session, xen
 
 
 /**
+ * Destroy the specified VIF instance.
+ */
+extern bool
+xen_vif_destroy(xen_session *session, xen_vif vif);
+
+
+/**
  * Get the uuid field of the given VIF.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_vm.h     Thu Nov 09 11:37:35 2006 +0000
@@ -217,6 +217,15 @@ xen_vm_create(xen_session *session, xen_
 
 
 /**
+ * Destroy the specified VM.  The VM is completely removed from the
+ * system.  This function can only be called when the VM is in the Halted
+ * State.
+ */
+extern bool
+xen_vm_destroy(xen_session *session, xen_vm vm);
+
+
+/**
  * Get all the VM instances with the given label.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/include/xen_vtpm.h
--- a/tools/libxen/include/xen_vtpm.h   Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/include/xen_vtpm.h   Thu Nov 09 11:37:35 2006 +0000
@@ -172,6 +172,13 @@ xen_vtpm_create(xen_session *session, xe
 
 
 /**
+ * Destroy the specified VTPM instance.
+ */
+extern bool
+xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm);
+
+
+/**
  * Get the uuid field of the given VTPM.
  */
 extern bool
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_host.c
--- a/tools/libxen/src/xen_host.c       Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_host.c       Thu Nov 09 11:37:35 2006 +0000
@@ -150,6 +150,20 @@ xen_host_create(xen_session *session, xe
 
 
 bool
+xen_host_destroy(xen_session *session, xen_host host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    xen_call_(session, "host.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_host_get_by_name_label(xen_session *session, struct xen_host_set **result, 
char *label)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_host_cpu.c
--- a/tools/libxen/src/xen_host_cpu.c   Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_host_cpu.c   Thu Nov 09 11:37:35 2006 +0000
@@ -150,6 +150,20 @@ xen_host_cpu_create(xen_session *session
 
 
 bool
+xen_host_cpu_destroy(xen_session *session, xen_host_cpu host_cpu)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host_cpu }
+        };
+
+    xen_call_(session, "host_cpu.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_host_cpu_get_host(xen_session *session, xen_host *result, xen_host_cpu 
host_cpu)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_network.c
--- a/tools/libxen/src/xen_network.c    Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_network.c    Thu Nov 09 11:37:35 2006 +0000
@@ -148,6 +148,20 @@ xen_network_create(xen_session *session,
 
 
 bool
+xen_network_destroy(xen_session *session, xen_network network)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = network }
+        };
+
+    xen_call_(session, "network.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_network_get_by_name_label(xen_session *session, struct xen_network_set 
**result, char *label)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_pif.c
--- a/tools/libxen/src/xen_pif.c        Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_pif.c        Thu Nov 09 11:37:35 2006 +0000
@@ -153,6 +153,20 @@ xen_pif_create(xen_session *session, xen
 
 
 bool
+xen_pif_destroy(xen_session *session, xen_pif pif)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = pif }
+        };
+
+    xen_call_(session, "PIF.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_pif_get_name(xen_session *session, char **result, xen_pif pif)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_sr.c
--- a/tools/libxen/src/xen_sr.c Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_sr.c Thu Nov 09 11:37:35 2006 +0000
@@ -152,6 +152,20 @@ xen_sr_create(xen_session *session, xen_
 
 
 bool
+xen_sr_destroy(xen_session *session, xen_sr sr)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = sr }
+        };
+
+    xen_call_(session, "SR.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, 
char *label)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_user.c
--- a/tools/libxen/src/xen_user.c       Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_user.c       Thu Nov 09 11:37:35 2006 +0000
@@ -130,6 +130,20 @@ xen_user_create(xen_session *session, xe
 
 
 bool
+xen_user_destroy(xen_session *session, xen_user user)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = user }
+        };
+
+    xen_call_(session, "user.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_user_get_short_name(xen_session *session, char **result, xen_user user)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_vbd.c
--- a/tools/libxen/src/xen_vbd.c        Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_vbd.c        Thu Nov 09 11:37:35 2006 +0000
@@ -153,6 +153,20 @@ xen_vbd_create(xen_session *session, xen
 
 
 bool
+xen_vbd_destroy(xen_session *session, xen_vbd vbd)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vbd }
+        };
+
+    xen_call_(session, "VBD.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_vdi.c
--- a/tools/libxen/src/xen_vdi.c        Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_vdi.c        Thu Nov 09 11:37:35 2006 +0000
@@ -167,6 +167,20 @@ xen_vdi_create(xen_session *session, xen
 
 
 bool
+xen_vdi_destroy(xen_session *session, xen_vdi vdi)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vdi }
+        };
+
+    xen_call_(session, "VDI.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, 
char *label)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_vif.c
--- a/tools/libxen/src/xen_vif.c        Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_vif.c        Thu Nov 09 11:37:35 2006 +0000
@@ -157,6 +157,20 @@ xen_vif_create(xen_session *session, xen
 
 
 bool
+xen_vif_destroy(xen_session *session, xen_vif vif)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vif }
+        };
+
+    xen_call_(session, "VIF.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vif_get_name(xen_session *session, char **result, xen_vif vif)
 {
     abstract_value param_values[] =
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_vm.c Thu Nov 09 11:37:35 2006 +0000
@@ -280,6 +280,20 @@ xen_vm_create(xen_session *session, xen_
 
 
 bool
+xen_vm_destroy(xen_session *session, xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    xen_call_(session, "VM.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, 
char *label)
 {
     abstract_value param_values[] =
@@ -1580,17 +1594,3 @@ xen_vm_get_uuid(xen_session *session, ch
     *result = session->ok ? xen_strdup_((char *)vm) : NULL;
     return session->ok;
 }
-
-
-bool
-xen_vm_destroy(xen_session *session, xen_vm vm)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm }
-        };
-
-    xen_call_(session, "VM.destroy", param_values, 1, NULL, NULL);
-    return session->ok;
-}
diff -r e3d42ea643b0 -r eccbf694ba0b tools/libxen/src/xen_vtpm.c
--- a/tools/libxen/src/xen_vtpm.c       Thu Nov 09 11:23:09 2006 +0000
+++ b/tools/libxen/src/xen_vtpm.c       Thu Nov 09 11:37:35 2006 +0000
@@ -139,6 +139,20 @@ xen_vtpm_create(xen_session *session, xe
 
 
 bool
+xen_vtpm_destroy(xen_session *session, xen_vtpm vtpm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vtpm }
+        };
+
+    xen_call_(session, "VTPM.destroy", param_values, 1, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vtpm_get_vm(xen_session *session, xen_vm *result, xen_vtpm vtpm)
 {
     abstract_value param_values[] =

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.