diff options
-rw-r--r-- | docs/xen-api/xenapi-datamodel.tex | 33 | ||||
-rw-r--r-- | tools/libxen/include/xen_vm_metrics.h | 9 | ||||
-rw-r--r-- | tools/libxen/src/xen_vm_metrics.c | 21 |
3 files changed, 63 insertions, 0 deletions
diff --git a/docs/xen-api/xenapi-datamodel.tex b/docs/xen-api/xenapi-datamodel.tex index d152bcc469..a631be8a35 100644 --- a/docs/xen-api/xenapi-datamodel.tex +++ b/docs/xen-api/xenapi-datamodel.tex @@ -4184,6 +4184,7 @@ $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/number} & int & Current number of VCPUs $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\ $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/CPU} & (int $\rightarrow$ int) Map & VCPU to PCPU map \\ $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/params} & (string $\rightarrow$ string) Map & The live equivalent to VM.VCPUs\_params \\ +$\mathit{RO}_\mathit{run}$ & {\tt state} & string Set & The state of the guest, eg blocked, dying etc \\ $\mathit{RO}_\mathit{run}$ & {\tt start\_time} & datetime & Time at which this VM was last booted \\ $\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline @@ -4402,6 +4403,38 @@ value of the field \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} +\subsubsection{RPC name:~get\_state} + +{\bf Overview:} +Get the state field of the given VM\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} (string Set) get_state (session_id s, VM_metrics 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 VM\_metrics 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} \subsubsection{RPC name:~get\_start\_time} {\bf Overview:} diff --git a/tools/libxen/include/xen_vm_metrics.h b/tools/libxen/include/xen_vm_metrics.h index 4b64b5953e..6dfddf6dfd 100644 --- a/tools/libxen/include/xen_vm_metrics.h +++ b/tools/libxen/include/xen_vm_metrics.h @@ -22,6 +22,7 @@ #include "xen_common.h" #include "xen_int_float_map.h" #include "xen_int_int_map.h" +#include "xen_string_set.h" #include "xen_string_string_map.h" #include "xen_vm_metrics_decl.h" @@ -70,6 +71,7 @@ typedef struct xen_vm_metrics_record xen_int_float_map *vcpus_utilisation; xen_int_int_map *vcpus_cpu; xen_string_string_map *vcpus_params; + struct xen_string_set *state; time_t start_time; time_t last_updated; } xen_vm_metrics_record; @@ -210,6 +212,13 @@ xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **re /** + * Get the state field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics); + + +/** * Get the start_time field of the given VM_metrics. */ extern bool diff --git a/tools/libxen/src/xen_vm_metrics.c b/tools/libxen/src/xen_vm_metrics.c index bd0509bfc4..3bf2fd7c29 100644 --- a/tools/libxen/src/xen_vm_metrics.c +++ b/tools/libxen/src/xen_vm_metrics.c @@ -57,6 +57,9 @@ static const struct_member xen_vm_metrics_record_struct_members[] = { .key = "VCPUs_params", .type = &abstract_type_string_string_map, .offset = offsetof(xen_vm_metrics_record, vcpus_params) }, + { .key = "state", + .type = &abstract_type_string_set, + .offset = offsetof(xen_vm_metrics_record, state) }, { .key = "start_time", .type = &abstract_type_datetime, .offset = offsetof(xen_vm_metrics_record, start_time) }, @@ -87,6 +90,7 @@ xen_vm_metrics_record_free(xen_vm_metrics_record *record) xen_int_float_map_free(record->vcpus_utilisation); xen_int_int_map_free(record->vcpus_cpu); xen_string_string_map_free(record->vcpus_params); + xen_string_set_free(record->state); free(record); } @@ -215,6 +219,23 @@ xen_vm_metrics_get_vcpus_params(xen_session *session, xen_string_string_map **re bool +xen_vm_metrics_get_state(xen_session *session, struct xen_string_set **result, xen_vm_metrics vm_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm_metrics } + }; + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + XEN_CALL_("VM_metrics.get_state"); + return session->ok; +} + + +bool xen_vm_metrics_get_start_time(xen_session *session, time_t *result, xen_vm_metrics vm_metrics) { abstract_value param_values[] = |