WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] Added VM_metrics class, taking some of th

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] Added VM_metrics class, taking some of the fields from VM. Make VM.static_max
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2007 07:05:34 -0800
Delivery-date: Wed, 31 Jan 2007 08:04:31 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170181818 0
# Node ID 61262143a4b07687b47a444a46e5538a9744fd0f
# Parent  abd140fe5f6c16b3617e600bcf5952f1ef102a82
Added VM_metrics class, taking some of the fields from VM.  Make VM.static_max
and static_min read-write.  Added VM.VCPUs/{max,at_startup}.  Make
VM.VCPUs/params a string -> string map.

This is the modelling, the C bindings, and the message file -- Xend support to
follow.

Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
 docs/xen-api/xenapi-datamodel.tex          |  834 +++++++++++++++++++++++------
 tools/libxen/include/xen_vm.h              |   91 ++-
 tools/libxen/include/xen_vm_metrics.h      |  201 ++++++
 tools/libxen/include/xen_vm_metrics_decl.h |   30 +
 tools/libxen/src/xen_vm.c                  |  261 ++++++---
 tools/libxen/src/xen_vm_metrics.c          |  194 ++++++
 tools/libxen/test/test_bindings.c          |    3 
 tools/python/xen/xm/messages/en/xen-xm.po  |    5 
 8 files changed, 1361 insertions(+), 258 deletions(-)

diff -r abd140fe5f6c -r 61262143a4b0 docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 18:30:27 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 18:30:18 2007 +0000
@@ -25,6 +25,7 @@ Name & Description \\
 {\tt session} & A session \\
 {\tt task} & A long-running asynchronous task \\
 {\tt VM} & A virtual machine (or 'guest') \\
+{\tt VM\_metrics} & The metrics associated with a VM \\
 {\tt host} & A physical host \\
 {\tt host\_metrics} & The metrics associated with a host \\
 {\tt host\_cpu} & A physical CPU \\
@@ -60,6 +61,7 @@ VIF.network & network.VIFs & one-to-many
 VIF.network & network.VIFs & one-to-many\\
 host.metrics & host\_metrics.host & one-to-one\\
 PIF.metrics & PIF\_metrics.PIF & one-to-one\\
+VM.metrics & VM\_metrics.VM & one-to-one\\
 PIF.host & host.PIFs & one-to-many\\
 PIF.network & network.PIFs & one-to-many\\
 SR.VDIs & VDI.SR & many-to-one\\
@@ -1064,14 +1066,15 @@ Quals & Field & Type & Description \\
 $\mathit{RW}$ &  {\tt auto\_power\_on} & bool & true if this VM should be 
started automatically after host boot \\
 $\mathit{RO}_\mathit{run}$ &  {\tt suspend\_VDI} & VDI ref & The VDI that a 
suspend image is stored on. (Only has meaning if VM is currently suspended) \\
 $\mathit{RO}_\mathit{run}$ &  {\tt resident\_on} & host ref & the host the VM 
