[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] Added modelling and C bindings for crashdumps, and suspend VDIs.
# HG changeset patch # User Ewan Mellor <ewan@xxxxxxxxxxxxx> # Date 1170161020 0 # Node ID 69c5afd5ab08446f11ede88574a8a8f06ac5b4cb # Parent f91dd7642a42525c2e012ea4297f1e097dfbb02e Added modelling and C bindings for crashdumps, and suspend VDIs. Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx> --- docs/xen-api/xenapi-datamodel.tex | 505 +++++++++++++++++++++++++++++- tools/libxen/include/xen_crashdump.h | 206 ++++++++++++ tools/libxen/include/xen_crashdump_decl.h | 30 + tools/libxen/include/xen_host.h | 31 + tools/libxen/include/xen_vdi.h | 9 tools/libxen/include/xen_vdi_type.h | 12 tools/libxen/include/xen_vm.h | 18 + tools/libxen/src/xen_crashdump.c | 199 +++++++++++ tools/libxen/src/xen_host.c | 75 ++++ tools/libxen/src/xen_vdi.c | 24 + tools/libxen/src/xen_vdi_type.c | 4 tools/libxen/src/xen_vm.c | 44 ++ 12 files changed, 1152 insertions(+), 5 deletions(-) diff -r f91dd7642a42 -r 69c5afd5ab08 docs/xen-api/xenapi-datamodel.tex --- a/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 13:52:52 2007 +0000 +++ b/docs/xen-api/xenapi-datamodel.tex Tue Jan 30 12:43:40 2007 +0000 @@ -35,6 +35,7 @@ Name & Description \\ {\tt VDI} & A virtual disk image \\ {\tt VBD} & A virtual block device \\ {\tt PBD} & The physical block devices through which hosts access SRs \\ +{\tt crashdump} & A VM crashdump \\ {\tt VTPM} & A virtual TPM device \\ {\tt console} & A console \\ {\tt user} & A user of the system \\ @@ -51,7 +52,9 @@ host.PBDs & PBD.host & many-to-one\\ host.PBDs & PBD.host & many-to-one\\ SR.PBDs & PBD.SR & many-to-one\\ VDI.VBDs & VBD.VDI & many-to-one\\ +VDI.crash\_dumps & crashdump.VDI & many-to-one\\ VBD.VM & VM.VBDs & one-to-many\\ +crashdump.VM & VM.crash\_dumps & one-to-many\\ VIF.VM & VM.VIFs & one-to-many\\ VIF.network & network.VIFs & one-to-many\\ PIF.metrics & PIF\_metrics.PIF & one-to-one\\ @@ -121,6 +124,8 @@ The following enumeration types are used \hspace{0.5cm}{\tt system} & a disk that may be replaced on upgrade \\ \hspace{0.5cm}{\tt user} & a disk that is always preserved on upgrade \\ \hspace{0.5cm}{\tt ephemeral} & a disk that may be reformatted on upgrade \\ +\hspace{0.5cm}{\tt suspend} & a disk that stores a suspend image \\ +\hspace{0.5cm}{\tt crashdump} & a disk that stores VM crashdump information \\ \hline \end{longtable} @@ -1022,6 +1027,7 @@ Quals & Field & Type & Description \\ $\mathit{RW}$ & {\tt user\_version} & int & a user version number for this machine \\ $\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 \\ $\mathit{RW}$ & {\tt auto\_power\_on} & bool & true if this VM should be started automatically after host boot \\ +$\mathit{RO}_\mathit{run}$ & {\tt suspend\_VDI} & VDI ref & The VDI that a suspend image is stored on. (Only has meaning if VM is currently suspended) \\ $\mathit{RO}_\mathit{run}$ & {\tt resident\_on} & host ref & the host the VM is currently resident on \\ $\mathit{RO}_\mathit{ins}$ & {\tt memory/static\_max} & int & Statically-set (i.e. absolute) maximum (bytes) \\ $\mathit{RW}$ & {\tt memory/dynamic\_max} & int & Dynamic maximum (bytes) \\ @@ -1038,6 +1044,7 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt consoles} & (console ref) Set & virtual console devices \\ $\mathit{RO}_\mathit{run}$ & {\tt VIFs} & (VIF ref) Set & virtual network interfaces \\ $\mathit{RO}_\mathit{run}$ & {\tt VBDs} & (VBD ref) Set & virtual block devices \\ +$\mathit{RO}_\mathit{run}$ & {\tt crash\_dumps} & (crashdump ref) Set & crash dumps associated with this VM \\ $\mathit{RO}_\mathit{run}$ & {\tt VTPMs} & (VTPM ref) Set & virtual TPMs \\ $\mathit{RW}$ & {\tt PV/bootloader} & string & name of or path to bootloader \\ $\mathit{RW}$ & {\tt PV/kernel} & string & path to the kernel \\ @@ -1835,6 +1842,38 @@ void \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} +\subsubsection{RPC name:~get\_suspend\_VDI} + +{\bf Overview:} +Get the suspend\_VDI field of the given VM. + + \noindent {\bf Signature:} +\begin{verbatim} (VDI ref) get_suspend_VDI (session_id s, VM ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VM ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +VDI ref +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} \subsubsection{RPC name:~get\_resident\_on} {\bf Overview:} @@ -2612,6 +2651,38 @@ Get the VBDs field of the given VM. \noindent {\bf Return Type:} {\tt (VBD ref) Set +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_crash\_dumps} + +{\bf Overview:} +Get the crash\_dumps field of the given VM. + + \noindent {\bf Signature:} +\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VM ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VM ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +(crashdump ref) Set } @@ -3760,6 +3831,8 @@ Quals & Field & Type & Description \\ $\mathit{RO}_\mathit{run}$ & {\tt resident\_VMs} & (VM ref) Set & list of VMs currently resident on host \\ $\mathit{RW}$ & {\tt logging} & (string $\rightarrow$ string) Map & logging configuration \\ $\mathit{RO}_\mathit{run}$ & {\tt PIFs} & (PIF ref) Set & physical network interfaces \\ +$\mathit{RW}$ & {\tt suspend\_image\_sr} & SR ref & The SR in which VDIs for suspend images are created \\ +$\mathit{RW}$ & {\tt crash\_dump\_sr} & SR ref & The SR in which VDIs for crash dumps are created \\ $\mathit{RO}_\mathit{run}$ & {\tt PBDs} & (PBD ref) Set & physical blockdevices \\ $\mathit{RO}_\mathit{run}$ & {\tt host\_CPUs} & (host\_cpu ref) Set & The physical CPUs on this host \\ \hline @@ -4448,6 +4521,138 @@ Get the PIFs field of the given host. value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_suspend\_image\_sr} + +{\bf Overview:} +Get the suspend\_image\_sr field of the given host. + + \noindent {\bf Signature:} +\begin{verbatim} (SR ref) get_suspend_image_sr (session_id s, host ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt host ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +SR ref +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~set\_suspend\_image\_sr} + +{\bf Overview:} +Set the suspend\_image\_sr field of the given host. + + \noindent {\bf Signature:} +\begin{verbatim} void set_suspend_image_sr (session_id s, host ref self, SR ref value)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt host ref } & self & reference to the object \\ \hline + +{\tt SR ref } & value & New value to set \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_crash\_dump\_sr} + +{\bf Overview:} +Get the crash\_dump\_sr field of the given host. + + \noindent {\bf Signature:} +\begin{verbatim} (SR ref) get_crash_dump_sr (session_id s, host ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt host ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +SR ref +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~set\_crash\_dump\_sr} + +{\bf Overview:} +Set the crash\_dump\_sr field of the given host. + + \noindent {\bf Signature:} +\begin{verbatim} void set_crash_dump_sr (session_id s, host ref self, SR ref value)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt host ref } & self & reference to the object \\ \hline + +{\tt SR ref } & value & New value to set \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + \vspace{0.3cm} \vspace{0.3cm} \vspace{0.3cm} @@ -7541,6 +7746,7 @@ Quals & Field & Type & Description \\ $\mathit{RW}$ & {\tt name/description} & string & a notes field containg human-readable description \\ $\mathit{RW}$ & {\tt SR} & SR ref & storage repository in which the VDI resides \\ $\mathit{RO}_\mathit{run}$ & {\tt VBDs} & (VBD ref) Set & list of vbds that refer to this disk \\ +$\mathit{RO}_\mathit{run}$ & {\tt crash\_dumps} & (crashdump ref) Set & list of crash dumps that refer to this disk \\ $\mathit{RW}$ & {\tt virtual\_size} & int & size of disk as presented to the guest (in multiples of sector\_size field) \\ $\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) \\ $\mathit{RO}_\mathit{ins}$ & {\tt sector\_size} & int & sector size of VDI (in bytes) \\ @@ -7872,6 +8078,38 @@ Get the VBDs field of the given VDI. \noindent {\bf Return Type:} {\tt (VBD ref) Set +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_crash\_dumps} + +{\bf Overview:} +Get the crash\_dumps field of the given VDI. + + \noindent {\bf Signature:} +\begin{verbatim} ((crashdump ref) Set) get_crash_dumps (session_id s, VDI ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt VDI ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +(crashdump ref) Set } @@ -9257,12 +9495,277 @@ all fields from the object \vspace{1cm} \newpage +\section{Class: crashdump} +\subsection{Fields for class: crashdump} +\begin{longtable}{|lllp{0.38\textwidth}|} +\hline +\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf crashdump} \\ +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A +VM crashdump.}} \\ +\hline +Quals & Field & Type & Description \\ +\hline +$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object reference \\ +$\mathit{RO}_\mathit{ins}$ & {\tt VM} & VM ref & the virtual machine \\ +$\mathit{RO}_\mathit{ins}$ & {\tt VDI} & VDI ref & the virtual disk \\ +\hline +\end{longtable} +\subsection{Additional RPCs associated with class: crashdump} +\subsubsection{RPC name:~get\_all} + +{\bf Overview:} +Return a list of all the crashdumps known to the system. + + \noindent {\bf Signature:} +\begin{verbatim} ((crashdump ref) Set) get_all (session_id s)\end{verbatim} + + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +(crashdump ref) Set +} + + +references to all objects +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_uuid} + +{\bf Overview:} +Get the uuid field of the given crashdump. + + \noindent {\bf Signature:} +\begin{verbatim} string get_uuid (session_id s, crashdump ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +string +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_VM} + +{\bf Overview:} +Get the VM field of the given crashdump. + + \noindent {\bf Signature:} +\begin{verbatim} (VM ref) get_VM (session_id s, crashdump ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +VM ref +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_VDI} + +{\bf Overview:} +Get the VDI field of the given crashdump. + + \noindent {\bf Signature:} +\begin{verbatim} (VDI ref) get_VDI (session_id s, crashdump ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +VDI ref +} + + +value of the field +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~create} + +{\bf Overview:} +Create a new crashdump instance, and return its handle. + + \noindent {\bf Signature:} +\begin{verbatim} (crashdump ref) create (session_id s, crashdump record args)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump record } & args & All constructor arguments \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +crashdump ref +} + + +reference to the newly created object +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~destroy} + +{\bf Overview:} +Destroy the specified crashdump instance. + + \noindent {\bf Signature:} +\begin{verbatim} void destroy (session_id s, crashdump ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +void +} + + + +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_by\_uuid} + +{\bf Overview:} +Get a reference to the crashdump instance with the specified UUID. + + \noindent {\bf Signature:} +\begin{verbatim} (crashdump ref) get_by_uuid (session_id s, string uuid)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt string } & uuid & UUID of object to return \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +crashdump ref +} + + +reference to the object +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} +\subsubsection{RPC name:~get\_record} + +{\bf Overview:} +Get a record containing the current state of the given crashdump. + + \noindent {\bf Signature:} +\begin{verbatim} (crashdump record) get_record (session_id s, crashdump ref self)\end{verbatim} + + +\noindent{\bf Arguments:} + + +\vspace{0.3cm} +\begin{tabular}{|c|c|p{7cm}|} + \hline +{\bf type} & {\bf name} & {\bf description} \\ \hline +{\tt crashdump ref } & self & reference to the object \\ \hline + +\end{tabular} + +\vspace{0.3cm} + + \noindent {\bf Return Type:} +{\tt +crashdump record +} + + +all fields from the object +\vspace{0.3cm} +\vspace{0.3cm} +\vspace{0.3cm} + +\vspace{1cm} +\newpage \section{Class: VTPM} \subsection{Fields for class: VTPM} \begin{longtable}{|lllp{0.38\textwidth}|} \hline \multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf VTPM} \\ -\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A virtual TPM device}} \\ +\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em A +virtual TPM device.}} \\ \hline Quals & Field & Type & Description \\ \hline diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_crashdump.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen_crashdump.h Tue Jan 30 12:43:40 2007 +0000 @@ -0,0 +1,206 @@ +/* + * Copyright (c) 2006, XenSource Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef XEN_CRASHDUMP_H +#define XEN_CRASHDUMP_H + +#include "xen_common.h" +#include "xen_crashdump_decl.h" +#include "xen_vdi_decl.h" +#include "xen_vm_decl.h" + + +/* + * The crashdump class. + * + * A VM crashdump. + */ + + +/** + * Free the given xen_crashdump. The given handle must have been + * allocated by this library. + */ +extern void +xen_crashdump_free(xen_crashdump crashdump); + + +typedef struct xen_crashdump_set +{ + size_t size; + xen_crashdump *contents[]; +} xen_crashdump_set; + +/** + * Allocate a xen_crashdump_set of the given size. + */ +extern xen_crashdump_set * +xen_crashdump_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_set. The given set must have been + * allocated by this library. + */ +extern void +xen_crashdump_set_free(xen_crashdump_set *set); + + +typedef struct xen_crashdump_record +{ + xen_crashdump handle; + char *uuid; + struct xen_vm_record_opt *vm; + struct xen_vdi_record_opt *vdi; +} xen_crashdump_record; + +/** + * Allocate a xen_crashdump_record. + */ +extern xen_crashdump_record * +xen_crashdump_record_alloc(void); + +/** + * Free the given xen_crashdump_record, and all referenced values. The + * given record must have been allocated by this library. + */ +extern void +xen_crashdump_record_free(xen_crashdump_record *record); + + +typedef struct xen_crashdump_record_opt +{ + bool is_record; + union + { + xen_crashdump handle; + xen_crashdump_record *record; + } u; +} xen_crashdump_record_opt; + +/** + * Allocate a xen_crashdump_record_opt. + */ +extern xen_crashdump_record_opt * +xen_crashdump_record_opt_alloc(void); + +/** + * Free the given xen_crashdump_record_opt, and all referenced values. + * The given record_opt must have been allocated by this library. + */ +extern void +xen_crashdump_record_opt_free(xen_crashdump_record_opt *record_opt); + + +typedef struct xen_crashdump_record_set +{ + size_t size; + xen_crashdump_record *contents[]; +} xen_crashdump_record_set; + +/** + * Allocate a xen_crashdump_record_set of the given size. + */ +extern xen_crashdump_record_set * +xen_crashdump_record_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_record_set, and all referenced values. + * The given set must have been allocated by this library. + */ +extern void +xen_crashdump_record_set_free(xen_crashdump_record_set *set); + + + +typedef struct xen_crashdump_record_opt_set +{ + size_t size; + xen_crashdump_record_opt *contents[]; +} xen_crashdump_record_opt_set; + +/** + * Allocate a xen_crashdump_record_opt_set of the given size. + */ +extern xen_crashdump_record_opt_set * +xen_crashdump_record_opt_set_alloc(size_t size); + +/** + * Free the given xen_crashdump_record_opt_set, and all referenced + * values. The given set must have been allocated by this library. + */ +extern void +xen_crashdump_record_opt_set_free(xen_crashdump_record_opt_set *set); + + +/** + * Get a record containing the current state of the given crashdump. + */ +extern bool +xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump); + + +/** + * Get a reference to the crashdump instance with the specified UUID. + */ +extern bool +xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid); + + +/** + * Create a new crashdump instance, and return its handle. + */ +extern bool +xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record); + + +/** + * Destroy the specified crashdump instance. + */ +extern bool +xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump); + + +/** + * Get the uuid field of the given crashdump. + */ +extern bool +xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump); + + +/** + * Get the VM field of the given crashdump. + */ +extern bool +xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump); + + +/** + * Get the VDI field of the given crashdump. + */ +extern bool +xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump); + + +/** + * Return a list of all the crashdumps known to the system. + */ +extern bool +xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result); + + +#endif diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_crashdump_decl.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/include/xen_crashdump_decl.h Tue Jan 30 12:43:40 2007 +0000 @@ -0,0 +1,30 @@ +/* + * Copyright (c) 2006, XenSource Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef XEN_CRASHDUMP_DECL_H +#define XEN_CRASHDUMP_DECL_H + +typedef void *xen_crashdump; + +struct xen_crashdump_set; +struct xen_crashdump_record; +struct xen_crashdump_record_set; +struct xen_crashdump_record_opt; +struct xen_crashdump_record_opt_set; + +#endif diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_host.h --- a/tools/libxen/include/xen_host.h Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/include/xen_host.h Tue Jan 30 12:43:40 2007 +0000 @@ -24,6 +24,7 @@ #include "xen_host_decl.h" #include "xen_pbd_decl.h" #include "xen_pif_decl.h" +#include "xen_sr_decl.h" #include "xen_string_string_map.h" #include "xen_vm_decl.h" @@ -74,6 +75,8 @@ typedef struct xen_host_record struct xen_vm_record_opt_set *resident_vms; xen_string_string_map *logging; struct xen_pif_record_opt_set *pifs; + struct xen_sr_record_opt *suspend_image_sr; + struct xen_sr_record_opt *crash_dump_sr; struct xen_pbd_record_opt_set *pbds; struct xen_host_cpu_record_opt_set *host_cpus; } xen_host_record; @@ -249,6 +252,20 @@ xen_host_get_pifs(xen_session *session, /** + * Get the suspend_image_sr field of the given host. + */ +extern bool +xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host); + + +/** + * Get the crash_dump_sr field of the given host. + */ +extern bool +xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host); + + +/** * Get the PBDs field of the given host. */ extern bool @@ -323,6 +340,20 @@ xen_host_remove_from_logging(xen_session /** + * Set the suspend_image_sr field of the given host. + */ +extern bool +xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr); + + +/** + * Set the crash_dump_sr field of the given host. + */ +extern bool +xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr); + + +/** * Puts the host into a state in which no new VMs can be started. * Currently active VMs on the host continue to execute. */ diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_vdi.h --- a/tools/libxen/include/xen_vdi.h Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/include/xen_vdi.h Tue Jan 30 12:43:40 2007 +0000 @@ -20,6 +20,7 @@ #define XEN_VDI_H #include "xen_common.h" +#include "xen_crashdump_decl.h" #include "xen_sr_decl.h" #include "xen_vbd_decl.h" #include "xen_vdi_decl.h" @@ -69,6 +70,7 @@ typedef struct xen_vdi_record char *name_description; struct xen_sr_record_opt *sr; struct xen_vbd_record_opt_set *vbds; + struct xen_crashdump_record_opt_set *crash_dumps; int64_t virtual_size; int64_t physical_utilisation; int64_t sector_size; @@ -227,6 +229,13 @@ xen_vdi_get_vbds(xen_session *session, s /** + * Get the crash_dumps field of the given VDI. + */ +extern bool +xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi); + + +/** * Get the virtual_size field of the given VDI. */ extern bool diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_vdi_type.h --- a/tools/libxen/include/xen_vdi_type.h Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/include/xen_vdi_type.h Tue Jan 30 12:43:40 2007 +0000 @@ -38,7 +38,17 @@ enum xen_vdi_type /** * a disk that may be reformatted on upgrade */ - XEN_VDI_TYPE_EPHEMERAL + XEN_VDI_TYPE_EPHEMERAL, + + /** + * a disk that stores a suspend image + */ + XEN_VDI_TYPE_SUSPEND, + + /** + * a disk that stores VM crashdump information + */ + XEN_VDI_TYPE_CRASHDUMP }; diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/include/xen_vm.h --- a/tools/libxen/include/xen_vm.h Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/include/xen_vm.h Tue Jan 30 12:43:40 2007 +0000 @@ -21,12 +21,14 @@ #include "xen_common.h" #include "xen_console_decl.h" +#include "xen_crashdump_decl.h" #include "xen_host_decl.h" #include "xen_int_float_map.h" #include "xen_on_crash_behaviour.h" #include "xen_on_normal_exit.h" #include "xen_string_string_map.h" #include "xen_vbd_decl.h" +#include "xen_vdi_decl.h" #include "xen_vif_decl.h" #include "xen_vm_decl.h" #include "xen_vm_power_state.h" @@ -108,6 +110,7 @@ typedef struct xen_vm_record int64_t user_version; bool is_a_template; bool auto_power_on; + struct xen_vdi_record_opt *suspend_vdi; struct xen_host_record_opt *resident_on; int64_t memory_static_max; int64_t memory_dynamic_max; @@ -124,6 +127,7 @@ typedef struct xen_vm_record struct xen_console_record_opt_set *consoles; struct xen_vif_record_opt_set *vifs; struct xen_vbd_record_opt_set *vbds; + struct xen_crashdump_record_opt_set *crash_dumps; struct xen_vtpm_record_opt_set *vtpms; char *pv_bootloader; char *pv_kernel; @@ -307,6 +311,13 @@ xen_vm_get_auto_power_on(xen_session *se /** + * Get the suspend_VDI field of the given VM. + */ +extern bool +xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm); + + +/** * Get the resident_on field of the given VM. */ extern bool @@ -416,6 +427,13 @@ xen_vm_get_vifs(xen_session *session, st */ extern bool xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm); + + +/** + * Get the crash_dumps field of the given VM. + */ +extern bool +xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm); /** diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/src/xen_crashdump.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tools/libxen/src/xen_crashdump.c Tue Jan 30 12:43:40 2007 +0000 @@ -0,0 +1,199 @@ +/* + * Copyright (c) 2006, XenSource Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include <stddef.h> +#include <stdlib.h> + +#include "xen_common.h" +#include "xen_crashdump.h" +#include "xen_internal.h" +#include "xen_vdi.h" +#include "xen_vm.h" + + +XEN_FREE(xen_crashdump) +XEN_SET_ALLOC_FREE(xen_crashdump) +XEN_ALLOC(xen_crashdump_record) +XEN_SET_ALLOC_FREE(xen_crashdump_record) +XEN_ALLOC(xen_crashdump_record_opt) +XEN_RECORD_OPT_FREE(xen_crashdump) +XEN_SET_ALLOC_FREE(xen_crashdump_record_opt) + + +static const struct_member xen_crashdump_record_struct_members[] = + { + { .key = "uuid", + .type = &abstract_type_string, + .offset = offsetof(xen_crashdump_record, uuid) }, + { .key = "VM", + .type = &abstract_type_ref, + .offset = offsetof(xen_crashdump_record, vm) }, + { .key = "VDI", + .type = &abstract_type_ref, + .offset = offsetof(xen_crashdump_record, vdi) } + }; + +const abstract_type xen_crashdump_record_abstract_type_ = + { + .typename = STRUCT, + .struct_size = sizeof(xen_crashdump_record), + .member_count = + sizeof(xen_crashdump_record_struct_members) / sizeof(struct_member), + .members = xen_crashdump_record_struct_members + }; + + +void +xen_crashdump_record_free(xen_crashdump_record *record) +{ + if (record == NULL) + { + return; + } + free(record->handle); + free(record->uuid); + xen_vm_record_opt_free(record->vm); + xen_vdi_record_opt_free(record->vdi); + free(record); +} + + +bool +xen_crashdump_get_record(xen_session *session, xen_crashdump_record **result, xen_crashdump crashdump) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = crashdump } + }; + + abstract_type result_type = xen_crashdump_record_abstract_type_; + + *result = NULL; + XEN_CALL_("crashdump.get_record"); + + if (session->ok) + { + (*result)->handle = xen_strdup_((*result)->uuid); + } + + return session->ok; +} + + +bool +xen_crashdump_get_by_uuid(xen_session *session, xen_crashdump *result, char *uuid) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = uuid } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("crashdump.get_by_uuid"); + return session->ok; +} + + +bool +xen_crashdump_create(xen_session *session, xen_crashdump *result, xen_crashdump_record *record) +{ + abstract_value param_values[] = + { + { .type = &xen_crashdump_record_abstract_type_, + .u.struct_val = record } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("crashdump.create"); + return session->ok; +} + + +bool +xen_crashdump_destroy(xen_session *session, xen_crashdump crashdump) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = crashdump } + }; + + xen_call_(session, "crashdump.destroy", param_values, 1, NULL, NULL); + return session->ok; +} + + +bool +xen_crashdump_get_vm(xen_session *session, xen_vm *result, xen_crashdump crashdump) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = crashdump } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("crashdump.get_VM"); + return session->ok; +} + + +bool +xen_crashdump_get_vdi(xen_session *session, xen_vdi *result, xen_crashdump crashdump) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = crashdump } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("crashdump.get_VDI"); + return session->ok; +} + + +bool +xen_crashdump_get_all(xen_session *session, struct xen_crashdump_set **result) +{ + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + xen_call_(session, "crashdump.get_all", NULL, 0, &result_type, result); + return session->ok; +} + + +bool +xen_crashdump_get_uuid(xen_session *session, char **result, xen_crashdump crashdump) +{ + *result = session->ok ? xen_strdup_((char *)crashdump) : NULL; + return session->ok; +} diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/src/xen_host.c --- a/tools/libxen/src/xen_host.c Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/src/xen_host.c Tue Jan 30 12:43:40 2007 +0000 @@ -26,6 +26,7 @@ #include "xen_internal.h" #include "xen_pbd.h" #include "xen_pif.h" +#include "xen_sr.h" #include "xen_string_string_map.h" #include "xen_vm.h" @@ -65,6 +66,12 @@ static const struct_member xen_host_reco { .key = "PIFs", .type = &abstract_type_ref_set, .offset = offsetof(xen_host_record, pifs) }, + { .key = "suspend_image_sr", + .type = &abstract_type_ref, + .offset = offsetof(xen_host_record, suspend_image_sr) }, + { .key = "crash_dump_sr", + .type = &abstract_type_ref, + .offset = offsetof(xen_host_record, crash_dump_sr) }, { .key = "PBDs", .type = &abstract_type_ref_set, .offset = offsetof(xen_host_record, pbds) }, @@ -99,6 +106,8 @@ xen_host_record_free(xen_host_record *re xen_vm_record_opt_set_free(record->resident_vms); xen_string_string_map_free(record->logging); xen_pif_record_opt_set_free(record->pifs); + xen_sr_record_opt_free(record->suspend_image_sr); + xen_sr_record_opt_free(record->crash_dump_sr); xen_pbd_record_opt_set_free(record->pbds); xen_host_cpu_record_opt_set_free(record->host_cpus); free(record); @@ -313,6 +322,40 @@ xen_host_get_pifs(xen_session *session, bool +xen_host_get_suspend_image_sr(xen_session *session, xen_sr *result, xen_host host) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = host } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("host.get_suspend_image_sr"); + return session->ok; +} + + +bool +xen_host_get_crash_dump_sr(xen_session *session, xen_sr *result, xen_host host) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = host } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("host.get_crash_dump_sr"); + return session->ok; +} + + +bool xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host host) { abstract_value param_values[] = @@ -479,6 +522,38 @@ xen_host_remove_from_logging(xen_session bool +xen_host_set_suspend_image_sr(xen_session *session, xen_host host, xen_sr suspend_image_sr) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = host }, + { .type = &abstract_type_string, + .u.string_val = suspend_image_sr } + }; + + xen_call_(session, "host.set_suspend_image_sr", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool +xen_host_set_crash_dump_sr(xen_session *session, xen_host host, xen_sr crash_dump_sr) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = host }, + { .type = &abstract_type_string, + .u.string_val = crash_dump_sr } + }; + + xen_call_(session, "host.set_crash_dump_sr", param_values, 2, NULL, NULL); + return session->ok; +} + + +bool xen_host_disable(xen_session *session, xen_host host) { abstract_value param_values[] = diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/src/xen_vdi.c --- a/tools/libxen/src/xen_vdi.c Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/src/xen_vdi.c Tue Jan 30 12:43:40 2007 +0000 @@ -21,6 +21,7 @@ #include <stdlib.h> #include "xen_common.h" +#include "xen_crashdump.h" #include "xen_internal.h" #include "xen_sr.h" #include "xen_vbd.h" @@ -54,6 +55,9 @@ static const struct_member xen_vdi_recor { .key = "VBDs", .type = &abstract_type_ref_set, .offset = offsetof(xen_vdi_record, vbds) }, + { .key = "crash_dumps", + .type = &abstract_type_ref_set, + .offset = offsetof(xen_vdi_record, crash_dumps) }, { .key = "virtual_size", .type = &abstract_type_int, .offset = offsetof(xen_vdi_record, virtual_size) }, @@ -97,6 +101,7 @@ xen_vdi_record_free(xen_vdi_record *reco free(record->name_description); xen_sr_record_opt_free(record->sr); xen_vbd_record_opt_set_free(record->vbds); + xen_crashdump_record_opt_set_free(record->crash_dumps); free(record); } @@ -258,6 +263,23 @@ xen_vdi_get_vbds(xen_session *session, s bool +xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vdi } + }; + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + XEN_CALL_("VDI.get_crash_dumps"); + return session->ok; +} + + +bool xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi) { abstract_value param_values[] = @@ -315,9 +337,7 @@ xen_vdi_get_type(xen_session *session, e }; abstract_type result_type = xen_vdi_type_abstract_type_; - char *result_str = NULL; XEN_CALL_("VDI.get_type"); - *result = xen_vdi_type_from_string(session, result_str); return session->ok; } diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/src/xen_vdi_type.c --- a/tools/libxen/src/xen_vdi_type.c Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/src/xen_vdi_type.c Tue Jan 30 12:43:40 2007 +0000 @@ -30,7 +30,9 @@ static const char *lookup_table[] = { "system", "user", - "ephemeral" + "ephemeral", + "suspend", + "crashdump" }; diff -r f91dd7642a42 -r 69c5afd5ab08 tools/libxen/src/xen_vm.c --- a/tools/libxen/src/xen_vm.c Tue Jan 30 13:52:52 2007 +0000 +++ b/tools/libxen/src/xen_vm.c Tue Jan 30 12:43:40 2007 +0000 @@ -22,6 +22,7 @@ #include "xen_common.h" #include "xen_console.h" +#include "xen_crashdump.h" #include "xen_host.h" #include "xen_int_float_map.h" #include "xen_internal.h" @@ -29,6 +30,7 @@ #include "xen_on_normal_exit_internal.h" #include "xen_string_string_map.h" #include "xen_vbd.h" +#include "xen_vdi.h" #include "xen_vif.h" #include "xen_vm.h" #include "xen_vm_power_state_internal.h" @@ -67,6 +69,9 @@ static const struct_member xen_vm_record { .key = "auto_power_on", .type = &abstract_type_bool, .offset = offsetof(xen_vm_record, auto_power_on) }, + { .key = "suspend_VDI", + .type = &abstract_type_ref, + .offset = offsetof(xen_vm_record, suspend_vdi) }, { .key = "resident_on", .type = &abstract_type_ref, .offset = offsetof(xen_vm_record, resident_on) }, @@ -115,6 +120,9 @@ static const struct_member xen_vm_record { .key = "VBDs", .type = &abstract_type_ref_set, .offset = offsetof(xen_vm_record, vbds) }, + { .key = "crash_dumps", + .type = &abstract_type_ref_set, + .offset = offsetof(xen_vm_record, crash_dumps) }, { .key = "VTPMs", .type = &abstract_type_ref_set, .offset = offsetof(xen_vm_record, vtpms) }, @@ -183,6 +191,7 @@ xen_vm_record_free(xen_vm_record *record free(record->uuid); free(record->name_label); free(record->name_description); + xen_vdi_record_opt_free(record->suspend_vdi); xen_host_record_opt_free(record->resident_on); free(record->vcpus_policy); free(record->vcpus_params); @@ -190,6 +199,7 @@ xen_vm_record_free(xen_vm_record *record xen_console_record_opt_set_free(record->consoles); xen_vif_record_opt_set_free(record->vifs); xen_vbd_record_opt_set_free(record->vbds); + xen_crashdump_record_opt_set_free(record->crash_dumps); xen_vtpm_record_opt_set_free(record->vtpms); free(record->pv_bootloader); free(record->pv_kernel); @@ -391,6 +401,23 @@ xen_vm_get_auto_power_on(xen_session *se bool +xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm } + }; + + abstract_type result_type = abstract_type_string; + + *result = NULL; + XEN_CALL_("VM.get_suspend_VDI"); + return session->ok; +} + + +bool xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm) { abstract_value param_values[] = @@ -651,6 +678,23 @@ xen_vm_get_vbds(xen_session *session, st bool +xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm) +{ + abstract_value param_values[] = + { + { .type = &abstract_type_string, + .u.string_val = vm } + }; + + abstract_type result_type = abstract_type_string_set; + + *result = NULL; + XEN_CALL_("VM.get_crash_dumps"); + return session->ok; +} + + +bool xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm) { abstract_value param_values[] = _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |