% % Copyright (c) 2006-2007 XenSource, Inc. % % Permission is granted to copy, distribute and/or modify this document under % the terms of the GNU Free Documentation License, Version 1.2 or any later % version published by the Free Software Foundation; with no Invariant % Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the % license is included in the section entitled % "GNU Free Documentation License" or the file fdl.tex. % % Authors: Ewan Mellor, Richard Sharp, Dave Scott, Jon Harrop. % \chapter{API Reference} \label{api-reference} \section{Classes} The following classes are defined: \begin{center}\begin{tabular}{|lp{10cm}|} \hline Name & Description \\ \hline {\tt session} & A session \\ {\tt task} & A long-running asynchronous task \\ {\tt event} & Asynchronous event registration and handling \\ {\tt VM} & A virtual machine (or 'guest') \\ {\tt VM\_metrics} & The metrics associated with a VM \\ {\tt VM\_guest\_metrics} & The metrics reported by the guest (as opposed to inferred from outside) \\ {\tt host} & A physical host \\ {\tt host\_metrics} & The metrics associated with a host \\ {\tt host\_cpu} & A physical CPU \\ {\tt network} & A virtual network \\ {\tt VIF} & A virtual network interface \\ {\tt VIF\_metrics} & The metrics associated with a virtual network device \\ {\tt PIF} & A physical network interface (note separate VLANs are represented as several PIFs) \\ {\tt PIF\_metrics} & The metrics associated with a physical network interface \\ {\tt SR} & A storage repository \\ {\tt VDI} & A virtual disk image \\ {\tt VBD} & A virtual block device \\ {\tt VBD\_metrics} & The metrics associated with 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 \\ {\tt debug} & A basic class for testing \\ {\tt XSPolicy} & A class for handling Xen Security Policies \\ {\tt ACMPolicy} & A class for handling ACM-type policies \\ \hline \end{tabular}\end{center} \section{Relationships Between Classes} Fields that are bound together are shown in the following table: \begin{center}\begin{tabular}{|ll|l|} \hline {\em object.field} & {\em object.field} & {\em relationship} \\ \hline 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.host & host.PIFs & one-to-many\\ PIF.network & network.PIFs & one-to-many\\ SR.VDIs & VDI.SR & many-to-one\\ VTPM.VM & VM.VTPMs & one-to-many\\ console.VM & VM.consoles & one-to-many\\ host.resident\_VMs & VM.resident\_on & many-to-one\\ host.host\_CPUs & host\_cpu.host & many-to-one\\ \hline \end{tabular}\end{center} The following represents bound fields (as specified above) diagramatically, using crows-foot notation to specify one-to-one, one-to-many or many-to-many relationships: \begin{center}\resizebox{0.8\textwidth}{!}{ \includegraphics{xenapi-datamodel-graph} }\end{center} \ \subsection{List of bound fields} \section{Types} \subsection{Primitives} The following primitive types are used to specify methods and fields in the API Reference: \begin{center}\begin{tabular}{|ll|} \hline Type & Description \\ \hline String & text strings \\ Int & 64-bit integers \\ Float & IEEE double-precision floating-point numbers \\ Bool & boolean \\ DateTime & date and timestamp \\ Ref (object name) & reference to an object of class name \\ \hline \end{tabular}\end{center} \subsection{Higher order types} The following type constructors are used: \begin{center}\begin{tabular}{|ll|} \hline Type & Description \\ \hline List (t) & an arbitrary-length list of elements of type t \\ Map (a $\rightarrow$ b) & a table mapping values of type a to values of type b \\ \hline \end{tabular}\end{center} \subsection{Enumeration types} The following enumeration types are used: \begin{longtable}{|ll|} \hline {\tt enum event\_operation} & \\ \hline \hspace{0.5cm}{\tt add} & An object has been created \\ \hspace{0.5cm}{\tt del} & An object has been deleted \\ \hspace{0.5cm}{\tt mod} & An object has been modified \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum console\_protocol} & \\ \hline \hspace{0.5cm}{\tt vt100} & VT100 terminal \\ \hspace{0.5cm}{\tt rfb} & Remote FrameBuffer protocol (as used in VNC) \\ \hspace{0.5cm}{\tt rdp} & Remote Desktop Protocol \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum vdi\_type} & \\ \hline \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} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum vm\_power\_state} & \\ \hline \hspace{0.5cm}{\tt Halted} & Halted \\ \hspace{0.5cm}{\tt Paused} & Paused \\ \hspace{0.5cm}{\tt Running} & Running \\ \hspace{0.5cm}{\tt Suspended} & Suspended \\ \hspace{0.5cm}{\tt Unknown} & Some other unknown state \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum task\_allowed\_operations} & \\ \hline \hspace{0.5cm}{\tt Cancel} & Cancel \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum task\_status\_type} & \\ \hline \hspace{0.5cm}{\tt pending} & task is in progress \\ \hspace{0.5cm}{\tt success} & task was completed successfully \\ \hspace{0.5cm}{\tt failure} & task has failed \\ \hspace{0.5cm}{\tt cancelling} & task is being cancelled \\ \hspace{0.5cm}{\tt cancelled} & task has been cancelled \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum on\_normal\_exit} & \\ \hline \hspace{0.5cm}{\tt destroy} & destroy the VM state \\ \hspace{0.5cm}{\tt restart} & restart the VM \\ \hline \end{longtable} \vspace{1cm} \begin{longtable}{|ll|} \hline {\tt enum on\_crash\_behaviour} & \\ \hline \hspace{0.5cm}{\tt destroy} & destroy the VM state \\ \hspace{0.5cm}{\tt coredump\_and\_destroy} & record a coredump and then destroy the VM state \\ \hspace{0.5cm}{\tt restart} & restart the VM \\ \hspace{0.5cm}{\tt coredump\_and\_restart} & record a co
#ifndef __LINUX_GEN_STATS_H
#define __LINUX_GEN_STATS_H
#include <linux/types.h>
enum {
TCA_STATS_UNSPEC,
TCA_STATS_BASIC,
TCA_STATS_RATE_EST,
TCA_STATS_QUEUE,
TCA_STATS_APP,
__TCA_STATS_MAX,
};
#define TCA_STATS_MAX (__TCA_STATS_MAX - 1)
/**
* struct gnet_stats_basic - byte/packet throughput statistics
* @bytes: number of seen bytes
* @packets: number of seen packets
*/
struct gnet_stats_basic
{
__u64 bytes;
__u32 packets;
};
/**
* struct gnet_stats_rate_est - rate estimator
* @bps: current byte rate
* @pps: current packet rate
*/
struct gnet_stats_rate_est
{
__u32 bps;
__u32 pps;
};
/**
* struct gnet_stats_queue - queuing statistics
* @qlen: queue length
* @backlog: backlog size of queue
* @drops: number of dropped packets
* @requeues: number of requeues
* @overlimits: number of enqueues over the limit
*/
struct gnet_stats_queue
{
__u32 qlen;
__u32 backlog;
__u32 drops;
__u32 requeues;
__u32 overlimits;
};
/**
* struct gnet_estimator - rate estimator configuration
* @interval: sampling period
* @ewma_log: the log of measurement window weight
*/
struct gnet_estimator
{
signed char interval;
unsigned char ewma_log;
};
#endif /* __LINUX_GEN_STATS_H */