is currently resident on \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_max} & int & Statically-set 
(i.e. absolute) maximum (bytes) \\
+$\mathit{RW}$ &  {\tt memory/static\_max} & int & Statically-set (i.e. 
absolute) maximum (bytes) \\
 $\mathit{RW}$ &  {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\
-$\mathit{RO}_\mathit{run}$ &  {\tt memory/actual} & int & Guest's actual usage 
(bytes) \\
 $\mathit{RW}$ &  {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\
-$\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_min} & int & Statically-set 
(i.e. absolute) mininum (bytes) \\
+$\mathit{RW}$ &  {\tt memory/static\_min} & int & Statically-set (i.e. 
absolute) mininum (bytes) \\
 $\mathit{RW}$ &  {\tt VCPUs/policy} & string & the name of the VCPU scheduling 
policy to be applied \\
-$\mathit{RW}$ &  {\tt VCPUs/params} & string & string-encoded parameters 
passed to selected VCPU policy \\
-$\mathit{RW}$ &  {\tt VCPUs/number} & int & Current number of VCPUs \\
+$\mathit{RW}$ &  {\tt VCPUs/params} & (string $\rightarrow$ string) Map & 
configuration parameters for the selected VCPU policy \\
+$\mathit{RW}$ &  {\tt VCPUs/max} & int & Max number of VCPUs \\
+$\mathit{RW}$ &  {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\
+$\mathit{RO}_\mathit{ins}$ &  {\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{RW}$ &  {\tt actions/after\_shutdown} & on\_normal\_exit & action to 
take after the guest has shutdown itself \\
 $\mathit{RW}$ &  {\tt actions/after\_reboot} & on\_normal\_exit & action to 
take after the guest has rebooted itself \\
@@ -1096,6 +1099,7 @@ Quals & Field & Type & Description \\
 $\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 is\_control\_domain} & bool & true if this 
is a control domain (domain 0 or a driver domain) \\
+$\mathit{RO}_\mathit{ins}$ &  {\tt metrics} & VM\_metrics ref & metrics 
associated with this VM. \\
 \hline
 \end{longtable}
 \subsection{Additional RPCs associated with class: VM}
@@ -1974,6 +1978,40 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
+\subsubsection{RPC name:~set\_memory\_static\_max}
+
+{\bf Overview:} 
+Set the memory/static\_max field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_memory_static_max (session_id s, VM ref self, int 
value)\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 
+
+{\tt int } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
 \subsubsection{RPC name:~get\_memory\_dynamic\_max}
 
 {\bf Overview:} 
@@ -2040,13 +2078,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_actual}
-
-{\bf Overview:} 
-Get the memory/actual field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_memory_actual (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~get\_memory\_dynamic\_min}
+
+{\bf Overview:} 
+Get the memory/dynamic\_min field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_memory_dynamic_min (session_id s, VM ref 
self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2072,13 +2110,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_dynamic\_min}
-
-{\bf Overview:} 
-Get the memory/dynamic\_min field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_memory_dynamic_min (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~set\_memory\_dynamic\_min}
+
+{\bf Overview:} 
+Set the memory/dynamic\_min field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_memory_dynamic_min (session_id s, VM ref self, int 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2090,6 +2128,40 @@ Get the memory/dynamic\_min field of the
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VM ref } & self & reference to the object \\ \hline 
 
+{\tt int } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory\_static\_min}
+
+{\bf Overview:} 
+Get the memory/static\_min field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_memory_static_min (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}
@@ -2104,13 +2176,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~set\_memory\_dynamic\_min}
-
-{\bf Overview:} 
-Set the memory/dynamic\_min field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_memory_dynamic_min (session_id s, VM ref self, int 
value)\end{verbatim}
+\subsubsection{RPC name:~set\_memory\_static\_min}
+
+{\bf Overview:} 
+Set the memory/static\_min field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_memory_static_min (session_id s, VM ref self, int 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2138,13 +2210,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_memory\_static\_min}
-
-{\bf Overview:} 
-Get the memory/static\_min field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_memory_static_min (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~get\_VCPUs\_policy}
+
+{\bf Overview:} 
+Get the VCPUs/policy field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string get_VCPUs_policy (session_id s, VM ref 
self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2162,6 +2234,209 @@ Get the memory/static\_min field of the 
 
  \noindent {\bf Return Type:} 
 {\tt 
+string
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_VCPUs\_policy}
+
+{\bf Overview:} 
+Set the VCPUs/policy field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string 
value)\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 
+
+{\tt string } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_params}
+
+{\bf Overview:} 
+Get the VCPUs/params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((string -> string) Map) get_VCPUs_params (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:~set\_VCPUs\_params}
+
+{\bf Overview:} 
+Set the VCPUs/params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, (string -> 
string) Map value)\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 
+
+{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~add\_to\_VCPUs\_params}
+
+{\bf Overview:} 
+Add the given key-value pair to the VCPUs/params field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void add_to_VCPUs_params (session_id s, VM ref self, string 
key, string value)\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 
+
+{\tt string } & key & Key to add \\ \hline 
+
+{\tt string } & value & Value to add \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~remove\_from\_VCPUs\_params}
+
+{\bf Overview:} 
+Remove the given key and its corresponding value from the VCPUs/params
+field of the given VM.  If the key is not in that Map, then do nothing.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void remove_from_VCPUs_params (session_id s, VM ref self, 
string key)\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 
+
+{\tt string } & key & Key to remove \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_max}
+
+{\bf Overview:} 
+Get the VCPUs/max field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_VCPUs_max (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 
 int
 }
 
