ia64/xen-unstable

changeset 14867:ed29a1d721f8

Added host.enabled flag.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author ewan@localhost.localdomain
date Mon Apr 16 16:10:39 2007 -0400 (2007-04-16)
parents 8ea56a6141dd
children 765ac13f425b
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_host.h tools/libxen/src/xen_host.c tools/python/xen/xend/XendAPI.py
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Fri Apr 13 16:54:03 2007 +0100
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Mon Apr 16 16:10:39 2007 -0400
     1.3 @@ -5086,6 +5086,7 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/minor} & int & minor version number \\
     1.5  $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor} & string & identification of vendor \\
     1.6  $\mathit{RO}_\mathit{run}$ &  {\tt API\_version/vendor\_implementation} & (string $\rightarrow$ string) Map & details of vendor implementation \\
     1.7 +$\mathit{RO}_\mathit{run}$ &  {\tt enabled} & bool & True if the host is currently enabled \\
     1.8  $\mathit{RO}_\mathit{run}$ &  {\tt software\_version} & (string $\rightarrow$ string) Map & version strings \\
     1.9  $\mathit{RW}$ &  {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\
    1.10  $\mathit{RO}_\mathit{run}$ &  {\tt capabilities} & string Set & Xen capabilities \\
    1.11 @@ -5698,6 +5699,38 @@ value of the field
    1.12  \vspace{0.3cm}
    1.13  \vspace{0.3cm}
    1.14  \vspace{0.3cm}
    1.15 +\subsubsection{RPC name:~get\_enabled}
    1.16 +
    1.17 +{\bf Overview:} 
    1.18 +Get the enabled field of the given host.
    1.19 +
    1.20 + \noindent {\bf Signature:} 
    1.21 +\begin{verbatim} bool get_enabled (session_id s, host ref self)\end{verbatim}
    1.22 +
    1.23 +
    1.24 +\noindent{\bf Arguments:}
    1.25 +
    1.26 + 
    1.27 +\vspace{0.3cm}
    1.28 +\begin{tabular}{|c|c|p{7cm}|}
    1.29 + \hline
    1.30 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.31 +{\tt host ref } & self & reference to the object \\ \hline 
    1.32 +
    1.33 +\end{tabular}
    1.34 +
    1.35 +\vspace{0.3cm}
    1.36 +
    1.37 + \noindent {\bf Return Type:} 
    1.38 +{\tt 
    1.39 +bool
    1.40 +}
    1.41 +
    1.42 +
    1.43 +value of the field
    1.44 +\vspace{0.3cm}
    1.45 +\vspace{0.3cm}
    1.46 +\vspace{0.3cm}
    1.47  \subsubsection{RPC name:~get\_software\_version}
    1.48  
    1.49  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_host.h	Fri Apr 13 16:54:03 2007 +0100
     2.2 +++ b/tools/libxen/include/xen_host.h	Mon Apr 16 16:10:39 2007 -0400
     2.3 @@ -76,6 +76,7 @@ typedef struct xen_host_record
     2.4      int64_t api_version_minor;
     2.5      char *api_version_vendor;
     2.6      xen_string_string_map *api_version_vendor_implementation;
     2.7 +    bool enabled;
     2.8      xen_string_string_map *software_version;
     2.9      xen_string_string_map *other_config;
    2.10      struct xen_string_set *capabilities;
    2.11 @@ -242,6 +243,13 @@ xen_host_get_api_version_vendor_implemen
    2.12  
    2.13  
    2.14  /**
    2.15 + * Get the enabled field of the given host.
    2.16 + */
    2.17 +extern bool
    2.18 +xen_host_get_enabled(xen_session *session, bool *result, xen_host host);
    2.19 +
    2.20 +
    2.21 +/**
    2.22   * Get the software_version field of the given host.
    2.23   */
    2.24  extern bool
     3.1 --- a/tools/libxen/src/xen_host.c	Fri Apr 13 16:54:03 2007 +0100
     3.2 +++ b/tools/libxen/src/xen_host.c	Mon Apr 16 16:10:39 2007 -0400
     3.3 @@ -64,6 +64,9 @@ static const struct_member xen_host_reco
     3.4          { .key = "API_version_vendor_implementation",
     3.5            .type = &abstract_type_string_string_map,
     3.6            .offset = offsetof(xen_host_record, api_version_vendor_implementation) },
     3.7 +        { .key = "enabled",
     3.8 +          .type = &abstract_type_bool,
     3.9 +          .offset = offsetof(xen_host_record, enabled) },
    3.10          { .key = "software_version",
    3.11            .type = &abstract_type_string_string_map,
    3.12            .offset = offsetof(xen_host_record, software_version) },
    3.13 @@ -307,6 +310,22 @@ xen_host_get_api_version_vendor_implemen
    3.14  
    3.15  
    3.16  bool
    3.17 +xen_host_get_enabled(xen_session *session, bool *result, xen_host host)
    3.18 +{
    3.19 +    abstract_value param_values[] =
    3.20 +        {
    3.21 +            { .type = &abstract_type_string,
    3.22 +              .u.string_val = host }
    3.23 +        };
    3.24 +
    3.25 +    abstract_type result_type = abstract_type_bool;
    3.26 +
    3.27 +    XEN_CALL_("host.get_enabled");
    3.28 +    return session->ok;
    3.29 +}
    3.30 +
    3.31 +
    3.32 +bool
    3.33  xen_host_get_software_version(xen_session *session, xen_string_string_map **result, xen_host host)
    3.34  {
    3.35      abstract_value param_values[] =
     4.1 --- a/tools/python/xen/xend/XendAPI.py	Fri Apr 13 16:54:03 2007 +0100
     4.2 +++ b/tools/python/xen/xend/XendAPI.py	Mon Apr 16 16:10:39 2007 -0400
     4.3 @@ -876,7 +876,8 @@ class XendAPI(object):
     4.4                      'API_version_major',
     4.5                      'API_version_minor',
     4.6                      'API_version_vendor',
     4.7 -                    'API_version_vendor_implementation']
     4.8 +                    'API_version_vendor_implementation',
     4.9 +                    'enabled']
    4.10      
    4.11      host_attr_rw = ['name_label',
    4.12                      'name_description',
    4.13 @@ -933,8 +934,8 @@ class XendAPI(object):
    4.14          return xen_api_success(XEN_API_VERSION_VENDOR)
    4.15      def host_get_API_version_vendor_implementation(self, _, ref):
    4.16          return xen_api_success(XEN_API_VERSION_VENDOR_IMPLEMENTATION)
    4.17 -    def host_get_software_version(self, session, host_ref):
    4.18 -        return xen_api_success(XendNode.instance().xen_version())
    4.19 +    def host_get_enabled(self, _, _):
    4.20 +        return xen_api_success(XendDomain.instance().allow_new_domains())
    4.21      def host_get_resident_VMs(self, session, host_ref):
    4.22          return xen_api_success(XendDomain.instance().get_domain_refs())
    4.23      def host_get_PBDs(self, _, ref):