Added modelling and C bindings for the PBD class. PBDs are the analogue of
authorEwan Mellor <ewan@xensource.com>
Mon, 29 Jan 2007 13:17:53 +0000 (13:17 +0000)
committerEwan Mellor <ewan@xensource.com>
Mon, 29 Jan 2007 13:17:53 +0000 (13:17 +0000)
PIFs, indicating how an SR is attached to a host.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
docs/xen-api/xenapi-datamodel.tex
tools/libxen/include/xen_host.h
tools/libxen/include/xen_sr.h
tools/libxen/src/xen_host.c
tools/libxen/src/xen_sr.c

index 2b83c293b4c23734a7cdee5550e0726b90bc30a2..8e17ee03067ab50dced6ad05e9740755e809b03d 100644 (file)
@@ -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 in the following table:
 {\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 @@ $\mathit{RW}$ &  {\tt name/description} & string & a notes field containg human-
 $\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}
@@ -4644,6 +4648,38 @@ 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\_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
+}
+
+
 value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -7063,6 +7099,7 @@ $\mathit{RO}_\mathit{run}$ &  {\tt uuid} & string & unique identifier/object ref
 $\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) \\
@@ -7321,6 +7358,38 @@ Get the VDIs field of the given SR.
 }
 
 
+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
+}
+
+
 value of the field
 \vspace{0.3cm}
 \vspace{0.3cm}
@@ -9131,6 +9200,315 @@ VBD record
 }
 
 
+all fields from the object
+\vspace{0.3cm}
+\vspace{0.3cm}
+\vspace{0.3cm}
+
+\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}
index 5b1a4dca8a92ef67e6d603451b5c1a0275188106..41823abca89458d1190f6206092f9c6f44f19857 100644 (file)
 #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;
 
@@ -230,6 +232,13 @@ extern bool
 xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host host);
 
 
+/**
+ * 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.
  */
index eb8a420149e111e7b78085365863a0b57ffaf55a..e5e42998441eaab5c6da0b656635f78fa548c297 100644 (file)
 #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;
@@ -215,6 +217,13 @@ extern bool
 xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr);
 
 
+/**
+ * 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.
  */
index 931a0c44ce8aafbfe84edff88339f1866834ada1..f93dda0bc974ff7718bccd5014c48ff5ca8fdb7f 100644 (file)
@@ -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_record_struct_members[] =
         { .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 *record)
     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);
 }
@@ -265,6 +270,23 @@ xen_host_get_pifs(xen_session *session, struct xen_pif_set **result, xen_host ho
 }
 
 
+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)
 {
index 3c4ffb16deb6a3df18c5e4d8f8f2e10c806c7010..c3650f26a036ae8d00938a5e4e44d572e82b45d5 100644 (file)
@@ -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_struct_members[] =
         { .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);