@@ -2170,13 +2445,13 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_policy}
-
-{\bf Overview:} 
-Get the VCPUs/policy field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_VCPUs_policy (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~set\_VCPUs\_max}
+
+{\bf Overview:} 
+Set the VCPUs/max field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_VCPUs_max (session_id s, VM ref self, int 
value)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2188,27 +2463,29 @@ Get the VCPUs/policy field of the given 
 {\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
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_policy}
-
-{\bf Overview:} 
-Set the VCPUs/policy field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_VCPUs_policy (session_id s, VM ref self, string 
value)\end{verbatim}
+{\tt int } & value & New value to set \\ \hline 
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+void
+}
+
+
+
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_at\_startup}
+
+{\bf Overview:} 
+Get the VCPUs/at\_startup field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_VCPUs_at_startup (session_id s, VM ref 
self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2220,7 +2497,39 @@ Set the VCPUs/policy field of the given 
 {\bf type} & {\bf name} & {\bf description} \\ \hline
 {\tt VM ref } & self & reference to the object \\ \hline 
 
-{\tt string } & value & New value to set \\ \hline 
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:} 
+{\tt 
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~set\_VCPUs\_at\_startup}
+
+{\bf Overview:} 
+Set the VCPUs/at\_startup field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} void set_VCPUs_at_startup (session_id s, VM ref self, int 
value)\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 
+
+{\tt int } & value & New value to set \\ \hline 
 
 \end{tabular}
 
@@ -2236,13 +2545,13 @@ void
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_params}
-
-{\bf Overview:} 
-Get the VCPUs/params field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} string get_VCPUs_params (session_id s, VM ref 
self)\end{verbatim}
+\subsubsection{RPC name:~get\_VCPUs\_number}
+
+{\bf Overview:} 
+Get the VCPUs/number field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_VCPUs_number (session_id s, VM ref self)\end{verbatim}
 
 
 \noindent{\bf Arguments:}
@@ -2260,111 +2569,11 @@ Get the VCPUs/params field of the given 
 
  \noindent {\bf Return Type:} 
 {\tt 
-string
-}
-
-
-value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_params}
-
-{\bf Overview:} 
-Set the VCPUs/params field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, string 
value)\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 
-
-{\tt string } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~get\_VCPUs\_number}
-
-{\bf Overview:} 
-Get the VCPUs/number field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} int get_VCPUs_number (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 
 int
 }
 
 
 value of the field
-\vspace{0.3cm}
-\vspace{0.3cm}
-\vspace{0.3cm}
-\subsubsection{RPC name:~set\_VCPUs\_number}
-
-{\bf Overview:} 
-Set the VCPUs/number field of the given VM.
-
- \noindent {\bf Signature:} 
-\begin{verbatim} void set_VCPUs_number (session_id s, VM ref self, int 
value)\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 
-
-{\tt int } & value & New value to set \\ \hline 
-
-\end{tabular}
-
-\vspace{0.3cm}
-
- \noindent {\bf Return Type:} 
-{\tt 
-void
-}
-
-
-
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -3717,6 +3926,38 @@ value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
+\subsubsection{RPC name:~get\_metrics}
+
+{\bf Overview:} 
+Get the metrics field of the given VM.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (VM_metrics ref) get_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\_metrics ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
 \subsubsection{RPC name:~create}
 
 {\bf Overview:} 
