ia64/xen-unstable

changeset 13742:69c5afd5ab08

Added modelling and C bindings for crashdumps, and suspend VDIs.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Jan 30 12:43:40 2007 +0000 (2007-01-30)
parents f91dd7642a42
children 4637dfae0856
files docs/xen-api/xenapi-datamodel.tex tools/libxen/include/xen_crashdump.h tools/libxen/include/xen_crashdump_decl.h tools/libxen/include/xen_host.h tools/libxen/include/xen_vdi.h tools/libxen/include/xen_vdi_type.h tools/libxen/include/xen_vm.h tools/libxen/src/xen_crashdump.c tools/libxen/src/xen_host.c tools/libxen/src/xen_vdi.c tools/libxen/src/xen_vdi_type.c tools/libxen/src/xen_vm.c
line diff
     1.1 --- a/docs/xen-api/xenapi-datamodel.tex	Tue Jan 30 13:52:52 2007 +0000
     1.2 +++ b/docs/xen-api/xenapi-datamodel.tex	Tue Jan 30 12:43:40 2007 +0000
     1.3 @@ -35,6 +35,7 @@ Name & Description \\
     1.4  {\tt VDI} & A virtual disk image \\
     1.5  {\tt VBD} & A virtual block device \\
     1.6  {\tt PBD} & The physical block devices through which hosts access SRs \\
     1.7 +{\tt crashdump} & A VM crashdump \\
     1.8  {\tt VTPM} & A virtual TPM device \\
     1.9  {\tt console} & A console \\
    1.10  {\tt user} & A user of the system \\
    1.11 @@ -51,7 +52,9 @@ Fields that are bound together are shown
    1.12  host.PBDs & PBD.host & many-to-one\\
    1.13  SR.PBDs & PBD.SR & many-to-one\\
    1.14  VDI.VBDs & VBD.VDI & many-to-one\\
    1.15 +VDI.crash\_dumps & crashdump.VDI & many-to-one\\
    1.16  VBD.VM & VM.VBDs & one-to-many\\
    1.17 +crashdump.VM & VM.crash\_dumps & one-to-many\\
    1.18  VIF.VM & VM.VIFs & one-to-many\\
    1.19  VIF.network & network.VIFs & one-to-many\\
    1.20  PIF.metrics & PIF\_metrics.PIF & one-to-one\\
    1.21 @@ -121,6 +124,8 @@ The following enumeration types are used
    1.22  \hspace{0.5cm}{\tt system} & a disk that may be replaced on upgrade \\
    1.23  \hspace{0.5cm}{\tt user} & a disk that is always preserved on upgrade \\
    1.24  \hspace{0.5cm}{\tt ephemeral} & a disk that may be reformatted on upgrade \\
    1.25 +\hspace{0.5cm}{\tt suspend} & a disk that stores a suspend image \\
    1.26 +\hspace{0.5cm}{\tt crashdump} & a disk that stores VM crashdump information \\
    1.27  \hline
    1.28  \end{longtable}
    1.29  
    1.30 @@ -1022,6 +1027,7 @@ Quals & Field & Type & Description \\
    1.31  $\mathit{RW}$ &  {\tt user\_version} & int & a user version number for this machine \\
    1.32  $\mathit{RW}$ &  {\tt is\_a\_template} & bool & true if this is a template. Template VMs can never be started, they are used only for cloning other VMs \\
    1.33  $\mathit{RW}$ &  {\tt auto\_power\_on} & bool & true if this VM should be started automatically after host boot \\
    1.34 +$\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.35  $\mathit{RO}_\mathit{run}$ &  {\tt resident\_on} & host ref & the host the VM is currently resident on \\
    1.36  $\mathit{RO}_\mathit{ins}$ &  {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\
    1.37  $\mathit{RW}$ &  {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\
    1.38 @@ -1038,6 +1044,7 @@ Quals & Field & Type & Description \\
    1.39  $\mathit{RO}_\mathit{run}$ &  {\tt consoles} & (console ref) Set & virtual console devices \\
    1.40  $\mathit{RO}_\mathit{run}$ &  {\tt VIFs} & (VIF ref) Set & virtual network interfaces \\
    1.41  $\mathit{RO}_\mathit{run}$ &  {\tt VBDs} & (VBD ref) Set & virtual block devices \\
    1.42 +$\mathit{RO}_\mathit{run}$ &  {\tt crash\_dumps} & (crashdump ref) Set & crash dumps associated with this VM \\
    1.43  $\mathit{RO}_\mathit{run}$ &  {\tt VTPMs} & (VTPM ref) Set & virtual TPMs \\
    1.44  $\mathit{RW}$ &  {\tt PV/bootloader} & string & name of or path to bootloader \\
    1.45  $\mathit{RW}$ &  {\tt PV/kernel} & string & path to the kernel \\
    1.46 @@ -1835,6 +1842,38 @@ void
    1.47  \vspace{0.3cm}
    1.48  \vspace{0.3cm}
    1.49  \vspace{0.3cm}
    1.50 +\subsubsection{RPC name:~get\_suspend\_VDI}
    1.51 +
    1.52 +{\bf Overview:} 
    1.53 +Get the suspend\_VDI field of the given VM.
    1.54 +
    1.55 + \noindent {\bf Signature:} 
    1.56 +\begin{verbatim} (VDI ref) get_suspend_VDI (session_id s, VM ref self)\end{verbatim}
    1.57 +
    1.58 +
    1.59 +\noindent{\bf Arguments:}
    1.60 +
    1.61 + 
    1.62 +\vspace{0.3cm}
    1.63 +\begin{tabular}{|c|c|p{7cm}|}
    1.64 + \hline
    1.65 +{\bf type} & {\bf name} & {\bf description} \\ \hline
    1.66 +{\tt VM ref } & self & reference to the object \\ \hline 
    1.67 +
    1.68 +\end{tabular}
    1.69 +
    1.70 +\vspace{0.3cm}
    1.71 +
    1.72 + \noindent {\bf Return Type:} 
    1.73 +{\tt 
    1.74 +VDI ref
    1.75 +}
    1.76 +
    1.77 +
    1.78 +value of the field
    1.79 +\vspace{0.3cm}
    1.80 +\vspace{0.3cm}
    1.81 +\vspace{0.3cm}
    1.82  \subsubsection{RPC name:~get\_resident\_on}
    1.83  
    1.84  {\bf Overview:} 
    1.85 @@ -2619,6 +2658,38 @@ value of the field
    1.86  \vspace{0.3cm}
    1.87  \vspace{0.3cm}
    1.88  \vspace{0.3cm}
    1.89 +\subsubsection{RPC name:~get\_crash\_dumps}
    1.90 +
    1.91 +{\bf Overview:} 
    1.92 +Get the crash\_dumps field of the given VM.
    1.93 +
    1.94 + \noindent {\bf Signature:} 
    1.95 +\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VM ref self)\end{verbatim}
    1.96 +
    1.97 +
    1.98 +\noindent{\bf Arguments:}
    1.99 +
   1.100 + 
   1.101 +\vspace{0.3cm}
   1.102 +\begin{tabular}{|c|c|p{7cm}|}
   1.103 + \hline
   1.104 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.105 +{\tt VM ref } & self & reference to the object \\ \hline 
   1.106 +
   1.107 +\end{tabular}
   1.108 +
   1.109 +\vspace{0.3cm}
   1.110 +
   1.111 + \noindent {\bf Return Type:} 
   1.112 +{\tt 
   1.113 +(crashdump ref) Set
   1.114 +}
   1.115 +
   1.116 +
   1.117 +value of the field
   1.118 +\vspace{0.3cm}
   1.119 +\vspace{0.3cm}
   1.120 +\vspace{0.3cm}
   1.121  \subsubsection{RPC name:~get\_VTPMs}
   1.122  
   1.123  {\bf Overview:} 
   1.124 @@ -3760,6 +3831,8 @@ Quals & Field & Type & Description \\
   1.125  $\mathit{RO}_\mathit{run}$ &  {\tt resident\_VMs} & (VM ref) Set & list of VMs currently resident on host \\
   1.126  $\mathit{RW}$ &  {\tt logging} & (string $\rightarrow$ string) Map & logging configuration \\
   1.127  $\mathit{RO}_\mathit{run}$ &  {\tt PIFs} & (PIF ref) Set & physical network interfaces \\
   1.128 +$\mathit{RW}$ &  {\tt suspend\_image\_sr} & SR ref & The SR in which VDIs for suspend images are created \\
   1.129 +$\mathit{RW}$ &  {\tt crash\_dump\_sr} & SR ref & The SR in which VDIs for crash dumps are created \\
   1.130  $\mathit{RO}_\mathit{run}$ &  {\tt PBDs} & (PBD ref) Set & physical blockdevices \\
   1.131  $\mathit{RO}_\mathit{run}$ &  {\tt host\_CPUs} & (host\_cpu ref) Set & The physical CPUs on this host \\
   1.132  \hline
   1.133 @@ -4451,6 +4524,138 @@ value of the field
   1.134  \vspace{0.3cm}
   1.135  \vspace{0.3cm}
   1.136  \vspace{0.3cm}
   1.137 +\subsubsection{RPC name:~get\_suspend\_image\_sr}
   1.138 +
   1.139 +{\bf Overview:} 
   1.140 +Get the suspend\_image\_sr field of the given host.
   1.141 +
   1.142 + \noindent {\bf Signature:} 
   1.143 +\begin{verbatim} (SR ref) get_suspend_image_sr (session_id s, host ref self)\end{verbatim}
   1.144 +
   1.145 +
   1.146 +\noindent{\bf Arguments:}
   1.147 +
   1.148 + 
   1.149 +\vspace{0.3cm}
   1.150 +\begin{tabular}{|c|c|p{7cm}|}
   1.151 + \hline
   1.152 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.153 +{\tt host ref } & self & reference to the object \\ \hline 
   1.154 +
   1.155 +\end{tabular}
   1.156 +
   1.157 +\vspace{0.3cm}
   1.158 +
   1.159 + \noindent {\bf Return Type:} 
   1.160 +{\tt 
   1.161 +SR ref
   1.162 +}
   1.163 +
   1.164 +
   1.165 +value of the field
   1.166 +\vspace{0.3cm}
   1.167 +\vspace{0.3cm}
   1.168 +\vspace{0.3cm}
   1.169 +\subsubsection{RPC name:~set\_suspend\_image\_sr}
   1.170 +
   1.171 +{\bf Overview:} 
   1.172 +Set the suspend\_image\_sr field of the given host.
   1.173 +
   1.174 + \noindent {\bf Signature:} 
   1.175 +\begin{verbatim} void set_suspend_image_sr (session_id s, host ref self, SR ref value)\end{verbatim}
   1.176 +
   1.177 +
   1.178 +\noindent{\bf Arguments:}
   1.179 +
   1.180 + 
   1.181 +\vspace{0.3cm}
   1.182 +\begin{tabular}{|c|c|p{7cm}|}
   1.183 + \hline
   1.184 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.185 +{\tt host ref } & self & reference to the object \\ \hline 
   1.186 +
   1.187 +{\tt SR ref } & value & New value to set \\ \hline 
   1.188 +
   1.189 +\end{tabular}
   1.190 +
   1.191 +\vspace{0.3cm}
   1.192 +
   1.193 + \noindent {\bf Return Type:} 
   1.194 +{\tt 
   1.195 +void
   1.196 +}
   1.197 +
   1.198 +
   1.199 +
   1.200 +\vspace{0.3cm}
   1.201 +\vspace{0.3cm}
   1.202 +\vspace{0.3cm}
   1.203 +\subsubsection{RPC name:~get\_crash\_dump\_sr}
   1.204 +
   1.205 +{\bf Overview:} 
   1.206 +Get the crash\_dump\_sr field of the given host.
   1.207 +
   1.208 + \noindent {\bf Signature:} 
   1.209 +\begin{verbatim} (SR ref) get_crash_dump_sr (session_id s, host ref self)\end{verbatim}
   1.210 +
   1.211 +
   1.212 +\noindent{\bf Arguments:}
   1.213 +
   1.214 + 
   1.215 +\vspace{0.3cm}
   1.216 +\begin{tabular}{|c|c|p{7cm}|}
   1.217 + \hline
   1.218 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.219 +{\tt host ref } & self & reference to the object \\ \hline 
   1.220 +
   1.221 +\end{tabular}
   1.222 +
   1.223 +\vspace{0.3cm}
   1.224 +
   1.225 + \noindent {\bf Return Type:} 
   1.226 +{\tt 
   1.227 +SR ref
   1.228 +}
   1.229 +
   1.230 +
   1.231 +value of the field
   1.232 +\vspace{0.3cm}
   1.233 +\vspace{0.3cm}
   1.234 +\vspace{0.3cm}
   1.235 +\subsubsection{RPC name:~set\_crash\_dump\_sr}
   1.236 +
   1.237 +{\bf Overview:} 
   1.238 +Set the crash\_dump\_sr field of the given host.
   1.239 +
   1.240 + \noindent {\bf Signature:} 
   1.241 +\begin{verbatim} void set_crash_dump_sr (session_id s, host ref self, SR ref value)\end{verbatim}
   1.242 +
   1.243 +
   1.244 +\noindent{\bf Arguments:}
   1.245 +
   1.246 + 
   1.247 +\vspace{0.3cm}
   1.248 +\begin{tabular}{|c|c|p{7cm}|}
   1.249 + \hline
   1.250 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.251 +{\tt host ref } & self & reference to the object \\ \hline 
   1.252 +
   1.253 +{\tt SR ref } & value & New value to set \\ \hline 
   1.254 +
   1.255 +\end{tabular}
   1.256 +
   1.257 +\vspace{0.3cm}
   1.258 +
   1.259 + \noindent {\bf Return Type:} 
   1.260 +{\tt 
   1.261 +void
   1.262 +}
   1.263 +
   1.264 +
   1.265 +
   1.266 +\vspace{0.3cm}
   1.267 +\vspace{0.3cm}
   1.268 +\vspace{0.3cm}
   1.269  \subsubsection{RPC name:~get\_PBDs}
   1.270  
   1.271  {\bf Overview:} 
   1.272 @@ -7541,6 +7746,7 @@ Quals & Field & Type & Description \\
   1.273  $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-readable description \\
   1.274  $\mathit{RW}$ &  {\tt SR} & SR ref & storage repository in which the VDI resides \\
   1.275  $\mathit{RO}_\mathit{run}$ &  {\tt VBDs} & (VBD ref) Set & list of vbds that refer to this disk \\
   1.276 +$\mathit{RO}_\mathit{run}$ &  {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\
   1.277  $\mathit{RW}$ &  {\tt virtual\_size} & int & size of disk as presented to the guest (in multiples of sector\_size field) \\
   1.278  $\mathit{RO}_\mathit{run}$ &  {\tt physical\_utilisation} & int & amount of physical space that the disk image is currently taking up on the storage repository (in bytes) \\
   1.279  $\mathit{RO}_\mathit{ins}$ &  {\tt sector\_size} & int & sector size of VDI (in bytes) \\
   1.280 @@ -7879,6 +8085,38 @@ value of the field
   1.281  \vspace{0.3cm}
   1.282  \vspace{0.3cm}
   1.283  \vspace{0.3cm}
   1.284 +\subsubsection{RPC name:~get\_crash\_dumps}
   1.285 +
   1.286 +{\bf Overview:} 
   1.287 +Get the crash\_dumps field of the given VDI.
   1.288 +
   1.289 + \noindent {\bf Signature:} 
   1.290 +\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VDI ref self)\end{verbatim}
   1.291 +
   1.292 +
   1.293 +\noindent{\bf Arguments:}
   1.294 +
   1.295 + 
   1.296 +\vspace{0.3cm}
   1.297 +\begin{tabular}{|c|c|p{7cm}|}
   1.298 + \hline
   1.299 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.300 +{\tt VDI ref } & self & reference to the object \\ \hline 
   1.301 +
   1.302 +\end{tabular}
   1.303 +
   1.304 +\vspace{0.3cm}
   1.305 +
   1.306 + \noindent {\bf Return Type:} 
   1.307 +{\tt 
   1.308 +(crashdump ref) Set
   1.309 +}
   1.310 +
   1.311 +
   1.312 +value of the field
   1.313 +\vspace{0.3cm}
   1.314 +\vspace{0.3cm}
   1.315 +\vspace{0.3cm}
   1.316  \subsubsection{RPC name:~get\_virtual\_size}
   1.317  
   1.318  {\bf Overview:} 
   1.319 @@ -9257,12 +9495,277 @@ all fields from the object
   1.320  
   1.321  \vspace{1cm}
   1.322  \newpage
   1.323 +\section{Class: crashdump}
   1.324 +\subsection{Fields for class: crashdump}
   1.325 +\begin{longtable}{|lllp{0.38\textwidth}|}
   1.326 +\hline
   1.327 +\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf crashdump} \\
   1.328 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
   1.329 +VM crashdump.}} \\
   1.330 +\hline
   1.331 +Quals & Field & Type & Description \\
   1.332 +\hline
   1.333 +$\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object reference \\
   1.334 +$\mathit{RO}_\mathit{ins}$ &  {\tt VM} & VM ref & the virtual machine \\
   1.335 +$\mathit{RO}_\mathit{ins}$ &  {\tt VDI} & VDI ref & the virtual disk \\
   1.336 +\hline
   1.337 +\end{longtable}
   1.338 +\subsection{Additional RPCs associated with class: crashdump}
   1.339 +\subsubsection{RPC name:~get\_all}
   1.340 +
   1.341 +{\bf Overview:} 
   1.342 +Return a list of all the crashdumps known to the system.
   1.343 +
   1.344 + \noindent {\bf Signature:} 
   1.345 +\begin{verbatim} ((crashdump ref) Set) get_all (session_id s)\end{verbatim}
   1.346 +
   1.347 +
   1.348 +\vspace{0.3cm}
   1.349 +
   1.350 + \noindent {\bf Return Type:} 
   1.351 +{\tt 
   1.352 +(crashdump ref) Set
   1.353 +}
   1.354 +
   1.355 +
   1.356 +references to all objects
   1.357 +\vspace{0.3cm}
   1.358 +\vspace{0.3cm}
   1.359 +\vspace{0.3cm}
   1.360 +\subsubsection{RPC name:~get\_uuid}
   1.361 +
   1.362 +{\bf Overview:} 
   1.363 +Get the uuid field of the given crashdump.
   1.364 +
   1.365 + \noindent {\bf Signature:} 
   1.366 +\begin{verbatim} string get_uuid (session_id s, crashdump ref self)\end{verbatim}
   1.367 +
   1.368 +
   1.369 +\noindent{\bf Arguments:}
   1.370 +
   1.371 + 
   1.372 +\vspace{0.3cm}
   1.373 +\begin{tabular}{|c|c|p{7cm}|}
   1.374 + \hline
   1.375 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.376 +{\tt crashdump ref } & self & reference to the object \\ \hline 
   1.377 +
   1.378 +\end{tabular}
   1.379 +
   1.380 +\vspace{0.3cm}
   1.381 +
   1.382 + \noindent {\bf Return Type:} 
   1.383 +{\tt 
   1.384 +string
   1.385 +}
   1.386 +
   1.387 +
   1.388 +value of the field
   1.389 +\vspace{0.3cm}
   1.390 +\vspace{0.3cm}
   1.391 +\vspace{0.3cm}
   1.392 +\subsubsection{RPC name:~get\_VM}
   1.393 +
   1.394 +{\bf Overview:} 
   1.395 +Get the VM field of the given crashdump.
   1.396 +
   1.397 + \noindent {\bf Signature:} 
   1.398 +\begin{verbatim} (VM ref) get_VM (session_id s, crashdump ref self)\end{verbatim}
   1.399 +
   1.400 +
   1.401 +\noindent{\bf Arguments:}
   1.402 +
   1.403 + 
   1.404 +\vspace{0.3cm}
   1.405 +\begin{tabular}{|c|c|p{7cm}|}
   1.406 + \hline
   1.407 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.408 +{\tt crashdump ref } & self & reference to the object \\ \hline 
   1.409 +
   1.410 +\end{tabular}
   1.411 +
   1.412 +\vspace{0.3cm}
   1.413 +
   1.414 + \noindent {\bf Return Type:} 
   1.415 +{\tt 
   1.416 +VM ref
   1.417 +}
   1.418 +
   1.419 +
   1.420 +value of the field
   1.421 +\vspace{0.3cm}
   1.422 +\vspace{0.3cm}
   1.423 +\vspace{0.3cm}
   1.424 +\subsubsection{RPC name:~get\_VDI}
   1.425 +
   1.426 +{\bf Overview:} 
   1.427 +Get the VDI field of the given crashdump.
   1.428 +
   1.429 + \noindent {\bf Signature:} 
   1.430 +\begin{verbatim} (VDI ref) get_VDI (session_id s, crashdump ref self)\end{verbatim}
   1.431 +
   1.432 +
   1.433 +\noindent{\bf Arguments:}
   1.434 +
   1.435 + 
   1.436 +\vspace{0.3cm}
   1.437 +\begin{tabular}{|c|c|p{7cm}|}
   1.438 + \hline
   1.439 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.440 +{\tt crashdump ref } & self & reference to the object \\ \hline 
   1.441 +
   1.442 +\end{tabular}
   1.443 +
   1.444 +\vspace{0.3cm}
   1.445 +
   1.446 + \noindent {\bf Return Type:} 
   1.447 +{\tt 
   1.448 +VDI ref
   1.449 +}
   1.450 +
   1.451 +
   1.452 +value of the field
   1.453 +\vspace{0.3cm}
   1.454 +\vspace{0.3cm}
   1.455 +\vspace{0.3cm}
   1.456 +\subsubsection{RPC name:~create}
   1.457 +
   1.458 +{\bf Overview:} 
   1.459 +Create a new crashdump instance, and return its handle.
   1.460 +
   1.461 + \noindent {\bf Signature:} 
   1.462 +\begin{verbatim} (crashdump ref) create (session_id s, crashdump record args)\end{verbatim}
   1.463 +
   1.464 +
   1.465 +\noindent{\bf Arguments:}
   1.466 +
   1.467 + 
   1.468 +\vspace{0.3cm}
   1.469 +\begin{tabular}{|c|c|p{7cm}|}
   1.470 + \hline
   1.471 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.472 +{\tt crashdump record } & args & All constructor arguments \\ \hline 
   1.473 +
   1.474 +\end{tabular}
   1.475 +
   1.476 +\vspace{0.3cm}
   1.477 +
   1.478 + \noindent {\bf Return Type:} 
   1.479 +{\tt 
   1.480 +crashdump ref
   1.481 +}
   1.482 +
   1.483 +
   1.484 +reference to the newly created object
   1.485 +\vspace{0.3cm}
   1.486 +\vspace{0.3cm}
   1.487 +\vspace{0.3cm}
   1.488 +\subsubsection{RPC name:~destroy}
   1.489 +
   1.490 +{\bf Overview:} 
   1.491 +Destroy the specified crashdump instance.
   1.492 +
   1.493 + \noindent {\bf Signature:} 
   1.494 +\begin{verbatim} void destroy (session_id s, crashdump ref self)\end{verbatim}
   1.495 +
   1.496 +
   1.497 +\noindent{\bf Arguments:}
   1.498 +
   1.499 + 
   1.500 +\vspace{0.3cm}
   1.501 +\begin{tabular}{|c|c|p{7cm}|}
   1.502 + \hline
   1.503 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.504 +{\tt crashdump ref } & self & reference to the object \\ \hline 
   1.505 +
   1.506 +\end{tabular}
   1.507 +
   1.508 +\vspace{0.3cm}
   1.509 +
   1.510 + \noindent {\bf Return Type:} 
   1.511 +{\tt 
   1.512 +void
   1.513 +}
   1.514 +
   1.515 +
   1.516 +
   1.517 +\vspace{0.3cm}
   1.518 +\vspace{0.3cm}
   1.519 +\vspace{0.3cm}
   1.520 +\subsubsection{RPC name:~get\_by\_uuid}
   1.521 +
   1.522 +{\bf Overview:} 
   1.523 +Get a reference to the crashdump instance with the specified UUID.
   1.524 +
   1.525 + \noindent {\bf Signature:} 
   1.526 +\begin{verbatim} (crashdump ref) get_by_uuid (session_id s, string uuid)\end{verbatim}
   1.527 +
   1.528 +
   1.529 +\noindent{\bf Arguments:}
   1.530 +
   1.531 + 
   1.532 +\vspace{0.3cm}
   1.533 +\begin{tabular}{|c|c|p{7cm}|}
   1.534 + \hline
   1.535 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.536 +{\tt string } & uuid & UUID of object to return \\ \hline 
   1.537 +
   1.538 +\end{tabular}
   1.539 +
   1.540 +\vspace{0.3cm}
   1.541 +
   1.542 + \noindent {\bf Return Type:} 
   1.543 +{\tt 
   1.544 +crashdump ref
   1.545 +}
   1.546 +
   1.547 +
   1.548 +reference to the object
   1.549 +\vspace{0.3cm}
   1.550 +\vspace{0.3cm}
   1.551 +\vspace{0.3cm}
   1.552 +\subsubsection{RPC name:~get\_record}
   1.553 +
   1.554 +{\bf Overview:} 
   1.555 +Get a record containing the current state of the given crashdump.
   1.556 +
   1.557 + \noindent {\bf Signature:} 
   1.558 +\begin{verbatim} (crashdump record) get_record (session_id s, crashdump ref self)\end{verbatim}
   1.559 +
   1.560 +
   1.561 +\noindent{\bf Arguments:}
   1.562 +
   1.563 + 
   1.564 +\vspace{0.3cm}
   1.565 +\begin{tabular}{|c|c|p{7cm}|}
   1.566 + \hline
   1.567 +{\bf type} & {\bf name} & {\bf description} \\ \hline
   1.568 +{\tt crashdump ref } & self & reference to the object \\ \hline 
   1.569 +
   1.570 +\end{tabular}
   1.571 +
   1.572 +\vspace{0.3cm}
   1.573 +
   1.574 + \noindent {\bf Return Type:} 
   1.575 +{\tt 
   1.576 +crashdump record
   1.577 +}
   1.578 +
   1.579 +
   1.580 +all fields from the object
   1.581 +\vspace{0.3cm}
   1.582 +\vspace{0.3cm}
   1.583 +\vspace{0.3cm}
   1.584 +
   1.585 +\vspace{1cm}
   1.586 +\newpage
   1.587  \section{Class: VTPM}
   1.588  \subsection{Fields for class: VTPM}
   1.589  \begin{longtable}{|lllp{0.38\textwidth}|}
   1.590  \hline
   1.591  \multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VTPM} \\
   1.592 -\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual TPM device}} \\
   1.593 +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A
   1.594 +virtual TPM device.}} \\
   1.595  \hline
   1.596  Quals & Field & Type & Description \\
   1.597  \hline
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/tools/libxen/include/xen_crashdump.h	Tue Jan 30 12:43:40 2007 +0000
     2.3 @@ -0,0 +1,206 @@
     2.4 +/*
     2.5 + * Copyright (c) 2006, XenSource Inc.
     2.6 + *
     2.7 + * This library is free software; you can redistribute it and/or
     2.8 + * modify it under the terms of the GNU Lesser General Public
     2.9 + * License as published by the Free Software Foundation; either
    2.10 + * version 2.1 of the License, or (at your option) any later version.
    2.11 + *
    2.12 + * This library is distributed in the hope that it will be useful,
    2.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    2.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    2.15 + * Lesser General Public License for more details.
    2.16 + *
    2.17 + * You should have received a copy of the GNU Lesser General Public
    2.18 + * License along with this library; if not, write to the Free Software
    2.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    2.20 + */
    2.21 +
    2.22 +#ifndef XEN_CRASHDUMP_H
    2.23 +#define XEN_CRASHDUMP_H
    2.24 +
    2.25 +#include "xen_common.h"
    2.26 +#include "xen_crashdump_decl.h"
    2.27 +#include "xen_vdi_decl.h"
    2.28 +#include "xen_vm_decl.h"
    2.29 +
    2.30 +
    2.31 +/*
    2.32 + * The crashdump class.
    2.33 + * 
    2.34 + * A VM crashdump.
    2.35 + */
    2.36 +
    2.37 +
    2.38 +/**
    2.39 + * Free the given xen_crashdump.  The given handle must have been
    2.40 + * allocated by this library.
    2.41 + */
    2.42 +extern void
    2.43 +xen_crashdump_free(xen_crashdump crashdump);
    2.44 +
    2.45 +
    2.46 +typedef struct xen_crashdump_set
    2.47 +{
    2.48 +    size_t size;
    2.49 +    xen_crashdump *contents[];
    2.50 +} xen_crashdump_set;
    2.51 +
    2.52 +/**
    2.53 + * Allocate a xen_crashdump_set of the given size.
    2.54 + */
    2.55 +extern xen_crashdump_set *
    2.56 +xen_crashdump_set_alloc(size_t size);
    2.57 +
    2.58 +/**
    2.59 + * Free the given xen_crashdump_set.  The given set must have been
    2.60 + * allocated by this library.
    2.61 + */
    2.62 +extern void
    2.63 +xen_crashdump_set_free(xen_crashdump_set *set);
    2.64 +
    2.65 +
    2.66 +typedef struct xen_crashdump_record
    2.67 +{
    2.68 +    xen_crashdump handle;
    2.69 +    char *uuid;
    2.70 +    struct xen_vm_record_opt *vm;
    2.71 +    struct xen_vdi_record_opt *vdi;
    2.72 +} xen_crashdump_record;
    2.73 +
    2.74 +/**
    2.75 + * Allocate a xen_crashdump_record.
    2.76 + */
    2.77 +extern xen_crashdump_record *
    2.78 +xen_crashdump_record_alloc(void);
    2.79 +
    2.80 +/**
    2.81 + * Free the given xen_crashdump_record, and all referenced values.  The
    2.82 + * given record must have been allocated by this library.
    2.83 + */
    2.84 +extern void
    2.85 +xen_crashdump_record_free(xen_crashdump_record *record);
    2.86 +
    2.87 +
    2.88 +typedef struct xen_crashdump_record_opt
    2.89 +{
    2.90 +    bool is_record;
    2.91 +    union
    2.92 +    {
    2.93 +        xen_crashdump handle;
    2.94 +        xen_crashdump_record *record;
    2.95 +    } u;
    2.96 +} xen_crashdump_record_opt;
    2.97 +
    2.98 +/**
    2.99 + * Allocate a xen_crashdump_record_opt.
   2.100 + */
   2.101 +extern xen_crashdump_record_opt *
   2.102 +xen_crashdump_record_opt_alloc(void);
   2.103 +
   2.104 +/**
   2.105 + * Free the given xen_crashdump_record_opt, and all referenced values. 
   2.106 + * The given record_opt must have been allocated by this library.
   2.107 + */
   2.108 +extern void
   2.109 +xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt);
   2.110 +
   2.111 +
   2.112 +typedef struct xen_crashdump_record_set
   2.113 +{
   2.114 +    size_t size;
   2.115 +    xen_crashdump_record *contents[];
   2.116 +} xen_crashdump_record_set;
   2.117 +
   2.118 +/**
   2.119 + * Allocate a xen_crashdump_record_set of the given size.
   2.120 + */
   2.121 +extern xen_crashdump_record_set *
   2.122 +xen_crashdump_record_set_alloc(size_t size);
   2.123 +
   2.124 +/**
   2.125 + * Free the given xen_crashdump_record_set, and all referenced values. 
   2.126 + * The given set must have been allocated by this library.
   2.127 + */
   2.128 +extern void
   2.129 +xen_crashdump_record_set_free(xen_crashdump_record_set *set);
   2.130 +
   2.131 +
   2.132 +
   2.133 +typedef struct xen_crashdump_record_opt_set
   2.134 +{
   2.135 +    size_t size;
   2.136 +    xen_crashdump_record_opt *contents[];
   2.137 +} xen_crashdump_record_opt_set;
   2.138 +
   2.139 +/**
   2.140 + * Allocate a xen_crashdump_record_opt_set of the given size.
   2.141 + */
   2.142 +extern xen_crashdump_record_opt_set *
   2.143 +xen_crashdump_record_opt_set_alloc(size_t size);
   2.144 +
   2.145 +/**
   2.146 + * Free the given xen_crashdump_record_opt_set, and all referenced
   2.147 + * values.  The given set must have been allocated by this library.
   2.148 + */
   2.149 +extern void
   2.150 +xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set);
   2.151 +
   2.152 +
   2.153 +/**
   2.154 + * Get a record containing the current state of the given crashdump.
   2.155 + */
   2.156 +extern bool
   2.157 +xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump);
   2.158 +
   2.159 +
   2.160 +/**
   2.161 + * Get a reference to the crashdump instance with the specified UUID.
   2.162 + */
   2.163 +extern bool
   2.164 +xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid);
   2.165 +
   2.166 +
   2.167 +/**
   2.168 + * Create a new crashdump instance, and return its handle.
   2.169 + */
   2.170 +extern bool
   2.171 +xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record);
   2.172 +
   2.173 +
   2.174 +/**
   2.175 + * Destroy the specified crashdump instance.
   2.176 + */
   2.177 +extern bool
   2.178 +xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump);
   2.179 +
   2.180 +
   2.181 +/**
   2.182 + * Get the uuid field of the given crashdump.
   2.183 + */
   2.184 +extern bool
   2.185 +xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump);
   2.186 +
   2.187 +
   2.188 +/**
   2.189 + * Get the VM field of the given crashdump.
   2.190 + */
   2.191 +extern bool
   2.192 +xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump);
   2.193 +
   2.194 +
   2.195 +/**
   2.196 + * Get the VDI field of the given crashdump.
   2.197 + */
   2.198 +extern bool
   2.199 +xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump);
   2.200 +
   2.201 +
   2.202 +/**
   2.203 + * Return a list of all the crashdumps known to the system.
   2.204 + */
   2.205 +extern bool
   2.206 +xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result);
   2.207 +
   2.208 +
   2.209 +#endif
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/tools/libxen/include/xen_crashdump_decl.h	Tue Jan 30 12:43:40 2007 +0000
     3.3 @@ -0,0 +1,30 @@
     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_CRASHDUMP_DECL_H
    3.23 +#define XEN_CRASHDUMP_DECL_H
    3.24 +
    3.25 +typedef void *xen_crashdump;
    3.26 +
    3.27 +struct xen_crashdump_set;
    3.28 +struct xen_crashdump_record;
    3.29 +struct xen_crashdump_record_set;
    3.30 +struct xen_crashdump_record_opt;
    3.31 +struct xen_crashdump_record_opt_set;
    3.32 +
    3.33 +#endif
     4.1 --- a/tools/libxen/include/xen_host.h	Tue Jan 30 13:52:52 2007 +0000
     4.2 +++ b/tools/libxen/include/xen_host.h	Tue Jan 30 12:43:40 2007 +0000
     4.3 @@ -24,6 +24,7 @@
     4.4  #include "xen_host_decl.h"
     4.5  #include "xen_pbd_decl.h"
     4.6  #include "xen_pif_decl.h"
     4.7 +#include "xen_sr_decl.h"
     4.8  #include "xen_string_string_map.h"
     4.9  #include "xen_vm_decl.h"
    4.10  
    4.11 @@ -74,6 +75,8 @@ typedef struct xen_host_record
    4.12      struct xen_vm_record_opt_set *resident_vms;
    4.13      xen_string_string_map *logging;
    4.14      struct xen_pif_record_opt_set *pifs;
    4.15 +    struct xen_sr_record_opt *suspend_image_sr;
    4.16 +    struct xen_sr_record_opt *crash_dump_sr;
    4.17      struct xen_pbd_record_opt_set *pbds;
    4.18      struct xen_host_cpu_record_opt_set *host_cpus;
    4.19  } xen_host_record;
    4.20 @@ -249,6 +252,20 @@ xen_host_get_pifs(xen_session *session, 
    4.21  
    4.22  
    4.23  /**
    4.24 + * Get the suspend_image_sr field of the given host.
    4.25 + */
    4.26 +extern bool
    4.27 +xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host);
    4.28 +
    4.29 +
    4.30 +/**
    4.31 + * Get the crash_dump_sr field of the given host.
    4.32 + */
    4.33 +extern bool
    4.34 +xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host);
    4.35 +
    4.36 +
    4.37 +/**
    4.38   * Get the PBDs field of the given host.
    4.39   */
    4.40  extern bool
    4.41 @@ -323,6 +340,20 @@ xen_host_remove_from_logging(xen_session
    4.42  
    4.43  
    4.44  /**
    4.45 + * Set the suspend_image_sr field of the given host.
    4.46 + */
    4.47 +extern bool
    4.48 +xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr);
    4.49 +
    4.50 +
    4.51 +/**
    4.52 + * Set the crash_dump_sr field of the given host.
    4.53 + */
    4.54 +extern bool
    4.55 +xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr);
    4.56 +
    4.57 +
    4.58 +/**
    4.59   * Puts the host into a state in which no new VMs can be started.
    4.60   * Currently active VMs on the host continue to execute.
    4.61   */
     5.1 --- a/tools/libxen/include/xen_vdi.h	Tue Jan 30 13:52:52 2007 +0000
     5.2 +++ b/tools/libxen/include/xen_vdi.h	Tue Jan 30 12:43:40 2007 +0000
     5.3 @@ -20,6 +20,7 @@
     5.4  #define XEN_VDI_H
     5.5  
     5.6  #include "xen_common.h"
     5.7 +#include "xen_crashdump_decl.h"
     5.8  #include "xen_sr_decl.h"
     5.9  #include "xen_vbd_decl.h"
    5.10  #include "xen_vdi_decl.h"
    5.11 @@ -69,6 +70,7 @@ typedef struct xen_vdi_record
    5.12      char *name_description;
    5.13      struct xen_sr_record_opt *sr;
    5.14      struct xen_vbd_record_opt_set *vbds;
    5.15 +    struct xen_crashdump_record_opt_set *crash_dumps;
    5.16      int64_t virtual_size;
    5.17      int64_t physical_utilisation;
    5.18      int64_t sector_size;
    5.19 @@ -227,6 +229,13 @@ xen_vdi_get_vbds(xen_session *session, s
    5.20  
    5.21  
    5.22  /**
    5.23 + * Get the crash_dumps field of the given VDI.
    5.24 + */
    5.25 +extern bool
    5.26 +xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi);
    5.27 +
    5.28 +
    5.29 +/**
    5.30   * Get the virtual_size field of the given VDI.
    5.31   */
    5.32  extern bool
     6.1 --- a/tools/libxen/include/xen_vdi_type.h	Tue Jan 30 13:52:52 2007 +0000
     6.2 +++ b/tools/libxen/include/xen_vdi_type.h	Tue Jan 30 12:43:40 2007 +0000
     6.3 @@ -38,7 +38,17 @@ enum xen_vdi_type
     6.4      /**
     6.5       * a disk that may be reformatted on upgrade
     6.6       */
     6.7 -    XEN_VDI_TYPE_EPHEMERAL
     6.8 +    XEN_VDI_TYPE_EPHEMERAL,
     6.9 +
    6.10 +    /**
    6.11 +     * a disk that stores a suspend image
    6.12 +     */
    6.13 +    XEN_VDI_TYPE_SUSPEND,
    6.14 +
    6.15 +    /**
    6.16 +     * a disk that stores VM crashdump information
    6.17 +     */
    6.18 +    XEN_VDI_TYPE_CRASHDUMP
    6.19  };
    6.20  
    6.21  
     7.1 --- a/tools/libxen/include/xen_vm.h	Tue Jan 30 13:52:52 2007 +0000
     7.2 +++ b/tools/libxen/include/xen_vm.h	Tue Jan 30 12:43:40 2007 +0000
     7.3 @@ -21,12 +21,14 @@
     7.4  
     7.5  #include "xen_common.h"
     7.6  #include "xen_console_decl.h"
     7.7 +#include "xen_crashdump_decl.h"
     7.8  #include "xen_host_decl.h"
     7.9  #include "xen_int_float_map.h"
    7.10  #include "xen_on_crash_behaviour.h"
    7.11  #include "xen_on_normal_exit.h"
    7.12  #include "xen_string_string_map.h"
    7.13  #include "xen_vbd_decl.h"
    7.14 +#include "xen_vdi_decl.h"
    7.15  #include "xen_vif_decl.h"
    7.16  #include "xen_vm_decl.h"
    7.17  #include "xen_vm_power_state.h"
    7.18 @@ -108,6 +110,7 @@ typedef struct xen_vm_record
    7.19      int64_t user_version;
    7.20      bool is_a_template;
    7.21      bool auto_power_on;
    7.22 +    struct xen_vdi_record_opt *suspend_vdi;
    7.23      struct xen_host_record_opt *resident_on;
    7.24      int64_t memory_static_max;
    7.25      int64_t memory_dynamic_max;
    7.26 @@ -124,6 +127,7 @@ typedef struct xen_vm_record
    7.27      struct xen_console_record_opt_set *consoles;
    7.28      struct xen_vif_record_opt_set *vifs;
    7.29      struct xen_vbd_record_opt_set *vbds;
    7.30 +    struct xen_crashdump_record_opt_set *crash_dumps;
    7.31      struct xen_vtpm_record_opt_set *vtpms;
    7.32      char *pv_bootloader;
    7.33      char *pv_kernel;
    7.34 @@ -307,6 +311,13 @@ xen_vm_get_auto_power_on(xen_session *se
    7.35  
    7.36  
    7.37  /**
    7.38 + * Get the suspend_VDI field of the given VM.
    7.39 + */
    7.40 +extern bool
    7.41 +xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm);
    7.42 +
    7.43 +
    7.44 +/**
    7.45   * Get the resident_on field of the given VM.
    7.46   */
    7.47  extern bool
    7.48 @@ -419,6 +430,13 @@ xen_vm_get_vbds(xen_session *session, st
    7.49  
    7.50  
    7.51  /**
    7.52 + * Get the crash_dumps field of the given VM.
    7.53 + */
    7.54 +extern bool
    7.55 +xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm);
    7.56 +
    7.57 +
    7.58 +/**
    7.59   * Get the VTPMs field of the given VM.
    7.60   */
    7.61  extern bool
     8.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     8.2 +++ b/tools/libxen/src/xen_crashdump.c	Tue Jan 30 12:43:40 2007 +0000
     8.3 @@ -0,0 +1,199 @@
     8.4 +/*
     8.5 + * Copyright (c) 2006, XenSource Inc.
     8.6 + *
     8.7 + * This library is free software; you can redistribute it and/or
     8.8 + * modify it under the terms of the GNU Lesser General Public
     8.9 + * License as published by the Free Software Foundation; either
    8.10 + * version 2.1 of the License, or (at your option) any later version.
    8.11 + *
    8.12 + * This library is distributed in the hope that it will be useful,
    8.13 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    8.14 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    8.15 + * Lesser General Public License for more details.
    8.16 + *
    8.17 + * You should have received a copy of the GNU Lesser General Public
    8.18 + * License along with this library; if not, write to the Free Software
    8.19 + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
    8.20 + */
    8.21 +
    8.22 +
    8.23 +#include <stddef.h>
    8.24 +#include <stdlib.h>
    8.25 +
    8.26 +#include "xen_common.h"
    8.27 +#include "xen_crashdump.h"
    8.28 +#include "xen_internal.h"
    8.29 +#include "xen_vdi.h"
    8.30 +#include "xen_vm.h"
    8.31 +
    8.32 +
    8.33 +XEN_FREE(xen_crashdump)
    8.34 +XEN_SET_ALLOC_FREE(xen_crashdump)
    8.35 +XEN_ALLOC(xen_crashdump_record)
    8.36 +XEN_SET_ALLOC_FREE(xen_crashdump_record)
    8.37 +XEN_ALLOC(xen_crashdump_record_opt)
    8.38 +XEN_RECORD_OPT_FREE(xen_crashdump)
    8.39 +XEN_SET_ALLOC_FREE(xen_crashdump_record_opt)
    8.40 +
    8.41 +
    8.42 +static const struct_member xen_crashdump_record_struct_members[] =
    8.43 +    {
    8.44 +        { .key = "uuid",
    8.45 +          .type = &abstract_type_string,
    8.46 +          .offset = offsetof(xen_crashdump_record, uuid) },
    8.47 +        { .key = "VM",
    8.48 +          .type = &abstract_type_ref,
    8.49 +          .offset = offsetof(xen_crashdump_record, vm) },
    8.50 +        { .key = "VDI",
    8.51 +          .type = &abstract_type_ref,
    8.52 +          .offset = offsetof(xen_crashdump_record, vdi) }
    8.53 +    };
    8.54 +
    8.55 +const abstract_type xen_crashdump_record_abstract_type_ =
    8.56 +    {
    8.57 +       .typename = STRUCT,
    8.58 +       .struct_size = sizeof(xen_crashdump_record),
    8.59 +       .member_count =
    8.60 +           sizeof(xen_crashdump_record_struct_members) / sizeof(struct_member),
    8.61 +       .members = xen_crashdump_record_struct_members
    8.62 +    };
    8.63 +
    8.64 +
    8.65 +void
    8.66 +xen_crashdump_record_free(xen_crashdump_record *record)
    8.67 +{
    8.68 +    if (record == NULL)
    8.69 +    {
    8.70 +        return;
    8.71 +    }
    8.72 +    free(record->handle);
    8.73 +    free(record->uuid);
    8.74 +    xen_vm_record_opt_free(record->vm);
    8.75 +    xen_vdi_record_opt_free(record->vdi);
    8.76 +    free(record);
    8.77 +}
    8.78 +
    8.79 +
    8.80 +bool
    8.81 +xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump)
    8.82 +{
    8.83 +    abstract_value param_values[] =
    8.84 +        {
    8.85 +            { .type = &abstract_type_string,
    8.86 +              .u.string_val = crashdump }
    8.87 +        };
    8.88 +
    8.89 +    abstract_type result_type = xen_crashdump_record_abstract_type_;
    8.90 +
    8.91 +    *result = NULL;
    8.92 +    XEN_CALL_("crashdump.get_record");
    8.93 +
    8.94 +    if (session->ok)
    8.95 +    {
    8.96 +       (*result)->handle = xen_strdup_((*result)->uuid);
    8.97 +    }
    8.98 +
    8.99 +    return session->ok;
   8.100 +}
   8.101 +
   8.102 +
   8.103 +bool
   8.104 +xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid)
   8.105 +{
   8.106 +    abstract_value param_values[] =
   8.107 +        {
   8.108 +            { .type = &abstract_type_string,
   8.109 +              .u.string_val = uuid }
   8.110 +        };
   8.111 +
   8.112 +    abstract_type result_type = abstract_type_string;
   8.113 +
   8.114 +    *result = NULL;
   8.115 +    XEN_CALL_("crashdump.get_by_uuid");
   8.116 +    return session->ok;
   8.117 +}
   8.118 +
   8.119 +
   8.120 +bool
   8.121 +xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record)
   8.122 +{
   8.123 +    abstract_value param_values[] =
   8.124 +        {
   8.125 +            { .type = &xen_crashdump_record_abstract_type_,
   8.126 +              .u.struct_val = record }
   8.127 +        };
   8.128 +
   8.129 +    abstract_type result_type = abstract_type_string;
   8.130 +
   8.131 +    *result = NULL;
   8.132 +    XEN_CALL_("crashdump.create");
   8.133 +    return session->ok;
   8.134 +}
   8.135 +
   8.136 +
   8.137 +bool
   8.138 +xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump)
   8.139 +{
   8.140 +    abstract_value param_values[] =
   8.141 +        {
   8.142 +            { .type = &abstract_type_string,
   8.143 +              .u.string_val = crashdump }
   8.144 +        };
   8.145 +
   8.146 +    xen_call_(session, "crashdump.destroy", param_values, 1, NULL, NULL);
   8.147 +    return session->ok;
   8.148 +}
   8.149 +
   8.150 +
   8.151 +bool
   8.152 +xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump)
   8.153 +{
   8.154 +    abstract_value param_values[] =
   8.155 +        {
   8.156 +            { .type = &abstract_type_string,
   8.157 +              .u.string_val = crashdump }
   8.158 +        };
   8.159 +
   8.160 +    abstract_type result_type = abstract_type_string;
   8.161 +
   8.162 +    *result = NULL;
   8.163 +    XEN_CALL_("crashdump.get_VM");
   8.164 +    return session->ok;
   8.165 +}
   8.166 +
   8.167 +
   8.168 +bool
   8.169 +xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump)
   8.170 +{
   8.171 +    abstract_value param_values[] =
   8.172 +        {
   8.173 +            { .type = &abstract_type_string,
   8.174 +              .u.string_val = crashdump }
   8.175 +        };
   8.176 +
   8.177 +    abstract_type result_type = abstract_type_string;
   8.178 +
   8.179 +    *result = NULL;
   8.180 +    XEN_CALL_("crashdump.get_VDI");
   8.181 +    return session->ok;
   8.182 +}
   8.183 +
   8.184 +
   8.185 +bool
   8.186 +xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result)
   8.187 +{
   8.188 +
   8.189 +    abstract_type result_type = abstract_type_string_set;
   8.190 +
   8.191 +    *result = NULL;
   8.192 +    xen_call_(session, "crashdump.get_all", NULL, 0, &result_type, result);
   8.193 +    return session->ok;
   8.194 +}
   8.195 +
   8.196 +
   8.197 +bool
   8.198 +xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump)
   8.199 +{
   8.200 +    *result = session->ok ? xen_strdup_((char *)crashdump) : NULL;
   8.201 +    return session->ok;
   8.202 +}
     9.1 --- a/tools/libxen/src/xen_host.c	Tue Jan 30 13:52:52 2007 +0000
     9.2 +++ b/tools/libxen/src/xen_host.c	Tue Jan 30 12:43:40 2007 +0000
     9.3 @@ -26,6 +26,7 @@
     9.4  #include "xen_internal.h"
     9.5  #include "xen_pbd.h"
     9.6  #include "xen_pif.h"
     9.7 +#include "xen_sr.h"
     9.8  #include "xen_string_string_map.h"
     9.9  #include "xen_vm.h"
    9.10  
    9.11 @@ -65,6 +66,12 @@ static const struct_member xen_host_reco
    9.12          { .key = "PIFs",
    9.13            .type = &abstract_type_ref_set,
    9.14            .offset = offsetof(xen_host_record, pifs) },
    9.15 +        { .key = "suspend_image_sr",
    9.16 +          .type = &abstract_type_ref,
    9.17 +          .offset = offsetof(xen_host_record, suspend_image_sr) },
    9.18 +        { .key = "crash_dump_sr",
    9.19 +          .type = &abstract_type_ref,
    9.20 +          .offset = offsetof(xen_host_record, crash_dump_sr) },
    9.21          { .key = "PBDs",
    9.22            .type = &abstract_type_ref_set,
    9.23            .offset = offsetof(xen_host_record, pbds) },
    9.24 @@ -99,6 +106,8 @@ xen_host_record_free(xen_host_record *re
    9.25      xen_vm_record_opt_set_free(record->resident_vms);
    9.26      xen_string_string_map_free(record->logging);
    9.27      xen_pif_record_opt_set_free(record->pifs);
    9.28 +    xen_sr_record_opt_free(record->suspend_image_sr);
    9.29 +    xen_sr_record_opt_free(record->crash_dump_sr);
    9.30      xen_pbd_record_opt_set_free(record->pbds);
    9.31      xen_host_cpu_record_opt_set_free(record->host_cpus);
    9.32      free(record);
    9.33 @@ -313,6 +322,40 @@ xen_host_get_pifs(xen_session *session, 
    9.34  
    9.35  
    9.36  bool
    9.37 +xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host)
    9.38 +{
    9.39 +    abstract_value param_values[] =
    9.40 +        {
    9.41 +            { .type = &abstract_type_string,
    9.42 +              .u.string_val = host }
    9.43 +        };
    9.44 +
    9.45 +    abstract_type result_type = abstract_type_string;
    9.46 +
    9.47 +    *result = NULL;
    9.48 +    XEN_CALL_("host.get_suspend_image_sr");
    9.49 +    return session->ok;
    9.50 +}
    9.51 +
    9.52 +
    9.53 +bool
    9.54 +xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host)
    9.55 +{
    9.56 +    abstract_value param_values[] =
    9.57 +        {
    9.58 +            { .type = &abstract_type_string,
    9.59 +              .u.string_val = host }
    9.60 +        };
    9.61 +
    9.62 +    abstract_type result_type = abstract_type_string;
    9.63 +
    9.64 +    *result = NULL;
    9.65 +    XEN_CALL_("host.get_crash_dump_sr");
    9.66 +    return session->ok;
    9.67 +}
    9.68 +
    9.69 +
    9.70 +bool
    9.71  xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host)
    9.72  {
    9.73      abstract_value param_values[] =
    9.74 @@ -479,6 +522,38 @@ xen_host_remove_from_logging(xen_session
    9.75  
    9.76  
    9.77  bool
    9.78 +xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr)
    9.79 +{
    9.80 +    abstract_value param_values[] =
    9.81 +        {
    9.82 +            { .type = &abstract_type_string,
    9.83 +              .u.string_val = host },
    9.84 +            { .type = &abstract_type_string,
    9.85 +              .u.string_val = suspend_image_sr }
    9.86 +        };
    9.87 +
    9.88 +    xen_call_(session, "host.set_suspend_image_sr", param_values, 2, NULL, NULL);
    9.89 +    return session->ok;
    9.90 +}
    9.91 +
    9.92 +
    9.93 +bool
    9.94 +xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr)
    9.95 +{
    9.96 +    abstract_value param_values[] =
    9.97 +        {
    9.98 +            { .type = &abstract_type_string,
    9.99 +              .u.string_val = host },
   9.100 +            { .type = &abstract_type_string,
   9.101 +              .u.string_val = crash_dump_sr }
   9.102 +        };
   9.103 +
   9.104 +    xen_call_(session, "host.set_crash_dump_sr", param_values, 2, NULL, NULL);
   9.105 +    return session->ok;
   9.106 +}
   9.107 +
   9.108 +
   9.109 +bool
   9.110  xen_host_disable(xen_session *session, xen_host host)
   9.111  {
   9.112      abstract_value param_values[] =
    10.1 --- a/tools/libxen/src/xen_vdi.c	Tue Jan 30 13:52:52 2007 +0000
    10.2 +++ b/tools/libxen/src/xen_vdi.c	Tue Jan 30 12:43:40 2007 +0000
    10.3 @@ -21,6 +21,7 @@
    10.4  #include <stdlib.h>
    10.5  
    10.6  #include "xen_common.h"
    10.7 +#include "xen_crashdump.h"
    10.8  #include "xen_internal.h"
    10.9  #include "xen_sr.h"
   10.10  #include "xen_vbd.h"
   10.11 @@ -54,6 +55,9 @@ static const struct_member xen_vdi_recor
   10.12          { .key = "VBDs",
   10.13            .type = &abstract_type_ref_set,
   10.14            .offset = offsetof(xen_vdi_record, vbds) },
   10.15 +        { .key = "crash_dumps",
   10.16 +          .type = &abstract_type_ref_set,
   10.17 +          .offset = offsetof(xen_vdi_record, crash_dumps) },
   10.18          { .key = "virtual_size",
   10.19            .type = &abstract_type_int,
   10.20            .offset = offsetof(xen_vdi_record, virtual_size) },
   10.21 @@ -97,6 +101,7 @@ xen_vdi_record_free(xen_vdi_record *reco
   10.22      free(record->name_description);
   10.23      xen_sr_record_opt_free(record->sr);
   10.24      xen_vbd_record_opt_set_free(record->vbds);
   10.25 +    xen_crashdump_record_opt_set_free(record->crash_dumps);
   10.26      free(record);
   10.27  }
   10.28  
   10.29 @@ -258,6 +263,23 @@ xen_vdi_get_vbds(xen_session *session, s
   10.30  
   10.31  
   10.32  bool
   10.33 +xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi)
   10.34 +{
   10.35 +    abstract_value param_values[] =
   10.36 +        {
   10.37 +            { .type = &abstract_type_string,
   10.38 +              .u.string_val = vdi }
   10.39 +        };
   10.40 +
   10.41 +    abstract_type result_type = abstract_type_string_set;
   10.42 +
   10.43 +    *result = NULL;
   10.44 +    XEN_CALL_("VDI.get_crash_dumps");
   10.45 +    return session->ok;
   10.46 +}
   10.47 +
   10.48 +
   10.49 +bool
   10.50  xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi)
   10.51  {
   10.52      abstract_value param_values[] =
   10.53 @@ -315,9 +337,7 @@ xen_vdi_get_type(xen_session *session, e
   10.54          };
   10.55  
   10.56      abstract_type result_type = xen_vdi_type_abstract_type_;
   10.57 -    char *result_str = NULL;
   10.58      XEN_CALL_("VDI.get_type");
   10.59 -    *result = xen_vdi_type_from_string(session, result_str);
   10.60      return session->ok;
   10.61  }
   10.62  
    11.1 --- a/tools/libxen/src/xen_vdi_type.c	Tue Jan 30 13:52:52 2007 +0000
    11.2 +++ b/tools/libxen/src/xen_vdi_type.c	Tue Jan 30 12:43:40 2007 +0000
    11.3 @@ -30,7 +30,9 @@ static const char *lookup_table[] =
    11.4  {
    11.5      "system",
    11.6      "user",
    11.7 -    "ephemeral"
    11.8 +    "ephemeral",
    11.9 +    "suspend",
   11.10 +    "crashdump"
   11.11  };
   11.12  
   11.13  
    12.1 --- a/tools/libxen/src/xen_vm.c	Tue Jan 30 13:52:52 2007 +0000
    12.2 +++ b/tools/libxen/src/xen_vm.c	Tue Jan 30 12:43:40 2007 +0000
    12.3 @@ -22,6 +22,7 @@
    12.4  
    12.5  #include "xen_common.h"
    12.6  #include "xen_console.h"
    12.7 +#include "xen_crashdump.h"
    12.8  #include "xen_host.h"
    12.9  #include "xen_int_float_map.h"
   12.10  #include "xen_internal.h"
   12.11 @@ -29,6 +30,7 @@
   12.12  #include "xen_on_normal_exit_internal.h"
   12.13  #include "xen_string_string_map.h"
   12.14  #include "xen_vbd.h"
   12.15 +#include "xen_vdi.h"
   12.16  #include "xen_vif.h"
   12.17  #include "xen_vm.h"
   12.18  #include "xen_vm_power_state_internal.h"
   12.19 @@ -67,6 +69,9 @@ static const struct_member xen_vm_record
   12.20          { .key = "auto_power_on",
   12.21            .type = &abstract_type_bool,
   12.22            .offset = offsetof(xen_vm_record, auto_power_on) },
   12.23 +        { .key = "suspend_VDI",
   12.24 +          .type = &abstract_type_ref,
   12.25 +          .offset = offsetof(xen_vm_record, suspend_vdi) },
   12.26          { .key = "resident_on",
   12.27            .type = &abstract_type_ref,
   12.28            .offset = offsetof(xen_vm_record, resident_on) },
   12.29 @@ -115,6 +120,9 @@ static const struct_member xen_vm_record
   12.30          { .key = "VBDs",
   12.31            .type = &abstract_type_ref_set,
   12.32            .offset = offsetof(xen_vm_record, vbds) },
   12.33 +        { .key = "crash_dumps",
   12.34 +          .type = &abstract_type_ref_set,
   12.35 +          .offset = offsetof(xen_vm_record, crash_dumps) },
   12.36          { .key = "VTPMs",
   12.37            .type = &abstract_type_ref_set,
   12.38            .offset = offsetof(xen_vm_record, vtpms) },
   12.39 @@ -183,6 +191,7 @@ xen_vm_record_free(xen_vm_record *record
   12.40      free(record->uuid);
   12.41      free(record->name_label);
   12.42      free(record->name_description);
   12.43 +    xen_vdi_record_opt_free(record->suspend_vdi);
   12.44      xen_host_record_opt_free(record->resident_on);
   12.45      free(record->vcpus_policy);
   12.46      free(record->vcpus_params);
   12.47 @@ -190,6 +199,7 @@ xen_vm_record_free(xen_vm_record *record
   12.48      xen_console_record_opt_set_free(record->consoles);
   12.49      xen_vif_record_opt_set_free(record->vifs);
   12.50      xen_vbd_record_opt_set_free(record->vbds);
   12.51 +    xen_crashdump_record_opt_set_free(record->crash_dumps);
   12.52      xen_vtpm_record_opt_set_free(record->vtpms);
   12.53      free(record->pv_bootloader);
   12.54      free(record->pv_kernel);
   12.55 @@ -391,6 +401,23 @@ xen_vm_get_auto_power_on(xen_session *se
   12.56  
   12.57  
   12.58  bool
   12.59 +xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm)
   12.60 +{
   12.61 +    abstract_value param_values[] =
   12.62 +        {
   12.63 +            { .type = &abstract_type_string,
   12.64 +              .u.string_val = vm }
   12.65 +        };
   12.66 +
   12.67 +    abstract_type result_type = abstract_type_string;
   12.68 +
   12.69 +    *result = NULL;
   12.70 +    XEN_CALL_("VM.get_suspend_VDI");
   12.71 +    return session->ok;
   12.72 +}
   12.73 +
   12.74 +
   12.75 +bool
   12.76  xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm)
   12.77  {
   12.78      abstract_value param_values[] =
   12.79 @@ -651,6 +678,23 @@ xen_vm_get_vbds(xen_session *session, st
   12.80  
   12.81  
   12.82  bool
   12.83 +xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm)
   12.84 +{
   12.85 +    abstract_value param_values[] =
   12.86 +        {
   12.87 +            { .type = &abstract_type_string,
   12.88 +              .u.string_val = vm }
   12.89 +        };
   12.90 +
   12.91 +    abstract_type result_type = abstract_type_string_set;
   12.92 +
   12.93 +    *result = NULL;
   12.94 +    XEN_CALL_("VM.get_crash_dumps");
   12.95 +    return session->ok;
   12.96 +}
   12.97 +
   12.98 +
   12.99 +bool
  12.100  xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm)
  12.101  {
  12.102      abstract_value param_values[] =