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

[Xen-changelog] [xen-unstable] Added host.dmesg method.



# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170411917 0
# Node ID c804da44b06cf342e1500c70e6e58f638c03afd7
# Parent  dc32de8329eb52cb7739ad4aff9a0dccaa88499b
Added host.dmesg method.

Also, fixed all of the host methods, which had been broken by the introduction
of the host_metrics class.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex |   34 +++++++++++++++++++++++++++++++++-
 tools/libxen/include/xen_host.h   |    7 +++++++
 tools/libxen/src/xen_host.c       |   17 +++++++++++++++++
 tools/libxen/test/test_bindings.c |   17 +++++++++++++++++
 tools/python/xen/xend/XendAPI.py  |   10 +++++++---
 5 files changed, 81 insertions(+), 4 deletions(-)

diff -r dc32de8329eb -r c804da44b06c docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Fri Feb 02 10:07:58 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Fri Feb 02 10:25:17 2007 +0000
@@ -4664,10 +4664,42 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
+\subsubsection{RPC name:~dmesg}
+
+{\bf Overview:} 
+Get the host xen dmesg.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string dmesg (session_id s, host ref host)\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 } & host & The Host to query \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+string
+}
+
+
+dmesg string
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
 \subsubsection{RPC name:~get\_all}
 
 {\bf Overview:} 
-Return a list of all the hosts known to the system
+Return a list of all the hosts known to the system.
 
  \noindent {\bf Signature:} 
 \begin{verbatim} ((host ref) Set) get_all (session_id s)\end{verbatim}
diff -r dc32de8329eb -r c804da44b06c tools/libxen/include/xen_host.h
--- a/tools/libxen/include/xen_host.h   Fri Feb 02 10:07:58 2007 +0000
+++ b/tools/libxen/include/xen_host.h   Fri Feb 02 10:25:17 2007 +0000
@@ -394,6 +394,13 @@ xen_host_reboot(xen_session *session, xe
 
 
 /**
+ * Get the host xen dmesg.
+ */
+extern bool
+xen_host_dmesg(xen_session *session, char **result, xen_host host);
+
+
+/**
  * Return a list of all the hosts known to the system.
  */
 extern bool
diff -r dc32de8329eb -r c804da44b06c tools/libxen/src/xen_host.c
--- a/tools/libxen/src/xen_host.c       Fri Feb 02 10:07:58 2007 +0000
+++ b/tools/libxen/src/xen_host.c       Fri Feb 02 10:25:17 2007 +0000
@@ -632,6 +632,23 @@ xen_host_reboot(xen_session *session, xe
 
 
 bool
+xen_host_dmesg(xen_session *session, char **result, xen_host host)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = host }
+        };
+
+    abstract_type result_type = abstract_type_string;
+
+    *result = NULL;
+    XEN_CALL_("host.dmesg");
+    return session->ok;
+}
+
+
+bool
 xen_host_get_all(xen_session *session, struct xen_host_set **result)
 {
 
diff -r dc32de8329eb -r c804da44b06c tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Fri Feb 02 10:07:58 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Fri Feb 02 10:25:17 2007 +0000
@@ -206,6 +206,20 @@ int main(int argc, char **argv)
         return 1;
     }
 
+    char *dmesg;
+    if (!xen_host_dmesg(session, &dmesg, host))
+    {
+        print_error(session);
+        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 ");
@@ -222,6 +236,8 @@ int main(int argc, char **argv)
         printf("%s -> %s.\n", versions->contents[i].key,
                versions->contents[i].val);
     }
+
+    printf("Host dmesg follows:\n%s\n\n", dmesg);
 
     printf("%s.\n", vm_record->uuid);
 
@@ -244,6 +260,7 @@ int main(int argc, char **argv)
 
     xen_host_free(host);
     xen_string_string_map_free(versions);
+    free(dmesg);
 
 
     xen_vm new_vm = create_new_vm(session, true);
diff -r dc32de8329eb -r c804da44b06c tools/python/xen/xend/XendAPI.py
--- a/tools/python/xen/xend/XendAPI.py  Fri Feb 02 10:07:58 2007 +0000
+++ b/tools/python/xen/xend/XendAPI.py  Fri Feb 02 10:25:17 2007 +0000
@@ -22,7 +22,7 @@ import traceback
 import traceback
 import threading
 
-from xen.xend import XendDomain, XendDomainInfo, XendNode
+from xen.xend import XendDomain, XendDomainInfo, XendNode, XendDmesg
 from xen.xend import XendLogging, XendTaskManager
 
 from xen.xend.XendAuthSessions import instance as auth_manager
@@ -615,7 +615,8 @@ class XendAPI(object):
                     ('reboot', None),
                     ('shutdown', None),
                     ('add_to_other_config', None),
-                    ('remove_from_other_config', None)]
+                    ('remove_from_other_config', None),
+                    ('dmesg', 'String')]
     
     host_funcs = [('get_by_name_label', 'Set(host)')]
 
@@ -673,6 +674,9 @@ class XendAPI(object):
         if not XendDomain.instance().allow_new_domains():
             return xen_api_error(XEND_ERROR_HOST_RUNNING)
         return xen_api_error(XEND_ERROR_UNSUPPORTED)        
+
+    def host_dmesg(self, session, host_ref):
+        return xen_api_success(XendDmesg.instance().info())
 
     def host_get_record(self, session, host_ref):
         node = XendNode.instance()
@@ -737,7 +741,7 @@ class XendAPI(object):
                             'memory_free',
                             'host']
     host_metrics_attr_rw = []
-    host_methods = []
+    host_metrics_methods = []
 
     def _host_metrics_get(self, ref, f):
         return xen_api_success(getattr(node, f)())

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