@@ -3875,6 +4116,251 @@ Get all the VM instances with the given 
 
 
 references to objects with match names
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\vspace{1cm}
+\newpage
+\section{Class: VM\_metrics}
+\subsection{Fields for class: VM\_metrics}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM\_metrics} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The metrics associated with a VM.}} \\
+\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 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 \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: VM\_metrics}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:} 
+Get the uuid field of the given VM\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} string get_uuid (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
+}
+
+
+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\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (VM ref) get_VM (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 
+VM ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_memory\_actual}
+
+{\bf Overview:} 
+Get the memory/actual field of the given VM\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_memory_actual (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 
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_number}
+
+{\bf Overview:} 
+Get the VCPUs/number field of the given VM\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} int get_VCPUs_number (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 
+int
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_VCPUs\_utilisation}
+
+{\bf Overview:} 
+Get the VCPUs/utilisation field of the given VM\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (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 
+(int $\rightarrow$ float) 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\_metrics instance with the specified UUID.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (VM_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\_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\_metrics.
+
+ \noindent {\bf Signature:} 
+\begin{verbatim} (VM_metrics record) get_record (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 
+VM\_metrics record
+}
+
+
+all fields from the object
 \vspace{0.3cm}
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -11334,6 +11820,16 @@ handle parameter echoes the bad value gi
 \begin{verbatim}VM_HANDLE_INVALID(handle)\end{verbatim}
 \begin{center}\rule{10em}{0.1pt}\end{center}
 
+\subsubsection{VM\_METRICS\_HANDLE\_INVALID}
+
+You gave an invalid VM\_metrics handle.  The VM\_metrics may have recently
+been deleted.  The handle parameter echoes the bad value given.
+
+\vspace{0.3cm}
+{\bf Signature:}
+\begin{verbatim}VM_METRICS_HANDLE_INVALID(handle)\end{verbatim}
+\begin{center}\rule{10em}{0.1pt}\end{center}
+
 \subsubsection{VTPM\_HANDLE\_INVALID}
 
 You gave an invalid VTPM handle.  The VTPM may have recently been deleted. 
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/include/xen_vm.h
--- a/tools/libxen/include/xen_vm.h     Tue Jan 30 18:30:27 2007 +0000
+++ b/tools/libxen/include/xen_vm.h     Tue Jan 30 18:30:18 2007 +0000
@@ -31,6 +31,7 @@
 #include "xen_vdi_decl.h"
 #include "xen_vif_decl.h"
 #include "xen_vm_decl.h"
+#include "xen_vm_metrics_decl.h"
 #include "xen_vm_power_state.h"
 #include "xen_vtpm_decl.h"
 
@@ -114,11 +115,12 @@ typedef struct xen_vm_record
     struct xen_host_record_opt *resident_on;
     int64_t memory_static_max;
     int64_t memory_dynamic_max;
-    int64_t memory_actual;
     int64_t memory_dynamic_min;
     int64_t memory_static_min;
     char *vcpus_policy;
-    char *vcpus_params;
+    xen_string_string_map *vcpus_params;
+    int64_t vcpus_max;
+    int64_t vcpus_at_startup;
     int64_t vcpus_number;
     xen_int_float_map *vcpus_utilisation;
     enum xen_on_normal_exit actions_after_shutdown;
@@ -144,6 +146,7 @@ typedef struct xen_vm_record
     xen_string_string_map *tools_version;
     xen_string_string_map *other_config;
     bool is_control_domain;
+    struct xen_vm_metrics_record_opt *metrics;
 } xen_vm_record;
 
 /**
@@ -340,13 +343,6 @@ xen_vm_get_memory_dynamic_max(xen_sessio
 
 
 /**
- * Get the memory/actual field of the given VM.
- */
-extern bool
-xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm);
-
-
-/**
  * Get the memory/dynamic_min field of the given VM.
  */
 extern bool
@@ -371,7 +367,21 @@ xen_vm_get_vcpus_policy(xen_session *ses
  * Get the VCPUs/params field of the given VM.
  */
 extern bool
-xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm);
+xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, 
xen_vm vm);
+
+
+/**
+ * Get the VCPUs/max field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm);
+
+
+/**
+ * Get the VCPUs/at_startup field of the given VM.
+ */
+extern bool
+xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm);
 
 
 /**
@@ -550,6 +560,13 @@ xen_vm_get_is_control_domain(xen_session
 
 
 /**
+ * Get the metrics field of the given VM.
+ */
+extern bool
+xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm);
+
+
+/**
  * Set the name/label field of the given VM.
  */
 extern bool
