[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Add a last_updated field to every metrics class.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1174656449 0 # Node ID 678b8838d361c5d5469219334d9941526978b377 # Parent 931c4b77ea7dc244145250b128f8010cd6e22b18 Add a last_updated field to every metrics class. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- docs/xen-api/xenapi-datamodel.tex | 198 ++++++++++++++++++++++++++++ tools/libxen/include/xen_host_metrics.h | 8 + tools/libxen/include/xen_pif_metrics.h | 8 + tools/libxen/include/xen_vbd_metrics.h | 8 + tools/libxen/include/xen_vif_metrics.h | 8 + tools/libxen/include/xen_vm_guest_metrics.h | 8 + tools/libxen/include/xen_vm_metrics.h | 8 + tools/libxen/src/xen_host_metrics.c | 21 ++ tools/libxen/src/xen_pif_metrics.c | 21 ++ tools/libxen/src/xen_vbd_metrics.c | 21 ++ tools/libxen/src/xen_vif_metrics.c | 21 ++ tools/libxen/src/xen_vm_guest_metrics.c | 21 ++ tools/libxen/src/xen_vm_metrics.c | 21 ++ tools/libxen/test/test_bindings.c | 5 tools/python/xen/xend/XendAPI.py | 86 +++++------- tools/python/xen/xend/XendPIFMetrics.py | 4 tools/python/xen/xend/XendVMMetrics.py | 2 17 files changed, 417 insertions(+), 52 deletions(-) diff -r 931c4b77ea7d -r 678b8838d361 docs/xen-api/xenapi-datamodel.tex --- a/docs/xen-api/xenapi-datamodel.tex Fri Mar 23 13:26:08 2007 +0000 +++ b/docs/xen-api/xenapi-datamodel.tex Fri Mar 23 13:27:29 2007 +0000 @@ -3983,6 +3983,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual memory (bytes) \\ $\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 last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: VM\_metrics} @@ -4128,6 +4129,38 @@ Get the VCPUs/utilisation field of the g \noindent {\bf Return Type:} {\tt (int $\rightarrow$ float) Map +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given VM\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (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 +datetime } @@ -4219,6 +4252,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt disks} & (string $\rightarrow$ string) Map & disk configuration/free space \\ $\mathit{RO}_\mathit{run}$ & {\tt networks} & (string $\rightarrow$ string) Map & network configuration \\ $\mathit{RO}_\mathit{run}$ & {\tt other} & (string $\rightarrow$ string) Map & anything else \\ +$\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: VM\_guest\_metrics} @@ -4460,6 +4494,38 @@ Get the other field of the given VM\_gue \noindent {\bf Return Type:} {\tt (string $\rightarrow$ string) Map +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given VM\_guest\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (session_id s, VM_guest_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\_guest\_metrics ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +datetime } @@ -5816,6 +5882,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ $\mathit{RO}_\mathit{run}$ & {\tt memory/total} & int & Host's total memory (bytes) \\ $\mathit{RO}_\mathit{run}$ & {\tt memory/free} & int & Host's free memory (bytes) \\ +$\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: host\_metrics} @@ -5929,6 +5996,38 @@ Get the memory/free field of the given h \noindent {\bf Return Type:} {\tt int +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given host\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (session_id s, host_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 host\_metrics ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +datetime } @@ -7745,6 +7844,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ $\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\ $\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\ +$\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: VIF\_metrics} @@ -7858,6 +7958,38 @@ Get the io/write\_kbs field of the given \noindent {\bf Return Type:} {\tt float +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given VIF\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (session_id s, VIF_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 VIF\_metrics ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +datetime } @@ -8522,6 +8654,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ $\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\ $\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\ +$\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: PIF\_metrics} @@ -8635,6 +8768,38 @@ Get the io/write\_kbs field of the given \noindent {\bf Return Type:} {\tt float +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given PIF\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (session_id s, PIF_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 PIF\_metrics ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +datetime } @@ -11293,6 +11458,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ $\mathit{RO}_\mathit{run}$ & {\tt io/read\_kbs} & float & Read bandwidth (KiB/s) \\ $\mathit{RO}_\mathit{run}$ & {\tt io/write\_kbs} & float & Write bandwidth (KiB/s) \\ +$\mathit{RO}_\mathit{run}$ & {\tt last\_updated} & datetime & Time at which this information was last updated \\ \hline \end{longtable} \subsection{RPCs associated with class: VBD\_metrics} @@ -11406,6 +11572,38 @@ Get the io/write\_kbs field of the given \noindent {\bf Return Type:} {\tt float +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_last\_updated} + +{\bf Overview:} +Get the last\_updated field of the given VBD\_metrics. + + \noindent {\bf Signature:} +\begin{verbatim} datetime get_last_updated (session_id s, VBD_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 VBD\_metrics ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +datetime } diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_host_metrics.h --- a/tools/libxen/include/xen_host_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_host_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -64,6 +64,7 @@ typedef struct xen_host_metrics_record char *uuid; int64_t memory_total; int64_t memory_free; + time_t last_updated; } xen_host_metrics_record; /** @@ -182,6 +183,13 @@ xen_host_metrics_get_memory_free(xen_ses /** + * Get the last_updated field of the given host_metrics. + */ +extern bool +xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics); + + +/** * Return a list of all the host_metrics instances known to the system. */ extern bool diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_pif_metrics.h --- a/tools/libxen/include/xen_pif_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_pif_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -64,6 +64,7 @@ typedef struct xen_pif_metrics_record char *uuid; double io_read_kbs; double io_write_kbs; + time_t last_updated; } xen_pif_metrics_record; /** @@ -181,6 +182,13 @@ xen_pif_metrics_get_io_write_kbs(xen_ses /** + * Get the last_updated field of the given PIF_metrics. + */ +extern bool +xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics); + + +/** * Return a list of all the PIF_metrics instances known to the system. */ extern bool diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_vbd_metrics.h --- a/tools/libxen/include/xen_vbd_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_vbd_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -64,6 +64,7 @@ typedef struct xen_vbd_metrics_record char *uuid; double io_read_kbs; double io_write_kbs; + time_t last_updated; } xen_vbd_metrics_record; /** @@ -181,6 +182,13 @@ xen_vbd_metrics_get_io_write_kbs(xen_ses /** + * Get the last_updated field of the given VBD_metrics. + */ +extern bool +xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics); + + +/** * Return a list of all the VBD_metrics instances known to the system. */ extern bool diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_vif_metrics.h --- a/tools/libxen/include/xen_vif_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_vif_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -64,6 +64,7 @@ typedef struct xen_vif_metrics_record char *uuid; double io_read_kbs; double io_write_kbs; + time_t last_updated; } xen_vif_metrics_record; /** @@ -181,6 +182,13 @@ xen_vif_metrics_get_io_write_kbs(xen_ses /** + * Get the last_updated field of the given VIF_metrics. + */ +extern bool +xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics); + + +/** * Return a list of all the VIF_metrics instances known to the system. */ extern bool diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_vm_guest_metrics.h --- a/tools/libxen/include/xen_vm_guest_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_vm_guest_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -69,6 +69,7 @@ typedef struct xen_vm_guest_metrics_reco xen_string_string_map *disks; xen_string_string_map *networks; xen_string_string_map *other; + time_t last_updated; } xen_vm_guest_metrics_record; /** @@ -216,6 +217,13 @@ xen_vm_guest_metrics_get_other(xen_sessi /** + * Get the last_updated field of the given VM_guest_metrics. + */ +extern bool +xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics); + + +/** * Return a list of all the VM_guest_metrics instances known to the * system. */ diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/include/xen_vm_metrics.h --- a/tools/libxen/include/xen_vm_metrics.h Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/include/xen_vm_metrics.h Fri Mar 23 13:27:29 2007 +0000 @@ -66,6 +66,7 @@ typedef struct xen_vm_metrics_record int64_t memory_actual; int64_t vcpus_number; xen_int_float_map *vcpus_utilisation; + time_t last_updated; } xen_vm_metrics_record; /** @@ -190,6 +191,13 @@ xen_vm_metrics_get_vcpus_utilisation(xen /** + * Get the last_updated field of the given VM_metrics. + */ +extern bool +xen_vm_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_metrics vm_metrics); + + +/** * Return a list of all the VM_metrics instances known to the system. */ extern bool diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_host_metrics.c --- a/tools/libxen/src/xen_host_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_host_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -44,7 +44,10 @@ static const struct_member xen_host_metr .offset = offsetof(xen_host_metrics_record, memory_total) }, { .key = "memory_free", .type = &abstract_type_int, - .offset = offsetof(xen_host_metrics_record, memory_free) } + .offset = offsetof(xen_host_metrics_record, memory_free) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_host_metrics_record, last_updated) } }; const abstract_type xen_host_metrics_record_abstract_type_ = @@ -143,6 +146,22 @@ xen_host_metrics_get_memory_free(xen_ses bool +xen_host_metrics_get_last_updated(xen_session *session, time_t *result, xen_host_metrics host_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = host_metrics } + }; + + abstract_type result_type = abstract_type_datetime; + + XEN_CALL_("host_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_host_metrics_get_all(xen_session *session, struct xen_host_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_pif_metrics.c --- a/tools/libxen/src/xen_pif_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_pif_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -44,7 +44,10 @@ static const struct_member xen_pif_metri .offset = offsetof(xen_pif_metrics_record, io_read_kbs) }, { .key = "io_write_kbs", .type = &abstract_type_float, - .offset = offsetof(xen_pif_metrics_record, io_write_kbs) } + .offset = offsetof(xen_pif_metrics_record, io_write_kbs) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_pif_metrics_record, last_updated) } }; const abstract_type xen_pif_metrics_record_abstract_type_ = @@ -143,6 +146,22 @@ xen_pif_metrics_get_io_write_kbs(xen_ses bool +xen_pif_metrics_get_last_updated(xen_session *session, time_t *result, xen_pif_metrics pif_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = pif_metrics } + }; + + abstract_type result_type = abstract_type_datetime; + + XEN_CALL_("PIF_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_pif_metrics_get_all(xen_session *session, struct xen_pif_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_vbd_metrics.c --- a/tools/libxen/src/xen_vbd_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_vbd_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -44,7 +44,10 @@ static const struct_member xen_vbd_metri .offset = offsetof(xen_vbd_metrics_record, io_read_kbs) }, { .key = "io_write_kbs", .type = &abstract_type_float, - .offset = offsetof(xen_vbd_metrics_record, io_write_kbs) } + .offset = offsetof(xen_vbd_metrics_record, io_write_kbs) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_vbd_metrics_record, last_updated) } }; const abstract_type xen_vbd_metrics_record_abstract_type_ = @@ -143,6 +146,22 @@ xen_vbd_metrics_get_io_write_kbs(xen_ses bool +xen_vbd_metrics_get_last_updated(xen_session *session, time_t *result, xen_vbd_metrics vbd_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vbd_metrics } + }; + + abstract_type result_type = abstract_type_datetime; + + XEN_CALL_("VBD_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_vbd_metrics_get_all(xen_session *session, struct xen_vbd_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_vif_metrics.c --- a/tools/libxen/src/xen_vif_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_vif_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -44,7 +44,10 @@ static const struct_member xen_vif_metri .offset = offsetof(xen_vif_metrics_record, io_read_kbs) }, { .key = "io_write_kbs", .type = &abstract_type_float, - .offset = offsetof(xen_vif_metrics_record, io_write_kbs) } + .offset = offsetof(xen_vif_metrics_record, io_write_kbs) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_vif_metrics_record, last_updated) } }; const abstract_type xen_vif_metrics_record_abstract_type_ = @@ -143,6 +146,22 @@ xen_vif_metrics_get_io_write_kbs(xen_ses bool +xen_vif_metrics_get_last_updated(xen_session *session, time_t *result, xen_vif_metrics vif_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vif_metrics } + }; + + abstract_type result_type = abstract_type_datetime; + + XEN_CALL_("VIF_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_vif_metrics_get_all(xen_session *session, struct xen_vif_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_vm_guest_metrics.c --- a/tools/libxen/src/xen_vm_guest_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_vm_guest_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -57,7 +57,10 @@ static const struct_member xen_vm_guest_ .offset = offsetof(xen_vm_guest_metrics_record, networks) }, { .key = "other", .type = &abstract_type_string_string_map, - .offset = offsetof(xen_vm_guest_metrics_record, other) } + .offset = offsetof(xen_vm_guest_metrics_record, other) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_vm_guest_metrics_record, last_updated) } }; const abstract_type xen_vm_guest_metrics_record_abstract_type_ = @@ -232,6 +235,22 @@ xen_vm_guest_metrics_get_other(xen_sessi bool +xen_vm_guest_metrics_get_last_updated(xen_session *session, time_t *result, xen_vm_guest_metrics vm_guest_metrics) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm_guest_metrics } + }; + + abstract_type result_type = abstract_type_datetime; + + XEN_CALL_("VM_guest_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_vm_guest_metrics_get_all(xen_session *session, struct xen_vm_guest_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/src/xen_vm_metrics.c --- a/tools/libxen/src/xen_vm_metrics.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/src/xen_vm_metrics.c Fri Mar 23 13:27:29 2007 +0000 @@ -48,7 +48,10 @@ static const struct_member xen_vm_metric .offset = offsetof(xen_vm_metrics_record, vcpus_number) }, { .key = "VCPUs_utilisation", .type = &abstract_type_int_float_map, - .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) } + .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) }, + { .key = "last_updated", + .type = &abstract_type_datetime, + .offset = offsetof(xen_vm_metrics_record, last_updated) } }; const abstract_type xen_vm_metrics_record_abstract_type_ = @@ -165,6 +168,22 @@ xen_vm_metrics_get_vcpus_utilisation(xen bool +xen_vm_metrics_get_last_updated(xen_session *session, time_t *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_datetime; + + XEN_CALL_("VM_metrics.get_last_updated"); + return session->ok; +} + + +bool xen_vm_metrics_get_all(xen_session *session, struct xen_vm_metrics_set **result) { diff -r 931c4b77ea7d -r 678b8838d361 tools/libxen/test/test_bindings.c --- a/tools/libxen/test/test_bindings.c Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/libxen/test/test_bindings.c Fri Mar 23 13:27:29 2007 +0000 @@ -592,6 +592,11 @@ static void print_vm_metrics(xen_session return; } + char time[256]; + struct tm *tm = localtime(&vm_metrics_record->last_updated); + strftime(time, 256, "Metrics updated at %c, local time.\n", tm); + printf(time); + for (size_t i = 0; i < vm_metrics_record->vcpus_utilisation->size; i++) { printf("%"PRId64" -> %lf.\n", diff -r 931c4b77ea7d -r 678b8838d361 tools/python/xen/xend/XendAPI.py --- a/tools/python/xen/xend/XendAPI.py Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/python/xen/xend/XendAPI.py Fri Mar 23 13:27:29 2007 +0000 @@ -21,6 +21,8 @@ import sys import sys import traceback import threading +import time +import xmlrpclib from xen.xend import XendDomain, XendDomainInfo, XendNode, XendDmesg from xen.xend import XendLogging, XendTaskManager @@ -76,6 +78,11 @@ def xen_api_todo(): def xen_api_todo(): """Temporary method to make sure we track down all the TODOs""" return {"Status": "Error", "ErrorDescription": XEND_ERROR_TODO} + + +def now(): + return xmlrpclib.DateTime(time.strftime("%Y%m%dT%H:%M:%S", time.gmtime())) + # --------------------------------------------------- # Python Method Decorators for input value validation @@ -850,7 +857,8 @@ class XendAPI(object): # ---------------------------------------------------------------- host_metrics_attr_ro = ['memory_total', - 'memory_free'] + 'memory_free', + 'last_updated'] host_metrics_attr_rw = [] host_metrics_methods = [] @@ -865,13 +873,17 @@ class XendAPI(object): 'uuid' : ref, 'memory_total' : self._host_metrics_get_memory_total(), 'memory_free' : self._host_metrics_get_memory_free(), + 'last_updated' : now(), }) - def host_metrics_get_memory_total(self, _, ref): + def host_metrics_get_memory_total(self, _1, _2): return xen_api_success(self._host_metrics_get_memory_total()) - def host_metrics_get_memory_free(self, _, ref): + def host_metrics_get_memory_free(self, _1, _2): return xen_api_success(self._host_metrics_get_memory_free()) + + def host_metrics_get_last_updated(self, _1, _2): + return xen_api_success(now()) def _host_metrics_get_memory_total(self): node = XendNode.instance() @@ -1012,7 +1024,8 @@ class XendAPI(object): # ---------------------------------------------------------------- PIF_metrics_attr_ro = ['io_read_kbs', - 'io_write_kbs'] + 'io_write_kbs', + 'last_updated'] PIF_metrics_attr_rw = [] PIF_methods = [] @@ -1030,6 +1043,9 @@ class XendAPI(object): def PIF_metrics_get_io_write_kbs(self, _, ref): return xen_api_success(self._PIF_metrics_get(ref).get_io_write_kbs()) + + def PIF_metrics_get_last_updated(self, _1, _2): + return xen_api_success(now()) # Xen API: Class VM @@ -1609,7 +1625,8 @@ class XendAPI(object): 'VCPUs_flags', 'VCPUs_params', 'state', - 'start_time'] + 'start_time', + 'last_updated'] VM_metrics_attr_rw = [] VM_metrics_methods = [] @@ -1645,6 +1662,9 @@ class XendAPI(object): def VM_metrics_get_state(self, _, ref): return xen_api_success(self._VM_metrics_get(ref).get_state()) + + def VM_metrics_get_last_updated(self, _1, _2): + return xen_api_success(now()) # Xen API: Class VBD @@ -1800,7 +1820,8 @@ class XendAPI(object): # ---------------------------------------------------------------- VBD_metrics_attr_ro = ['io_read_kbs', - 'io_write_kbs'] + 'io_write_kbs', + 'last_updated'] VBD_metrics_attr_rw = [] VBD_methods = [] @@ -1810,13 +1831,18 @@ class XendAPI(object): return xen_api_error(['HANDLE_INVALID', 'VBD_metrics', ref]) return xen_api_success( { 'io_read_kbs' : vm.get_dev_property('vbd', ref, 'io_read_kbs'), - 'io_write_kbs' : vm.get_dev_property('vbd', ref, 'io_write_kbs') }) + 'io_write_kbs' : vm.get_dev_property('vbd', ref, 'io_write_kbs'), + 'last_updated' : now() + }) def VBD_metrics_get_io_read_kbs(self, _, ref): return self._VBD_get(ref, 'io_read_kbs') def VBD_metrics_get_io_write_kbs(self, session, ref): return self._VBD_get(ref, 'io_write_kbs') + + def VBD_metrics_get_last_updated(self, _1, _2): + return xen_api_success(now()) # Xen API: Class VIF @@ -1934,7 +1960,8 @@ class XendAPI(object): # ---------------------------------------------------------------- VIF_metrics_attr_ro = ['io_read_kbs', - 'io_write_kbs'] + 'io_write_kbs', + 'last_updated'] VIF_metrics_attr_rw = [] VIF_methods = [] @@ -1944,13 +1971,18 @@ class XendAPI(object): return xen_api_error(['HANDLE_INVALID', 'VIF_metrics', ref]) return xen_api_success( { 'io_read_kbs' : vm.get_dev_property('vif', ref, 'io_read_kbs'), - 'io_write_kbs' : vm.get_dev_property('vif', ref, 'io_write_kbs') }) + 'io_write_kbs' : vm.get_dev_property('vif', ref, 'io_write_kbs'), + 'last_updated' : now() + }) def VIF_metrics_get_io_read_kbs(self, _, ref): return self._VIF_get(ref, 'io_read_kbs') def VIF_metrics_get_io_write_kbs(self, session, ref): return self._VIF_get(ref, 'io_write_kbs') + + def VIF_metrics_get_last_updated(self, _1, _2): + return xen_api_success(now()) # Xen API: Class VDI @@ -2424,39 +2456,3 @@ class XendAPIAsyncProxy: synchronous_method_name, session) return xen_api_success(task_uuid) - -# -# Auto generate some stubs based on XendAPI introspection -# -if __name__ == "__main__": - def output(line): - print ' ' + line - - classes = ['VDI', 'SR'] - for cls in classes: - ro_attrs = getattr(XendAPI, '%s_attr_ro' % cls, []) - rw_attrs = getattr(XendAPI, '%s_attr_rw' % cls, []) - methods = getattr(XendAPI, '%s_methods' % cls, []) - funcs = getattr(XendAPI, '%s_funcs' % cls, []) - - ref = '%s_ref' % cls - - for attr_name in ro_attrs + rw_attrs + XendAPI.Base_attr_ro: - getter_name = '%s_get_%s' % (cls, attr_name) - output('def %s(self, session, %s):' % (getter_name, ref)) - output(' return xen_api_todo()') - - for attr_name in rw_attrs + XendAPI.Base_attr_rw: - setter_name = '%s_set_%s' % (cls, attr_name) - output('def %s(self, session, %s, value):' % (setter_name, ref)) - output(' return xen_api_todo()') - - for method_name in methods + XendAPI.Base_methods: - method_full_name = '%s_%s' % (cls,method_name) - output('def %s(self, session, %s):' % (method_full_name, ref)) - output(' return xen_api_todo()') - - for func_name in funcs + XendAPI.Base_funcs: - func_full_name = '%s_%s' % (cls, func_name) - output('def %s(self, session):' % func_full_name) - output(' return xen_api_todo()') diff -r 931c4b77ea7d -r 678b8838d361 tools/python/xen/xend/XendPIFMetrics.py --- a/tools/python/xen/xend/XendPIFMetrics.py Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/python/xen/xend/XendPIFMetrics.py Fri Mar 23 13:27:29 2007 +0000 @@ -40,8 +40,10 @@ class XendPIFMetrics: return 0.0 def get_record(self): + import xen.xend.XendAPI as XendAPI return {'uuid' : self.uuid, 'PIF' : self.pif.uuid, 'io_read_kbs' : self.get_io_read_kbs(), - 'io_write_kbs' : self.get_io_write_kbs() + 'io_write_kbs' : self.get_io_write_kbs(), + 'last_updated' : XendAPI.now(), } diff -r 931c4b77ea7d -r 678b8838d361 tools/python/xen/xend/XendVMMetrics.py --- a/tools/python/xen/xend/XendVMMetrics.py Fri Mar 23 13:26:08 2007 +0000 +++ b/tools/python/xen/xend/XendVMMetrics.py Fri Mar 23 13:27:29 2007 +0000 @@ -141,6 +141,7 @@ class XendVMMetrics: return self.xend_domain_instance.info.get("start_time", -1) def get_record(self): + import xen.xend.XendAPI as XendAPI return { 'uuid' : self.uuid, 'memory_actual' : self.get_memory_actual(), 'VCPUs_number' : self.get_VCPUs_number(), @@ -150,4 +151,5 @@ class XendVMMetrics: 'VCPUs_params' : self.get_VCPUs_params(), 'start_time' : self.get_start_time(), 'state' : self.get_state(), + 'last_updated' : XendAPI.now(), } _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |