# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1172445434 0
# Node ID e71b277f1533df03a3c51641552308d10aa4e0f0
# Parent cfd23ac1b32a2a7538eeb68f5b86ebbe059866ff
Replace VM.tools_version with a richer VM_guest_metrics class.
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
docs/xen-api/xenapi-datamodel.tex | 411 +++++++++++++++++++++--
tools/libxen/include/xen_vm.h | 17
tools/libxen/include/xen_vm_guest_metrics.h | 227 ++++++++++++
tools/libxen/include/xen_vm_guest_metrics_decl.h | 30 +
tools/libxen/src/xen_vm.c | 47 +-
tools/libxen/src/xen_vm_guest_metrics.c | 261 ++++++++++++++
6 files changed, 929 insertions(+), 64 deletions(-)
diff -r cfd23ac1b32a -r e71b277f1533 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 22:47:29 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:17:14 2007 +0000
@@ -26,6 +26,7 @@ Name & Description \\
{\tt task} & A long-running asynchronous task \\
{\tt VM} & A virtual machine (or 'guest') \\
{\tt VM\_metrics} & The metrics associated with a VM \\
+{\tt VM\_guest\_metrics} & The metrics reported by the guest (as opposed to
inferred from outside) \\
{\tt host} & A physical host \\
{\tt host\_metrics} & The metrics associated with a host \\
{\tt host\_cpu} & A physical CPU \\
@@ -1098,11 +1099,11 @@ Quals & Field & Type & Description \\
$\mathit{RW}$ & {\tt platform/clock\_offset} & bool & timeshift applied to
guest's clock \\
$\mathit{RW}$ & {\tt platform/enable\_audio} & bool & emulate audio \\
$\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for
pass-through devices \\
-$\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$
string) Map & versions of installed paravirtualised drivers \\
$\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map &
additional configuration \\
$\mathit{RO}_\mathit{run}$ & {\tt domid} & int & domain ID (if available, -1
otherwise) \\
$\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this
is a control domain (domain 0 or a driver domain) \\
$\mathit{RO}_\mathit{run}$ & {\tt metrics} & VM\_metrics ref & metrics
associated with this VM. \\
+$\mathit{RO}_\mathit{run}$ & {\tt guest\_metrics} & VM\_guest\_metrics ref &
metrics associated with the running guest \\
\hline
\end{longtable}
\subsection{Additional RPCs associated with class: VM}
@@ -3801,38 +3802,6 @@ value of the field
\vspace{0.3cm}
\vspace{0.3cm}
\vspace{0.3cm}
-\subsubsection{RPC name:~get\_tools\_version}
-
-{\bf Overview:}
-Get the tools\_version field of the given VM.
-
- \noindent {\bf Signature:}
-\begin{verbatim} ((string -> string) Map) get_tools_version (session_id s, VM
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 ref } & self & reference to the object \\ \hline
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \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\_other\_config}
{\bf Overview:}
@@ -4059,6 +4028,38 @@ Get the metrics field of the given VM.
\noindent {\bf Return Type:}
{\tt
VM\_metrics ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_guest\_metrics}
+
+{\bf Overview:}
+Get the guest\_metrics field of the given VM.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_guest_metrics ref) get_guest_metrics (session_id s, VM
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 ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM\_guest\_metrics ref
}
@@ -4432,6 +4433,350 @@ Get a record containing the current stat
\noindent {\bf Return Type:}
{\tt
VM\_metrics record
+}
+
+
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
+\section{Class: VM\_guest\_metrics}
+\subsection{Fields for class: VM\_guest\_metrics}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM\_guest\_metrics} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The metrics reported by the guest (as opposed to inferred from outside).}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object
reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & VM to which these metrics
apply \\
+$\mathit{RO}_\mathit{run}$ & {\tt os\_version} & (string $\rightarrow$
string) Map & version of the OS \\
+$\mathit{RO}_\mathit{run}$ & {\tt PV\_drivers\_version} & (string
$\rightarrow$ string) Map & version of the PV drivers \\
+$\mathit{RO}_\mathit{run}$ & {\tt memory} & (string $\rightarrow$ string) Map
& free/used/total memory \\
+$\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 \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: VM\_guest\_metrics}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (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
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VM}
+
+{\bf Overview:}
+Get the VM field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM ref) get_VM (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
+VM ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_os\_version}
+
+{\bf Overview:}
+Get the os\_version field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_os_version (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PV\_drivers\_version}
+
+{\bf Overview:}
+Get the PV\_drivers\_version field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_PV_drivers_version (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory}
+
+{\bf Overview:}
+Get the memory field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_memory (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_disks}
+
+{\bf Overview:}
+Get the disks field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_disks (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_networks}
+
+{\bf Overview:}
+Get the networks field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_networks (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_other}
+
+{\bf Overview:}
+Get the other field of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_other (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
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_by\_uuid}
+
+{\bf Overview:}
+Get a reference to the VM\_guest\_metrics instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_guest_metrics ref) get_by_uuid (session_id s, string
uuid)\end{verbatim}
+
+
+\noindent{\bf Arguments:}
+
+
+\vspace{0.3cm}
+\begin{tabular}{|c|c|p{7cm}|}
+ \hline
+{\bf type} & {\bf name} & {\bf description} \\ \hline
+{\tt string } & uuid & UUID of object to return \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+VM\_guest\_metrics ref
+}
+
+
+reference to the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_record}
+
+{\bf Overview:}
+Get a record containing the current state of the given VM\_guest\_metrics.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (VM_guest_metrics record) get_record (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
+VM\_guest\_metrics record
}
diff -r cfd23ac1b32a -r e71b277f1533 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h Sun Feb 25 22:47:29 2007 +0000
+++ b/tools/libxen/include/xen_vm.h Sun Feb 25 23:17:14 2007 +0000
@@ -30,6 +30,7 @@
#include "xen_vdi_decl.h"
#include "xen_vif_decl.h"
#include "xen_vm_decl.h"
+#include "xen_vm_guest_metrics_decl.h"
#include "xen_vm_metrics_decl.h"
#include "xen_vm_power_state.h"
#include "xen_vtpm_decl.h"
@@ -144,11 +145,11 @@ typedef struct xen_vm_record
bool platform_clock_offset;
bool platform_enable_audio;
char *pci_bus;
- xen_string_string_map *tools_version;
xen_string_string_map *other_config;
int64_t domid;
bool is_control_domain;
struct xen_vm_metrics_record_opt *metrics;
+ struct xen_vm_guest_metrics_record_opt *guest_metrics;
} xen_vm_record;
/**
@@ -534,13 +535,6 @@ xen_vm_get_pci_bus(xen_session *session,
/**
- * Get the tools_version field of the given VM.
- */
-extern bool
-xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result,
xen_vm vm);
-
-
-/**
* Get the other_config field of the given VM.
*/
extern bool
@@ -566,6 +560,13 @@ xen_vm_get_is_control_domain(xen_session
*/
extern bool
xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm);
+
+
+/**
+ * Get the guest_metrics field of the given VM.
+ */
+extern bool
+xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result,
xen_vm vm);
/**
diff -r cfd23ac1b32a -r e71b277f1533 tools/libxen/include/xen_vm_guest_metrics.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_guest_metrics.h Sun Feb 25 23:17:14
2007 +0000
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_GUEST_METRICS_H
+#define XEN_VM_GUEST_METRICS_H
+
+#include "xen_common.h"
+#include "xen_string_string_map.h"
+#include "xen_vm_decl.h"
+#include "xen_vm_guest_metrics_decl.h"
+
+
+/*
+ * The VM_guest_metrics class.
+ *
+ * The metrics reported by the guest (as opposed to inferred from outside).
+ */
+
+
+/**
+ * Free the given xen_vm_guest_metrics. The given handle must have
+ * been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics);
+
+
+typedef struct xen_vm_guest_metrics_set
+{
+ size_t size;
+ xen_vm_guest_metrics *contents[];
+} xen_vm_guest_metrics_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_set of the given size.
+ */
+extern xen_vm_guest_metrics_set *
+xen_vm_guest_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_set. The given set must have
+ * been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set);
+
+
+typedef struct xen_vm_guest_metrics_record
+{
+ xen_vm_guest_metrics handle;
+ char *uuid;
+ struct xen_vm_record_opt *vm;
+ xen_string_string_map *os_version;
+ xen_string_string_map *pv_drivers_version;
+ xen_string_string_map *memory;
+ xen_string_string_map *disks;
+ xen_string_string_map *networks;
+ xen_string_string_map *other;
+} xen_vm_guest_metrics_record;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record.
+ */
+extern xen_vm_guest_metrics_record *
+xen_vm_guest_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vm_guest_metrics_record, and all referenced
+ * values. The given record must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record);
+
+
+typedef struct xen_vm_guest_metrics_record_opt
+{
+ bool is_record;
+ union
+ {
+ xen_vm_guest_metrics handle;
+ xen_vm_guest_metrics_record *record;
+ } u;
+} xen_vm_guest_metrics_record_opt;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_opt.
+ */
+extern xen_vm_guest_metrics_record_opt *
+xen_vm_guest_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_opt, and all referenced
+ * values. The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt
*record_opt);
+
+
+typedef struct xen_vm_guest_metrics_record_set
+{
+ size_t size;
+ xen_vm_guest_metrics_record *contents[];
+} xen_vm_guest_metrics_record_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_set of the given size.
+ */
+extern xen_vm_guest_metrics_record_set *
+xen_vm_guest_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_set, and all referenced
+ * values. The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set);
+
+
+
+typedef struct xen_vm_guest_metrics_record_opt_set
+{
+ size_t size;
+ xen_vm_guest_metrics_record_opt *contents[];
+} xen_vm_guest_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vm_guest_metrics_record_opt_set of the given size.
+ */
+extern xen_vm_guest_metrics_record_opt_set *
+xen_vm_guest_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_guest_metrics_record_opt_set, and all
+ * referenced values. The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set
*set);
+
+
+/**
+ * Get a record containing the current state of the given
+ * VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_record(xen_session *session,
xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get a reference to the VM_guest_metrics instance with the specified
+ * UUID.
+ */
+extern bool
+xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics
*result, char *uuid);
+
+
+/**
+ * Get the uuid field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_uuid(xen_session *session, char **result,
xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the VM field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_vm(xen_session *session, xen_vm *result,
xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the os_version field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_os_version(xen_session *session,
xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the PV_drivers_version field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session,
xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the memory field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the disks field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the networks field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+/**
+ * Get the other field of the given VM_guest_metrics.
+ */
+extern bool
+xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map
**result, xen_vm_guest_metrics vm_guest_metrics);
+
+
+#endif
diff -r cfd23ac1b32a -r e71b277f1533
tools/libxen/include/xen_vm_guest_metrics_decl.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_guest_metrics_decl.h Sun Feb 25 23:17:14
2007 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+#ifndef XEN_VM_GUEST_METRICS_DECL_H
+#define XEN_VM_GUEST_METRICS_DECL_H
+
+typedef void *xen_vm_guest_metrics;
+
+struct xen_vm_guest_metrics_set;
+struct xen_vm_guest_metrics_record;
+struct xen_vm_guest_metrics_record_set;
+struct xen_vm_guest_metrics_record_opt;
+struct xen_vm_guest_metrics_record_opt_set;
+
+#endif
diff -r cfd23ac1b32a -r e71b277f1533 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Sun Feb 25 22:47:29 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Sun Feb 25 23:17:14 2007 +0000
@@ -32,6 +32,7 @@
#include "xen_vdi.h"
#include "xen_vif.h"
#include "xen_vm.h"
+#include "xen_vm_guest_metrics.h"
#include "xen_vm_metrics.h"
#include "xen_vm_power_state_internal.h"
#include "xen_vtpm.h"
@@ -162,9 +163,6 @@ static const struct_member xen_vm_record
{ .key = "PCI_bus",
.type = &abstract_type_string,
.offset = offsetof(xen_vm_record, pci_bus) },
- { .key = "tools_version",
- .type = &abstract_type_string_string_map,
- .offset = offsetof(xen_vm_record, tools_version) },
{ .key = "other_config",
.type = &abstract_type_string_string_map,
.offset = offsetof(xen_vm_record, other_config) },
@@ -176,7 +174,10 @@ static const struct_member xen_vm_record
.offset = offsetof(xen_vm_record, is_control_domain) },
{ .key = "metrics",
.type = &abstract_type_ref,
- .offset = offsetof(xen_vm_record, metrics) }
+ .offset = offsetof(xen_vm_record, metrics) },
+ { .key = "guest_metrics",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vm_record, guest_metrics) }
};
const abstract_type xen_vm_record_abstract_type_ =
@@ -218,9 +219,9 @@ xen_vm_record_free(xen_vm_record *record
xen_string_string_map_free(record->hvm_boot_params);
free(record->platform_serial);
free(record->pci_bus);
- xen_string_string_map_free(record->tools_version);
xen_string_string_map_free(record->other_config);
xen_vm_metrics_record_opt_free(record->metrics);
+ xen_vm_guest_metrics_record_opt_free(record->guest_metrics);
free(record);
}
@@ -922,7 +923,7 @@ xen_vm_get_pci_bus(xen_session *session,
bool
-xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result,
xen_vm vm)
+xen_vm_get_other_config(xen_session *session, xen_string_string_map **result,
xen_vm vm)
{
abstract_value param_values[] =
{
@@ -933,23 +934,6 @@ xen_vm_get_tools_version(xen_session *se
abstract_type result_type = abstract_type_string_string_map;
*result = NULL;
- XEN_CALL_("VM.get_tools_version");
- return session->ok;
-}
-
-
-bool
-xen_vm_get_other_config(xen_session *session, xen_string_string_map **result,
xen_vm vm)
-{
- abstract_value param_values[] =
- {
- { .type = &abstract_type_string,
- .u.string_val = vm }
- };
-
- abstract_type result_type = abstract_type_string_string_map;
-
- *result = NULL;
XEN_CALL_("VM.get_other_config");
return session->ok;
}
@@ -1000,6 +984,23 @@ xen_vm_get_metrics(xen_session *session,
*result = NULL;
XEN_CALL_("VM.get_metrics");
+ return session->ok;
+}
+
+
+bool
+xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result,
xen_vm vm)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = vm }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VM.get_guest_metrics");
return session->ok;
}
diff -r cfd23ac1b32a -r e71b277f1533 tools/libxen/src/xen_vm_guest_metrics.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_vm_guest_metrics.c Sun Feb 25 23:17:14 2007 +0000
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 2006-2007, XenSource Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "xen_common.h"
+#include "xen_internal.h"
+#include "xen_string_string_map.h"
+#include "xen_vm.h"
+#include "xen_vm_guest_metrics.h"
+
+
+XEN_FREE(xen_vm_guest_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_guest_metrics)
+XEN_ALLOC(xen_vm_guest_metrics_record)
+XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record)
+XEN_ALLOC(xen_vm_guest_metrics_record_opt)
+XEN_RECORD_OPT_FREE(xen_vm_guest_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record_opt)
+
+
+static const struct_member xen_vm_guest_metrics_record_struct_members[] =
+ {
+ { .key = "uuid",
+ .type = &abstract_type_string,
+ .offset = offsetof(xen_vm_guest_metrics_record, uuid) },
+ { .key = "VM",
+ .type = &abstract_type_ref,
+ .offset = offsetof(xen_vm_guest_metrics_record, vm) },
+ { .key = "os_version",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, os_version) },
+ { .key = "PV_drivers_version",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, pv_drivers_version)
},
+ { .key = "memory",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, memory) },
+ { .key = "disks",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, disks) },
+ { .key = "networks",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, networks) },
+ { .key = "other",
+ .type = &abstract_type_string_string_map,
+ .offset = offsetof(xen_vm_guest_metrics_record, other) }
+ };
+
+const abstract_type xen_vm_guest_metrics_record_abstract_type_ =
+ {
+ .typename = STRUCT,
+ .struct_size = sizeof(xen_vm_guest_metrics_record),
+ .member_count =
+ sizeof(xen_vm_guest_metrics_record_struct_members) /
sizeof(struct_member),
+ .members = xen_vm_guest_metrics_record_struct_members
+ };
+
+
+void
+xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record)
+{
+ if (record == NULL)
+ {
+ return;
+ }
+ free(record->handle);
+ free(record->uuid);
+ xen_vm_record_opt_free(record->vm);
+ xen_string_string_map_free(record->os_version);
+ xen_string_string_map_free(record->pv_drivers_version);
+ xen_string_string_map_free(record->memory);
+ xen_string_string_map_free(record->disks);
+ xen_string_string_map_free(record->networks);
+ xen_string_string_map_free(record->other);
+ free(record);
+}
+
+
+bool
+xen_vm_guest_metrics_get_record(xen_session *session,
xen_vm_guest_metrics_record **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 = xen_vm_guest_metrics_record_abstract_type_;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_record");
+
+ if (session->ok)
+ {
+ (*result)->handle = xen_strdup_((*result)->uuid);
+ }
+
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics
*result, char *uuid)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = uuid }
+ };
+
+ abstract_type result_type = abstract_type_string;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_by_uuid");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_vm(xen_session *session, xen_vm *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_string;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_VM");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_os_version(xen_session *session,
xen_string_string_map **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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_os_version");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session,
xen_string_string_map **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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_PV_drivers_version");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map
**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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_memory");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map
**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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_disks");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map
**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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_networks");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map
**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_string_string_map;
+
+ *result = NULL;
+ XEN_CALL_("VM_guest_metrics.get_other");
+ return session->ok;
+}
+
+
+bool
+xen_vm_guest_metrics_get_uuid(xen_session *session, char **result,
xen_vm_guest_metrics vm_guest_metrics)
+{
+ *result = session->ok ? xen_strdup_((char *)vm_guest_metrics) : NULL;
+ return session->ok;
+}
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|