@@ -585,6 +602,13 @@ xen_vm_set_auto_power_on(xen_session *se
 
 
 /**
+ * Set the memory/static_max field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t 
static_max);
+
+
+/**
  * Set the memory/dynamic_max field of the given VM.
  */
 extern bool
@@ -599,6 +623,13 @@ xen_vm_set_memory_dynamic_min(xen_sessio
 
 
 /**
+ * Set the memory/static_min field of the given VM.
+ */
+extern bool
+xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t 
static_min);
+
+
+/**
  * Set the VCPUs/policy field of the given VM.
  */
 extern bool
@@ -609,14 +640,38 @@ xen_vm_set_vcpus_policy(xen_session *ses
  * Set the VCPUs/params field of the given VM.
  */
 extern bool
-xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params);
-
-
-/**
- * Set the VCPUs/number field of the given VM.
- */
-extern bool
-xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number);
+xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map 
*params);
+
+
+/**
+ * Add the given key-value pair to the VCPUs/params field of the given
+ * VM.
+ */
+extern bool
+xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char 
*value);
+
+
+/**
+ * Remove the given key and its corresponding value from the
+ * VCPUs/params field of the given VM.  If the key is not in that Map, then do
+ * nothing.
+ */
+extern bool
+xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key);
+
+
+/**
+ * Set the VCPUs/max field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max);
+
+
+/**
+ * Set the VCPUs/at_startup field of the given VM.
+ */
+extern bool
+xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t 
at_startup);
 
 
 /**
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/include/xen_vm_metrics.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_metrics.h     Tue Jan 30 18:30:18 2007 +0000
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2006, 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_METRICS_H
+#define XEN_VM_METRICS_H
+
+#include "xen_common.h"
+#include "xen_int_float_map.h"
+#include "xen_vm_decl.h"
+#include "xen_vm_metrics_decl.h"
+
+
+/*
+ * The VM_metrics class.
+ * 
+ * The metrics associated with a VM.
+ */
+
+
+/**
+ * Free the given xen_vm_metrics.  The given handle must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_free(xen_vm_metrics vm_metrics);
+
+
+typedef struct xen_vm_metrics_set
+{
+    size_t size;
+    xen_vm_metrics *contents[];
+} xen_vm_metrics_set;
+
+/**
+ * Allocate a xen_vm_metrics_set of the given size.
+ */
+extern xen_vm_metrics_set *
+xen_vm_metrics_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_set.  The given set must have been
+ * allocated by this library.
+ */
+extern void
+xen_vm_metrics_set_free(xen_vm_metrics_set *set);
+
+
+typedef struct xen_vm_metrics_record
+{
+    xen_vm_metrics handle;
+    char *uuid;
+    struct xen_vm_record_opt *vm;
+    int64_t memory_actual;
+    int64_t vcpus_number;
+    xen_int_float_map *vcpus_utilisation;
+} xen_vm_metrics_record;
+
+/**
+ * Allocate a xen_vm_metrics_record.
+ */
+extern xen_vm_metrics_record *
+xen_vm_metrics_record_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record, and all referenced values. 
+ * The given record must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_free(xen_vm_metrics_record *record);
+
+
+typedef struct xen_vm_metrics_record_opt
+{
+    bool is_record;
+    union
+    {
+        xen_vm_metrics handle;
+        xen_vm_metrics_record *record;
+    } u;
+} xen_vm_metrics_record_opt;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt.
+ */
+extern xen_vm_metrics_record_opt *
+xen_vm_metrics_record_opt_alloc(void);
+
+/**
+ * Free the given xen_vm_metrics_record_opt, and all referenced values.
+ *  The given record_opt must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt);
+
+
+typedef struct xen_vm_metrics_record_set
+{
+    size_t size;
+    xen_vm_metrics_record *contents[];
+} xen_vm_metrics_record_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_set of the given size.
+ */
+extern xen_vm_metrics_record_set *
+xen_vm_metrics_record_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_set, and all referenced values.
+ *  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set);
+
+
+
+typedef struct xen_vm_metrics_record_opt_set
+{
+    size_t size;
+    xen_vm_metrics_record_opt *contents[];
+} xen_vm_metrics_record_opt_set;
+
+/**
+ * Allocate a xen_vm_metrics_record_opt_set of the given size.
+ */
+extern xen_vm_metrics_record_opt_set *
+xen_vm_metrics_record_opt_set_alloc(size_t size);
+
+/**
+ * Free the given xen_vm_metrics_record_opt_set, and all referenced
+ * values.  The given set must have been allocated by this library.
+ */
+extern void
+xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set);
+
+
+/**
+ * Get a record containing the current state of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record 
**result, xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get a reference to the VM_metrics instance with the specified UUID.
+ */
+extern bool
+xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char 
*uuid);
+
+
+/**
+ * Get the uuid field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics 
vm_metrics);
+
+
+/**
+ * Get the VM field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics 
vm_metrics);
+
+
+/**
+ * Get the memory/actual field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/number field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, 
xen_vm_metrics vm_metrics);
+
+
+/**
+ * Get the VCPUs/utilisation field of the given VM_metrics.
+ */
+extern bool
+xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map 
**result, xen_vm_metrics vm_metrics);
+
+
+#endif
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/include/xen_vm_metrics_decl.h
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/include/xen_vm_metrics_decl.h        Tue Jan 30 18:30:18 
2007 +0000
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2006, 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_METRICS_DECL_H
+#define XEN_VM_METRICS_DECL_H
+
+typedef void *xen_vm_metrics;
+
+struct xen_vm_metrics_set;
+struct xen_vm_metrics_record;
+struct xen_vm_metrics_record_set;
+struct xen_vm_metrics_record_opt;
+struct xen_vm_metrics_record_opt_set;
+
+#endif
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/src/xen_vm.c
--- a/tools/libxen/src/xen_vm.c Tue Jan 30 18:30:27 2007 +0000
+++ b/tools/libxen/src/xen_vm.c Tue Jan 30 18:30:18 2007 +0000
@@ -33,6 +33,7 @@
 #include "xen_vdi.h"
 #include "xen_vif.h"
 #include "xen_vm.h"
