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

[Xen-changelog] [xen-unstable] Added host.capabilities field.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172446625 0
# Node ID 36702d9b2c5cffc73f431bffc109629db386f898
# Parent  e71b277f1533df03a3c51641552308d10aa4e0f0
Added host.capabilities field.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex |   33 +++++++++++++++++++++++++++++++++
 tools/libxen/include/xen_host.h   |    8 ++++++++
 tools/libxen/src/xen_host.c       |   21 +++++++++++++++++++++
 tools/libxen/test/test_bindings.c |   24 ++++++++++++++++++++++++
 tools/python/xen/xend/XendAPI.py  |    4 ++++
 tools/python/xen/xend/XendNode.py |    3 +++
 6 files changed, 93 insertions(+)

diff -r e71b277f1533 -r 36702d9b2c5c docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:17:14 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:37:05 2007 +0000
@@ -4806,6 +4806,7 @@ Quals & Field & Type & Description \\
 $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor\_implementation} & 
(string $\rightarrow$ string) Map & details of vendor implementation \\
 $\mathit{RO}_\mathit{run}$ &  {\tt software\_version} & (string $\rightarrow$ 
string) Map & version strings \\
 $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & 
additional configuration \\
+$\mathit{RO}_\mathit{run}$ &  {\tt capabilities} & string Set & Xen 
capabilities \\
 $\mathit{RO}_\mathit{run}$ &  {\tt supported\_bootloaders} & string Set & a 
list of the bootloaders installed on the machine \\
 $\mathit{RO}_\mathit{run}$ &  {\tt resident\_VMs} & (VM ref) Set & list of VMs 
currently resident on host \\
 $\mathit{RW}$ &  {\tt logging} & (string $\rightarrow$ string) Map & logging 
configuration \\
@@ -5460,6 +5461,38 @@ void
 
 
 
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_capabilities}
+
+{\bf Overview:} 
+Get the capabilities field of the given host.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (string Set) get_capabilities (session_id s, host ref 
self)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+ 
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt host ref } & self & reference to the object \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+string Set
+}
+
+
+value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
diff -r e71b277f1533 -r 36702d9b2c5c tools/libxen/include/xen_host.h
--- a/tools/libxen/include/xen_host.h   Sun Feb 25 23:17:14 2007 +0000
+++ b/tools/libxen/include/xen_host.h   Sun Feb 25 23:37:05 2007 +0000
@@ -78,6 +78,7 @@ typedef struct xen_host_record
     xen_string_string_map *api_version_vendor_implementation;
     xen_string_string_map *software_version;
     xen_string_string_map *other_config;
+    struct xen_string_set *capabilities;
     struct xen_string_set *supported_bootloaders;
     struct xen_vm_record_opt_set *resident_vms;
     xen_string_string_map *logging;
@@ -253,6 +254,13 @@ xen_host_get_other_config(xen_session *s
 
 
 /**
+ * Get the capabilities field of the given host.
+ */
+extern bool
+xen_host_get_capabilities(xen_session *session, struct xen_string_set 
**result, xen_host host);
+
+
+/**
  * Get the supported_bootloaders field of the given host.
  */
 extern bool
diff -r e71b277f1533 -r 36702d9b2c5c tools/libxen/src/xen_host.c
--- a/tools/libxen/src/xen_host.c       Sun Feb 25 23:17:14 2007 +0000
+++ b/tools/libxen/src/xen_host.c       Sun Feb 25 23:37:05 2007 +0000
@@ -70,6 +70,9 @@ static const struct_member xen_host_reco
         { .key = "other_config",
           .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_host_record, other_config) },
+        { .key = "capabilities",
+          .type = &abstract_type_string_set,
+          .offset = offsetof(xen_host_record, capabilities) },
         { .key = "supported_bootloaders",
           .type = &abstract_type_string_set,
           .offset = offsetof(xen_host_record, supported_bootloaders) },
