ia64/xen-unstable

changeset 14814:565b5662c880

Added docs and bindings for VM_metrics.state.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Apr 10 19:04:37 2007 +0100 (2007-04-10)
parents 369dfbf298ef
children f3f4f4ca6f61
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vm_metrics.h tools/libxen/src/xen_vm_metrics.c
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Wed Apr 11 18:39:05 2007 +0100
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Tue Apr 10 19:04:37 2007 +0100
     1.3 @@ -4184,6 +4184,7 @@ Quals & Field & Type & Description \\
     1.4  $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\
     1.5  $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/CPU} & (int $\rightarrow$ int) Map & VCPU to PCPU map \\
     1.6  $\mathit{RO}_\mathit{run}$ &  {\tt VCPUs/params} & (string $\rightarrow$ string) Map & The live equivalent to VM.VCPUs\_params \\
     1.7 +$\mathit{RO}_\mathit{run}$ &  {\tt state} & string Set & The state of the guest, eg blocked, dying etc \\
     1.8  $\mathit{RO}_\mathit{run}$ &  {\tt start\_time} & datetime & Time at which this VM was last booted \\
     1.9  $\mathit{RO}_\mathit{run}$ &  {\tt last\_updated} & datetime & Time at which this information was last updated \\
    1.10  \hline
    1.11 @@ -4402,6 +4403,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\_state}
    1.16 +
    1.17 +{\bf Overview:} 
    1.18 +Get the state field of the given VM\_metrics.
    1.19 +
    1.20 + \noindent {\bf Signature:} 
    1.21 +\begin{verbatim} (string Set) get_state (session_id s, VM_metrics 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 VM\_metrics 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 +string Set
    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\_start\_time}
    1.48  
    1.49  {\bf Overview:} 
     2.1 --- a/tools/libxen/include/xen_vm_metrics.h	Wed Apr 11 18:39:05 2007 +0100
     2.2 +++ b/tools/libxen/include/xen_vm_metrics.h	Tue Apr 10 19:04:37 2007 +0100
     2.3 @@ -22,6 +22,7 @@
     2.4  #include "xen_common.h"
     2.5  #include "xen_int_float_map.h"
     2.6  #include "xen_int_int_map.h"
     2.7 +#include "xen_string_set.h"
     2.8  #include "xen_string_string_map.h"
     2.9  #include "xen_vm_metrics_decl.h"
    2.10  
    2.11 @@ -70,6 +71,7 @@ typedef struct xen_vm_metrics_record
    2.12      xen_int_float_map *vcpus_utilisation;
    2.13      xen_int_int_map *vcpus_cpu;
    2.14      xen_string_string_map *vcpus_params;
    2.15 +    struct xen_string_set *state;
    2.16      time_t start_time;
    2.17      time_t last_updated;
    2.18  } xen_vm_metrics_record;
    2.19 @@ -210,6 +212,13 @@ xen_vm_metrics_get_vcpus_params(xen_sess
    2.20  
    2.21  
    2.22  /**
    2.23 + * Get the state field of the given VM_metrics.
    2.24 + */
    2.25 +extern bool
    2.26 +xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics);
    2.27 +
    2.28 +
    2.29 +/**
    2.30   * Get the start_time field of the given VM_metrics.
    2.31   */
    2.32  extern bool
     3.1 --- a/tools/libxen/src/xen_vm_metrics.c	Wed Apr 11 18:39:05 2007 +0100
     3.2 +++ b/tools/libxen/src/xen_vm_metrics.c	Tue Apr 10 19:04:37 2007 +0100
     3.3 @@ -57,6 +57,9 @@ static const struct_member xen_vm_metric
     3.4          { .key = "VCPUs_params",
     3.5            .type = &abstract_type_string_string_map,
     3.6            .offset = offsetof(xen_vm_metrics_record, vcpus_params) },
     3.7 +        { .key = "state",
     3.8 +          .type = &abstract_type_string_set,
     3.9 +          .offset = offsetof(xen_vm_metrics_record, state) },
    3.10          { .key = "start_time",
    3.11            .type = &abstract_type_datetime,
    3.12            .offset = offsetof(xen_vm_metrics_record, start_time) },
    3.13 @@ -87,6 +90,7 @@ xen_vm_metrics_record_free(xen_vm_metric
    3.14      xen_int_float_map_free(record->vcpus_utilisation);
    3.15      xen_int_int_map_free(record->vcpus_cpu);
    3.16      xen_string_string_map_free(record->vcpus_params);
    3.17 +    xen_string_set_free(record->state);
    3.18      free(record);
    3.19  }
    3.20  
    3.21 @@ -215,6 +219,23 @@ xen_vm_metrics_get_vcpus_params(xen_sess
    3.22  
    3.23  
    3.24  bool
    3.25 +xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics)
    3.26 +{
    3.27 +    abstract_value param_values[] =
    3.28 +        {
    3.29 +            { .type = &abstract_type_string,
    3.30 +              .u.string_val = vm_metrics }
    3.31 +        };
    3.32 +
    3.33 +    abstract_type result_type = abstract_type_string_set;
    3.34 +
    3.35 +    *result = NULL;
    3.36 +    XEN_CALL_("VM_metrics.get_state");
    3.37 +    return session->ok;
    3.38 +}
    3.39 +
    3.40 +
    3.41 +bool
    3.42  xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics)
    3.43  {
    3.44      abstract_value param_values[] =