+#include "xen_vm_metrics.h"
 #include "xen_vm_power_state_internal.h"
 #include "xen_vtpm.h"
 
@@ -81,9 +82,6 @@ static const struct_member xen_vm_record
         { .key = "memory_dynamic_max",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vm_record, memory_dynamic_max) },
-        { .key = "memory_actual",
-          .type = &abstract_type_int,
-          .offset = offsetof(xen_vm_record, memory_actual) },
         { .key = "memory_dynamic_min",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vm_record, memory_dynamic_min) },
@@ -94,8 +92,14 @@ static const struct_member xen_vm_record
           .type = &abstract_type_string,
           .offset = offsetof(xen_vm_record, vcpus_policy) },
         { .key = "VCPUs_params",
-          .type = &abstract_type_string,
+          .type = &abstract_type_string_string_map,
           .offset = offsetof(xen_vm_record, vcpus_params) },
+        { .key = "VCPUs_max",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_vm_record, vcpus_max) },
+        { .key = "VCPUs_at_startup",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_vm_record, vcpus_at_startup) },
         { .key = "VCPUs_number",
           .type = &abstract_type_int,
           .offset = offsetof(xen_vm_record, vcpus_number) },
@@ -170,7 +174,10 @@ static const struct_member xen_vm_record
           .offset = offsetof(xen_vm_record, other_config) },
         { .key = "is_control_domain",
           .type = &abstract_type_bool,
-          .offset = offsetof(xen_vm_record, is_control_domain) }
+          .offset = offsetof(xen_vm_record, is_control_domain) },
+        { .key = "metrics",
+          .type = &abstract_type_ref,
+          .offset = offsetof(xen_vm_record, metrics) }
     };
 
 const abstract_type xen_vm_record_abstract_type_ =
@@ -197,7 +204,7 @@ xen_vm_record_free(xen_vm_record *record
     xen_vdi_record_opt_free(record->suspend_vdi);
     xen_host_record_opt_free(record->resident_on);
     free(record->vcpus_policy);
-    free(record->vcpus_params);
+    xen_string_string_map_free(record->vcpus_params);
     xen_int_float_map_free(record->vcpus_utilisation);
     xen_console_record_opt_set_free(record->consoles);
     xen_vif_record_opt_set_free(record->vifs);
@@ -214,6 +221,7 @@ xen_vm_record_free(xen_vm_record *record
     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);
     free(record);
 }
 
