debuggers.hg
changeset 13774:61262143a4b0
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@xensource.com>
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@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Tue Jan 30 18:30:18 2007 +0000 (2007-01-30) |
parents | abd140fe5f6c |
children | 7d3bb465e938 |
files | docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vm.h tools/libxen/include/xen_vm_metrics.h tools/libxen/include/xen_vm_metrics_decl.h tools/libxen/src/xen_vm.c tools/libxen/src/xen_vm_metrics.c tools/libxen/test/test_bindings.c tools/python/xen/xm/messages/en/xen-xm.po |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 18:30:27 2007 +0000 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 18:30:18 2007 +0000 1.3 @@ -25,6 +25,7 @@ Name & Description \\ 1.4 {\tt session} & A session \\ 1.5 {\tt task} & A long-running asynchronous task \\ 1.6 {\tt VM} & A virtual machine (or 'guest') \\ 1.7 +{\tt VM\_metrics} & The metrics associated with a VM \\ 1.8 {\tt host} & A physical host \\ 1.9 {\tt host\_metrics} & The metrics associated with a host \\ 1.10 {\tt host\_cpu} & A physical CPU \\ 1.11 @@ -60,6 +61,7 @@ VIF.VM & VM.VIFs & one-to-many\\ 1.12 VIF.network & network.VIFs & one-to-many\\ 1.13 host.metrics & host\_metrics.host & one-to-one\\ 1.14 PIF.metrics & PIF\_metrics.PIF & one-to-one\\ 1.15 +VM.metrics & VM\_metrics.VM & one-to-one\\ 1.16 PIF.host & host.PIFs & one-to-many\\ 1.17 PIF.network & network.PIFs & one-to-many\\ 1.18 SR.VDIs & VDI.SR & many-to-one\\ 1.19 @@ -1064,14 +1066,15 @@ Quals & Field & Type & Description \\ 1.20 $\mathit{RW}$ & {\tt auto\_power\_on} & bool & true if this VM should be started automatically after host boot \\ 1.21 $\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) \\ 1.22 $\mathit{RO}_\mathit{run}$ & {\tt resident\_on} & host ref & the host the VM is currently resident on \\ 1.23 -$\mathit{RO}_\mathit{ins}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\ 1.24 +$\mathit{RW}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\ 1.25 $\mathit{RW}$ & {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\ 1.26 -$\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual usage (bytes) \\ 1.27 $\mathit{RW}$ & {\tt memory/dynamic\_min} & int & Dynamic minimum (bytes) \\ 1.28 -$\mathit{RO}_\mathit{ins}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\ 1.29 +$\mathit{RW}$ & {\tt memory/static\_min} & int & Statically-set (i.e. absolute) mininum (bytes) \\ 1.30 $\mathit{RW}$ & {\tt VCPUs/policy} & string & the name of the VCPU scheduling policy to be applied \\ 1.31 -$\mathit{RW}$ & {\tt VCPUs/params} & string & string-encoded parameters passed to selected VCPU policy \\ 1.32 -$\mathit{RW}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\ 1.33 +$\mathit{RW}$ & {\tt VCPUs/params} & (string $\rightarrow$ string) Map & configuration parameters for the selected VCPU policy \\ 1.34 +$\mathit{RW}$ & {\tt VCPUs/max} & int & Max number of VCPUs \\ 1.35 +$\mathit{RW}$ & {\tt VCPUs/at\_startup} & int & Boot number of VCPUs \\ 1.36 +$\mathit{RO}_\mathit{ins}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\ 1.37 $\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\ 1.38 $\mathit{RW}$ & {\tt actions/after\_shutdown} & on\_normal\_exit & action to take after the guest has shutdown itself \\ 1.39 $\mathit{RW}$ & {\tt actions/after\_reboot} & on\_normal\_exit & action to take after the guest has rebooted itself \\ 1.40 @@ -1096,6 +1099,7 @@ Quals & Field & Type & Description \\ 1.41 $\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\ 1.42 $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ 1.43 $\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\ 1.44 +$\mathit{RO}_\mathit{ins}$ & {\tt metrics} & VM\_metrics ref & metrics associated with this VM. \\ 1.45 \hline 1.46 \end{longtable} 1.47 \subsection{Additional RPCs associated with class: VM} 1.48 @@ -1974,6 +1978,40 @@ value of the field 1.49 \vspace{0.3cm} 1.50 \vspace{0.3cm} 1.51 \vspace{0.3cm} 1.52 +\subsubsection{RPC name:~set\_memory\_static\_max} 1.53 + 1.54 +{\bf Overview:} 1.55 +Set the memory/static\_max field of the given VM. 1.56 + 1.57 + \noindent {\bf Signature:} 1.58 +\begin{verbatim} void set_memory_static_max (session_id s, VM ref self, int value)\end{verbatim} 1.59 + 1.60 + 1.61 +\noindent{\bf Arguments:} 1.62 + 1.63 + 1.64 +\vspace{0.3cm} 1.65 +\begin{tabular}{|c|c|p{7cm}|} 1.66 + \hline 1.67 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.68 +{\tt VM ref } & self & reference to the object \\ \hline 1.69 + 1.70 +{\tt int } & value & New value to set \\ \hline 1.71 + 1.72 +\end{tabular} 1.73 + 1.74 +\vspace{0.3cm} 1.75 + 1.76 + \noindent {\bf Return Type:} 1.77 +{\tt 1.78 +void 1.79 +} 1.80 + 1.81 + 1.82 + 1.83 +\vspace{0.3cm} 1.84 +\vspace{0.3cm} 1.85 +\vspace{0.3cm} 1.86 \subsubsection{RPC name:~get\_memory\_dynamic\_max} 1.87 1.88 {\bf Overview:} 1.89 @@ -2040,38 +2078,6 @@ void 1.90 \vspace{0.3cm} 1.91 \vspace{0.3cm} 1.92 \vspace{0.3cm} 1.93 -\subsubsection{RPC name:~get\_memory\_actual} 1.94 - 1.95 -{\bf Overview:} 1.96 -Get the memory/actual field of the given VM. 1.97 - 1.98 - \noindent {\bf Signature:} 1.99 -\begin{verbatim} int get_memory_actual (session_id s, VM ref self)\end{verbatim} 1.100 - 1.101 - 1.102 -\noindent{\bf Arguments:} 1.103 - 1.104 - 1.105 -\vspace{0.3cm} 1.106 -\begin{tabular}{|c|c|p{7cm}|} 1.107 - \hline 1.108 -{\bf type} & {\bf name} & {\bf description} \\ \hline 1.109 -{\tt VM ref } & self & reference to the object \\ \hline 1.110 - 1.111 -\end{tabular} 1.112 - 1.113 -\vspace{0.3cm} 1.114 - 1.115 - \noindent {\bf Return Type:} 1.116 -{\tt 1.117 -int 1.118 -} 1.119 - 1.120 - 1.121 -value of the field 1.122 -\vspace{0.3cm} 1.123 -\vspace{0.3cm} 1.124 -\vspace{0.3cm} 1.125 \subsubsection{RPC name:~get\_memory\_dynamic\_min} 1.126 1.127 {\bf Overview:} 1.128 @@ -2170,6 +2176,40 @@ value of the field 1.129 \vspace{0.3cm} 1.130 \vspace{0.3cm} 1.131 \vspace{0.3cm} 1.132 +\subsubsection{RPC name:~set\_memory\_static\_min} 1.133 + 1.134 +{\bf Overview:} 1.135 +Set the memory/static\_min field of the given VM. 1.136 + 1.137 + \noindent {\bf Signature:} 1.138 +\begin{verbatim} void set_memory_static_min (session_id s, VM ref self, int value)\end{verbatim} 1.139 + 1.140 + 1.141 +\noindent{\bf Arguments:} 1.142 + 1.143 + 1.144 +\vspace{0.3cm} 1.145 +\begin{tabular}{|c|c|p{7cm}|} 1.146 + \hline 1.147 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.148 +{\tt VM ref } & self & reference to the object \\ \hline 1.149 + 1.150 +{\tt int } & value & New value to set \\ \hline 1.151 + 1.152 +\end{tabular} 1.153 + 1.154 +\vspace{0.3cm} 1.155 + 1.156 + \noindent {\bf Return Type:} 1.157 +{\tt 1.158 +void 1.159 +} 1.160 + 1.161 + 1.162 + 1.163 +\vspace{0.3cm} 1.164 +\vspace{0.3cm} 1.165 +\vspace{0.3cm} 1.166 \subsubsection{RPC name:~get\_VCPUs\_policy} 1.167 1.168 {\bf Overview:} 1.169 @@ -2242,7 +2282,7 @@ void 1.170 Get the VCPUs/params field of the given VM. 1.171 1.172 \noindent {\bf Signature:} 1.173 -\begin{verbatim} string get_VCPUs_params (session_id s, VM ref self)\end{verbatim} 1.174 +\begin{verbatim} ((string -> string) Map) get_VCPUs_params (session_id s, VM ref self)\end{verbatim} 1.175 1.176 1.177 \noindent{\bf Arguments:} 1.178 @@ -2260,7 +2300,7 @@ Get the VCPUs/params field of the given 1.179 1.180 \noindent {\bf Return Type:} 1.181 {\tt 1.182 -string 1.183 +(string $\rightarrow$ string) Map 1.184 } 1.185 1.186 1.187 @@ -2274,7 +2314,78 @@ value of the field 1.188 Set the VCPUs/params field of the given VM. 1.189 1.190 \noindent {\bf Signature:} 1.191 -\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, string value)\end{verbatim} 1.192 +\begin{verbatim} void set_VCPUs_params (session_id s, VM ref self, (string -> string) Map value)\end{verbatim} 1.193 + 1.194 + 1.195 +\noindent{\bf Arguments:} 1.196 + 1.197 + 1.198 +\vspace{0.3cm} 1.199 +\begin{tabular}{|c|c|p{7cm}|} 1.200 + \hline 1.201 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.202 +{\tt VM ref } & self & reference to the object \\ \hline 1.203 + 1.204 +{\tt (string $\rightarrow$ string) Map } & value & New value to set \\ \hline 1.205 + 1.206 +\end{tabular} 1.207 + 1.208 +\vspace{0.3cm} 1.209 + 1.210 + \noindent {\bf Return Type:} 1.211 +{\tt 1.212 +void 1.213 +} 1.214 + 1.215 + 1.216 + 1.217 +\vspace{0.3cm} 1.218 +\vspace{0.3cm} 1.219 +\vspace{0.3cm} 1.220 +\subsubsection{RPC name:~add\_to\_VCPUs\_params} 1.221 + 1.222 +{\bf Overview:} 1.223 +Add the given key-value pair to the VCPUs/params field of the given VM. 1.224 + 1.225 + \noindent {\bf Signature:} 1.226 +\begin{verbatim} void add_to_VCPUs_params (session_id s, VM ref self, string key, string value)\end{verbatim} 1.227 + 1.228 + 1.229 +\noindent{\bf Arguments:} 1.230 + 1.231 + 1.232 +\vspace{0.3cm} 1.233 +\begin{tabular}{|c|c|p{7cm}|} 1.234 + \hline 1.235 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.236 +{\tt VM ref } & self & reference to the object \\ \hline 1.237 + 1.238 +{\tt string } & key & Key to add \\ \hline 1.239 + 1.240 +{\tt string } & value & Value to add \\ \hline 1.241 + 1.242 +\end{tabular} 1.243 + 1.244 +\vspace{0.3cm} 1.245 + 1.246 + \noindent {\bf Return Type:} 1.247 +{\tt 1.248 +void 1.249 +} 1.250 + 1.251 + 1.252 + 1.253 +\vspace{0.3cm} 1.254 +\vspace{0.3cm} 1.255 +\vspace{0.3cm} 1.256 +\subsubsection{RPC name:~remove\_from\_VCPUs\_params} 1.257 + 1.258 +{\bf Overview:} 1.259 +Remove the given key and its corresponding value from the VCPUs/params 1.260 +field of the given VM. If the key is not in that Map, then do nothing. 1.261 + 1.262 + \noindent {\bf Signature:} 1.263 +\begin{verbatim} void remove_from_VCPUs_params (session_id s, VM ref self, string key)\end{verbatim} 1.264 1.265 1.266 \noindent{\bf Arguments:} 1.267 @@ -2286,7 +2397,139 @@ Set the VCPUs/params field of the given 1.268 {\bf type} & {\bf name} & {\bf description} \\ \hline 1.269 {\tt VM ref } & self & reference to the object \\ \hline 1.270 1.271 -{\tt string } & value & New value to set \\ \hline 1.272 +{\tt string } & key & Key to remove \\ \hline 1.273 + 1.274 +\end{tabular} 1.275 + 1.276 +\vspace{0.3cm} 1.277 + 1.278 + \noindent {\bf Return Type:} 1.279 +{\tt 1.280 +void 1.281 +} 1.282 + 1.283 + 1.284 + 1.285 +\vspace{0.3cm} 1.286 +\vspace{0.3cm} 1.287 +\vspace{0.3cm} 1.288 +\subsubsection{RPC name:~get\_VCPUs\_max} 1.289 + 1.290 +{\bf Overview:} 1.291 +Get the VCPUs/max field of the given VM. 1.292 + 1.293 + \noindent {\bf Signature:} 1.294 +\begin{verbatim} int get_VCPUs_max (session_id s, VM ref self)\end{verbatim} 1.295 + 1.296 + 1.297 +\noindent{\bf Arguments:} 1.298 + 1.299 + 1.300 +\vspace{0.3cm} 1.301 +\begin{tabular}{|c|c|p{7cm}|} 1.302 + \hline 1.303 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.304 +{\tt VM ref } & self & reference to the object \\ \hline 1.305 + 1.306 +\end{tabular} 1.307 + 1.308 +\vspace{0.3cm} 1.309 + 1.310 + \noindent {\bf Return Type:} 1.311 +{\tt 1.312 +int 1.313 +} 1.314 + 1.315 + 1.316 +value of the field 1.317 +\vspace{0.3cm} 1.318 +\vspace{0.3cm} 1.319 +\vspace{0.3cm} 1.320 +\subsubsection{RPC name:~set\_VCPUs\_max} 1.321 + 1.322 +{\bf Overview:} 1.323 +Set the VCPUs/max field of the given VM. 1.324 + 1.325 + \noindent {\bf Signature:} 1.326 +\begin{verbatim} void set_VCPUs_max (session_id s, VM ref self, int value)\end{verbatim} 1.327 + 1.328 + 1.329 +\noindent{\bf Arguments:} 1.330 + 1.331 + 1.332 +\vspace{0.3cm} 1.333 +\begin{tabular}{|c|c|p{7cm}|} 1.334 + \hline 1.335 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.336 +{\tt VM ref } & self & reference to the object \\ \hline 1.337 + 1.338 +{\tt int } & value & New value to set \\ \hline 1.339 + 1.340 +\end{tabular} 1.341 + 1.342 +\vspace{0.3cm} 1.343 + 1.344 + \noindent {\bf Return Type:} 1.345 +{\tt 1.346 +void 1.347 +} 1.348 + 1.349 + 1.350 + 1.351 +\vspace{0.3cm} 1.352 +\vspace{0.3cm} 1.353 +\vspace{0.3cm} 1.354 +\subsubsection{RPC name:~get\_VCPUs\_at\_startup} 1.355 + 1.356 +{\bf Overview:} 1.357 +Get the VCPUs/at\_startup field of the given VM. 1.358 + 1.359 + \noindent {\bf Signature:} 1.360 +\begin{verbatim} int get_VCPUs_at_startup (session_id s, VM ref self)\end{verbatim} 1.361 + 1.362 + 1.363 +\noindent{\bf Arguments:} 1.364 + 1.365 + 1.366 +\vspace{0.3cm} 1.367 +\begin{tabular}{|c|c|p{7cm}|} 1.368 + \hline 1.369 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.370 +{\tt VM ref } & self & reference to the object \\ \hline 1.371 + 1.372 +\end{tabular} 1.373 + 1.374 +\vspace{0.3cm} 1.375 + 1.376 + \noindent {\bf Return Type:} 1.377 +{\tt 1.378 +int 1.379 +} 1.380 + 1.381 + 1.382 +value of the field 1.383 +\vspace{0.3cm} 1.384 +\vspace{0.3cm} 1.385 +\vspace{0.3cm} 1.386 +\subsubsection{RPC name:~set\_VCPUs\_at\_startup} 1.387 + 1.388 +{\bf Overview:} 1.389 +Set the VCPUs/at\_startup field of the given VM. 1.390 + 1.391 + \noindent {\bf Signature:} 1.392 +\begin{verbatim} void set_VCPUs_at_startup (session_id s, VM ref self, int value)\end{verbatim} 1.393 + 1.394 + 1.395 +\noindent{\bf Arguments:} 1.396 + 1.397 + 1.398 +\vspace{0.3cm} 1.399 +\begin{tabular}{|c|c|p{7cm}|} 1.400 + \hline 1.401 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.402 +{\tt VM ref } & self & reference to the object \\ \hline 1.403 + 1.404 +{\tt int } & value & New value to set \\ \hline 1.405 1.406 \end{tabular} 1.407 1.408 @@ -2334,40 +2577,6 @@ value of the field 1.409 \vspace{0.3cm} 1.410 \vspace{0.3cm} 1.411 \vspace{0.3cm} 1.412 -\subsubsection{RPC name:~set\_VCPUs\_number} 1.413 - 1.414 -{\bf Overview:} 1.415 -Set the VCPUs/number field of the given VM. 1.416 - 1.417 - \noindent {\bf Signature:} 1.418 -\begin{verbatim} void set_VCPUs_number (session_id s, VM ref self, int value)\end{verbatim} 1.419 - 1.420 - 1.421 -\noindent{\bf Arguments:} 1.422 - 1.423 - 1.424 -\vspace{0.3cm} 1.425 -\begin{tabular}{|c|c|p{7cm}|} 1.426 - \hline 1.427 -{\bf type} & {\bf name} & {\bf description} \\ \hline 1.428 -{\tt VM ref } & self & reference to the object \\ \hline 1.429 - 1.430 -{\tt int } & value & New value to set \\ \hline 1.431 - 1.432 -\end{tabular} 1.433 - 1.434 -\vspace{0.3cm} 1.435 - 1.436 - \noindent {\bf Return Type:} 1.437 -{\tt 1.438 -void 1.439 -} 1.440 - 1.441 - 1.442 - 1.443 -\vspace{0.3cm} 1.444 -\vspace{0.3cm} 1.445 -\vspace{0.3cm} 1.446 \subsubsection{RPC name:~get\_VCPUs\_utilisation} 1.447 1.448 {\bf Overview:} 1.449 @@ -3717,6 +3926,38 @@ value of the field 1.450 \vspace{0.3cm} 1.451 \vspace{0.3cm} 1.452 \vspace{0.3cm} 1.453 +\subsubsection{RPC name:~get\_metrics} 1.454 + 1.455 +{\bf Overview:} 1.456 +Get the metrics field of the given VM. 1.457 + 1.458 + \noindent {\bf Signature:} 1.459 +\begin{verbatim} (VM_metrics ref) get_metrics (session_id s, VM ref self)\end{verbatim} 1.460 + 1.461 + 1.462 +\noindent{\bf Arguments:} 1.463 + 1.464 + 1.465 +\vspace{0.3cm} 1.466 +\begin{tabular}{|c|c|p{7cm}|} 1.467 + \hline 1.468 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.469 +{\tt VM ref } & self & reference to the object \\ \hline 1.470 + 1.471 +\end{tabular} 1.472 + 1.473 +\vspace{0.3cm} 1.474 + 1.475 + \noindent {\bf Return Type:} 1.476 +{\tt 1.477 +VM\_metrics ref 1.478 +} 1.479 + 1.480 + 1.481 +value of the field 1.482 +\vspace{0.3cm} 1.483 +\vspace{0.3cm} 1.484 +\vspace{0.3cm} 1.485 \subsubsection{RPC name:~create} 1.486 1.487 {\bf Overview:} 1.488 @@ -3881,6 +4122,251 @@ references to objects with match names 1.489 1.490 \vspace{1cm} 1.491 \newpage 1.492 +\section{Class: VM\_metrics} 1.493 +\subsection{Fields for class: VM\_metrics} 1.494 +\begin{longtable}{|lllp{0.38\textwidth}|} 1.495 +\hline 1.496 +\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM\_metrics} \\ 1.497 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em 1.498 +The metrics associated with a VM.}} \\ 1.499 +\hline 1.500 +Quals & Field & Type & Description \\ 1.501 +\hline 1.502 +$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ 1.503 +$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & VM to which these metrics apply \\ 1.504 +$\mathit{RO}_\mathit{run}$ & {\tt memory/actual} & int & Guest's actual memory (bytes) \\ 1.505 +$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/number} & int & Current number of VCPUs \\ 1.506 +$\mathit{RO}_\mathit{run}$ & {\tt VCPUs/utilisation} & (int $\rightarrow$ float) Map & Utilisation for all of guest's current VCPUs \\ 1.507 +\hline 1.508 +\end{longtable} 1.509 +\subsection{Additional RPCs associated with class: VM\_metrics} 1.510 +\subsubsection{RPC name:~get\_uuid} 1.511 + 1.512 +{\bf Overview:} 1.513 +Get the uuid field of the given VM\_metrics. 1.514 + 1.515 + \noindent {\bf Signature:} 1.516 +\begin{verbatim} string get_uuid (session_id s, VM_metrics ref self)\end{verbatim} 1.517 + 1.518 + 1.519 +\noindent{\bf Arguments:} 1.520 + 1.521 + 1.522 +\vspace{0.3cm} 1.523 +\begin{tabular}{|c|c|p{7cm}|} 1.524 + \hline 1.525 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.526 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.527 + 1.528 +\end{tabular} 1.529 + 1.530 +\vspace{0.3cm} 1.531 + 1.532 + \noindent {\bf Return Type:} 1.533 +{\tt 1.534 +string 1.535 +} 1.536 + 1.537 + 1.538 +value of the field 1.539 +\vspace{0.3cm} 1.540 +\vspace{0.3cm} 1.541 +\vspace{0.3cm} 1.542 +\subsubsection{RPC name:~get\_VM} 1.543 + 1.544 +{\bf Overview:} 1.545 +Get the VM field of the given VM\_metrics. 1.546 + 1.547 + \noindent {\bf Signature:} 1.548 +\begin{verbatim} (VM ref) get_VM (session_id s, VM_metrics ref self)\end{verbatim} 1.549 + 1.550 + 1.551 +\noindent{\bf Arguments:} 1.552 + 1.553 + 1.554 +\vspace{0.3cm} 1.555 +\begin{tabular}{|c|c|p{7cm}|} 1.556 + \hline 1.557 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.558 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.559 + 1.560 +\end{tabular} 1.561 + 1.562 +\vspace{0.3cm} 1.563 + 1.564 + \noindent {\bf Return Type:} 1.565 +{\tt 1.566 +VM ref 1.567 +} 1.568 + 1.569 + 1.570 +value of the field 1.571 +\vspace{0.3cm} 1.572 +\vspace{0.3cm} 1.573 +\vspace{0.3cm} 1.574 +\subsubsection{RPC name:~get\_memory\_actual} 1.575 + 1.576 +{\bf Overview:} 1.577 +Get the memory/actual field of the given VM\_metrics. 1.578 + 1.579 + \noindent {\bf Signature:} 1.580 +\begin{verbatim} int get_memory_actual (session_id s, VM_metrics ref self)\end{verbatim} 1.581 + 1.582 + 1.583 +\noindent{\bf Arguments:} 1.584 + 1.585 + 1.586 +\vspace{0.3cm} 1.587 +\begin{tabular}{|c|c|p{7cm}|} 1.588 + \hline 1.589 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.590 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.591 + 1.592 +\end{tabular} 1.593 + 1.594 +\vspace{0.3cm} 1.595 + 1.596 + \noindent {\bf Return Type:} 1.597 +{\tt 1.598 +int 1.599 +} 1.600 + 1.601 + 1.602 +value of the field 1.603 +\vspace{0.3cm} 1.604 +\vspace{0.3cm} 1.605 +\vspace{0.3cm} 1.606 +\subsubsection{RPC name:~get\_VCPUs\_number} 1.607 + 1.608 +{\bf Overview:} 1.609 +Get the VCPUs/number field of the given VM\_metrics. 1.610 + 1.611 + \noindent {\bf Signature:} 1.612 +\begin{verbatim} int get_VCPUs_number (session_id s, VM_metrics ref self)\end{verbatim} 1.613 + 1.614 + 1.615 +\noindent{\bf Arguments:} 1.616 + 1.617 + 1.618 +\vspace{0.3cm} 1.619 +\begin{tabular}{|c|c|p{7cm}|} 1.620 + \hline 1.621 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.622 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.623 + 1.624 +\end{tabular} 1.625 + 1.626 +\vspace{0.3cm} 1.627 + 1.628 + \noindent {\bf Return Type:} 1.629 +{\tt 1.630 +int 1.631 +} 1.632 + 1.633 + 1.634 +value of the field 1.635 +\vspace{0.3cm} 1.636 +\vspace{0.3cm} 1.637 +\vspace{0.3cm} 1.638 +\subsubsection{RPC name:~get\_VCPUs\_utilisation} 1.639 + 1.640 +{\bf Overview:} 1.641 +Get the VCPUs/utilisation field of the given VM\_metrics. 1.642 + 1.643 + \noindent {\bf Signature:} 1.644 +\begin{verbatim} ((int -> float) Map) get_VCPUs_utilisation (session_id s, VM_metrics ref self)\end{verbatim} 1.645 + 1.646 + 1.647 +\noindent{\bf Arguments:} 1.648 + 1.649 + 1.650 +\vspace{0.3cm} 1.651 +\begin{tabular}{|c|c|p{7cm}|} 1.652 + \hline 1.653 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.654 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.655 + 1.656 +\end{tabular} 1.657 + 1.658 +\vspace{0.3cm} 1.659 + 1.660 + \noindent {\bf Return Type:} 1.661 +{\tt 1.662 +(int $\rightarrow$ float) Map 1.663 +} 1.664 + 1.665 + 1.666 +value of the field 1.667 +\vspace{0.3cm} 1.668 +\vspace{0.3cm} 1.669 +\vspace{0.3cm} 1.670 +\subsubsection{RPC name:~get\_by\_uuid} 1.671 + 1.672 +{\bf Overview:} 1.673 +Get a reference to the VM\_metrics instance with the specified UUID. 1.674 + 1.675 + \noindent {\bf Signature:} 1.676 +\begin{verbatim} (VM_metrics ref) get_by_uuid (session_id s, string uuid)\end{verbatim} 1.677 + 1.678 + 1.679 +\noindent{\bf Arguments:} 1.680 + 1.681 + 1.682 +\vspace{0.3cm} 1.683 +\begin{tabular}{|c|c|p{7cm}|} 1.684 + \hline 1.685 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.686 +{\tt string } & uuid & UUID of object to return \\ \hline 1.687 + 1.688 +\end{tabular} 1.689 + 1.690 +\vspace{0.3cm} 1.691 + 1.692 + \noindent {\bf Return Type:} 1.693 +{\tt 1.694 +VM\_metrics ref 1.695 +} 1.696 + 1.697 + 1.698 +reference to the object 1.699 +\vspace{0.3cm} 1.700 +\vspace{0.3cm} 1.701 +\vspace{0.3cm} 1.702 +\subsubsection{RPC name:~get\_record} 1.703 + 1.704 +{\bf Overview:} 1.705 +Get a record containing the current state of the given VM\_metrics. 1.706 + 1.707 + \noindent {\bf Signature:} 1.708 +\begin{verbatim} (VM_metrics record) get_record (session_id s, VM_metrics ref self)\end{verbatim} 1.709 + 1.710 + 1.711 +\noindent{\bf Arguments:} 1.712 + 1.713 + 1.714 +\vspace{0.3cm} 1.715 +\begin{tabular}{|c|c|p{7cm}|} 1.716 + \hline 1.717 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.718 +{\tt VM\_metrics ref } & self & reference to the object \\ \hline 1.719 + 1.720 +\end{tabular} 1.721 + 1.722 +\vspace{0.3cm} 1.723 + 1.724 + \noindent {\bf Return Type:} 1.725 +{\tt 1.726 +VM\_metrics record 1.727 +} 1.728 + 1.729 + 1.730 +all fields from the object 1.731 +\vspace{0.3cm} 1.732 +\vspace{0.3cm} 1.733 +\vspace{0.3cm} 1.734 + 1.735 +\vspace{1cm} 1.736 +\newpage 1.737 \section{Class: host} 1.738 \subsection{Fields for class: host} 1.739 \begin{longtable}{|lllp{0.38\textwidth}|} 1.740 @@ -11334,6 +11820,16 @@ handle parameter echoes the bad value gi 1.741 \begin{verbatim}VM_HANDLE_INVALID(handle)\end{verbatim} 1.742 \begin{center}\rule{10em}{0.1pt}\end{center} 1.743 1.744 +\subsubsection{VM\_METRICS\_HANDLE\_INVALID} 1.745 + 1.746 +You gave an invalid VM\_metrics handle. The VM\_metrics may have recently 1.747 +been deleted. The handle parameter echoes the bad value given. 1.748 + 1.749 +\vspace{0.3cm} 1.750 +{\bf Signature:} 1.751 +\begin{verbatim}VM_METRICS_HANDLE_INVALID(handle)\end{verbatim} 1.752 +\begin{center}\rule{10em}{0.1pt}\end{center} 1.753 + 1.754 \subsubsection{VTPM\_HANDLE\_INVALID} 1.755 1.756 You gave an invalid VTPM handle. The VTPM may have recently been deleted.
2.1 --- a/tools/libxen/include/xen_vm.h Tue Jan 30 18:30:27 2007 +0000 2.2 +++ b/tools/libxen/include/xen_vm.h Tue Jan 30 18:30:18 2007 +0000 2.3 @@ -31,6 +31,7 @@ 2.4 #include "xen_vdi_decl.h" 2.5 #include "xen_vif_decl.h" 2.6 #include "xen_vm_decl.h" 2.7 +#include "xen_vm_metrics_decl.h" 2.8 #include "xen_vm_power_state.h" 2.9 #include "xen_vtpm_decl.h" 2.10 2.11 @@ -114,11 +115,12 @@ typedef struct xen_vm_record 2.12 struct xen_host_record_opt *resident_on; 2.13 int64_t memory_static_max; 2.14 int64_t memory_dynamic_max; 2.15 - int64_t memory_actual; 2.16 int64_t memory_dynamic_min; 2.17 int64_t memory_static_min; 2.18 char *vcpus_policy; 2.19 - char *vcpus_params; 2.20 + xen_string_string_map *vcpus_params; 2.21 + int64_t vcpus_max; 2.22 + int64_t vcpus_at_startup; 2.23 int64_t vcpus_number; 2.24 xen_int_float_map *vcpus_utilisation; 2.25 enum xen_on_normal_exit actions_after_shutdown; 2.26 @@ -144,6 +146,7 @@ typedef struct xen_vm_record 2.27 xen_string_string_map *tools_version; 2.28 xen_string_string_map *other_config; 2.29 bool is_control_domain; 2.30 + struct xen_vm_metrics_record_opt *metrics; 2.31 } xen_vm_record; 2.32 2.33 /** 2.34 @@ -340,13 +343,6 @@ xen_vm_get_memory_dynamic_max(xen_sessio 2.35 2.36 2.37 /** 2.38 - * Get the memory/actual field of the given VM. 2.39 - */ 2.40 -extern bool 2.41 -xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm); 2.42 - 2.43 - 2.44 -/** 2.45 * Get the memory/dynamic_min field of the given VM. 2.46 */ 2.47 extern bool 2.48 @@ -371,7 +367,21 @@ xen_vm_get_vcpus_policy(xen_session *ses 2.49 * Get the VCPUs/params field of the given VM. 2.50 */ 2.51 extern bool 2.52 -xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm); 2.53 +xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm); 2.54 + 2.55 + 2.56 +/** 2.57 + * Get the VCPUs/max field of the given VM. 2.58 + */ 2.59 +extern bool 2.60 +xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm); 2.61 + 2.62 + 2.63 +/** 2.64 + * Get the VCPUs/at_startup field of the given VM. 2.65 + */ 2.66 +extern bool 2.67 +xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm); 2.68 2.69 2.70 /** 2.71 @@ -550,6 +560,13 @@ xen_vm_get_is_control_domain(xen_session 2.72 2.73 2.74 /** 2.75 + * Get the metrics field of the given VM. 2.76 + */ 2.77 +extern bool 2.78 +xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm); 2.79 + 2.80 + 2.81 +/** 2.82 * Set the name/label field of the given VM. 2.83 */ 2.84 extern bool 2.85 @@ -585,6 +602,13 @@ xen_vm_set_auto_power_on(xen_session *se 2.86 2.87 2.88 /** 2.89 + * Set the memory/static_max field of the given VM. 2.90 + */ 2.91 +extern bool 2.92 +xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max); 2.93 + 2.94 + 2.95 +/** 2.96 * Set the memory/dynamic_max field of the given VM. 2.97 */ 2.98 extern bool 2.99 @@ -599,6 +623,13 @@ xen_vm_set_memory_dynamic_min(xen_sessio 2.100 2.101 2.102 /** 2.103 + * Set the memory/static_min field of the given VM. 2.104 + */ 2.105 +extern bool 2.106 +xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min); 2.107 + 2.108 + 2.109 +/** 2.110 * Set the VCPUs/policy field of the given VM. 2.111 */ 2.112 extern bool 2.113 @@ -609,14 +640,38 @@ xen_vm_set_vcpus_policy(xen_session *ses 2.114 * Set the VCPUs/params field of the given VM. 2.115 */ 2.116 extern bool 2.117 -xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params); 2.118 +xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params); 2.119 + 2.120 + 2.121 +/** 2.122 + * Add the given key-value pair to the VCPUs/params field of the given 2.123 + * VM. 2.124 + */ 2.125 +extern bool 2.126 +xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value); 2.127 2.128 2.129 /** 2.130 - * Set the VCPUs/number field of the given VM. 2.131 + * Remove the given key and its corresponding value from the 2.132 + * VCPUs/params field of the given VM. If the key is not in that Map, then do 2.133 + * nothing. 2.134 */ 2.135 extern bool 2.136 -xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number); 2.137 +xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key); 2.138 + 2.139 + 2.140 +/** 2.141 + * Set the VCPUs/max field of the given VM. 2.142 + */ 2.143 +extern bool 2.144 +xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max); 2.145 + 2.146 + 2.147 +/** 2.148 + * Set the VCPUs/at_startup field of the given VM. 2.149 + */ 2.150 +extern bool 2.151 +xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup); 2.152 2.153 2.154 /**
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/libxen/include/xen_vm_metrics.h Tue Jan 30 18:30:18 2007 +0000 3.3 @@ -0,0 +1,201 @@ 3.4 +/* 3.5 + * Copyright (c) 2006, XenSource Inc. 3.6 + * 3.7 + * This library is free software; you can redistribute it and/or 3.8 + * modify it under the terms of the GNU Lesser General Public 3.9 + * License as published by the Free Software Foundation; either 3.10 + * version 2.1 of the License, or (at your option) any later version. 3.11 + * 3.12 + * This library is distributed in the hope that it will be useful, 3.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 3.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 3.15 + * Lesser General Public License for more details. 3.16 + * 3.17 + * You should have received a copy of the GNU Lesser General Public 3.18 + * License along with this library; if not, write to the Free Software 3.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 3.20 + */ 3.21 + 3.22 +#ifndef XEN_VM_METRICS_H 3.23 +#define XEN_VM_METRICS_H 3.24 + 3.25 +#include "xen_common.h" 3.26 +#include "xen_int_float_map.h" 3.27 +#include "xen_vm_decl.h" 3.28 +#include "xen_vm_metrics_decl.h" 3.29 + 3.30 + 3.31 +/* 3.32 + * The VM_metrics class. 3.33 + * 3.34 + * The metrics associated with a VM. 3.35 + */ 3.36 + 3.37 + 3.38 +/** 3.39 + * Free the given xen_vm_metrics. The given handle must have been 3.40 + * allocated by this library. 3.41 + */ 3.42 +extern void 3.43 +xen_vm_metrics_free(xen_vm_metrics vm_metrics); 3.44 + 3.45 + 3.46 +typedef struct xen_vm_metrics_set 3.47 +{ 3.48 + size_t size; 3.49 + xen_vm_metrics *contents[]; 3.50 +} xen_vm_metrics_set; 3.51 + 3.52 +/** 3.53 + * Allocate a xen_vm_metrics_set of the given size. 3.54 + */ 3.55 +extern xen_vm_metrics_set * 3.56 +xen_vm_metrics_set_alloc(size_t size); 3.57 + 3.58 +/** 3.59 + * Free the given xen_vm_metrics_set. The given set must have been 3.60 + * allocated by this library. 3.61 + */ 3.62 +extern void 3.63 +xen_vm_metrics_set_free(xen_vm_metrics_set *set); 3.64 + 3.65 + 3.66 +typedef struct xen_vm_metrics_record 3.67 +{ 3.68 + xen_vm_metrics handle; 3.69 + char *uuid; 3.70 + struct xen_vm_record_opt *vm; 3.71 + int64_t memory_actual; 3.72 + int64_t vcpus_number; 3.73 + xen_int_float_map *vcpus_utilisation; 3.74 +} xen_vm_metrics_record; 3.75 + 3.76 +/** 3.77 + * Allocate a xen_vm_metrics_record. 3.78 + */ 3.79 +extern xen_vm_metrics_record * 3.80 +xen_vm_metrics_record_alloc(void); 3.81 + 3.82 +/** 3.83 + * Free the given xen_vm_metrics_record, and all referenced values. 3.84 + * The given record must have been allocated by this library. 3.85 + */ 3.86 +extern void 3.87 +xen_vm_metrics_record_free(xen_vm_metrics_record *record); 3.88 + 3.89 + 3.90 +typedef struct xen_vm_metrics_record_opt 3.91 +{ 3.92 + bool is_record; 3.93 + union 3.94 + { 3.95 + xen_vm_metrics handle; 3.96 + xen_vm_metrics_record *record; 3.97 + } u; 3.98 +} xen_vm_metrics_record_opt; 3.99 + 3.100 +/** 3.101 + * Allocate a xen_vm_metrics_record_opt. 3.102 + */ 3.103 +extern xen_vm_metrics_record_opt * 3.104 +xen_vm_metrics_record_opt_alloc(void); 3.105 + 3.106 +/** 3.107 + * Free the given xen_vm_metrics_record_opt, and all referenced values. 3.108 + * The given record_opt must have been allocated by this library. 3.109 + */ 3.110 +extern void 3.111 +xen_vm_metrics_record_opt_free(xen_vm_metrics_record_opt *record_opt); 3.112 + 3.113 + 3.114 +typedef struct xen_vm_metrics_record_set 3.115 +{ 3.116 + size_t size; 3.117 + xen_vm_metrics_record *contents[]; 3.118 +} xen_vm_metrics_record_set; 3.119 + 3.120 +/** 3.121 + * Allocate a xen_vm_metrics_record_set of the given size. 3.122 + */ 3.123 +extern xen_vm_metrics_record_set * 3.124 +xen_vm_metrics_record_set_alloc(size_t size); 3.125 + 3.126 +/** 3.127 + * Free the given xen_vm_metrics_record_set, and all referenced values. 3.128 + * The given set must have been allocated by this library. 3.129 + */ 3.130 +extern void 3.131 +xen_vm_metrics_record_set_free(xen_vm_metrics_record_set *set); 3.132 + 3.133 + 3.134 + 3.135 +typedef struct xen_vm_metrics_record_opt_set 3.136 +{ 3.137 + size_t size; 3.138 + xen_vm_metrics_record_opt *contents[]; 3.139 +} xen_vm_metrics_record_opt_set; 3.140 + 3.141 +/** 3.142 + * Allocate a xen_vm_metrics_record_opt_set of the given size. 3.143 + */ 3.144 +extern xen_vm_metrics_record_opt_set * 3.145 +xen_vm_metrics_record_opt_set_alloc(size_t size); 3.146 + 3.147 +/** 3.148 + * Free the given xen_vm_metrics_record_opt_set, and all referenced 3.149 + * values. The given set must have been allocated by this library. 3.150 + */ 3.151 +extern void 3.152 +xen_vm_metrics_record_opt_set_free(xen_vm_metrics_record_opt_set *set); 3.153 + 3.154 + 3.155 +/** 3.156 + * Get a record containing the current state of the given VM_metrics. 3.157 + */ 3.158 +extern bool 3.159 +xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics); 3.160 + 3.161 + 3.162 +/** 3.163 + * Get a reference to the VM_metrics instance with the specified UUID. 3.164 + */ 3.165 +extern bool 3.166 +xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid); 3.167 + 3.168 + 3.169 +/** 3.170 + * Get the uuid field of the given VM_metrics. 3.171 + */ 3.172 +extern bool 3.173 +xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics); 3.174 + 3.175 + 3.176 +/** 3.177 + * Get the VM field of the given VM_metrics. 3.178 + */ 3.179 +extern bool 3.180 +xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics vm_metrics); 3.181 + 3.182 + 3.183 +/** 3.184 + * Get the memory/actual field of the given VM_metrics. 3.185 + */ 3.186 +extern bool 3.187 +xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics); 3.188 + 3.189 + 3.190 +/** 3.191 + * Get the VCPUs/number field of the given VM_metrics. 3.192 + */ 3.193 +extern bool 3.194 +xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics); 3.195 + 3.196 + 3.197 +/** 3.198 + * Get the VCPUs/utilisation field of the given VM_metrics. 3.199 + */ 3.200 +extern bool 3.201 +xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics); 3.202 + 3.203 + 3.204 +#endif
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/libxen/include/xen_vm_metrics_decl.h Tue Jan 30 18:30:18 2007 +0000 4.3 @@ -0,0 +1,30 @@ 4.4 +/* 4.5 + * Copyright (c) 2006, XenSource Inc. 4.6 + * 4.7 + * This library is free software; you can redistribute it and/or 4.8 + * modify it under the terms of the GNU Lesser General Public 4.9 + * License as published by the Free Software Foundation; either 4.10 + * version 2.1 of the License, or (at your option) any later version. 4.11 + * 4.12 + * This library is distributed in the hope that it will be useful, 4.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 4.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4.15 + * Lesser General Public License for more details. 4.16 + * 4.17 + * You should have received a copy of the GNU Lesser General Public 4.18 + * License along with this library; if not, write to the Free Software 4.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 4.20 + */ 4.21 + 4.22 +#ifndef XEN_VM_METRICS_DECL_H 4.23 +#define XEN_VM_METRICS_DECL_H 4.24 + 4.25 +typedef void *xen_vm_metrics; 4.26 + 4.27 +struct xen_vm_metrics_set; 4.28 +struct xen_vm_metrics_record; 4.29 +struct xen_vm_metrics_record_set; 4.30 +struct xen_vm_metrics_record_opt; 4.31 +struct xen_vm_metrics_record_opt_set; 4.32 + 4.33 +#endif
5.1 --- a/tools/libxen/src/xen_vm.c Tue Jan 30 18:30:27 2007 +0000 5.2 +++ b/tools/libxen/src/xen_vm.c Tue Jan 30 18:30:18 2007 +0000 5.3 @@ -33,6 +33,7 @@ 5.4 #include "xen_vdi.h" 5.5 #include "xen_vif.h" 5.6 #include "xen_vm.h" 5.7 +#include "xen_vm_metrics.h" 5.8 #include "xen_vm_power_state_internal.h" 5.9 #include "xen_vtpm.h" 5.10 5.11 @@ -81,9 +82,6 @@ static const struct_member xen_vm_record 5.12 { .key = "memory_dynamic_max", 5.13 .type = &abstract_type_int, 5.14 .offset = offsetof(xen_vm_record, memory_dynamic_max) }, 5.15 - { .key = "memory_actual", 5.16 - .type = &abstract_type_int, 5.17 - .offset = offsetof(xen_vm_record, memory_actual) }, 5.18 { .key = "memory_dynamic_min", 5.19 .type = &abstract_type_int, 5.20 .offset = offsetof(xen_vm_record, memory_dynamic_min) }, 5.21 @@ -94,8 +92,14 @@ static const struct_member xen_vm_record 5.22 .type = &abstract_type_string, 5.23 .offset = offsetof(xen_vm_record, vcpus_policy) }, 5.24 { .key = "VCPUs_params", 5.25 - .type = &abstract_type_string, 5.26 + .type = &abstract_type_string_string_map, 5.27 .offset = offsetof(xen_vm_record, vcpus_params) }, 5.28 + { .key = "VCPUs_max", 5.29 + .type = &abstract_type_int, 5.30 + .offset = offsetof(xen_vm_record, vcpus_max) }, 5.31 + { .key = "VCPUs_at_startup", 5.32 + .type = &abstract_type_int, 5.33 + .offset = offsetof(xen_vm_record, vcpus_at_startup) }, 5.34 { .key = "VCPUs_number", 5.35 .type = &abstract_type_int, 5.36 .offset = offsetof(xen_vm_record, vcpus_number) }, 5.37 @@ -170,7 +174,10 @@ static const struct_member xen_vm_record 5.38 .offset = offsetof(xen_vm_record, other_config) }, 5.39 { .key = "is_control_domain", 5.40 .type = &abstract_type_bool, 5.41 - .offset = offsetof(xen_vm_record, is_control_domain) } 5.42 + .offset = offsetof(xen_vm_record, is_control_domain) }, 5.43 + { .key = "metrics", 5.44 + .type = &abstract_type_ref, 5.45 + .offset = offsetof(xen_vm_record, metrics) } 5.46 }; 5.47 5.48 const abstract_type xen_vm_record_abstract_type_ = 5.49 @@ -197,7 +204,7 @@ xen_vm_record_free(xen_vm_record *record 5.50 xen_vdi_record_opt_free(record->suspend_vdi); 5.51 xen_host_record_opt_free(record->resident_on); 5.52 free(record->vcpus_policy); 5.53 - free(record->vcpus_params); 5.54 + xen_string_string_map_free(record->vcpus_params); 5.55 xen_int_float_map_free(record->vcpus_utilisation); 5.56 xen_console_record_opt_set_free(record->consoles); 5.57 xen_vif_record_opt_set_free(record->vifs); 5.58 @@ -214,6 +221,7 @@ xen_vm_record_free(xen_vm_record *record 5.59 free(record->pci_bus); 5.60 xen_string_string_map_free(record->tools_version); 5.61 xen_string_string_map_free(record->other_config); 5.62 + xen_vm_metrics_record_opt_free(record->metrics); 5.63 free(record); 5.64 } 5.65 5.66 @@ -470,22 +478,6 @@ xen_vm_get_memory_dynamic_max(xen_sessio 5.67 5.68 5.69 bool 5.70 -xen_vm_get_memory_actual(xen_session *session, int64_t *result, xen_vm vm) 5.71 -{ 5.72 - abstract_value param_values[] = 5.73 - { 5.74 - { .type = &abstract_type_string, 5.75 - .u.string_val = vm } 5.76 - }; 5.77 - 5.78 - abstract_type result_type = abstract_type_int; 5.79 - 5.80 - XEN_CALL_("VM.get_memory_actual"); 5.81 - return session->ok; 5.82 -} 5.83 - 5.84 - 5.85 -bool 5.86 xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm) 5.87 { 5.88 abstract_value param_values[] = 5.89 @@ -535,7 +527,7 @@ xen_vm_get_vcpus_policy(xen_session *ses 5.90 5.91 5.92 bool 5.93 -xen_vm_get_vcpus_params(xen_session *session, char **result, xen_vm vm) 5.94 +xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm) 5.95 { 5.96 abstract_value param_values[] = 5.97 { 5.98 @@ -543,7 +535,7 @@ xen_vm_get_vcpus_params(xen_session *ses 5.99 .u.string_val = vm } 5.100 }; 5.101 5.102 - abstract_type result_type = abstract_type_string; 5.103 + abstract_type result_type = abstract_type_string_string_map; 5.104 5.105 *result = NULL; 5.106 XEN_CALL_("VM.get_VCPUs_params"); 5.107 @@ -552,6 +544,38 @@ xen_vm_get_vcpus_params(xen_session *ses 5.108 5.109 5.110 bool 5.111 +xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm) 5.112 +{ 5.113 + abstract_value param_values[] = 5.114 + { 5.115 + { .type = &abstract_type_string, 5.116 + .u.string_val = vm } 5.117 + }; 5.118 + 5.119 + abstract_type result_type = abstract_type_int; 5.120 + 5.121 + XEN_CALL_("VM.get_VCPUs_max"); 5.122 + return session->ok; 5.123 +} 5.124 + 5.125 + 5.126 +bool 5.127 +xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm) 5.128 +{ 5.129 + abstract_value param_values[] = 5.130 + { 5.131 + { .type = &abstract_type_string, 5.132 + .u.string_val = vm } 5.133 + }; 5.134 + 5.135 + abstract_type result_type = abstract_type_int; 5.136 + 5.137 + XEN_CALL_("VM.get_VCPUs_at_startup"); 5.138 + return session->ok; 5.139 +} 5.140 + 5.141 + 5.142 +bool 5.143 xen_vm_get_vcpus_number(xen_session *session, int64_t *result, xen_vm vm) 5.144 { 5.145 abstract_value param_values[] = 5.146 @@ -965,6 +989,23 @@ xen_vm_get_is_control_domain(xen_session 5.147 5.148 5.149 bool 5.150 +xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm) 5.151 +{ 5.152 + abstract_value param_values[] = 5.153 + { 5.154 + { .type = &abstract_type_string, 5.155 + .u.string_val = vm } 5.156 + }; 5.157 + 5.158 + abstract_type result_type = abstract_type_string; 5.159 + 5.160 + *result = NULL; 5.161 + XEN_CALL_("VM.get_metrics"); 5.162 + return session->ok; 5.163 +} 5.164 + 5.165 + 5.166 +bool 5.167 xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label) 5.168 { 5.169 abstract_value param_values[] = 5.170 @@ -1045,6 +1086,22 @@ xen_vm_set_auto_power_on(xen_session *se 5.171 5.172 5.173 bool 5.174 +xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max) 5.175 +{ 5.176 + abstract_value param_values[] = 5.177 + { 5.178 + { .type = &abstract_type_string, 5.179 + .u.string_val = vm }, 5.180 + { .type = &abstract_type_int, 5.181 + .u.int_val = static_max } 5.182 + }; 5.183 + 5.184 + xen_call_(session, "VM.set_memory_static_max", param_values, 2, NULL, NULL); 5.185 + return session->ok; 5.186 +} 5.187 + 5.188 + 5.189 +bool 5.190 xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max) 5.191 { 5.192 abstract_value param_values[] = 5.193 @@ -1077,6 +1134,22 @@ xen_vm_set_memory_dynamic_min(xen_sessio 5.194 5.195 5.196 bool 5.197 +xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min) 5.198 +{ 5.199 + abstract_value param_values[] = 5.200 + { 5.201 + { .type = &abstract_type_string, 5.202 + .u.string_val = vm }, 5.203 + { .type = &abstract_type_int, 5.204 + .u.int_val = static_min } 5.205 + }; 5.206 + 5.207 + xen_call_(session, "VM.set_memory_static_min", param_values, 2, NULL, NULL); 5.208 + return session->ok; 5.209 +} 5.210 + 5.211 + 5.212 +bool 5.213 xen_vm_set_vcpus_policy(xen_session *session, xen_vm vm, char *policy) 5.214 { 5.215 abstract_value param_values[] = 5.216 @@ -1093,14 +1166,14 @@ xen_vm_set_vcpus_policy(xen_session *ses 5.217 5.218 5.219 bool 5.220 -xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, char *params) 5.221 +xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params) 5.222 { 5.223 abstract_value param_values[] = 5.224 { 5.225 { .type = &abstract_type_string, 5.226 .u.string_val = vm }, 5.227 - { .type = &abstract_type_string, 5.228 - .u.string_val = params } 5.229 + { .type = &abstract_type_string_string_map, 5.230 + .u.set_val = (arbitrary_set *)params } 5.231 }; 5.232 5.233 xen_call_(session, "VM.set_VCPUs_params", param_values, 2, NULL, NULL); 5.234 @@ -1109,17 +1182,67 @@ xen_vm_set_vcpus_params(xen_session *ses 5.235 5.236 5.237 bool 5.238 -xen_vm_set_vcpus_number(xen_session *session, xen_vm vm, int64_t number) 5.239 +xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value) 5.240 +{ 5.241 + abstract_value param_values[] = 5.242 + { 5.243 + { .type = &abstract_type_string, 5.244 + .u.string_val = vm }, 5.245 + { .type = &abstract_type_string, 5.246 + .u.string_val = key }, 5.247 + { .type = &abstract_type_string, 5.248 + .u.string_val = value } 5.249 + }; 5.250 + 5.251 + xen_call_(session, "VM.add_to_VCPUs_params", param_values, 3, NULL, NULL); 5.252 + return session->ok; 5.253 +} 5.254 + 5.255 + 5.256 +bool 5.257 +xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key) 5.258 +{ 5.259 + abstract_value param_values[] = 5.260 + { 5.261 + { .type = &abstract_type_string, 5.262 + .u.string_val = vm }, 5.263 + { .type = &abstract_type_string, 5.264 + .u.string_val = key } 5.265 + }; 5.266 + 5.267 + xen_call_(session, "VM.remove_from_VCPUs_params", param_values, 2, NULL, NULL); 5.268 + return session->ok; 5.269 +} 5.270 + 5.271 + 5.272 +bool 5.273 +xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max) 5.274 { 5.275 abstract_value param_values[] = 5.276 { 5.277 { .type = &abstract_type_string, 5.278 .u.string_val = vm }, 5.279 { .type = &abstract_type_int, 5.280 - .u.int_val = number } 5.281 + .u.int_val = max } 5.282 }; 5.283 5.284 - xen_call_(session, "VM.set_VCPUs_number", param_values, 2, NULL, NULL); 5.285 + xen_call_(session, "VM.set_VCPUs_max", param_values, 2, NULL, NULL); 5.286 + return session->ok; 5.287 +} 5.288 + 5.289 + 5.290 +bool 5.291 +xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup) 5.292 +{ 5.293 + abstract_value param_values[] = 5.294 + { 5.295 + { .type = &abstract_type_string, 5.296 + .u.string_val = vm }, 5.297 + { .type = &abstract_type_int, 5.298 + .u.int_val = at_startup } 5.299 + }; 5.300 + 5.301 + xen_call_(session, "VM.set_VCPUs_at_startup", param_values, 2, NULL, NULL); 5.302 return session->ok; 5.303 } 5.304
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/tools/libxen/src/xen_vm_metrics.c Tue Jan 30 18:30:18 2007 +0000 6.3 @@ -0,0 +1,194 @@ 6.4 +/* 6.5 + * Copyright (c) 2006, XenSource Inc. 6.6 + * 6.7 + * This library is free software; you can redistribute it and/or 6.8 + * modify it under the terms of the GNU Lesser General Public 6.9 + * License as published by the Free Software Foundation; either 6.10 + * version 2.1 of the License, or (at your option) any later version. 6.11 + * 6.12 + * This library is distributed in the hope that it will be useful, 6.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of 6.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 6.15 + * Lesser General Public License for more details. 6.16 + * 6.17 + * You should have received a copy of the GNU Lesser General Public 6.18 + * License along with this library; if not, write to the Free Software 6.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6.20 + */ 6.21 + 6.22 + 6.23 +#include <stddef.h> 6.24 +#include <stdlib.h> 6.25 + 6.26 +#include "xen_common.h" 6.27 +#include "xen_int_float_map.h" 6.28 +#include "xen_internal.h" 6.29 +#include "xen_vm.h" 6.30 +#include "xen_vm_metrics.h" 6.31 + 6.32 + 6.33 +XEN_FREE(xen_vm_metrics) 6.34 +XEN_SET_ALLOC_FREE(xen_vm_metrics) 6.35 +XEN_ALLOC(xen_vm_metrics_record) 6.36 +XEN_SET_ALLOC_FREE(xen_vm_metrics_record) 6.37 +XEN_ALLOC(xen_vm_metrics_record_opt) 6.38 +XEN_RECORD_OPT_FREE(xen_vm_metrics) 6.39 +XEN_SET_ALLOC_FREE(xen_vm_metrics_record_opt) 6.40 + 6.41 + 6.42 +static const struct_member xen_vm_metrics_record_struct_members[] = 6.43 + { 6.44 + { .key = "uuid", 6.45 + .type = &abstract_type_string, 6.46 + .offset = offsetof(xen_vm_metrics_record, uuid) }, 6.47 + { .key = "VM", 6.48 + .type = &abstract_type_ref, 6.49 + .offset = offsetof(xen_vm_metrics_record, vm) }, 6.50 + { .key = "memory_actual", 6.51 + .type = &abstract_type_int, 6.52 + .offset = offsetof(xen_vm_metrics_record, memory_actual) }, 6.53 + { .key = "VCPUs_number", 6.54 + .type = &abstract_type_int, 6.55 + .offset = offsetof(xen_vm_metrics_record, vcpus_number) }, 6.56 + { .key = "VCPUs_utilisation", 6.57 + .type = &abstract_type_int_float_map, 6.58 + .offset = offsetof(xen_vm_metrics_record, vcpus_utilisation) } 6.59 + }; 6.60 + 6.61 +const abstract_type xen_vm_metrics_record_abstract_type_ = 6.62 + { 6.63 + .typename = STRUCT, 6.64 + .struct_size = sizeof(xen_vm_metrics_record), 6.65 + .member_count = 6.66 + sizeof(xen_vm_metrics_record_struct_members) / sizeof(struct_member), 6.67 + .members = xen_vm_metrics_record_struct_members 6.68 + }; 6.69 + 6.70 + 6.71 +void 6.72 +xen_vm_metrics_record_free(xen_vm_metrics_record *record) 6.73 +{ 6.74 + if (record == NULL) 6.75 + { 6.76 + return; 6.77 + } 6.78 + free(record->handle); 6.79 + free(record->uuid); 6.80 + xen_vm_record_opt_free(record->vm); 6.81 + xen_int_float_map_free(record->vcpus_utilisation); 6.82 + free(record); 6.83 +} 6.84 + 6.85 + 6.86 +bool 6.87 +xen_vm_metrics_get_record(xen_session *session, xen_vm_metrics_record **result, xen_vm_metrics vm_metrics) 6.88 +{ 6.89 + abstract_value param_values[] = 6.90 + { 6.91 + { .type = &abstract_type_string, 6.92 + .u.string_val = vm_metrics } 6.93 + }; 6.94 + 6.95 + abstract_type result_type = xen_vm_metrics_record_abstract_type_; 6.96 + 6.97 + *result = NULL; 6.98 + XEN_CALL_("VM_metrics.get_record"); 6.99 + 6.100 + if (session->ok) 6.101 + { 6.102 + (*result)->handle = xen_strdup_((*result)->uuid); 6.103 + } 6.104 + 6.105 + return session->ok; 6.106 +} 6.107 + 6.108 + 6.109 +bool 6.110 +xen_vm_metrics_get_by_uuid(xen_session *session, xen_vm_metrics *result, char *uuid) 6.111 +{ 6.112 + abstract_value param_values[] = 6.113 + { 6.114 + { .type = &abstract_type_string, 6.115 + .u.string_val = uuid } 6.116 + }; 6.117 + 6.118 + abstract_type result_type = abstract_type_string; 6.119 + 6.120 + *result = NULL; 6.121 + XEN_CALL_("VM_metrics.get_by_uuid"); 6.122 + return session->ok; 6.123 +} 6.124 + 6.125 + 6.126 +bool 6.127 +xen_vm_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_metrics vm_metrics) 6.128 +{ 6.129 + abstract_value param_values[] = 6.130 + { 6.131 + { .type = &abstract_type_string, 6.132 + .u.string_val = vm_metrics } 6.133 + }; 6.134 + 6.135 + abstract_type result_type = abstract_type_string; 6.136 + 6.137 + *result = NULL; 6.138 + XEN_CALL_("VM_metrics.get_VM"); 6.139 + return session->ok; 6.140 +} 6.141 + 6.142 + 6.143 +bool 6.144 +xen_vm_metrics_get_memory_actual(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics) 6.145 +{ 6.146 + abstract_value param_values[] = 6.147 + { 6.148 + { .type = &abstract_type_string, 6.149 + .u.string_val = vm_metrics } 6.150 + }; 6.151 + 6.152 + abstract_type result_type = abstract_type_int; 6.153 + 6.154 + XEN_CALL_("VM_metrics.get_memory_actual"); 6.155 + return session->ok; 6.156 +} 6.157 + 6.158 + 6.159 +bool 6.160 +xen_vm_metrics_get_vcpus_number(xen_session *session, int64_t *result, xen_vm_metrics vm_metrics) 6.161 +{ 6.162 + abstract_value param_values[] = 6.163 + { 6.164 + { .type = &abstract_type_string, 6.165 + .u.string_val = vm_metrics } 6.166 + }; 6.167 + 6.168 + abstract_type result_type = abstract_type_int; 6.169 + 6.170 + XEN_CALL_("VM_metrics.get_VCPUs_number"); 6.171 + return session->ok; 6.172 +} 6.173 + 6.174 + 6.175 +bool 6.176 +xen_vm_metrics_get_vcpus_utilisation(xen_session *session, xen_int_float_map **result, xen_vm_metrics vm_metrics) 6.177 +{ 6.178 + abstract_value param_values[] = 6.179 + { 6.180 + { .type = &abstract_type_string, 6.181 + .u.string_val = vm_metrics } 6.182 + }; 6.183 + 6.184 + abstract_type result_type = abstract_type_int_float_map; 6.185 + 6.186 + *result = NULL; 6.187 + XEN_CALL_("VM_metrics.get_VCPUs_utilisation"); 6.188 + return session->ok; 6.189 +} 6.190 + 6.191 + 6.192 +bool 6.193 +xen_vm_metrics_get_uuid(xen_session *session, char **result, xen_vm_metrics vm_metrics) 6.194 +{ 6.195 + *result = session->ok ? xen_strdup_((char *)vm_metrics) : NULL; 6.196 + return session->ok; 6.197 +}
7.1 --- a/tools/libxen/test/test_bindings.c Tue Jan 30 18:30:27 2007 +0000 7.2 +++ b/tools/libxen/test/test_bindings.c Tue Jan 30 18:30:18 2007 +0000 7.3 @@ -277,6 +277,7 @@ int main(int argc, char **argv) 7.4 */ 7.5 static xen_vm create_new_vm(xen_session *session) 7.6 { 7.7 + xen_string_string_map *vcpus_params = xen_string_string_map_alloc(1); 7.8 xen_vm_record vm_record = 7.9 { 7.10 .name_label = "NewVM", 7.11 @@ -288,7 +289,7 @@ static xen_vm create_new_vm(xen_session 7.12 .memory_dynamic_min = 128, 7.13 .memory_static_min = 128, 7.14 .vcpus_policy = "credit", 7.15 - .vcpus_params = "", 7.16 + .vcpus_params = vcpus_params, 7.17 .vcpus_number = 2, 7.18 .actions_after_shutdown = XEN_ON_NORMAL_EXIT_DESTROY, 7.19 .actions_after_reboot = XEN_ON_NORMAL_EXIT_RESTART,
8.1 --- a/tools/python/xen/xm/messages/en/xen-xm.po Tue Jan 30 18:30:27 2007 +0000 8.2 +++ b/tools/python/xen/xm/messages/en/xen-xm.po Tue Jan 30 18:30:18 2007 +0000 8.3 @@ -19,7 +19,7 @@ 8.4 msgid "" 8.5 msgstr "" 8.6 "Project-Id-Version: Xen-xm 3.0\n" 8.7 -"PO-Revision-Date: 2007-01-30 12:49+0000\n" 8.8 +"PO-Revision-Date: 2007-01-30 17:15+0000\n" 8.9 "Last-Translator: Ewan Mellor <ewan@xensource.com>\n" 8.10 "Language-Team: xen-devel <xen-devel@lists.xensource.com>\n" 8.11 "MIME-Version: 1.0\n" 8.12 @@ -74,6 +74,9 @@ msgstr "The VIF handle %(1)s is invalid. 8.13 msgid "VM_HANDLE_INVALID" 8.14 msgstr "The VM handle %(1)s is invalid." 8.15 8.16 +msgid "VM_METRICS_HANDLE_INVALID" 8.17 +msgstr "The VM_metrics handle %(1)s is invalid." 8.18 + 8.19 msgid "VTPM_HANDLE_INVALID" 8.20 msgstr "The VTPM handle %(1)s is invalid." 8.21