1 | /* |
---|
2 | * Copyright (c) 2006-2007, 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 | */ |
---|
18 | |
---|
19 | |
---|
20 | #include <stddef.h> |
---|
21 | #include <stdlib.h> |
---|
22 | |
---|
23 | #include "xen_internal.h" |
---|
24 | #include "xen_vbd_mode_internal.h" |
---|
25 | #include "xen_vbd_type_internal.h" |
---|
26 | #include <xen/api/xen_common.h> |
---|
27 | #include <xen/api/xen_string_string_map.h> |
---|
28 | #include <xen/api/xen_vbd.h> |
---|
29 | #include <xen/api/xen_vbd_metrics.h> |
---|
30 | #include <xen/api/xen_vdi.h> |
---|
31 | #include <xen/api/xen_vm.h> |
---|
32 | |
---|
33 | |
---|
34 | XEN_FREE(xen_vbd) |
---|
35 | XEN_SET_ALLOC_FREE(xen_vbd) |
---|
36 | XEN_ALLOC(xen_vbd_record) |
---|
37 | XEN_SET_ALLOC_FREE(xen_vbd_record) |
---|
38 | XEN_ALLOC(xen_vbd_record_opt) |
---|
39 | XEN_RECORD_OPT_FREE(xen_vbd) |
---|
40 | XEN_SET_ALLOC_FREE(xen_vbd_record_opt) |
---|
41 | |
---|
42 | |
---|
43 | static const struct_member xen_vbd_record_struct_members[] = |
---|
44 | { |
---|
45 | { .key = "uuid", |
---|
46 | .type = &abstract_type_string, |
---|
47 | .offset = offsetof(xen_vbd_record, uuid) }, |
---|
48 | { .key = "VM", |
---|
49 | .type = &abstract_type_ref, |
---|
50 | .offset = offsetof(xen_vbd_record, vm) }, |
---|
51 | { .key = "VDI", |
---|
52 | .type = &abstract_type_ref, |
---|
53 | .offset = offsetof(xen_vbd_record, vdi) }, |
---|
54 | { .key = "device", |
---|
55 | .type = &abstract_type_string, |
---|
56 | .offset = offsetof(xen_vbd_record, device) }, |
---|
57 | { .key = "bootable", |
---|
58 | .type = &abstract_type_bool, |
---|
59 | .offset = offsetof(xen_vbd_record, bootable) }, |
---|
60 | { .key = "mode", |
---|
61 | .type = &xen_vbd_mode_abstract_type_, |
---|
62 | .offset = offsetof(xen_vbd_record, mode) }, |
---|
63 | { .key = "type", |
---|
64 | .type = &xen_vbd_type_abstract_type_, |
---|
65 | .offset = offsetof(xen_vbd_record, type) }, |
---|
66 | { .key = "currently_attached", |
---|
67 | .type = &abstract_type_bool, |
---|
68 | .offset = offsetof(xen_vbd_record, currently_attached) }, |
---|
69 | { .key = "status_code", |
---|
70 | .type = &abstract_type_int, |
---|
71 | .offset = offsetof(xen_vbd_record, status_code) }, |
---|
72 | { .key = "status_detail", |
---|
73 | .type = &abstract_type_string, |
---|
74 | .offset = offsetof(xen_vbd_record, status_detail) }, |
---|
75 | { .key = "runtime_properties", |
---|
76 | .type = &abstract_type_string_string_map, |
---|
77 | .offset = offsetof(xen_vbd_record, runtime_properties) }, |
---|
78 | { .key = "qos_algorithm_type", |
---|
79 | .type = &abstract_type_string, |
---|
80 | .offset = offsetof(xen_vbd_record, qos_algorithm_type) }, |
---|
81 | { .key = "qos_algorithm_params", |
---|
82 | .type = &abstract_type_string_string_map, |
---|
83 | .offset = offsetof(xen_vbd_record, qos_algorithm_params) }, |
---|
84 | { .key = "qos_supported_algorithms", |
---|
85 | .type = &abstract_type_string_set, |
---|
86 | .offset = offsetof(xen_vbd_record, qos_supported_algorithms) }, |
---|
87 | { .key = "metrics", |
---|
88 | .type = &abstract_type_ref, |
---|
89 | .offset = offsetof(xen_vbd_record, metrics) } |
---|
90 | }; |
---|
91 | |
---|
92 | const abstract_type xen_vbd_record_abstract_type_ = |
---|
93 | { |
---|
94 | .typename = STRUCT, |
---|
95 | .struct_size = sizeof(xen_vbd_record), |
---|
96 | .member_count = |
---|
97 | sizeof(xen_vbd_record_struct_members) / sizeof(struct_member), |
---|
98 | .members = xen_vbd_record_struct_members |
---|
99 | }; |
---|
100 | |
---|
101 | |
---|
102 | void |
---|
103 | xen_vbd_record_free(xen_vbd_record *record) |
---|
104 | { |
---|
105 | if (record == NULL) |
---|
106 | { |
---|
107 | return; |
---|
108 | } |
---|
109 | free(record->handle); |
---|
110 | free(record->uuid); |
---|
111 | xen_vm_record_opt_free(record->vm); |
---|
112 | xen_vdi_record_opt_free(record->vdi); |
---|
113 | free(record->device); |
---|
114 | free(record->status_detail); |
---|
115 | xen_string_string_map_free(record->runtime_properties); |
---|
116 | free(record->qos_algorithm_type); |
---|
117 | xen_string_string_map_free(record->qos_algorithm_params); |
---|
118 | xen_string_set_free(record->qos_supported_algorithms); |
---|
119 | xen_vbd_metrics_record_opt_free(record->metrics); |
---|
120 | free(record); |
---|
121 | } |
---|
122 | |
---|
123 | |
---|
124 | bool |
---|
125 | xen_vbd_get_record(xen_session *session, xen_vbd_record **result, xen_vbd vbd) |
---|
126 | { |
---|
127 | abstract_value param_values[] = |
---|
128 | { |
---|
129 | { .type = &abstract_type_string, |
---|
130 | .u.string_val = vbd } |
---|
131 | }; |
---|
132 | |
---|
133 | abstract_type result_type = xen_vbd_record_abstract_type_; |
---|
134 | |
---|
135 | *result = NULL; |
---|
136 | XEN_CALL_("VBD.get_record"); |
---|
137 | |
---|
138 | if (session->ok) |
---|
139 | { |
---|
140 | (*result)->handle = xen_strdup_((*result)->uuid); |
---|
141 | } |
---|
142 | |
---|
143 | return session->ok; |
---|
144 | } |
---|
145 | |
---|
146 | |
---|
147 | bool |
---|
148 | xen_vbd_get_by_uuid(xen_session *session, xen_vbd *result, char *uuid) |
---|
149 | { |
---|
150 | abstract_value param_values[] = |
---|
151 | { |
---|
152 | { .type = &abstract_type_string, |
---|
153 | .u.string_val = uuid } |
---|
154 | }; |
---|
155 | |
---|
156 | abstract_type result_type = abstract_type_string; |
---|
157 | |
---|
158 | *result = NULL; |
---|
159 | XEN_CALL_("VBD.get_by_uuid"); |
---|
160 | return session->ok; |
---|
161 | } |
---|
162 | |
---|
163 | |
---|
164 | bool |
---|
165 | xen_vbd_create(xen_session *session, xen_vbd *result, xen_vbd_record *record) |
---|
166 | { |
---|
167 | abstract_value param_values[] = |
---|
168 | { |
---|
169 | { .type = &xen_vbd_record_abstract_type_, |
---|
170 | .u.struct_val = record } |
---|
171 | }; |
---|
172 | |
---|
173 | abstract_type result_type = abstract_type_string; |
---|
174 | |
---|
175 | *result = NULL; |
---|
176 | XEN_CALL_("VBD.create"); |
---|
177 | return session->ok; |
---|
178 | } |
---|
179 | |
---|
180 | |
---|
181 | bool |
---|
182 | xen_vbd_destroy(xen_session *session, xen_vbd vbd) |
---|
183 | { |
---|
184 | abstract_value param_values[] = |
---|
185 | { |
---|
186 | { .type = &abstract_type_string, |
---|
187 | .u.string_val = vbd } |
---|
188 | }; |
---|
189 | |
---|
190 | xen_call_(session, "VBD.destroy", param_values, 1, NULL, NULL); |
---|
191 | return session->ok; |
---|
192 | } |
---|
193 | |
---|
194 | |
---|
195 | bool |
---|
196 | xen_vbd_get_vm(xen_session *session, xen_vm *result, xen_vbd vbd) |
---|
197 | { |
---|
198 | abstract_value param_values[] = |
---|
199 | { |
---|
200 | { .type = &abstract_type_string, |
---|
201 | .u.string_val = vbd } |
---|
202 | }; |
---|
203 | |
---|
204 | abstract_type result_type = abstract_type_string; |
---|
205 | |
---|
206 | *result = NULL; |
---|
207 | XEN_CALL_("VBD.get_VM"); |
---|
208 | return session->ok; |
---|
209 | } |
---|
210 | |
---|
211 | |
---|
212 | bool |
---|
213 | xen_vbd_get_vdi(xen_session *session, xen_vdi *result, xen_vbd vbd) |
---|
214 | { |
---|
215 | abstract_value param_values[] = |
---|
216 | { |
---|
217 | { .type = &abstract_type_string, |
---|
218 | .u.string_val = vbd } |
---|
219 | }; |
---|
220 | |
---|
221 | abstract_type result_type = abstract_type_string; |
---|
222 | |
---|
223 | *result = NULL; |
---|
224 | XEN_CALL_("VBD.get_VDI"); |
---|
225 | return session->ok; |
---|
226 | } |
---|
227 | |
---|
228 | |
---|
229 | bool |
---|
230 | xen_vbd_get_device(xen_session *session, char **result, xen_vbd vbd) |
---|
231 | { |
---|
232 | abstract_value param_values[] = |
---|
233 | { |
---|
234 | { .type = &abstract_type_string, |
---|
235 | .u.string_val = vbd } |
---|
236 | }; |
---|
237 | |
---|
238 | abstract_type result_type = abstract_type_string; |
---|
239 | |
---|
240 | *result = NULL; |
---|
241 | XEN_CALL_("VBD.get_device"); |
---|
242 | return session->ok; |
---|
243 | } |
---|
244 | |
---|
245 | |
---|
246 | bool |
---|
247 | xen_vbd_get_bootable(xen_session *session, bool *result, xen_vbd vbd) |
---|
248 | { |
---|
249 | abstract_value param_values[] = |
---|
250 | { |
---|
251 | { .type = &abstract_type_string, |
---|
252 | .u.string_val = vbd } |
---|
253 | }; |
---|
254 | |
---|
255 | abstract_type result_type = abstract_type_bool; |
---|
256 | |
---|
257 | XEN_CALL_("VBD.get_bootable"); |
---|
258 | return session->ok; |
---|
259 | } |
---|
260 | |
---|
261 | |
---|
262 | bool |
---|
263 | xen_vbd_get_mode(xen_session *session, enum xen_vbd_mode *result, xen_vbd vbd) |
---|
264 | { |
---|
265 | abstract_value param_values[] = |
---|
266 | { |
---|
267 | { .type = &abstract_type_string, |
---|
268 | .u.string_val = vbd } |
---|
269 | }; |
---|
270 | |
---|
271 | abstract_type result_type = xen_vbd_mode_abstract_type_; |
---|
272 | XEN_CALL_("VBD.get_mode"); |
---|
273 | return session->ok; |
---|
274 | } |
---|
275 | |
---|
276 | |
---|
277 | bool |
---|
278 | xen_vbd_get_type(xen_session *session, enum xen_vbd_type *result, xen_vbd vbd) |
---|
279 | { |
---|
280 | abstract_value param_values[] = |
---|
281 | { |
---|
282 | { .type = &abstract_type_string, |
---|
283 | .u.string_val = vbd } |
---|
284 | }; |
---|
285 | |
---|
286 | abstract_type result_type = xen_vbd_type_abstract_type_; |
---|
287 | XEN_CALL_("VBD.get_type"); |
---|
288 | return session->ok; |
---|
289 | } |
---|
290 | |
---|
291 | |
---|
292 | bool |
---|
293 | xen_vbd_get_currently_attached(xen_session *session, bool *result, xen_vbd vbd) |
---|
294 | { |
---|
295 | abstract_value param_values[] = |
---|
296 | { |
---|
297 | { .type = &abstract_type_string, |
---|
298 | .u.string_val = vbd } |
---|
299 | }; |
---|
300 | |
---|
301 | abstract_type result_type = abstract_type_bool; |
---|
302 | |
---|
303 | XEN_CALL_("VBD.get_currently_attached"); |
---|
304 | return session->ok; |
---|
305 | } |
---|
306 | |
---|
307 | |
---|
308 | bool |
---|
309 | xen_vbd_get_status_code(xen_session *session, int64_t *result, xen_vbd vbd) |
---|
310 | { |
---|
311 | abstract_value param_values[] = |
---|
312 | { |
---|
313 | { .type = &abstract_type_string, |
---|
314 | .u.string_val = vbd } |
---|
315 | }; |
---|
316 | |
---|
317 | abstract_type result_type = abstract_type_int; |
---|
318 | |
---|
319 | XEN_CALL_("VBD.get_status_code"); |
---|
320 | return session->ok; |
---|
321 | } |
---|
322 | |
---|
323 | |
---|
324 | bool |
---|
325 | xen_vbd_get_status_detail(xen_session *session, char **result, xen_vbd vbd) |
---|
326 | { |
---|
327 | abstract_value param_values[] = |
---|
328 | { |
---|
329 | { .type = &abstract_type_string, |
---|
330 | .u.string_val = vbd } |
---|
331 | }; |
---|
332 | |
---|
333 | abstract_type result_type = abstract_type_string; |
---|
334 | |
---|
335 | *result = NULL; |
---|
336 | XEN_CALL_("VBD.get_status_detail"); |
---|
337 | return session->ok; |
---|
338 | } |
---|
339 | |
---|
340 | |
---|
341 | bool |
---|
342 | xen_vbd_get_runtime_properties(xen_session *session, xen_string_string_map **result, xen_vbd vbd) |
---|
343 | { |
---|
344 | abstract_value param_values[] = |
---|
345 | { |
---|
346 | { .type = &abstract_type_string, |
---|
347 | .u.string_val = vbd } |
---|
348 | }; |
---|
349 | |
---|
350 | abstract_type result_type = abstract_type_string_string_map; |
---|
351 | |
---|
352 | *result = NULL; |
---|
353 | XEN_CALL_("VBD.get_runtime_properties"); |
---|
354 | return session->ok; |
---|
355 | } |
---|
356 | |
---|
357 | |
---|
358 | bool |
---|
359 | xen_vbd_get_qos_algorithm_type(xen_session *session, char **result, xen_vbd vbd) |
---|
360 | { |
---|
361 | abstract_value param_values[] = |
---|
362 | { |
---|
363 | { .type = &abstract_type_string, |
---|
364 | .u.string_val = vbd } |
---|
365 | }; |
---|
366 | |
---|
367 | abstract_type result_type = abstract_type_string; |
---|
368 | |
---|
369 | *result = NULL; |
---|
370 | XEN_CALL_("VBD.get_qos_algorithm_type"); |
---|
371 | return session->ok; |
---|
372 | } |
---|
373 | |
---|
374 | |
---|
375 | bool |
---|
376 | xen_vbd_get_qos_algorithm_params(xen_session *session, xen_string_string_map **result, xen_vbd vbd) |
---|
377 | { |
---|
378 | abstract_value param_values[] = |
---|
379 | { |
---|
380 | { .type = &abstract_type_string, |
---|
381 | .u.string_val = vbd } |
---|
382 | }; |
---|
383 | |
---|
384 | abstract_type result_type = abstract_type_string_string_map; |
---|
385 | |
---|
386 | *result = NULL; |
---|
387 | XEN_CALL_("VBD.get_qos_algorithm_params"); |
---|
388 | return session->ok; |
---|
389 | } |
---|
390 | |
---|
391 | |
---|
392 | bool |
---|
393 | xen_vbd_get_qos_supported_algorithms(xen_session *session, struct xen_string_set **result, xen_vbd vbd) |
---|
394 | { |
---|
395 | abstract_value param_values[] = |
---|
396 | { |
---|
397 | { .type = &abstract_type_string, |
---|
398 | .u.string_val = vbd } |
---|
399 | }; |
---|
400 | |
---|
401 | abstract_type result_type = abstract_type_string_set; |
---|
402 | |
---|
403 | *result = NULL; |
---|
404 | XEN_CALL_("VBD.get_qos_supported_algorithms"); |
---|
405 | return session->ok; |
---|
406 | } |
---|
407 | |
---|
408 | |
---|
409 | bool |
---|
410 | xen_vbd_get_metrics(xen_session *session, xen_vbd_metrics *result, xen_vbd vbd) |
---|
411 | { |
---|
412 | abstract_value param_values[] = |
---|
413 | { |
---|
414 | { .type = &abstract_type_string, |
---|
415 | .u.string_val = vbd } |
---|
416 | }; |
---|
417 | |
---|
418 | abstract_type result_type = abstract_type_string; |
---|
419 | |
---|
420 | *result = NULL; |
---|
421 | XEN_CALL_("VBD.get_metrics"); |
---|
422 | return session->ok; |
---|
423 | } |
---|
424 | |
---|
425 | |
---|
426 | bool |
---|
427 | xen_vbd_set_device(xen_session *session, xen_vbd vbd, char *device) |
---|
428 | { |
---|
429 | abstract_value param_values[] = |
---|
430 | { |
---|
431 | { .type = &abstract_type_string, |
---|
432 | .u.string_val = vbd }, |
---|
433 | { .type = &abstract_type_string, |
---|
434 | .u.string_val = device } |
---|
435 | }; |
---|
436 | |
---|
437 | xen_call_(session, "VBD.set_device", param_values, 2, NULL, NULL); |
---|
438 | return session->ok; |
---|
439 | } |
---|
440 | |
---|
441 | |
---|
442 | bool |
---|
443 | xen_vbd_set_bootable(xen_session *session, xen_vbd vbd, bool bootable) |
---|
444 | { |
---|
445 | abstract_value param_values[] = |
---|
446 | { |
---|
447 | { .type = &abstract_type_string, |
---|
448 | .u.string_val = vbd }, |
---|
449 | { .type = &abstract_type_bool, |
---|
450 | .u.bool_val = bootable } |
---|
451 | }; |
---|
452 | |
---|
453 | xen_call_(session, "VBD.set_bootable", param_values, 2, NULL, NULL); |
---|
454 | return session->ok; |
---|
455 | } |
---|
456 | |
---|
457 | |
---|
458 | bool |
---|
459 | xen_vbd_set_mode(xen_session *session, xen_vbd vbd, enum xen_vbd_mode mode) |
---|
460 | { |
---|
461 | abstract_value param_values[] = |
---|
462 | { |
---|
463 | { .type = &abstract_type_string, |
---|
464 | .u.string_val = vbd }, |
---|
465 | { .type = &xen_vbd_mode_abstract_type_, |
---|
466 | .u.string_val = xen_vbd_mode_to_string(mode) } |
---|
467 | }; |
---|
468 | |
---|
469 | xen_call_(session, "VBD.set_mode", param_values, 2, NULL, NULL); |
---|
470 | return session->ok; |
---|
471 | } |
---|
472 | |
---|
473 | |
---|
474 | bool |
---|
475 | xen_vbd_set_type(xen_session *session, xen_vbd vbd, enum xen_vbd_type type) |
---|
476 | { |
---|
477 | abstract_value param_values[] = |
---|
478 | { |
---|
479 | { .type = &abstract_type_string, |
---|
480 | .u.string_val = vbd }, |
---|
481 | { .type = &xen_vbd_type_abstract_type_, |
---|
482 | .u.string_val = xen_vbd_type_to_string(type) } |
---|
483 | }; |
---|
484 | |
---|
485 | xen_call_(session, "VBD.set_type", param_values, 2, NULL, NULL); |
---|
486 | return session->ok; |
---|
487 | } |
---|
488 | |
---|
489 | |
---|
490 | bool |
---|
491 | xen_vbd_set_qos_algorithm_type(xen_session *session, xen_vbd vbd, char *algorithm_type) |
---|
492 | { |
---|
493 | abstract_value param_values[] = |
---|
494 | { |
---|
495 | { .type = &abstract_type_string, |
---|
496 | .u.string_val = vbd }, |
---|
497 | { .type = &abstract_type_string, |
---|
498 | .u.string_val = algorithm_type } |
---|
499 | }; |
---|
500 | |
---|
501 | xen_call_(session, "VBD.set_qos_algorithm_type", param_values, 2, NULL, NULL); |
---|
502 | return session->ok; |
---|
503 | } |
---|
504 | |
---|
505 | |
---|
506 | bool |
---|
507 | xen_vbd_set_qos_algorithm_params(xen_session *session, xen_vbd vbd, xen_string_string_map *algorithm_params) |
---|
508 | { |
---|
509 | abstract_value param_values[] = |
---|
510 | { |
---|
511 | { .type = &abstract_type_string, |
---|
512 | .u.string_val = vbd }, |
---|
513 | { .type = &abstract_type_string_string_map, |
---|
514 | .u.set_val = (arbitrary_set *)algorithm_params } |
---|
515 | }; |
---|
516 | |
---|
517 | xen_call_(session, "VBD.set_qos_algorithm_params", param_values, 2, NULL, NULL); |
---|
518 | return session->ok; |
---|
519 | } |
---|
520 | |
---|
521 | |
---|
522 | bool |
---|
523 | xen_vbd_add_to_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key, char *value) |
---|
524 | { |
---|
525 | abstract_value param_values[] = |
---|
526 | { |
---|
527 | { .type = &abstract_type_string, |
---|
528 | .u.string_val = vbd }, |
---|
529 | { .type = &abstract_type_string, |
---|
530 | .u.string_val = key }, |
---|
531 | { .type = &abstract_type_string, |
---|
532 | .u.string_val = value } |
---|
533 | }; |
---|
534 | |
---|
535 | xen_call_(session, "VBD.add_to_qos_algorithm_params", param_values, 3, NULL, NULL); |
---|
536 | return session->ok; |
---|
537 | } |
---|
538 | |
---|
539 | |
---|
540 | bool |
---|
541 | xen_vbd_remove_from_qos_algorithm_params(xen_session *session, xen_vbd vbd, char *key) |
---|
542 | { |
---|
543 | abstract_value param_values[] = |
---|
544 | { |
---|
545 | { .type = &abstract_type_string, |
---|
546 | .u.string_val = vbd }, |
---|
547 | { .type = &abstract_type_string, |
---|
548 | .u.string_val = key } |
---|
549 | }; |
---|
550 | |
---|
551 | xen_call_(session, "VBD.remove_from_qos_algorithm_params", param_values, 2, NULL, NULL); |
---|
552 | return session->ok; |
---|
553 | } |
---|
554 | |
---|
555 | |
---|
556 | bool |
---|
557 | xen_vbd_media_change(xen_session *session, xen_vbd vbd, xen_vdi vdi) |
---|
558 | { |
---|
559 | abstract_value param_values[] = |
---|
560 | { |
---|
561 | { .type = &abstract_type_string, |
---|
562 | .u.string_val = vbd }, |
---|
563 | { .type = &abstract_type_string, |
---|
564 | .u.string_val = vdi } |
---|
565 | }; |
---|
566 | |
---|
567 | xen_call_(session, "VBD.media_change", param_values, 2, NULL, NULL); |
---|
568 | return session->ok; |
---|
569 | } |
---|
570 | |
---|
571 | |
---|
572 | bool |
---|
573 | xen_vbd_plug(xen_session *session, xen_vbd self) |
---|
574 | { |
---|
575 | abstract_value param_values[] = |
---|
576 | { |
---|
577 | { .type = &abstract_type_string, |
---|
578 | .u.string_val = self } |
---|
579 | }; |
---|
580 | |
---|
581 | xen_call_(session, "VBD.plug", param_values, 1, NULL, NULL); |
---|
582 | return session->ok; |
---|
583 | } |
---|
584 | |
---|
585 | |
---|
586 | bool |
---|
587 | xen_vbd_unplug(xen_session *session, xen_vbd self) |
---|
588 | { |
---|
589 | abstract_value param_values[] = |
---|
590 | { |
---|
591 | { .type = &abstract_type_string, |
---|
592 | .u.string_val = self } |
---|
593 | }; |
---|
594 | |
---|
595 | xen_call_(session, "VBD.unplug", param_values, 1, NULL, NULL); |
---|
596 | return session->ok; |
---|
597 | } |
---|
598 | |
---|
599 | |
---|
600 | bool |
---|
601 | xen_vbd_get_all(xen_session *session, struct xen_vbd_set **result) |
---|
602 | { |
---|
603 | |
---|
604 | abstract_type result_type = abstract_type_string_set; |
---|
605 | |
---|
606 | *result = NULL; |
---|
607 | xen_call_(session, "VBD.get_all", NULL, 0, &result_type, result); |
---|
608 | return session->ok; |
---|
609 | } |
---|
610 | |
---|
611 | |
---|
612 | bool |
---|
613 | xen_vbd_get_uuid(xen_session *session, char **result, xen_vbd vbd) |
---|
614 | { |
---|
615 | abstract_value param_values[] = |
---|
616 | { |
---|
617 | { .type = &abstract_type_string, |
---|
618 | .u.string_val = vbd } |
---|
619 | }; |
---|
620 | |
---|
621 | abstract_type result_type = abstract_type_string; |
---|
622 | |
---|
623 | *result = NULL; |
---|
624 | XEN_CALL_("VBD.get_uuid"); |
---|
625 | return session->ok; |
---|
626 | } |
---|