@@ -470,7 +478,7 @@ xen_vm_get_memory_dynamic_max(xen_sessio
 
 
 bool
-xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm)
+xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm)
 {
     abstract_value param_values[] =
         {
@@ -480,13 +488,13 @@ xen_vm_get_memory_actual(xen_session *se
 
     abstract_type result_type = abstract_type_int;
 
-    XEN_CALL_("VM.get_memory_actual");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm)
+    XEN_CALL_("VM.get_memory_dynamic_min");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm)
 {
     abstract_value param_values[] =
         {
@@ -496,13 +504,47 @@ xen_vm_get_memory_dynamic_min(xen_sessio
 
     abstract_type result_type = abstract_type_int;
 
-    XEN_CALL_("VM.get_memory_dynamic_min");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm)
+    XEN_CALL_("VM.get_memory_static_min");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_vcpus_policy(xen_session *session, char **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_VCPUs_policy");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_vcpus_params(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_VCPUs_params");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm)
 {
     abstract_value param_values[] =
         {
@@ -512,41 +554,23 @@ xen_vm_get_memory_static_min(xen_session
 
     abstract_type result_type = abstract_type_int;
 
-    XEN_CALL_("VM.get_memory_static_min");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_policy(xen_session *session, char **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_VCPUs_policy");
-    return session->ok;
-}
-
-
-bool
-xen_vm_get_vcpus_params(xen_session *session, char **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_VCPUs_params");
+    XEN_CALL_("VM.get_VCPUs_max");
+    return session->ok;
+}
+
+
+bool
+xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm }
+        };
+
+    abstract_type result_type = abstract_type_int;
+
+    XEN_CALL_("VM.get_VCPUs_at_startup");
     return session->ok;
 }
 
@@ -965,6 +989,23 @@ xen_vm_get_is_control_domain(xen_session
 
 
 bool
+xen_vm_get_metrics(xen_session *session, xen_vm_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_metrics");
+    return session->ok;
+}
+
+
+bool
 xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label)
 {
     abstract_value param_values[] =
@@ -1045,6 +1086,22 @@ xen_vm_set_auto_power_on(xen_session *se
 
 
 bool
+xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t 
static_max)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_int,
+              .u.int_val = static_max }
+        };
+
+    xen_call_(session, "VM.set_memory_static_max", param_values, 2, NULL, 
NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t 
dynamic_max)
 {
     abstract_value param_values[] =
@@ -1077,6 +1134,22 @@ xen_vm_set_memory_dynamic_min(xen_sessio
 
 
 bool
+xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t 
static_min)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_int,
+              .u.int_val = static_min }
+        };
+
+    xen_call_(session, "VM.set_memory_static_min", param_values, 2, NULL, 
NULL);
+    return session->ok;
+}
+
+
+bool
 xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy)
 {
     abstract_value param_values[] =
@@ -1093,14 +1166,14 @@ xen_vm_set_vcpus_policy(xen_session *ses
 
 
 bool
-xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params)
-{
-    abstract_value param_values[] =
-        {
-            { .type = &abstract_type_string,
-              .u.string_val = vm },
-            { .type = &abstract_type_string,
-              .u.string_val = params }
+xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map 
*params)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string_string_map,
+              .u.set_val = (arbitrary_set *)params }
         };
 
     xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL);
