ia64/xen-unstable

view tools/libxen/include/xen_sr.h @ 14045:7819d9332fba

Split the VBD I/O statistics out into a VBD_metrics class. Document the
VBD.type field, and add it to the C bindings (this was already in Xend).

Signed-off-by: Ewan Mellor <ewan@xensource.com>
author Ewan Mellor <ewan@xensource.com>
date Tue Feb 20 21:28:19 2007 +0000 (2007-02-20)
parents 049d9022653c
children e5931b5e6cc5
line source
1 /*
2 * Copyright (c) 2006, XenSource Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
19 #ifndef XEN_SR_H
20 #define XEN_SR_H
22 #include "xen_common.h"
23 #include "xen_pbd_decl.h"
24 #include "xen_sr_decl.h"
25 #include "xen_vdi_decl.h"
28 /*
29 * The SR class.
30 *
31 * A storage repository.
32 */
35 /**
36 * Free the given xen_sr. The given handle must have been allocated by
37 * this library.
38 */
39 extern void
40 xen_sr_free(xen_sr sr);
43 typedef struct xen_sr_set
44 {
45 size_t size;
46 xen_sr *contents[];
47 } xen_sr_set;
49 /**
50 * Allocate a xen_sr_set of the given size.
51 */
52 extern xen_sr_set *
53 xen_sr_set_alloc(size_t size);
55 /**
56 * Free the given xen_sr_set. The given set must have been allocated
57 * by this library.
58 */
59 extern void
60 xen_sr_set_free(xen_sr_set *set);
63 typedef struct xen_sr_record
64 {
65 xen_sr handle;
66 char *uuid;
67 char *name_label;
68 char *name_description;
69 struct xen_vdi_record_opt_set *vdis;
70 struct xen_pbd_record_opt_set *pbds;
71 int64_t virtual_allocation;
72 int64_t physical_utilisation;
73 int64_t physical_size;
74 char *type;
75 char *location;
76 } xen_sr_record;
78 /**
79 * Allocate a xen_sr_record.
80 */
81 extern xen_sr_record *
82 xen_sr_record_alloc(void);
84 /**
85 * Free the given xen_sr_record, and all referenced values. The given
86 * record must have been allocated by this library.
87 */
88 extern void
89 xen_sr_record_free(xen_sr_record *record);
92 typedef struct xen_sr_record_opt
93 {
94 bool is_record;
95 union
96 {
97 xen_sr handle;
98 xen_sr_record *record;
99 } u;
100 } xen_sr_record_opt;
102 /**
103 * Allocate a xen_sr_record_opt.
104 */
105 extern xen_sr_record_opt *
106 xen_sr_record_opt_alloc(void);
108 /**
109 * Free the given xen_sr_record_opt, and all referenced values. The
110 * given record_opt must have been allocated by this library.
111 */
112 extern void
113 xen_sr_record_opt_free(xen_sr_record_opt *record_opt);
116 typedef struct xen_sr_record_set
117 {
118 size_t size;
119 xen_sr_record *contents[];
120 } xen_sr_record_set;
122 /**
123 * Allocate a xen_sr_record_set of the given size.
124 */
125 extern xen_sr_record_set *
126 xen_sr_record_set_alloc(size_t size);
128 /**
129 * Free the given xen_sr_record_set, and all referenced values. The
130 * given set must have been allocated by this library.
131 */
132 extern void
133 xen_sr_record_set_free(xen_sr_record_set *set);
137 typedef struct xen_sr_record_opt_set
138 {
139 size_t size;
140 xen_sr_record_opt *contents[];
141 } xen_sr_record_opt_set;
143 /**
144 * Allocate a xen_sr_record_opt_set of the given size.
145 */
146 extern xen_sr_record_opt_set *
147 xen_sr_record_opt_set_alloc(size_t size);
149 /**
150 * Free the given xen_sr_record_opt_set, and all referenced values.
151 * The given set must have been allocated by this library.
152 */
153 extern void
154 xen_sr_record_opt_set_free(xen_sr_record_opt_set *set);
157 /**
158 * Get a record containing the current state of the given SR.
159 */
160 extern bool
161 xen_sr_get_record(xen_session *session, xen_sr_record **result, xen_sr sr);
164 /**
165 * Get a reference to the SR instance with the specified UUID.
166 */
167 extern bool
168 xen_sr_get_by_uuid(xen_session *session, xen_sr *result, char *uuid);
171 /**
172 * Create a new SR instance, and return its handle.
173 */
174 extern bool
175 xen_sr_create(xen_session *session, xen_sr *result, xen_sr_record *record);
178 /**
179 * Destroy the specified SR instance.
180 */
181 extern bool
182 xen_sr_destroy(xen_session *session, xen_sr sr);
185 /**
186 * Get all the SR instances with the given label.
187 */
188 extern bool
189 xen_sr_get_by_name_label(xen_session *session, struct xen_sr_set **result, char *label);
192 /**
193 * Get the uuid field of the given SR.
194 */
195 extern bool
196 xen_sr_get_uuid(xen_session *session, char **result, xen_sr sr);
199 /**
200 * Get the name/label field of the given SR.
201 */
202 extern bool
203 xen_sr_get_name_label(xen_session *session, char **result, xen_sr sr);
206 /**
207 * Get the name/description field of the given SR.
208 */
209 extern bool
210 xen_sr_get_name_description(xen_session *session, char **result, xen_sr sr);
213 /**
214 * Get the VDIs field of the given SR.
215 */
216 extern bool
217 xen_sr_get_vdis(xen_session *session, struct xen_vdi_set **result, xen_sr sr);
220 /**
221 * Get the PBDs field of the given SR.
222 */
223 extern bool
224 xen_sr_get_pbds(xen_session *session, struct xen_pbd_set **result, xen_sr sr);
227 /**
228 * Get the virtual_allocation field of the given SR.
229 */
230 extern bool
231 xen_sr_get_virtual_allocation(xen_session *session, int64_t *result, xen_sr sr);
234 /**
235 * Get the physical_utilisation field of the given SR.
236 */
237 extern bool
238 xen_sr_get_physical_utilisation(xen_session *session, int64_t *result, xen_sr sr);
241 /**
242 * Get the physical_size field of the given SR.
243 */
244 extern bool
245 xen_sr_get_physical_size(xen_session *session, int64_t *result, xen_sr sr);
248 /**
249 * Get the type field of the given SR.
250 */
251 extern bool
252 xen_sr_get_type(xen_session *session, char **result, xen_sr sr);
255 /**
256 * Get the location field of the given SR.
257 */
258 extern bool
259 xen_sr_get_location(xen_session *session, char **result, xen_sr sr);
262 /**
263 * Set the name/label field of the given SR.
264 */
265 extern bool
266 xen_sr_set_name_label(xen_session *session, xen_sr sr, char *label);
269 /**
270 * Set the name/description field of the given SR.
271 */
272 extern bool
273 xen_sr_set_name_description(xen_session *session, xen_sr sr, char *description);
276 /**
277 * Take an exact copy of the Storage Repository; the cloned storage
278 * repository has the same type as its parent
279 */
280 extern bool
281 xen_sr_clone(xen_session *session, xen_sr *result, xen_sr sr, char *loc, char *name);
284 /**
285 * Return a list of all the SRs known to the system.
286 */
287 extern bool
288 xen_sr_get_all(xen_session *session, struct xen_sr_set **result);
291 #endif