direct-io.hg

changeset 13791:c804da44b06c

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@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Fri Feb 02 10:25:17 2007 +0000 (2007-02-02)
parents dc32de8329eb
children 5c6f94192698
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_host.h tools/libxen/src/xen_host.c tools/libxen/test/test_bindings.c tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Fri Feb 02 10:07:58 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Fri Feb 02 10:25:17 2007 +0000
     1.3 @@ -4664,10 +4664,42 @@ void
     1.4  \vspace{0.3cm}
     1.5  \vspace{0.3cm}
     1.6  \vspace{0.3cm}
     1.7 +\subsubsection{RPC name:~dmesg}
     1.8 +
     1.9 +{\bf Overview:} 
    1.10 +Get the host xen dmesg.
    1.11 +
    1.12 + \noindent {\bf Signature:} 
    1.13 +\begin{verbatim} string dmesg (session_id s, host ref host)\end{verbatim}
    1.14 +
    1.15 +
    1.16 +\noindent{\bf Arguments:}
    1.17 +
    1.18 + 
    1.19 +\vspace{0.3cm}
    1.20 +\begin{tabular}{|c|c|p{7cm}|}
    1.21 + \hline
    1.22 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.23 +{\tt host ref } & host & The Host to query \\ \hline 
    1.24 +
    1.25 +\end{tabular}
    1.26 +
    1.27 +\vspace{0.3cm}
    1.28 +
    1.29 + \noindent {\bf Return Type:} 
    1.30 +{\tt 
    1.31 +string
    1.32 +}
    1.33 +
    1.34 +
    1.35 +dmesg string
    1.36 +\vspace{0.3cm}
    1.37 +\vspace{0.3cm}
    1.38 +\vspace{0.3cm}
    1.39  \subsubsection{RPC name:~get\_all}
    1.40  
    1.41  {\bf Overview:} 
    1.42 -Return a list of all the hosts known to the system
    1.43 +Return a list of all the hosts known to the system.
    1.44  
    1.45   \noindent {\bf Signature:} 
    1.46  \begin{verbatim} ((host ref) Set) get_all (session_id s)\end{verbatim}
     2.1 --- a/tools/libxen/include/xen_host.h	Fri Feb 02 10:07:58 2007 +0000
     2.2 +++ b/tools/libxen/include/xen_host.h	Fri Feb 02 10:25:17 2007 +0000
     2.3 @@ -394,6 +394,13 @@ xen_host_reboot(xen_session *session, xe
     2.4  
     2.5  
     2.6  /**
     2.7 + * Get the host xen dmesg.
     2.8 + */
     2.9 +extern bool
    2.10 +xen_host_dmesg(xen_session *session, char **result, xen_host host);
    2.11 +
    2.12 +
    2.13 +/**
    2.14   * Return a list of all the hosts known to the system.
    2.15   */
    2.16  extern bool
     3.1 --- a/tools/libxen/src/xen_host.c	Fri Feb 02 10:07:58 2007 +0000
     3.2 +++ b/tools/libxen/src/xen_host.c	Fri Feb 02 10:25:17 2007 +0000
     3.3 @@ -632,6 +632,23 @@ xen_host_reboot(xen_session *session, xe
     3.4  
     3.5  
     3.6  bool
     3.7 +xen_host_dmesg(xen_session *session, char **result, xen_host host)
     3.8 +{
     3.9 +    abstract_value param_values[] =
    3.10 +        {
    3.11 +            { .type = &abstract_type_string,
    3.12 +              .u.string_val = host }
    3.13 +        };
    3.14 +
    3.15 +    abstract_type result_type = abstract_type_string;
    3.16 +
    3.17 +    *result = NULL;
    3.18 +    XEN_CALL_("host.dmesg");
    3.19 +    return session->ok;
    3.20 +}
    3.21 +
    3.22 +
    3.23 +bool
    3.24  xen_host_get_all(xen_session *session, struct xen_host_set **result)
    3.25  {
    3.26  
     4.1 --- a/tools/libxen/test/test_bindings.c	Fri Feb 02 10:07:58 2007 +0000
     4.2 +++ b/tools/libxen/test/test_bindings.c	Fri Feb 02 10:25:17 2007 +0000
     4.3 @@ -206,6 +206,20 @@ int main(int argc, char **argv)
     4.4          return 1;
     4.5      }
     4.6  
     4.7 +    char *dmesg;
     4.8 +    if (!xen_host_dmesg(session, &dmesg, host))
     4.9 +    {
    4.10 +        print_error(session);
    4.11 +        xen_string_string_map_free(versions);
    4.12 +        xen_host_free(host);
    4.13 +        xen_vm_record_free(vm_record);
    4.14 +        xen_uuid_bytes_free(vm_uuid_bytes);
    4.15 +        xen_uuid_free(vm_uuid);
    4.16 +        xen_vm_free(vm);
    4.17 +        CLEANUP;
    4.18 +        return 1;
    4.19 +    }
    4.20 +
    4.21      printf("%s.\n", vm_uuid);
    4.22  
    4.23      fprintf(stderr, "In bytes, the VM UUID is ");
    4.24 @@ -223,6 +237,8 @@ int main(int argc, char **argv)
    4.25                 versions->contents[i].val);
    4.26      }
    4.27  
    4.28 +    printf("Host dmesg follows:\n%s\n\n", dmesg);
    4.29 +
    4.30      printf("%s.\n", vm_record->uuid);
    4.31  
    4.32      printf("Resident on %s.\n", (char *)vm_record->resident_on->u.handle);
    4.33 @@ -244,6 +260,7 @@ int main(int argc, char **argv)
    4.34  
    4.35      xen_host_free(host);
    4.36      xen_string_string_map_free(versions);
    4.37 +    free(dmesg);
    4.38  
    4.39  
    4.40      xen_vm new_vm = create_new_vm(session, true);
     5.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Feb 02 10:07:58 2007 +0000
     5.2 +++ b/tools/python/xen/xend/XendAPI.py	Fri Feb 02 10:25:17 2007 +0000
     5.3 @@ -22,7 +22,7 @@ import sys
     5.4  import traceback
     5.5  import threading
     5.6  
     5.7 -from xen.xend import XendDomain, XendDomainInfo, XendNode
     5.8 +from xen.xend import XendDomain, XendDomainInfo, XendNode, XendDmesg
     5.9  from xen.xend import XendLogging, XendTaskManager
    5.10  
    5.11  from xen.xend.XendAuthSessions import instance as auth_manager
    5.12 @@ -615,7 +615,8 @@ class XendAPI(object):
    5.13                      ('reboot', None),
    5.14                      ('shutdown', None),
    5.15                      ('add_to_other_config', None),
    5.16 -                    ('remove_from_other_config', None)]
    5.17 +                    ('remove_from_other_config', None),
    5.18 +                    ('dmesg', 'String')]
    5.19      
    5.20      host_funcs = [('get_by_name_label', 'Set(host)')]
    5.21  
    5.22 @@ -674,6 +675,9 @@ class XendAPI(object):
    5.23              return xen_api_error(XEND_ERROR_HOST_RUNNING)
    5.24          return xen_api_error(XEND_ERROR_UNSUPPORTED)        
    5.25  
    5.26 +    def host_dmesg(self, session, host_ref):
    5.27 +        return xen_api_success(XendDmesg.instance().info())
    5.28 +
    5.29      def host_get_record(self, session, host_ref):
    5.30          node = XendNode.instance()
    5.31          dom = XendDomain.instance()
    5.32 @@ -737,7 +741,7 @@ class XendAPI(object):
    5.33                              'memory_free',
    5.34                              'host']
    5.35      host_metrics_attr_rw = []
    5.36 -    host_methods = []
    5.37 +    host_metrics_methods = []
    5.38  
    5.39      def _host_metrics_get(self, ref, f):
    5.40          return xen_api_success(getattr(node, f)())