@@ -124,6 +127,7 @@ xen_host_record_free(xen_host_record *re
     xen_string_string_map_free(record->api_version_vendor_implementation);
     xen_string_string_map_free(record->software_version);
     xen_string_string_map_free(record->other_config);
+    xen_string_set_free(record->capabilities);
     xen_string_set_free(record->supported_bootloaders);
     xen_vm_record_opt_set_free(record->resident_vms);
     xen_string_string_map_free(record->logging);
@@ -329,6 +333,23 @@ xen_host_get_other_config(xen_session *s
 
 
 bool
+xen_host_get_capabilities(xen_session *session, struct xen_string_set 
**result, xen_host host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_string_set;
+
+    *result = NULL;
+    XEN_CALL_("host.get_capabilities");
+    return session->ok;
+}
+
+
+bool
 xen_host_get_supported_bootloaders(xen_session *session, struct xen_string_set 
**result, xen_host host)
 {
     abstract_value param_values[] =
diff -r e71b277f1533 -r 36702d9b2c5c tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Sun Feb 25 23:17:14 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Sun Feb 25 23:37:05 2007 +0000
@@ -238,6 +238,22 @@ int main(int argc, char **argv)
         return 1;
     }
 
+    xen_string_set *capabilities;
+    if (!xen_host_get_capabilities(session, &capabilities, host))
+    {
+        print_error(session);
+        free(dmesg);
+        xen_string_set_free(supported_bootloaders);
+        xen_string_string_map_free(versions);
+        xen_host_free(host);
+        xen_vm_record_free(vm_record);
+        xen_uuid_bytes_free(vm_uuid_bytes);
+        xen_uuid_free(vm_uuid);
+        xen_vm_free(vm);
+        CLEANUP;
+        return 1;
+    }
+
     printf("%s.\n", vm_uuid);
 
     fprintf(stderr, "In bytes, the VM UUID is ");
@@ -261,6 +277,13 @@ int main(int argc, char **argv)
     for (size_t i = 0; i < supported_bootloaders->size; i++)
     {
         printf(" %s", supported_bootloaders->contents[i]);
+    }
+    printf("\n");
+
+    printf("Host has the following capabilities:");
+    for (size_t i = 0; i < capabilities->size; i++)
+    {
+        printf(" %s", capabilities->contents[i]);
     }
     printf("\n");
 
@@ -279,6 +302,7 @@ int main(int argc, char **argv)
     xen_string_string_map_free(versions);
     free(dmesg);
     xen_string_set_free(supported_bootloaders);
+    xen_string_set_free(capabilities);
 
     print_vm_metrics(session, vm);
     if (!session->ok)
diff -r e71b277f1533 -r 36702d9b2c5c tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Sun Feb 25 23:17:14 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Sun Feb 25 23:37:05 2007 +0000
@@ -630,6 +630,7 @@ class XendAPI(object):
                     'resident_VMs',
                     'host_CPUs',
                     'metrics',
+                    'capabilities',
                     'supported_bootloaders',
                     'API_version_major',
                     'API_version_minor',
@@ -694,6 +695,8 @@ class XendAPI(object):
         return xen_api_success(XendNode.instance().get_host_cpu_refs())
     def host_get_metrics(self, _, ref):
         return xen_api_success(XendNode.instance().host_metrics_uuid)
+    def host_get_capabilities(self, session, host_ref):
+        return xen_api_success(XendNode.instance().get_capabilities())
     def host_get_supported_bootloaders(self, session, host_ref):
         return xen_api_success(['pygrub'])
 
@@ -732,6 +735,7 @@ class XendAPI(object):
                   'resident_VMs': dom.get_domain_refs(),
                   'host_CPUs': node.get_host_cpu_refs(),
                   'metrics': node.host_metrics_uuid,
+                  'capabilities': node.get_capabilities(),
                   'supported_bootloaders': 'pygrub'}
         return xen_api_success(record)
 
diff -r e71b277f1533 -r 36702d9b2c5c tools/python/xen/xend/XendNode.py
--- a/tools/python/xen/xend/XendNode.py Sun Feb 25 23:17:14 2007 +0000
+++ b/tools/python/xen/xend/XendNode.py Sun Feb 25 23:37:05 2007 +0000
@@ -353,6 +353,9 @@ class XendNode:
     def get_uuid(self):
         return self.uuid
 
+    def get_capabilities(self):
+        return self.xc.xeninfo()['xen_caps'].split(" ")
+
     #
     # Host CPU Functions
     #

_______________________________________________
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®.