ia64/xen-unstable
changeset 14123:e71b277f1533
Replace VM.tools_version with a richer VM_guest_metrics class.
Signed-off-by: Ewan Mellor <ewan@xensource.com>
Signed-off-by: Ewan Mellor <ewan@xensource.com>
author | Ewan Mellor <ewan@xensource.com> |
---|---|
date | Sun Feb 25 23:17:14 2007 +0000 (2007-02-25) |
parents | cfd23ac1b32a |
children | 36702d9b2c5c |
files | docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_vm.h tools/libxen/include/xen_vm_guest_metrics.h tools/libxen/include/xen_vm_guest_metrics_decl.h tools/libxen/src/xen_vm.c tools/libxen/src/xen_vm_guest_metrics.c |
line diff
1.1 --- a/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 22:47:29 2007 +0000 1.2 +++ b/docs/xen-api/xenapi-datamodel.tex Sun Feb 25 23:17:14 2007 +0000 1.3 @@ -26,6 +26,7 @@ Name & Description \\ 1.4 {\tt task} & A long-running asynchronous task \\ 1.5 {\tt VM} & A virtual machine (or 'guest') \\ 1.6 {\tt VM\_metrics} & The metrics associated with a VM \\ 1.7 +{\tt VM\_guest\_metrics} & The metrics reported by the guest (as opposed to inferred from outside) \\ 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 @@ -1098,11 +1099,11 @@ Quals & Field & Type & Description \\ 1.12 $\mathit{RW}$ & {\tt platform/clock\_offset} & bool & timeshift applied to guest's clock \\ 1.13 $\mathit{RW}$ & {\tt platform/enable\_audio} & bool & emulate audio \\ 1.14 $\mathit{RO}_\mathit{ins}$ & {\tt PCI\_bus} & string & PCI bus path for pass-through devices \\ 1.15 -$\mathit{RO}_\mathit{run}$ & {\tt tools\_version} & (string $\rightarrow$ string) Map & versions of installed paravirtualised drivers \\ 1.16 $\mathit{RW}$ & {\tt other\_config} & (string $\rightarrow$ string) Map & additional configuration \\ 1.17 $\mathit{RO}_\mathit{run}$ & {\tt domid} & int & domain ID (if available, -1 otherwise) \\ 1.18 $\mathit{RO}_\mathit{run}$ & {\tt is\_control\_domain} & bool & true if this is a control domain (domain 0 or a driver domain) \\ 1.19 $\mathit{RO}_\mathit{run}$ & {\tt metrics} & VM\_metrics ref & metrics associated with this VM. \\ 1.20 +$\mathit{RO}_\mathit{run}$ & {\tt guest\_metrics} & VM\_guest\_metrics ref & metrics associated with the running guest \\ 1.21 \hline 1.22 \end{longtable} 1.23 \subsection{Additional RPCs associated with class: VM} 1.24 @@ -3801,38 +3802,6 @@ value of the field 1.25 \vspace{0.3cm} 1.26 \vspace{0.3cm} 1.27 \vspace{0.3cm} 1.28 -\subsubsection{RPC name:~get\_tools\_version} 1.29 - 1.30 -{\bf Overview:} 1.31 -Get the tools\_version field of the given VM. 1.32 - 1.33 - \noindent {\bf Signature:} 1.34 -\begin{verbatim} ((string -> string) Map) get_tools_version (session_id s, VM ref self)\end{verbatim} 1.35 - 1.36 - 1.37 -\noindent{\bf Arguments:} 1.38 - 1.39 - 1.40 -\vspace{0.3cm} 1.41 -\begin{tabular}{|c|c|p{7cm}|} 1.42 - \hline 1.43 -{\bf type} & {\bf name} & {\bf description} \\ \hline 1.44 -{\tt VM ref } & self & reference to the object \\ \hline 1.45 - 1.46 -\end{tabular} 1.47 - 1.48 -\vspace{0.3cm} 1.49 - 1.50 - \noindent {\bf Return Type:} 1.51 -{\tt 1.52 -(string $\rightarrow$ string) Map 1.53 -} 1.54 - 1.55 - 1.56 -value of the field 1.57 -\vspace{0.3cm} 1.58 -\vspace{0.3cm} 1.59 -\vspace{0.3cm} 1.60 \subsubsection{RPC name:~get\_other\_config} 1.61 1.62 {\bf Overview:} 1.63 @@ -4066,6 +4035,38 @@ value of the field 1.64 \vspace{0.3cm} 1.65 \vspace{0.3cm} 1.66 \vspace{0.3cm} 1.67 +\subsubsection{RPC name:~get\_guest\_metrics} 1.68 + 1.69 +{\bf Overview:} 1.70 +Get the guest\_metrics field of the given VM. 1.71 + 1.72 + \noindent {\bf Signature:} 1.73 +\begin{verbatim} (VM_guest_metrics ref) get_guest_metrics (session_id s, VM ref self)\end{verbatim} 1.74 + 1.75 + 1.76 +\noindent{\bf Arguments:} 1.77 + 1.78 + 1.79 +\vspace{0.3cm} 1.80 +\begin{tabular}{|c|c|p{7cm}|} 1.81 + \hline 1.82 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.83 +{\tt VM ref } & self & reference to the object \\ \hline 1.84 + 1.85 +\end{tabular} 1.86 + 1.87 +\vspace{0.3cm} 1.88 + 1.89 + \noindent {\bf Return Type:} 1.90 +{\tt 1.91 +VM\_guest\_metrics ref 1.92 +} 1.93 + 1.94 + 1.95 +value of the field 1.96 +\vspace{0.3cm} 1.97 +\vspace{0.3cm} 1.98 +\vspace{0.3cm} 1.99 \subsubsection{RPC name:~create} 1.100 1.101 {\bf Overview:} 1.102 @@ -4442,6 +4443,350 @@ all fields from the object 1.103 1.104 \vspace{1cm} 1.105 \newpage 1.106 +\section{Class: VM\_guest\_metrics} 1.107 +\subsection{Fields for class: VM\_guest\_metrics} 1.108 +\begin{longtable}{|lllp{0.38\textwidth}|} 1.109 +\hline 1.110 +\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VM\_guest\_metrics} \\ 1.111 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em 1.112 +The metrics reported by the guest (as opposed to inferred from outside).}} \\ 1.113 +\hline 1.114 +Quals & Field & Type & Description \\ 1.115 +\hline 1.116 +$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ 1.117 +$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & VM to which these metrics apply \\ 1.118 +$\mathit{RO}_\mathit{run}$ & {\tt os\_version} & (string $\rightarrow$ string) Map & version of the OS \\ 1.119 +$\mathit{RO}_\mathit{run}$ & {\tt PV\_drivers\_version} & (string $\rightarrow$ string) Map & version of the PV drivers \\ 1.120 +$\mathit{RO}_\mathit{run}$ & {\tt memory} & (string $\rightarrow$ string) Map & free/used/total memory \\ 1.121 +$\mathit{RO}_\mathit{run}$ & {\tt disks} & (string $\rightarrow$ string) Map & disk configuration/free space \\ 1.122 +$\mathit{RO}_\mathit{run}$ & {\tt networks} & (string $\rightarrow$ string) Map & network configuration \\ 1.123 +$\mathit{RO}_\mathit{run}$ & {\tt other} & (string $\rightarrow$ string) Map & anything else \\ 1.124 +\hline 1.125 +\end{longtable} 1.126 +\subsection{Additional RPCs associated with class: VM\_guest\_metrics} 1.127 +\subsubsection{RPC name:~get\_uuid} 1.128 + 1.129 +{\bf Overview:} 1.130 +Get the uuid field of the given VM\_guest\_metrics. 1.131 + 1.132 + \noindent {\bf Signature:} 1.133 +\begin{verbatim} string get_uuid (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.134 + 1.135 + 1.136 +\noindent{\bf Arguments:} 1.137 + 1.138 + 1.139 +\vspace{0.3cm} 1.140 +\begin{tabular}{|c|c|p{7cm}|} 1.141 + \hline 1.142 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.143 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.144 + 1.145 +\end{tabular} 1.146 + 1.147 +\vspace{0.3cm} 1.148 + 1.149 + \noindent {\bf Return Type:} 1.150 +{\tt 1.151 +string 1.152 +} 1.153 + 1.154 + 1.155 +value of the field 1.156 +\vspace{0.3cm} 1.157 +\vspace{0.3cm} 1.158 +\vspace{0.3cm} 1.159 +\subsubsection{RPC name:~get\_VM} 1.160 + 1.161 +{\bf Overview:} 1.162 +Get the VM field of the given VM\_guest\_metrics. 1.163 + 1.164 + \noindent {\bf Signature:} 1.165 +\begin{verbatim} (VM ref) get_VM (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.166 + 1.167 + 1.168 +\noindent{\bf Arguments:} 1.169 + 1.170 + 1.171 +\vspace{0.3cm} 1.172 +\begin{tabular}{|c|c|p{7cm}|} 1.173 + \hline 1.174 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.175 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.176 + 1.177 +\end{tabular} 1.178 + 1.179 +\vspace{0.3cm} 1.180 + 1.181 + \noindent {\bf Return Type:} 1.182 +{\tt 1.183 +VM ref 1.184 +} 1.185 + 1.186 + 1.187 +value of the field 1.188 +\vspace{0.3cm} 1.189 +\vspace{0.3cm} 1.190 +\vspace{0.3cm} 1.191 +\subsubsection{RPC name:~get\_os\_version} 1.192 + 1.193 +{\bf Overview:} 1.194 +Get the os\_version field of the given VM\_guest\_metrics. 1.195 + 1.196 + \noindent {\bf Signature:} 1.197 +\begin{verbatim} ((string -> string) Map) get_os_version (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.198 + 1.199 + 1.200 +\noindent{\bf Arguments:} 1.201 + 1.202 + 1.203 +\vspace{0.3cm} 1.204 +\begin{tabular}{|c|c|p{7cm}|} 1.205 + \hline 1.206 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.207 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.208 + 1.209 +\end{tabular} 1.210 + 1.211 +\vspace{0.3cm} 1.212 + 1.213 + \noindent {\bf Return Type:} 1.214 +{\tt 1.215 +(string $\rightarrow$ string) Map 1.216 +} 1.217 + 1.218 + 1.219 +value of the field 1.220 +\vspace{0.3cm} 1.221 +\vspace{0.3cm} 1.222 +\vspace{0.3cm} 1.223 +\subsubsection{RPC name:~get\_PV\_drivers\_version} 1.224 + 1.225 +{\bf Overview:} 1.226 +Get the PV\_drivers\_version field of the given VM\_guest\_metrics. 1.227 + 1.228 + \noindent {\bf Signature:} 1.229 +\begin{verbatim} ((string -> string) Map) get_PV_drivers_version (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.230 + 1.231 + 1.232 +\noindent{\bf Arguments:} 1.233 + 1.234 + 1.235 +\vspace{0.3cm} 1.236 +\begin{tabular}{|c|c|p{7cm}|} 1.237 + \hline 1.238 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.239 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.240 + 1.241 +\end{tabular} 1.242 + 1.243 +\vspace{0.3cm} 1.244 + 1.245 + \noindent {\bf Return Type:} 1.246 +{\tt 1.247 +(string $\rightarrow$ string) Map 1.248 +} 1.249 + 1.250 + 1.251 +value of the field 1.252 +\vspace{0.3cm} 1.253 +\vspace{0.3cm} 1.254 +\vspace{0.3cm} 1.255 +\subsubsection{RPC name:~get\_memory} 1.256 + 1.257 +{\bf Overview:} 1.258 +Get the memory field of the given VM\_guest\_metrics. 1.259 + 1.260 + \noindent {\bf Signature:} 1.261 +\begin{verbatim} ((string -> string) Map) get_memory (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.262 + 1.263 + 1.264 +\noindent{\bf Arguments:} 1.265 + 1.266 + 1.267 +\vspace{0.3cm} 1.268 +\begin{tabular}{|c|c|p{7cm}|} 1.269 + \hline 1.270 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.271 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.272 + 1.273 +\end{tabular} 1.274 + 1.275 +\vspace{0.3cm} 1.276 + 1.277 + \noindent {\bf Return Type:} 1.278 +{\tt 1.279 +(string $\rightarrow$ string) Map 1.280 +} 1.281 + 1.282 + 1.283 +value of the field 1.284 +\vspace{0.3cm} 1.285 +\vspace{0.3cm} 1.286 +\vspace{0.3cm} 1.287 +\subsubsection{RPC name:~get\_disks} 1.288 + 1.289 +{\bf Overview:} 1.290 +Get the disks field of the given VM\_guest\_metrics. 1.291 + 1.292 + \noindent {\bf Signature:} 1.293 +\begin{verbatim} ((string -> string) Map) get_disks (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.294 + 1.295 + 1.296 +\noindent{\bf Arguments:} 1.297 + 1.298 + 1.299 +\vspace{0.3cm} 1.300 +\begin{tabular}{|c|c|p{7cm}|} 1.301 + \hline 1.302 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.303 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.304 + 1.305 +\end{tabular} 1.306 + 1.307 +\vspace{0.3cm} 1.308 + 1.309 + \noindent {\bf Return Type:} 1.310 +{\tt 1.311 +(string $\rightarrow$ string) Map 1.312 +} 1.313 + 1.314 + 1.315 +value of the field 1.316 +\vspace{0.3cm} 1.317 +\vspace{0.3cm} 1.318 +\vspace{0.3cm} 1.319 +\subsubsection{RPC name:~get\_networks} 1.320 + 1.321 +{\bf Overview:} 1.322 +Get the networks field of the given VM\_guest\_metrics. 1.323 + 1.324 + \noindent {\bf Signature:} 1.325 +\begin{verbatim} ((string -> string) Map) get_networks (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.326 + 1.327 + 1.328 +\noindent{\bf Arguments:} 1.329 + 1.330 + 1.331 +\vspace{0.3cm} 1.332 +\begin{tabular}{|c|c|p{7cm}|} 1.333 + \hline 1.334 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.335 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.336 + 1.337 +\end{tabular} 1.338 + 1.339 +\vspace{0.3cm} 1.340 + 1.341 + \noindent {\bf Return Type:} 1.342 +{\tt 1.343 +(string $\rightarrow$ string) Map 1.344 +} 1.345 + 1.346 + 1.347 +value of the field 1.348 +\vspace{0.3cm} 1.349 +\vspace{0.3cm} 1.350 +\vspace{0.3cm} 1.351 +\subsubsection{RPC name:~get\_other} 1.352 + 1.353 +{\bf Overview:} 1.354 +Get the other field of the given VM\_guest\_metrics. 1.355 + 1.356 + \noindent {\bf Signature:} 1.357 +\begin{verbatim} ((string -> string) Map) get_other (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.358 + 1.359 + 1.360 +\noindent{\bf Arguments:} 1.361 + 1.362 + 1.363 +\vspace{0.3cm} 1.364 +\begin{tabular}{|c|c|p{7cm}|} 1.365 + \hline 1.366 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.367 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.368 + 1.369 +\end{tabular} 1.370 + 1.371 +\vspace{0.3cm} 1.372 + 1.373 + \noindent {\bf Return Type:} 1.374 +{\tt 1.375 +(string $\rightarrow$ string) Map 1.376 +} 1.377 + 1.378 + 1.379 +value of the field 1.380 +\vspace{0.3cm} 1.381 +\vspace{0.3cm} 1.382 +\vspace{0.3cm} 1.383 +\subsubsection{RPC name:~get\_by\_uuid} 1.384 + 1.385 +{\bf Overview:} 1.386 +Get a reference to the VM\_guest\_metrics instance with the specified UUID. 1.387 + 1.388 + \noindent {\bf Signature:} 1.389 +\begin{verbatim} (VM_guest_metrics ref) get_by_uuid (session_id s, string uuid)\end{verbatim} 1.390 + 1.391 + 1.392 +\noindent{\bf Arguments:} 1.393 + 1.394 + 1.395 +\vspace{0.3cm} 1.396 +\begin{tabular}{|c|c|p{7cm}|} 1.397 + \hline 1.398 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.399 +{\tt string } & uuid & UUID of object to return \\ \hline 1.400 + 1.401 +\end{tabular} 1.402 + 1.403 +\vspace{0.3cm} 1.404 + 1.405 + \noindent {\bf Return Type:} 1.406 +{\tt 1.407 +VM\_guest\_metrics ref 1.408 +} 1.409 + 1.410 + 1.411 +reference to the object 1.412 +\vspace{0.3cm} 1.413 +\vspace{0.3cm} 1.414 +\vspace{0.3cm} 1.415 +\subsubsection{RPC name:~get\_record} 1.416 + 1.417 +{\bf Overview:} 1.418 +Get a record containing the current state of the given VM\_guest\_metrics. 1.419 + 1.420 + \noindent {\bf Signature:} 1.421 +\begin{verbatim} (VM_guest_metrics record) get_record (session_id s, VM_guest_metrics ref self)\end{verbatim} 1.422 + 1.423 + 1.424 +\noindent{\bf Arguments:} 1.425 + 1.426 + 1.427 +\vspace{0.3cm} 1.428 +\begin{tabular}{|c|c|p{7cm}|} 1.429 + \hline 1.430 +{\bf type} & {\bf name} & {\bf description} \\ \hline 1.431 +{\tt VM\_guest\_metrics ref } & self & reference to the object \\ \hline 1.432 + 1.433 +\end{tabular} 1.434 + 1.435 +\vspace{0.3cm} 1.436 + 1.437 + \noindent {\bf Return Type:} 1.438 +{\tt 1.439 +VM\_guest\_metrics record 1.440 +} 1.441 + 1.442 + 1.443 +all fields from the object 1.444 +\vspace{0.3cm} 1.445 +\vspace{0.3cm} 1.446 +\vspace{0.3cm} 1.447 + 1.448 +\vspace{1cm} 1.449 +\newpage 1.450 \section{Class: host} 1.451 \subsection{Fields for class: host} 1.452 \begin{longtable}{|lllp{0.38\textwidth}|}
2.1 --- a/tools/libxen/include/xen_vm.h Sun Feb 25 22:47:29 2007 +0000 2.2 +++ b/tools/libxen/include/xen_vm.h Sun Feb 25 23:17:14 2007 +0000 2.3 @@ -30,6 +30,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_guest_metrics_decl.h" 2.8 #include "xen_vm_metrics_decl.h" 2.9 #include "xen_vm_power_state.h" 2.10 #include "xen_vtpm_decl.h" 2.11 @@ -144,11 +145,11 @@ typedef struct xen_vm_record 2.12 bool platform_clock_offset; 2.13 bool platform_enable_audio; 2.14 char *pci_bus; 2.15 - xen_string_string_map *tools_version; 2.16 xen_string_string_map *other_config; 2.17 int64_t domid; 2.18 bool is_control_domain; 2.19 struct xen_vm_metrics_record_opt *metrics; 2.20 + struct xen_vm_guest_metrics_record_opt *guest_metrics; 2.21 } xen_vm_record; 2.22 2.23 /** 2.24 @@ -534,13 +535,6 @@ xen_vm_get_pci_bus(xen_session *session, 2.25 2.26 2.27 /** 2.28 - * Get the tools_version field of the given VM. 2.29 - */ 2.30 -extern bool 2.31 -xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, xen_vm vm); 2.32 - 2.33 - 2.34 -/** 2.35 * Get the other_config field of the given VM. 2.36 */ 2.37 extern bool 2.38 @@ -569,6 +563,13 @@ xen_vm_get_metrics(xen_session *session, 2.39 2.40 2.41 /** 2.42 + * Get the guest_metrics field of the given VM. 2.43 + */ 2.44 +extern bool 2.45 +xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm); 2.46 + 2.47 + 2.48 +/** 2.49 * Set the name/label field of the given VM. 2.50 */ 2.51 extern bool
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/tools/libxen/include/xen_vm_guest_metrics.h Sun Feb 25 23:17:14 2007 +0000 3.3 @@ -0,0 +1,227 @@ 3.4 +/* 3.5 + * Copyright (c) 2006-2007, 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_GUEST_METRICS_H 3.23 +#define XEN_VM_GUEST_METRICS_H 3.24 + 3.25 +#include "xen_common.h" 3.26 +#include "xen_string_string_map.h" 3.27 +#include "xen_vm_decl.h" 3.28 +#include "xen_vm_guest_metrics_decl.h" 3.29 + 3.30 + 3.31 +/* 3.32 + * The VM_guest_metrics class. 3.33 + * 3.34 + * The metrics reported by the guest (as opposed to inferred from outside). 3.35 + */ 3.36 + 3.37 + 3.38 +/** 3.39 + * Free the given xen_vm_guest_metrics. The given handle must have 3.40 + * been allocated by this library. 3.41 + */ 3.42 +extern void 3.43 +xen_vm_guest_metrics_free(xen_vm_guest_metrics vm_guest_metrics); 3.44 + 3.45 + 3.46 +typedef struct xen_vm_guest_metrics_set 3.47 +{ 3.48 + size_t size; 3.49 + xen_vm_guest_metrics *contents[]; 3.50 +} xen_vm_guest_metrics_set; 3.51 + 3.52 +/** 3.53 + * Allocate a xen_vm_guest_metrics_set of the given size. 3.54 + */ 3.55 +extern xen_vm_guest_metrics_set * 3.56 +xen_vm_guest_metrics_set_alloc(size_t size); 3.57 + 3.58 +/** 3.59 + * Free the given xen_vm_guest_metrics_set. The given set must have 3.60 + * been allocated by this library. 3.61 + */ 3.62 +extern void 3.63 +xen_vm_guest_metrics_set_free(xen_vm_guest_metrics_set *set); 3.64 + 3.65 + 3.66 +typedef struct xen_vm_guest_metrics_record 3.67 +{ 3.68 + xen_vm_guest_metrics handle; 3.69 + char *uuid; 3.70 + struct xen_vm_record_opt *vm; 3.71 + xen_string_string_map *os_version; 3.72 + xen_string_string_map *pv_drivers_version; 3.73 + xen_string_string_map *memory; 3.74 + xen_string_string_map *disks; 3.75 + xen_string_string_map *networks; 3.76 + xen_string_string_map *other; 3.77 +} xen_vm_guest_metrics_record; 3.78 + 3.79 +/** 3.80 + * Allocate a xen_vm_guest_metrics_record. 3.81 + */ 3.82 +extern xen_vm_guest_metrics_record * 3.83 +xen_vm_guest_metrics_record_alloc(void); 3.84 + 3.85 +/** 3.86 + * Free the given xen_vm_guest_metrics_record, and all referenced 3.87 + * values. The given record must have been allocated by this library. 3.88 + */ 3.89 +extern void 3.90 +xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record); 3.91 + 3.92 + 3.93 +typedef struct xen_vm_guest_metrics_record_opt 3.94 +{ 3.95 + bool is_record; 3.96 + union 3.97 + { 3.98 + xen_vm_guest_metrics handle; 3.99 + xen_vm_guest_metrics_record *record; 3.100 + } u; 3.101 +} xen_vm_guest_metrics_record_opt; 3.102 + 3.103 +/** 3.104 + * Allocate a xen_vm_guest_metrics_record_opt. 3.105 + */ 3.106 +extern xen_vm_guest_metrics_record_opt * 3.107 +xen_vm_guest_metrics_record_opt_alloc(void); 3.108 + 3.109 +/** 3.110 + * Free the given xen_vm_guest_metrics_record_opt, and all referenced 3.111 + * values. The given record_opt must have been allocated by this library. 3.112 + */ 3.113 +extern void 3.114 +xen_vm_guest_metrics_record_opt_free(xen_vm_guest_metrics_record_opt *record_opt); 3.115 + 3.116 + 3.117 +typedef struct xen_vm_guest_metrics_record_set 3.118 +{ 3.119 + size_t size; 3.120 + xen_vm_guest_metrics_record *contents[]; 3.121 +} xen_vm_guest_metrics_record_set; 3.122 + 3.123 +/** 3.124 + * Allocate a xen_vm_guest_metrics_record_set of the given size. 3.125 + */ 3.126 +extern xen_vm_guest_metrics_record_set * 3.127 +xen_vm_guest_metrics_record_set_alloc(size_t size); 3.128 + 3.129 +/** 3.130 + * Free the given xen_vm_guest_metrics_record_set, and all referenced 3.131 + * values. The given set must have been allocated by this library. 3.132 + */ 3.133 +extern void 3.134 +xen_vm_guest_metrics_record_set_free(xen_vm_guest_metrics_record_set *set); 3.135 + 3.136 + 3.137 + 3.138 +typedef struct xen_vm_guest_metrics_record_opt_set 3.139 +{ 3.140 + size_t size; 3.141 + xen_vm_guest_metrics_record_opt *contents[]; 3.142 +} xen_vm_guest_metrics_record_opt_set; 3.143 + 3.144 +/** 3.145 + * Allocate a xen_vm_guest_metrics_record_opt_set of the given size. 3.146 + */ 3.147 +extern xen_vm_guest_metrics_record_opt_set * 3.148 +xen_vm_guest_metrics_record_opt_set_alloc(size_t size); 3.149 + 3.150 +/** 3.151 + * Free the given xen_vm_guest_metrics_record_opt_set, and all 3.152 + * referenced values. The given set must have been allocated by this library. 3.153 + */ 3.154 +extern void 3.155 +xen_vm_guest_metrics_record_opt_set_free(xen_vm_guest_metrics_record_opt_set *set); 3.156 + 3.157 + 3.158 +/** 3.159 + * Get a record containing the current state of the given 3.160 + * VM_guest_metrics. 3.161 + */ 3.162 +extern bool 3.163 +xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics); 3.164 + 3.165 + 3.166 +/** 3.167 + * Get a reference to the VM_guest_metrics instance with the specified 3.168 + * UUID. 3.169 + */ 3.170 +extern bool 3.171 +xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid); 3.172 + 3.173 + 3.174 +/** 3.175 + * Get the uuid field of the given VM_guest_metrics. 3.176 + */ 3.177 +extern bool 3.178 +xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics); 3.179 + 3.180 + 3.181 +/** 3.182 + * Get the VM field of the given VM_guest_metrics. 3.183 + */ 3.184 +extern bool 3.185 +xen_vm_guest_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_guest_metrics vm_guest_metrics); 3.186 + 3.187 + 3.188 +/** 3.189 + * Get the os_version field of the given VM_guest_metrics. 3.190 + */ 3.191 +extern bool 3.192 +xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.193 + 3.194 + 3.195 +/** 3.196 + * Get the PV_drivers_version field of the given VM_guest_metrics. 3.197 + */ 3.198 +extern bool 3.199 +xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.200 + 3.201 + 3.202 +/** 3.203 + * Get the memory field of the given VM_guest_metrics. 3.204 + */ 3.205 +extern bool 3.206 +xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.207 + 3.208 + 3.209 +/** 3.210 + * Get the disks field of the given VM_guest_metrics. 3.211 + */ 3.212 +extern bool 3.213 +xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.214 + 3.215 + 3.216 +/** 3.217 + * Get the networks field of the given VM_guest_metrics. 3.218 + */ 3.219 +extern bool 3.220 +xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.221 + 3.222 + 3.223 +/** 3.224 + * Get the other field of the given VM_guest_metrics. 3.225 + */ 3.226 +extern bool 3.227 +xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics); 3.228 + 3.229 + 3.230 +#endif
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/tools/libxen/include/xen_vm_guest_metrics_decl.h Sun Feb 25 23:17:14 2007 +0000 4.3 @@ -0,0 +1,30 @@ 4.4 +/* 4.5 + * Copyright (c) 2006-2007, 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_GUEST_METRICS_DECL_H 4.23 +#define XEN_VM_GUEST_METRICS_DECL_H 4.24 + 4.25 +typedef void *xen_vm_guest_metrics; 4.26 + 4.27 +struct xen_vm_guest_metrics_set; 4.28 +struct xen_vm_guest_metrics_record; 4.29 +struct xen_vm_guest_metrics_record_set; 4.30 +struct xen_vm_guest_metrics_record_opt; 4.31 +struct xen_vm_guest_metrics_record_opt_set; 4.32 + 4.33 +#endif
5.1 --- a/tools/libxen/src/xen_vm.c Sun Feb 25 22:47:29 2007 +0000 5.2 +++ b/tools/libxen/src/xen_vm.c Sun Feb 25 23:17:14 2007 +0000 5.3 @@ -32,6 +32,7 @@ 5.4 #include "xen_vdi.h" 5.5 #include "xen_vif.h" 5.6 #include "xen_vm.h" 5.7 +#include "xen_vm_guest_metrics.h" 5.8 #include "xen_vm_metrics.h" 5.9 #include "xen_vm_power_state_internal.h" 5.10 #include "xen_vtpm.h" 5.11 @@ -162,9 +163,6 @@ static const struct_member xen_vm_record 5.12 { .key = "PCI_bus", 5.13 .type = &abstract_type_string, 5.14 .offset = offsetof(xen_vm_record, pci_bus) }, 5.15 - { .key = "tools_version", 5.16 - .type = &abstract_type_string_string_map, 5.17 - .offset = offsetof(xen_vm_record, tools_version) }, 5.18 { .key = "other_config", 5.19 .type = &abstract_type_string_string_map, 5.20 .offset = offsetof(xen_vm_record, other_config) }, 5.21 @@ -176,7 +174,10 @@ static const struct_member xen_vm_record 5.22 .offset = offsetof(xen_vm_record, is_control_domain) }, 5.23 { .key = "metrics", 5.24 .type = &abstract_type_ref, 5.25 - .offset = offsetof(xen_vm_record, metrics) } 5.26 + .offset = offsetof(xen_vm_record, metrics) }, 5.27 + { .key = "guest_metrics", 5.28 + .type = &abstract_type_ref, 5.29 + .offset = offsetof(xen_vm_record, guest_metrics) } 5.30 }; 5.31 5.32 const abstract_type xen_vm_record_abstract_type_ = 5.33 @@ -218,9 +219,9 @@ xen_vm_record_free(xen_vm_record *record 5.34 xen_string_string_map_free(record->hvm_boot_params); 5.35 free(record->platform_serial); 5.36 free(record->pci_bus); 5.37 - xen_string_string_map_free(record->tools_version); 5.38 xen_string_string_map_free(record->other_config); 5.39 xen_vm_metrics_record_opt_free(record->metrics); 5.40 + xen_vm_guest_metrics_record_opt_free(record->guest_metrics); 5.41 free(record); 5.42 } 5.43 5.44 @@ -922,23 +923,6 @@ xen_vm_get_pci_bus(xen_session *session, 5.45 5.46 5.47 bool 5.48 -xen_vm_get_tools_version(xen_session *session, xen_string_string_map **result, xen_vm vm) 5.49 -{ 5.50 - abstract_value param_values[] = 5.51 - { 5.52 - { .type = &abstract_type_string, 5.53 - .u.string_val = vm } 5.54 - }; 5.55 - 5.56 - abstract_type result_type = abstract_type_string_string_map; 5.57 - 5.58 - *result = NULL; 5.59 - XEN_CALL_("VM.get_tools_version"); 5.60 - return session->ok; 5.61 -} 5.62 - 5.63 - 5.64 -bool 5.65 xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm) 5.66 { 5.67 abstract_value param_values[] = 5.68 @@ -1005,6 +989,23 @@ xen_vm_get_metrics(xen_session *session, 5.69 5.70 5.71 bool 5.72 +xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm) 5.73 +{ 5.74 + abstract_value param_values[] = 5.75 + { 5.76 + { .type = &abstract_type_string, 5.77 + .u.string_val = vm } 5.78 + }; 5.79 + 5.80 + abstract_type result_type = abstract_type_string; 5.81 + 5.82 + *result = NULL; 5.83 + XEN_CALL_("VM.get_guest_metrics"); 5.84 + return session->ok; 5.85 +} 5.86 + 5.87 + 5.88 +bool 5.89 xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label) 5.90 { 5.91 abstract_value param_values[] =
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/tools/libxen/src/xen_vm_guest_metrics.c Sun Feb 25 23:17:14 2007 +0000 6.3 @@ -0,0 +1,261 @@ 6.4 +/* 6.5 + * Copyright (c) 2006-2007, 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_internal.h" 6.28 +#include "xen_string_string_map.h" 6.29 +#include "xen_vm.h" 6.30 +#include "xen_vm_guest_metrics.h" 6.31 + 6.32 + 6.33 +XEN_FREE(xen_vm_guest_metrics) 6.34 +XEN_SET_ALLOC_FREE(xen_vm_guest_metrics) 6.35 +XEN_ALLOC(xen_vm_guest_metrics_record) 6.36 +XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record) 6.37 +XEN_ALLOC(xen_vm_guest_metrics_record_opt) 6.38 +XEN_RECORD_OPT_FREE(xen_vm_guest_metrics) 6.39 +XEN_SET_ALLOC_FREE(xen_vm_guest_metrics_record_opt) 6.40 + 6.41 + 6.42 +static const struct_member xen_vm_guest_metrics_record_struct_members[] = 6.43 + { 6.44 + { .key = "uuid", 6.45 + .type = &abstract_type_string, 6.46 + .offset = offsetof(xen_vm_guest_metrics_record, uuid) }, 6.47 + { .key = "VM", 6.48 + .type = &abstract_type_ref, 6.49 + .offset = offsetof(xen_vm_guest_metrics_record, vm) }, 6.50 + { .key = "os_version", 6.51 + .type = &abstract_type_string_string_map, 6.52 + .offset = offsetof(xen_vm_guest_metrics_record, os_version) }, 6.53 + { .key = "PV_drivers_version", 6.54 + .type = &abstract_type_string_string_map, 6.55 + .offset = offsetof(xen_vm_guest_metrics_record, pv_drivers_version) }, 6.56 + { .key = "memory", 6.57 + .type = &abstract_type_string_string_map, 6.58 + .offset = offsetof(xen_vm_guest_metrics_record, memory) }, 6.59 + { .key = "disks", 6.60 + .type = &abstract_type_string_string_map, 6.61 + .offset = offsetof(xen_vm_guest_metrics_record, disks) }, 6.62 + { .key = "networks", 6.63 + .type = &abstract_type_string_string_map, 6.64 + .offset = offsetof(xen_vm_guest_metrics_record, networks) }, 6.65 + { .key = "other", 6.66 + .type = &abstract_type_string_string_map, 6.67 + .offset = offsetof(xen_vm_guest_metrics_record, other) } 6.68 + }; 6.69 + 6.70 +const abstract_type xen_vm_guest_metrics_record_abstract_type_ = 6.71 + { 6.72 + .typename = STRUCT, 6.73 + .struct_size = sizeof(xen_vm_guest_metrics_record), 6.74 + .member_count = 6.75 + sizeof(xen_vm_guest_metrics_record_struct_members) / sizeof(struct_member), 6.76 + .members = xen_vm_guest_metrics_record_struct_members 6.77 + }; 6.78 + 6.79 + 6.80 +void 6.81 +xen_vm_guest_metrics_record_free(xen_vm_guest_metrics_record *record) 6.82 +{ 6.83 + if (record == NULL) 6.84 + { 6.85 + return; 6.86 + } 6.87 + free(record->handle); 6.88 + free(record->uuid); 6.89 + xen_vm_record_opt_free(record->vm); 6.90 + xen_string_string_map_free(record->os_version); 6.91 + xen_string_string_map_free(record->pv_drivers_version); 6.92 + xen_string_string_map_free(record->memory); 6.93 + xen_string_string_map_free(record->disks); 6.94 + xen_string_string_map_free(record->networks); 6.95 + xen_string_string_map_free(record->other); 6.96 + free(record); 6.97 +} 6.98 + 6.99 + 6.100 +bool 6.101 +xen_vm_guest_metrics_get_record(xen_session *session, xen_vm_guest_metrics_record **result, xen_vm_guest_metrics vm_guest_metrics) 6.102 +{ 6.103 + abstract_value param_values[] = 6.104 + { 6.105 + { .type = &abstract_type_string, 6.106 + .u.string_val = vm_guest_metrics } 6.107 + }; 6.108 + 6.109 + abstract_type result_type = xen_vm_guest_metrics_record_abstract_type_; 6.110 + 6.111 + *result = NULL; 6.112 + XEN_CALL_("VM_guest_metrics.get_record"); 6.113 + 6.114 + if (session->ok) 6.115 + { 6.116 + (*result)->handle = xen_strdup_((*result)->uuid); 6.117 + } 6.118 + 6.119 + return session->ok; 6.120 +} 6.121 + 6.122 + 6.123 +bool 6.124 +xen_vm_guest_metrics_get_by_uuid(xen_session *session, xen_vm_guest_metrics *result, char *uuid) 6.125 +{ 6.126 + abstract_value param_values[] = 6.127 + { 6.128 + { .type = &abstract_type_string, 6.129 + .u.string_val = uuid } 6.130 + }; 6.131 + 6.132 + abstract_type result_type = abstract_type_string; 6.133 + 6.134 + *result = NULL; 6.135 + XEN_CALL_("VM_guest_metrics.get_by_uuid"); 6.136 + return session->ok; 6.137 +} 6.138 + 6.139 + 6.140 +bool 6.141 +xen_vm_guest_metrics_get_vm(xen_session *session, xen_vm *result, xen_vm_guest_metrics vm_guest_metrics) 6.142 +{ 6.143 + abstract_value param_values[] = 6.144 + { 6.145 + { .type = &abstract_type_string, 6.146 + .u.string_val = vm_guest_metrics } 6.147 + }; 6.148 + 6.149 + abstract_type result_type = abstract_type_string; 6.150 + 6.151 + *result = NULL; 6.152 + XEN_CALL_("VM_guest_metrics.get_VM"); 6.153 + return session->ok; 6.154 +} 6.155 + 6.156 + 6.157 +bool 6.158 +xen_vm_guest_metrics_get_os_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.159 +{ 6.160 + abstract_value param_values[] = 6.161 + { 6.162 + { .type = &abstract_type_string, 6.163 + .u.string_val = vm_guest_metrics } 6.164 + }; 6.165 + 6.166 + abstract_type result_type = abstract_type_string_string_map; 6.167 + 6.168 + *result = NULL; 6.169 + XEN_CALL_("VM_guest_metrics.get_os_version"); 6.170 + return session->ok; 6.171 +} 6.172 + 6.173 + 6.174 +bool 6.175 +xen_vm_guest_metrics_get_pv_drivers_version(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.176 +{ 6.177 + abstract_value param_values[] = 6.178 + { 6.179 + { .type = &abstract_type_string, 6.180 + .u.string_val = vm_guest_metrics } 6.181 + }; 6.182 + 6.183 + abstract_type result_type = abstract_type_string_string_map; 6.184 + 6.185 + *result = NULL; 6.186 + XEN_CALL_("VM_guest_metrics.get_PV_drivers_version"); 6.187 + return session->ok; 6.188 +} 6.189 + 6.190 + 6.191 +bool 6.192 +xen_vm_guest_metrics_get_memory(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.193 +{ 6.194 + abstract_value param_values[] = 6.195 + { 6.196 + { .type = &abstract_type_string, 6.197 + .u.string_val = vm_guest_metrics } 6.198 + }; 6.199 + 6.200 + abstract_type result_type = abstract_type_string_string_map; 6.201 + 6.202 + *result = NULL; 6.203 + XEN_CALL_("VM_guest_metrics.get_memory"); 6.204 + return session->ok; 6.205 +} 6.206 + 6.207 + 6.208 +bool 6.209 +xen_vm_guest_metrics_get_disks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.210 +{ 6.211 + abstract_value param_values[] = 6.212 + { 6.213 + { .type = &abstract_type_string, 6.214 + .u.string_val = vm_guest_metrics } 6.215 + }; 6.216 + 6.217 + abstract_type result_type = abstract_type_string_string_map; 6.218 + 6.219 + *result = NULL; 6.220 + XEN_CALL_("VM_guest_metrics.get_disks"); 6.221 + return session->ok; 6.222 +} 6.223 + 6.224 + 6.225 +bool 6.226 +xen_vm_guest_metrics_get_networks(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.227 +{ 6.228 + abstract_value param_values[] = 6.229 + { 6.230 + { .type = &abstract_type_string, 6.231 + .u.string_val = vm_guest_metrics } 6.232 + }; 6.233 + 6.234 + abstract_type result_type = abstract_type_string_string_map; 6.235 + 6.236 + *result = NULL; 6.237 + XEN_CALL_("VM_guest_metrics.get_networks"); 6.238 + return session->ok; 6.239 +} 6.240 + 6.241 + 6.242 +bool 6.243 +xen_vm_guest_metrics_get_other(xen_session *session, xen_string_string_map **result, xen_vm_guest_metrics vm_guest_metrics) 6.244 +{ 6.245 + abstract_value param_values[] = 6.246 + { 6.247 + { .type = &abstract_type_string, 6.248 + .u.string_val = vm_guest_metrics } 6.249 + }; 6.250 + 6.251 + abstract_type result_type = abstract_type_string_string_map; 6.252 + 6.253 + *result = NULL; 6.254 + XEN_CALL_("VM_guest_metrics.get_other"); 6.255 + return session->ok; 6.256 +} 6.257 + 6.258 + 6.259 +bool 6.260 +xen_vm_guest_metrics_get_uuid(xen_session *session, char **result, xen_vm_guest_metrics vm_guest_metrics) 6.261 +{ 6.262 + *result = session->ok ? xen_strdup_((char *)vm_guest_metrics) : NULL; 6.263 + return session->ok; 6.264 +}