@@ -1109,17 +1182,67 @@ xen_vm_set_vcpus_params(xen_session *ses
 
 
 bool
-xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number)
+xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char 
*value)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = key },
+            { .type = &abstract_type_string,
+              .u.string_val = value }
+        };
+
+    xen_call_(session, "VM.add_to_VCPUs_params", param_values, 3, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_string,
+              .u.string_val = key }
+        };
+
+    xen_call_(session, "VM.remove_from_VCPUs_params", param_values, 2, NULL, 
NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max)
 {
     abstract_value param_values[] =
         {
             { .type = &abstract_type_string,
               .u.string_val = vm },
             { .type = &abstract_type_int,
-              .u.int_val = number }
-        };
-
-    xen_call_(session, "VM.set_VCPUs_number", param_values, 2, NULL, NULL);
+              .u.int_val = max }
+        };
+
+    xen_call_(session, "VM.set_VCPUs_max", param_values, 2, NULL, NULL);
+    return session->ok;
+}
+
+
+bool
+xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t 
at_startup)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm },
+            { .type = &abstract_type_int,
+              .u.int_val = at_startup }
+        };
+
+    xen_call_(session, "VM.set_VCPUs_at_startup", param_values, 2, NULL, NULL);
     return session->ok;
 }
 
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/src/xen_vm_metrics.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/tools/libxen/src/xen_vm_metrics.c Tue Jan 30 18:30:18 2007 +0000
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2006, 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_int_float_map.h"
+#include "xen_internal.h"
+#include "xen_vm.h"
+#include "xen_vm_metrics.h"
+
+
+XEN_FREE(xen_vm_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_metrics)
+XEN_ALLOC(xen_vm_metrics_record)
+XEN_SET_ALLOC_FREE(xen_vm_metrics_record)
+XEN_ALLOC(xen_vm_metrics_record_opt)
+XEN_RECORD_OPT_FREE(xen_vm_metrics)
+XEN_SET_ALLOC_FREE(xen_vm_metrics_record_opt)
+
+
+static const struct_member xen_vm_metrics_record_struct_members[] =
+    {
+        { .key = "uuid",
+          .type = &abstract_type_string,
+          .offset = offsetof(xen_vm_metrics_record, uuid) },
+        { .key = "VM",
+          .type = &abstract_type_ref,
+          .offset = offsetof(xen_vm_metrics_record, vm) },
+        { .key = "memory_actual",
+          .type = &abstract_type_int,
+          .offset = offsetof(xen_vm_metrics_record, memory_actual) },
+        { .key = "VCPUs_number",
+          .type = &abstract_type_int,
+          .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) }
+    };
+
+const abstract_type xen_vm_metrics_record_abstract_type_ =
+    {
+       .typename = STRUCT,
+       .struct_size = sizeof(xen_vm_metrics_record),
+       .member_count =
+           sizeof(xen_vm_metrics_record_struct_members) / 
sizeof(struct_member),
+       .members = xen_vm_metrics_record_struct_members
+    };
+
+
+void
+xen_vm_metrics_record_free(xen_vm_metrics_record *record)
+{
+    if (record == NULL)
+    {
+        return;
+    }
+    free(record->handle);
+    free(record->uuid);
+    xen_vm_record_opt_free(record->vm);
+    xen_int_float_map_free(record->vcpus_utilisation);
+    free(record);
+}
+
+
+bool
+xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record 
**result, xen_vm_metrics vm_metrics)
+{
+    abstract_value param_values[] =
+        {
+            { .type = &abstract_type_string,
+              .u.string_val = vm_metrics }
+        };
+
+    abstract_type result_type = xen_vm_metrics_record_abstract_type_;
+
+    *result = NULL;
+    XEN_CALL_("VM_metrics.get_record");
+
+    if (session->ok)
+    {
+       (*result)->handle = xen_strdup_((*result)->uuid);
+    }
+
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_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_metrics.get_by_uuid");
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vm(xen_session *session, xen_vm *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;
+
+    *result = NULL;
+    XEN_CALL_("VM_metrics.get_VM");
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_memory_actual(xen_session *session, int64_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_int;
+
+    XEN_CALL_("VM_metrics.get_memory_actual");
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vcpus_number(xen_session *session, int64_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_int;
+
+    XEN_CALL_("VM_metrics.get_VCPUs_number");
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map 
**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_int_float_map;
+
+    *result = NULL;
+    XEN_CALL_("VM_metrics.get_VCPUs_utilisation");
+    return session->ok;
+}
+
+
+bool
+xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics 
vm_metrics)
+{
+    *result = session->ok ? xen_strdup_((char *)vm_metrics) : NULL;
+    return session->ok;
+}
diff -r abd140fe5f6c -r 61262143a4b0 tools/libxen/test/test_bindings.c
--- a/tools/libxen/test/test_bindings.c Tue Jan 30 18:30:27 2007 +0000
+++ b/tools/libxen/test/test_bindings.c Tue Jan 30 18:30:18 2007 +0000
@@ -277,6 +277,7 @@ int main(int argc, char **argv)
  */
 static xen_vm create_new_vm(xen_session *session)
 {
+    xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1);
     xen_vm_record vm_record =
         {
             .name_label = "NewVM",
@@ -288,7 +289,7 @@ static xen_vm create_new_vm(xen_session 
             .memory_dynamic_min = 128,
             .memory_static_min = 128,
             .vcpus_policy = "credit",
-            .vcpus_params = "",
+            .vcpus_params = vcpus_params,
             .vcpus_number = 2,
             .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY,
             .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
diff -r abd140fe5f6c -r 61262143a4b0 tools/python/xen/xm/messages/en/xen-xm.po
--- a/tools/python/xen/xm/messages/en/xen-xm.po Tue Jan 30 18:30:27 2007 +0000
+++ b/tools/python/xen/xm/messages/en/xen-xm.po Tue Jan 30 18:30:18 2007 +0000
@@ -19,7 +19,7 @@ msgid ""
 msgid ""
 msgstr ""
 "Project-Id-Version: Xen-xm 3.0\n"
-"PO-Revision-Date: 2007-01-30 12:49+0000\n"
+"PO-Revision-Date: 2007-01-30 17:15+0000\n"
 "Last-Translator: Ewan Mellor <ewan@xxxxxxxxxxxxx>\n"
 "Language-Team: xen-devel <xen-devel@xxxxxxxxxxxxxxxxxxx>\n"
 "MIME-Version: 1.0\n"
@@ -74,6 +74,9 @@ msgid "VM_HANDLE_INVALID"
 msgid "VM_HANDLE_INVALID"
 msgstr "The VM handle %(1)s is invalid."
 
+msgid "VM_METRICS_HANDLE_INVALID"
+msgstr "The VM_metrics handle %(1)s is invalid."
+
 msgid "VTPM_HANDLE_INVALID"
 msgstr "The VTPM handle %(1)s is invalid."
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] Added VM_metrics class, taking some of the fields from VM. Make VM.static_max, Xen patchbot-unstable <=