# HG changeset patch
# User Ewan Mellor <ewan@xxxxxxxxxxxxx>
# Date 1170076673 0
# Node ID 049d9022653c9668f93bc8071d0abd8ddff19ea0
# Parent 7d64bdc7a300c19f6232290f10dfd4bdbaacfb70
Added modelling and C bindings for the PBD class. PBDs are the analogue of
PIFs, indicating how an SR is attached to a host.
Signed-off-by: Ewan Mellor <ewan@xxxxxxxxxxxxx>
---
docs/xen-api/xenapi-datamodel.tex | 378 ++++++++++++++++++++++++++++++++++++++
tools/libxen/include/xen_host.h | 13 +
tools/libxen/include/xen_sr.h | 13 +
tools/libxen/src/xen_host.c | 22 ++
tools/libxen/src/xen_sr.c | 5
5 files changed, 427 insertions(+), 4 deletions(-)
diff -r 7d64bdc7a300 -r 049d9022653c docs/xen-api/xenapi-datamodel.tex
--- a/docs/xen-api/xenapi-datamodel.tex Mon Jan 29 13:16:00 2007 +0000
+++ b/docs/xen-api/xenapi-datamodel.tex Mon Jan 29 13:17:53 2007 +0000
@@ -33,6 +33,7 @@ Name & Description \\
{\tt SR} & A storage repository \\
{\tt VDI} & A virtual disk image \\
{\tt VBD} & A virtual block device \\
+{\tt PBD} & The physical block devices through which hosts access SRs \\
{\tt VTPM} & A virtual TPM device \\
{\tt console} & A console \\
{\tt user} & A user of the system \\
@@ -46,6 +47,8 @@ Fields that are bound together are shown
{\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\\
VBD.VM & VM.VBDs & one-to-many\\
VIF.VM & VM.VIFs & one-to-many\\
@@ -4232,6 +4235,7 @@ Quals & Field & Type & Description \\
$\mathit{RO}_\mathit{run}$ & {\tt software\_version} & (string $\rightarrow$
string) Map & version strings \\
$\mathit{RO}_\mathit{run}$ & {\tt resident\_VMs} & (VM ref) Set & list of VMs
currently resident on host \\
$\mathit{RO}_\mathit{run}$ & {\tt PIFs} & (PIF ref) Set & physical network
interfaces \\
+$\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
\end{longtable}
@@ -4641,6 +4645,38 @@ Get the PIFs field of the given host.
\noindent {\bf Return Type:}
{\tt
(PIF ref) Set
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PBDs}
+
+{\bf Overview:}
+Get the PBDs field of the given host.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((PBD ref) Set) get_PBDs (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
+(PBD ref) Set
}
@@ -7063,6 +7099,7 @@ Quals & Field & Type & Description \\
$\mathit{RW}$ & {\tt name/label} & string & a human-readable name \\
$\mathit{RW}$ & {\tt name/description} & string & a notes field containg
human-readable description \\
$\mathit{RO}_\mathit{run}$ & {\tt VDIs} & (VDI ref) Set & managed virtual
disks \\
+$\mathit{RO}_\mathit{run}$ & {\tt PBDs} & (PBD ref) Set & physical
blockdevices \\
$\mathit{RO}_\mathit{run}$ & {\tt virtual\_allocation} & int & sum of
virtual\_sizes of all VDIs in this storage repository (in bytes) \\
$\mathit{RO}_\mathit{run}$ & {\tt physical\_utilisation} & int & physical
space currently utilised on this storage repository (in bytes). Note that for
sparse disk formats, physical\_utilisation may be less than virtual\_allocation
\\
$\mathit{RO}_\mathit{ins}$ & {\tt physical\_size} & int & total physical size
of the repository (in bytes) \\
@@ -7318,6 +7355,38 @@ Get the VDIs field of the given SR.
\noindent {\bf Return Type:}
{\tt
(VDI ref) Set
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_PBDs}
+
+{\bf Overview:}
+Get the PBDs field of the given SR.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((PBD ref) Set) get_PBDs (session_id s, SR 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 SR ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(PBD ref) Set
}
@@ -9138,6 +9207,315 @@ all fields from the object
\vspace{1cm}
\newpage
+\section{Class: PBD}
+\subsection{Fields for class: PBD}
+\begin{longtable}{|lllp{0.38\textwidth}|}
+\hline
+\multicolumn{1}{|l}{Name} & \multicolumn{3}{l|}{\bf PBD} \\
+\multicolumn{1}{|l}{Description} & \multicolumn{3}{l|}{\parbox{11cm}{\em
+The physical block devices through which hosts access SRs.}} \\
+\hline
+Quals & Field & Type & Description \\
+\hline
+$\mathit{RO}_\mathit{run}$ & {\tt uuid} & string & unique identifier/object
reference \\
+$\mathit{RO}_\mathit{ins}$ & {\tt host} & host ref & physical machine on
which the pbd is available \\
+$\mathit{RO}_\mathit{ins}$ & {\tt SR} & SR ref & the storage repository that
the pbd realises \\
+$\mathit{RO}_\mathit{ins}$ & {\tt device\_config} & (string $\rightarrow$
string) Map & a config string that is provided to the host's SR-backend-driver
\\
+$\mathit{RO}_\mathit{run}$ & {\tt currently\_attached} & bool & is the SR
currently attached on this host? \\
+\hline
+\end{longtable}
+\subsection{Additional RPCs associated with class: PBD}
+\subsubsection{RPC name:~get\_uuid}
+
+{\bf Overview:}
+Get the uuid field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} string get_uuid (session_id s, PBD 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 PBD 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\_host}
+
+{\bf Overview:}
+Get the host field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (host ref) get_host (session_id s, PBD 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 PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+host ref
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_SR}
+
+{\bf Overview:}
+Get the SR field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (SR ref) get_SR (session_id s, PBD 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 PBD 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:~get\_device\_config}
+
+{\bf Overview:}
+Get the device\_config field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} ((string -> string) Map) get_device_config (session_id s, PBD
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 PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+(string $\rightarrow$ string) Map
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~get\_currently\_attached}
+
+{\bf Overview:}
+Get the currently\_attached field of the given PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} bool get_currently_attached (session_id s, PBD 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 PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+bool
+}
+
+
+value of the field
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+\subsubsection{RPC name:~create}
+
+{\bf Overview:}
+Create a new PBD instance, and return its handle.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (PBD ref) create (session_id s, PBD 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 PBD record } & args & All constructor arguments \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+PBD 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 PBD instance.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} void destroy (session_id s, PBD 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 PBD 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 PBD instance with the specified UUID.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (PBD 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
+PBD 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 PBD.
+
+ \noindent {\bf Signature:}
+\begin{verbatim} (PBD record) get_record (session_id s, PBD 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 PBD ref } & self & reference to the object \\ \hline
+
+\end{tabular}
+
+\vspace{0.3cm}
+
+ \noindent {\bf Return Type:}
+{\tt
+PBD 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}|}
diff -r 7d64bdc7a300 -r 049d9022653c tools/libxen/include/xen_host.h
--- a/tools/libxen/include/xen_host.h Mon Jan 29 13:16:00 2007 +0000
+++ b/tools/libxen/include/xen_host.h Mon Jan 29 13:17:53 2007 +0000
@@ -22,14 +22,15 @@
#include "xen_common.h"
#include "xen_host_cpu_decl.h"
#include "xen_host_decl.h"
+#include "xen_pbd_decl.h"
#include "xen_pif_decl.h"
#include "xen_string_string_map.h"
#include "xen_vm_decl.h"
/*
- * The host class.
- *
+ * The host class.
+ *
* A physical host.
*/
@@ -71,6 +72,7 @@ typedef struct xen_host_record
xen_string_string_map *software_version;
struct xen_vm_record_opt_set *resident_vms;
struct xen_pif_record_opt_set *pifs;
+ struct xen_pbd_record_opt_set *pbds;
struct xen_host_cpu_record_opt_set *host_cpus;
} xen_host_record;
@@ -231,6 +233,13 @@ xen_host_get_pifs(xen_session *session,
/**
+ * Get the PBDs field of the given host.
+ */
+extern bool
+xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host
host);
+
+
+/**
* Get the host_CPUs field of the given host.
*/
extern bool
diff -r 7d64bdc7a300 -r 049d9022653c tools/libxen/include/xen_sr.h
--- a/tools/libxen/include/xen_sr.h Mon Jan 29 13:16:00 2007 +0000
+++ b/tools/libxen/include/xen_sr.h Mon Jan 29 13:17:53 2007 +0000
@@ -20,13 +20,14 @@
#define XEN_SR_H
#include "xen_common.h"
+#include "xen_pbd_decl.h"
#include "xen_sr_decl.h"
#include "xen_vdi_decl.h"
/*
- * The SR class.
- *
+ * The SR class.
+ *
* A storage repository.
*/
@@ -66,6 +67,7 @@ typedef struct xen_sr_record
char *name_label;
char *name_description;
struct xen_vdi_record_opt_set *vdis;
+ struct xen_pbd_record_opt_set *pbds;
int64_t virtual_allocation;
int64_t physical_utilisation;
int64_t physical_size;
@@ -216,6 +218,13 @@ xen_sr_get_vdis(xen_session *session, st
/**
+ * Get the PBDs field of the given SR.
+ */
+extern bool
+xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr);
+
+
+/**
* Get the virtual_allocation field of the given SR.
*/
extern bool
diff -r 7d64bdc7a300 -r 049d9022653c tools/libxen/src/xen_host.c
--- a/tools/libxen/src/xen_host.c Mon Jan 29 13:16:00 2007 +0000
+++ b/tools/libxen/src/xen_host.c Mon Jan 29 13:17:53 2007 +0000
@@ -24,6 +24,7 @@
#include "xen_host.h"
#include "xen_host_cpu.h"
#include "xen_internal.h"
+#include "xen_pbd.h"
#include "xen_pif.h"
#include "xen_string_string_map.h"
#include "xen_vm.h"
@@ -58,6 +59,9 @@ static const struct_member xen_host_reco
{ .key = "PIFs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_host_record, pifs) },
+ { .key = "PBDs",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_host_record, pbds) },
{ .key = "host_CPUs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_host_record, host_cpus) }
@@ -87,6 +91,7 @@ xen_host_record_free(xen_host_record *re
xen_string_string_map_free(record->software_version);
xen_vm_record_opt_set_free(record->resident_vms);
xen_pif_record_opt_set_free(record->pifs);
+ xen_pbd_record_opt_set_free(record->pbds);
xen_host_cpu_record_opt_set_free(record->host_cpus);
free(record);
}
@@ -266,6 +271,23 @@ xen_host_get_pifs(xen_session *session,
bool
+xen_host_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_host
host)
+{
+ abstract_value param_values[] =
+ {
+ { .type = &abstract_type_string,
+ .u.string_val = host }
+ };
+
+ abstract_type result_type = abstract_type_string_set;
+
+ *result = NULL;
+ XEN_CALL_("host.get_PBDs");
+ return session->ok;
+}
+
+
+bool
xen_host_get_host_cpus(xen_session *session, struct xen_host_cpu_set **result,
xen_host host)
{
abstract_value param_values[] =
diff -r 7d64bdc7a300 -r 049d9022653c tools/libxen/src/xen_sr.c
--- a/tools/libxen/src/xen_sr.c Mon Jan 29 13:16:00 2007 +0000
+++ b/tools/libxen/src/xen_sr.c Mon Jan 29 13:17:53 2007 +0000
@@ -22,6 +22,7 @@
#include "xen_common.h"
#include "xen_internal.h"
+#include "xen_pbd.h"
#include "xen_sr.h"
#include "xen_vdi.h"
@@ -49,6 +50,9 @@ static const struct_member xen_sr_record
{ .key = "VDIs",
.type = &abstract_type_ref_set,
.offset = offsetof(xen_sr_record, vdis) },
+ { .key = "PBDs",
+ .type = &abstract_type_ref_set,
+ .offset = offsetof(xen_sr_record, pbds) },
{ .key = "virtual_allocation",
.type = &abstract_type_int,
.offset = offsetof(xen_sr_record, virtual_allocation) },
@@ -88,6 +92,7 @@ xen_sr_record_free(xen_sr_record *record
free(record->name_label);
free(record->name_description);
xen_vdi_record_opt_set_free(record->vdis);
+ xen_pbd_record_opt_set_free(record->pbds);
free(record->type);
free(record->location);
free(record);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|