| 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_vdi_type_internal.h" |
|---|
| 25 | #include <xen/api/xen_common.h> |
|---|
| 26 | #include <xen/api/xen_crashdump.h> |
|---|
| 27 | #include <xen/api/xen_sr.h> |
|---|
| 28 | #include <xen/api/xen_string_string_map.h> |
|---|
| 29 | #include <xen/api/xen_vbd.h> |
|---|
| 30 | #include <xen/api/xen_vdi.h> |
|---|
| 31 | |
|---|
| 32 | |
|---|
| 33 | XEN_FREE(xen_vdi) |
|---|
| 34 | XEN_SET_ALLOC_FREE(xen_vdi) |
|---|
| 35 | XEN_ALLOC(xen_vdi_record) |
|---|
| 36 | XEN_SET_ALLOC_FREE(xen_vdi_record) |
|---|
| 37 | XEN_ALLOC(xen_vdi_record_opt) |
|---|
| 38 | XEN_RECORD_OPT_FREE(xen_vdi) |
|---|
| 39 | XEN_SET_ALLOC_FREE(xen_vdi_record_opt) |
|---|
| 40 | |
|---|
| 41 | |
|---|
| 42 | static const struct_member xen_vdi_record_struct_members[] = |
|---|
| 43 | { |
|---|
| 44 | { .key = "uuid", |
|---|
| 45 | .type = &abstract_type_string, |
|---|
| 46 | .offset = offsetof(xen_vdi_record, uuid) }, |
|---|
| 47 | { .key = "name_label", |
|---|
| 48 | .type = &abstract_type_string, |
|---|
| 49 | .offset = offsetof(xen_vdi_record, name_label) }, |
|---|
| 50 | { .key = "name_description", |
|---|
| 51 | .type = &abstract_type_string, |
|---|
| 52 | .offset = offsetof(xen_vdi_record, name_description) }, |
|---|
| 53 | { .key = "SR", |
|---|
| 54 | .type = &abstract_type_ref, |
|---|
| 55 | .offset = offsetof(xen_vdi_record, sr) }, |
|---|
| 56 | { .key = "VBDs", |
|---|
| 57 | .type = &abstract_type_ref_set, |
|---|
| 58 | .offset = offsetof(xen_vdi_record, vbds) }, |
|---|
| 59 | { .key = "crash_dumps", |
|---|
| 60 | .type = &abstract_type_ref_set, |
|---|
| 61 | .offset = offsetof(xen_vdi_record, crash_dumps) }, |
|---|
| 62 | { .key = "virtual_size", |
|---|
| 63 | .type = &abstract_type_int, |
|---|
| 64 | .offset = offsetof(xen_vdi_record, virtual_size) }, |
|---|
| 65 | { .key = "physical_utilisation", |
|---|
| 66 | .type = &abstract_type_int, |
|---|
| 67 | .offset = offsetof(xen_vdi_record, physical_utilisation) }, |
|---|
| 68 | { .key = "type", |
|---|
| 69 | .type = &xen_vdi_type_abstract_type_, |
|---|
| 70 | .offset = offsetof(xen_vdi_record, type) }, |
|---|
| 71 | { .key = "sharable", |
|---|
| 72 | .type = &abstract_type_bool, |
|---|
| 73 | .offset = offsetof(xen_vdi_record, sharable) }, |
|---|
| 74 | { .key = "read_only", |
|---|
| 75 | .type = &abstract_type_bool, |
|---|
| 76 | .offset = offsetof(xen_vdi_record, read_only) }, |
|---|
| 77 | { .key = "other_config", |
|---|
| 78 | .type = &abstract_type_string_string_map, |
|---|
| 79 | .offset = offsetof(xen_vdi_record, other_config) } |
|---|
| 80 | }; |
|---|
| 81 | |
|---|
| 82 | const abstract_type xen_vdi_record_abstract_type_ = |
|---|
| 83 | { |
|---|
| 84 | .typename = STRUCT, |
|---|
| 85 | .struct_size = sizeof(xen_vdi_record), |
|---|
| 86 | .member_count = |
|---|
| 87 | sizeof(xen_vdi_record_struct_members) / sizeof(struct_member), |
|---|
| 88 | .members = xen_vdi_record_struct_members |
|---|
| 89 | }; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | void |
|---|
| 93 | xen_vdi_record_free(xen_vdi_record *record) |
|---|
| 94 | { |
|---|
| 95 | if (record == NULL) |
|---|
| 96 | { |
|---|
| 97 | return; |
|---|
| 98 | } |
|---|
| 99 | free(record->handle); |
|---|
| 100 | free(record->uuid); |
|---|
| 101 | free(record->name_label); |
|---|
| 102 | free(record->name_description); |
|---|
| 103 | xen_sr_record_opt_free(record->sr); |
|---|
| 104 | xen_vbd_record_opt_set_free(record->vbds); |
|---|
| 105 | xen_crashdump_record_opt_set_free(record->crash_dumps); |
|---|
| 106 | xen_string_string_map_free(record->other_config); |
|---|
| 107 | free(record); |
|---|
| 108 | } |
|---|
| 109 | |
|---|
| 110 | |
|---|
| 111 | bool |
|---|
| 112 | xen_vdi_get_record(xen_session *session, xen_vdi_record **result, xen_vdi vdi) |
|---|
| 113 | { |
|---|
| 114 | abstract_value param_values[] = |
|---|
| 115 | { |
|---|
| 116 | { .type = &abstract_type_string, |
|---|
| 117 | .u.string_val = vdi } |
|---|
| 118 | }; |
|---|
| 119 | |
|---|
| 120 | abstract_type result_type = xen_vdi_record_abstract_type_; |
|---|
| 121 | |
|---|
| 122 | *result = NULL; |
|---|
| 123 | XEN_CALL_("VDI.get_record"); |
|---|
| 124 | |
|---|
| 125 | if (session->ok) |
|---|
| 126 | { |
|---|
| 127 | (*result)->handle = xen_strdup_((*result)->uuid); |
|---|
| 128 | } |
|---|
| 129 | |
|---|
| 130 | return session->ok; |
|---|
| 131 | } |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | bool |
|---|
| 135 | xen_vdi_get_by_uuid(xen_session *session, xen_vdi *result, char *uuid) |
|---|
| 136 | { |
|---|
| 137 | abstract_value param_values[] = |
|---|
| 138 | { |
|---|
| 139 | { .type = &abstract_type_string, |
|---|
| 140 | .u.string_val = uuid } |
|---|
| 141 | }; |
|---|
| 142 | |
|---|
| 143 | abstract_type result_type = abstract_type_string; |
|---|
| 144 | |
|---|
| 145 | *result = NULL; |
|---|
| 146 | XEN_CALL_("VDI.get_by_uuid"); |
|---|
| 147 | return session->ok; |
|---|
| 148 | } |
|---|
| 149 | |
|---|
| 150 | |
|---|
| 151 | bool |
|---|
| 152 | xen_vdi_create(xen_session *session, xen_vdi *result, xen_vdi_record *record) |
|---|
| 153 | { |
|---|
| 154 | abstract_value param_values[] = |
|---|
| 155 | { |
|---|
| 156 | { .type = &xen_vdi_record_abstract_type_, |
|---|
| 157 | .u.struct_val = record } |
|---|
| 158 | }; |
|---|
| 159 | |
|---|
| 160 | abstract_type result_type = abstract_type_string; |
|---|
| 161 | |
|---|
| 162 | *result = NULL; |
|---|
| 163 | XEN_CALL_("VDI.create"); |
|---|
| 164 | return session->ok; |
|---|
| 165 | } |
|---|
| 166 | |
|---|
| 167 | |
|---|
| 168 | bool |
|---|
| 169 | xen_vdi_destroy(xen_session *session, xen_vdi vdi) |
|---|
| 170 | { |
|---|
| 171 | abstract_value param_values[] = |
|---|
| 172 | { |
|---|
| 173 | { .type = &abstract_type_string, |
|---|
| 174 | .u.string_val = vdi } |
|---|
| 175 | }; |
|---|
| 176 | |
|---|
| 177 | xen_call_(session, "VDI.destroy", param_values, 1, NULL, NULL); |
|---|
| 178 | return session->ok; |
|---|
| 179 | } |
|---|
| 180 | |
|---|
| 181 | |
|---|
| 182 | bool |
|---|
| 183 | xen_vdi_get_by_name_label(xen_session *session, struct xen_vdi_set **result, char *label) |
|---|
| 184 | { |
|---|
| 185 | abstract_value param_values[] = |
|---|
| 186 | { |
|---|
| 187 | { .type = &abstract_type_string, |
|---|
| 188 | .u.string_val = label } |
|---|
| 189 | }; |
|---|
| 190 | |
|---|
| 191 | abstract_type result_type = abstract_type_string_set; |
|---|
| 192 | |
|---|
| 193 | *result = NULL; |
|---|
| 194 | XEN_CALL_("VDI.get_by_name_label"); |
|---|
| 195 | return session->ok; |
|---|
| 196 | } |
|---|
| 197 | |
|---|
| 198 | |
|---|
| 199 | bool |
|---|
| 200 | xen_vdi_get_name_label(xen_session *session, char **result, xen_vdi vdi) |
|---|
| 201 | { |
|---|
| 202 | abstract_value param_values[] = |
|---|
| 203 | { |
|---|
| 204 | { .type = &abstract_type_string, |
|---|
| 205 | .u.string_val = vdi } |
|---|
| 206 | }; |
|---|
| 207 | |
|---|
| 208 | abstract_type result_type = abstract_type_string; |
|---|
| 209 | |
|---|
| 210 | *result = NULL; |
|---|
| 211 | XEN_CALL_("VDI.get_name_label"); |
|---|
| 212 | return session->ok; |
|---|
| 213 | } |
|---|
| 214 | |
|---|
| 215 | |
|---|
| 216 | bool |
|---|
| 217 | xen_vdi_get_name_description(xen_session *session, char **result, xen_vdi vdi) |
|---|
| 218 | { |
|---|
| 219 | abstract_value param_values[] = |
|---|
| 220 | { |
|---|
| 221 | { .type = &abstract_type_string, |
|---|
| 222 | .u.string_val = vdi } |
|---|
| 223 | }; |
|---|
| 224 | |
|---|
| 225 | abstract_type result_type = abstract_type_string; |
|---|
| 226 | |
|---|
| 227 | *result = NULL; |
|---|
| 228 | XEN_CALL_("VDI.get_name_description"); |
|---|
| 229 | return session->ok; |
|---|
| 230 | } |
|---|
| 231 | |
|---|
| 232 | |
|---|
| 233 | bool |
|---|
| 234 | xen_vdi_get_sr(xen_session *session, xen_sr *result, xen_vdi vdi) |
|---|
| 235 | { |
|---|
| 236 | abstract_value param_values[] = |
|---|
| 237 | { |
|---|
| 238 | { .type = &abstract_type_string, |
|---|
| 239 | .u.string_val = vdi } |
|---|
| 240 | }; |
|---|
| 241 | |
|---|
| 242 | abstract_type result_type = abstract_type_string; |
|---|
| 243 | |
|---|
| 244 | *result = NULL; |
|---|
| 245 | XEN_CALL_("VDI.get_SR"); |
|---|
| 246 | return session->ok; |
|---|
| 247 | } |
|---|
| 248 | |
|---|
| 249 | |
|---|
| 250 | bool |
|---|
| 251 | xen_vdi_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vdi vdi) |
|---|
| 252 | { |
|---|
| 253 | abstract_value param_values[] = |
|---|
| 254 | { |
|---|
| 255 | { .type = &abstract_type_string, |
|---|
| 256 | .u.string_val = vdi } |
|---|
| 257 | }; |
|---|
| 258 | |
|---|
| 259 | abstract_type result_type = abstract_type_string_set; |
|---|
| 260 | |
|---|
| 261 | *result = NULL; |
|---|
| 262 | XEN_CALL_("VDI.get_VBDs"); |
|---|
| 263 | return session->ok; |
|---|
| 264 | } |
|---|
| 265 | |
|---|
| 266 | |
|---|
| 267 | bool |
|---|
| 268 | xen_vdi_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vdi vdi) |
|---|
| 269 | { |
|---|
| 270 | abstract_value param_values[] = |
|---|
| 271 | { |
|---|
| 272 | { .type = &abstract_type_string, |
|---|
| 273 | .u.string_val = vdi } |
|---|
| 274 | }; |
|---|
| 275 | |
|---|
| 276 | abstract_type result_type = abstract_type_string_set; |
|---|
| 277 | |
|---|
| 278 | *result = NULL; |
|---|
| 279 | XEN_CALL_("VDI.get_crash_dumps"); |
|---|
| 280 | return session->ok; |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | |
|---|
| 284 | bool |
|---|
| 285 | xen_vdi_get_virtual_size(xen_session *session, int64_t *result, xen_vdi vdi) |
|---|
| 286 | { |
|---|
| 287 | abstract_value param_values[] = |
|---|
| 288 | { |
|---|
| 289 | { .type = &abstract_type_string, |
|---|
| 290 | .u.string_val = vdi } |
|---|
| 291 | }; |
|---|
| 292 | |
|---|
| 293 | abstract_type result_type = abstract_type_int; |
|---|
| 294 | |
|---|
| 295 | XEN_CALL_("VDI.get_virtual_size"); |
|---|
| 296 | return session->ok; |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | |
|---|
| 300 | bool |
|---|
| 301 | xen_vdi_get_physical_utilisation(xen_session *session, int64_t *result, xen_vdi vdi) |
|---|
| 302 | { |
|---|
| 303 | abstract_value param_values[] = |
|---|
| 304 | { |
|---|
| 305 | { .type = &abstract_type_string, |
|---|
| 306 | .u.string_val = vdi } |
|---|
| 307 | }; |
|---|
| 308 | |
|---|
| 309 | abstract_type result_type = abstract_type_int; |
|---|
| 310 | |
|---|
| 311 | XEN_CALL_("VDI.get_physical_utilisation"); |
|---|
| 312 | return session->ok; |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | |
|---|
| 316 | bool |
|---|
| 317 | xen_vdi_get_type(xen_session *session, enum xen_vdi_type *result, xen_vdi vdi) |
|---|
| 318 | { |
|---|
| 319 | abstract_value param_values[] = |
|---|
| 320 | { |
|---|
| 321 | { .type = &abstract_type_string, |
|---|
| 322 | .u.string_val = vdi } |
|---|
| 323 | }; |
|---|
| 324 | |
|---|
| 325 | abstract_type result_type = xen_vdi_type_abstract_type_; |
|---|
| 326 | XEN_CALL_("VDI.get_type"); |
|---|
| 327 | return session->ok; |
|---|
| 328 | } |
|---|
| 329 | |
|---|
| 330 | |
|---|
| 331 | bool |
|---|
| 332 | xen_vdi_get_sharable(xen_session *session, bool *result, xen_vdi vdi) |
|---|
| 333 | { |
|---|
| 334 | abstract_value param_values[] = |
|---|
| 335 | { |
|---|
| 336 | { .type = &abstract_type_string, |
|---|
| 337 | .u.string_val = vdi } |
|---|
| 338 | }; |
|---|
| 339 | |
|---|
| 340 | abstract_type result_type = abstract_type_bool; |
|---|
| 341 | |
|---|
| 342 | XEN_CALL_("VDI.get_sharable"); |
|---|
| 343 | return session->ok; |
|---|
| 344 | } |
|---|
| 345 | |
|---|
| 346 | |
|---|
| 347 | bool |
|---|
| 348 | xen_vdi_get_read_only(xen_session *session, bool *result, xen_vdi vdi) |
|---|
| 349 | { |
|---|
| 350 | abstract_value param_values[] = |
|---|
| 351 | { |
|---|
| 352 | { .type = &abstract_type_string, |
|---|
| 353 | .u.string_val = vdi } |
|---|
| 354 | }; |
|---|
| 355 | |
|---|
| 356 | abstract_type result_type = abstract_type_bool; |
|---|
| 357 | |
|---|
| 358 | XEN_CALL_("VDI.get_read_only"); |
|---|
| 359 | return session->ok; |
|---|
| 360 | } |
|---|
| 361 | |
|---|
| 362 | |
|---|
| 363 | bool |
|---|
| 364 | xen_vdi_get_other_config(xen_session *session, xen_string_string_map **result, xen_vdi vdi) |
|---|
| 365 | { |
|---|
| 366 | abstract_value param_values[] = |
|---|
| 367 | { |
|---|
| 368 | { .type = &abstract_type_string, |
|---|
| 369 | .u.string_val = vdi } |
|---|
| 370 | }; |
|---|
| 371 | |
|---|
| 372 | abstract_type result_type = abstract_type_string_string_map; |
|---|
| 373 | |
|---|
| 374 | *result = NULL; |
|---|
| 375 | XEN_CALL_("VDI.get_other_config"); |
|---|
| 376 | return session->ok; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | |
|---|
| 380 | bool |
|---|
| 381 | xen_vdi_set_name_label(xen_session *session, xen_vdi vdi, char *label) |
|---|
| 382 | { |
|---|
| 383 | abstract_value param_values[] = |
|---|
| 384 | { |
|---|
| 385 | { .type = &abstract_type_string, |
|---|
| 386 | .u.string_val = vdi }, |
|---|
| 387 | { .type = &abstract_type_string, |
|---|
| 388 | .u.string_val = label } |
|---|
| 389 | }; |
|---|
| 390 | |
|---|
| 391 | xen_call_(session, "VDI.set_name_label", param_values, 2, NULL, NULL); |
|---|
| 392 | return session->ok; |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | |
|---|
| 396 | bool |
|---|
| 397 | xen_vdi_set_name_description(xen_session *session, xen_vdi vdi, char *description) |
|---|
| 398 | { |
|---|
| 399 | abstract_value param_values[] = |
|---|
| 400 | { |
|---|
| 401 | { .type = &abstract_type_string, |
|---|
| 402 | .u.string_val = vdi }, |
|---|
| 403 | { .type = &abstract_type_string, |
|---|
| 404 | .u.string_val = description } |
|---|
| 405 | }; |
|---|
| 406 | |
|---|
| 407 | xen_call_(session, "VDI.set_name_description", param_values, 2, NULL, NULL); |
|---|
| 408 | return session->ok; |
|---|
| 409 | } |
|---|
| 410 | |
|---|
| 411 | |
|---|
| 412 | bool |
|---|
| 413 | xen_vdi_set_virtual_size(xen_session *session, xen_vdi vdi, int64_t virtual_size) |
|---|
| 414 | { |
|---|
| 415 | abstract_value param_values[] = |
|---|
| 416 | { |
|---|
| 417 | { .type = &abstract_type_string, |
|---|
| 418 | .u.string_val = vdi }, |
|---|
| 419 | { .type = &abstract_type_int, |
|---|
| 420 | .u.int_val = virtual_size } |
|---|
| 421 | }; |
|---|
| 422 | |
|---|
| 423 | xen_call_(session, "VDI.set_virtual_size", param_values, 2, NULL, NULL); |
|---|
| 424 | return session->ok; |
|---|
| 425 | } |
|---|
| 426 | |
|---|
| 427 | |
|---|
| 428 | bool |
|---|
| 429 | xen_vdi_set_sharable(xen_session *session, xen_vdi vdi, bool sharable) |
|---|
| 430 | { |
|---|
| 431 | abstract_value param_values[] = |
|---|
| 432 | { |
|---|
| 433 | { .type = &abstract_type_string, |
|---|
| 434 | .u.string_val = vdi }, |
|---|
| 435 | { .type = &abstract_type_bool, |
|---|
| 436 | .u.bool_val = sharable } |
|---|
| 437 | }; |
|---|
| 438 | |
|---|
| 439 | xen_call_(session, "VDI.set_sharable", param_values, 2, NULL, NULL); |
|---|
| 440 | return session->ok; |
|---|
| 441 | } |
|---|
| 442 | |
|---|
| 443 | |
|---|
| 444 | bool |
|---|
| 445 | xen_vdi_set_read_only(xen_session *session, xen_vdi vdi, bool read_only) |
|---|
| 446 | { |
|---|
| 447 | abstract_value param_values[] = |
|---|
| 448 | { |
|---|
| 449 | { .type = &abstract_type_string, |
|---|
| 450 | .u.string_val = vdi }, |
|---|
| 451 | { .type = &abstract_type_bool, |
|---|
| 452 | .u.bool_val = read_only } |
|---|
| 453 | }; |
|---|
| 454 | |
|---|
| 455 | xen_call_(session, "VDI.set_read_only", param_values, 2, NULL, NULL); |
|---|
| 456 | return session->ok; |
|---|
| 457 | } |
|---|
| 458 | |
|---|
| 459 | |
|---|
| 460 | bool |
|---|
| 461 | xen_vdi_set_other_config(xen_session *session, xen_vdi vdi, xen_string_string_map *other_config) |
|---|
| 462 | { |
|---|
| 463 | abstract_value param_values[] = |
|---|
| 464 | { |
|---|
| 465 | { .type = &abstract_type_string, |
|---|
| 466 | .u.string_val = vdi }, |
|---|
| 467 | { .type = &abstract_type_string_string_map, |
|---|
| 468 | .u.set_val = (arbitrary_set *)other_config } |
|---|
| 469 | }; |
|---|
| 470 | |
|---|
| 471 | xen_call_(session, "VDI.set_other_config", param_values, 2, NULL, NULL); |
|---|
| 472 | return session->ok; |
|---|
| 473 | } |
|---|
| 474 | |
|---|
| 475 | |
|---|
| 476 | bool |
|---|
| 477 | xen_vdi_add_to_other_config(xen_session *session, xen_vdi vdi, char *key, char *value) |
|---|
| 478 | { |
|---|
| 479 | abstract_value param_values[] = |
|---|
| 480 | { |
|---|
| 481 | { .type = &abstract_type_string, |
|---|
| 482 | .u.string_val = vdi }, |
|---|
| 483 | { .type = &abstract_type_string, |
|---|
| 484 | .u.string_val = key }, |
|---|
| 485 | { .type = &abstract_type_string, |
|---|
| 486 | .u.string_val = value } |
|---|
| 487 | }; |
|---|
| 488 | |
|---|
| 489 | xen_call_(session, "VDI.add_to_other_config", param_values, 3, NULL, NULL); |
|---|
| 490 | return session->ok; |
|---|
| 491 | } |
|---|
| 492 | |
|---|
| 493 | |
|---|
| 494 | bool |
|---|
| 495 | xen_vdi_remove_from_other_config(xen_session *session, xen_vdi vdi, char *key) |
|---|
| 496 | { |
|---|
| 497 | abstract_value param_values[] = |
|---|
| 498 | { |
|---|
| 499 | { .type = &abstract_type_string, |
|---|
| 500 | .u.string_val = vdi }, |
|---|
| 501 | { .type = &abstract_type_string, |
|---|
| 502 | .u.string_val = key } |
|---|
| 503 | }; |
|---|
| 504 | |
|---|
| 505 | xen_call_(session, "VDI.remove_from_other_config", param_values, 2, NULL, NULL); |
|---|
| 506 | return session->ok; |
|---|
| 507 | } |
|---|
| 508 | |
|---|
| 509 | |
|---|
| 510 | bool |
|---|
| 511 | xen_vdi_get_all(xen_session *session, struct xen_vdi_set **result) |
|---|
| 512 | { |
|---|
| 513 | |
|---|
| 514 | abstract_type result_type = abstract_type_string_set; |
|---|
| 515 | |
|---|
| 516 | *result = NULL; |
|---|
| 517 | xen_call_(session, "VDI.get_all", NULL, 0, &result_type, result); |
|---|
| 518 | return session->ok; |
|---|
| 519 | } |
|---|
| 520 | |
|---|
| 521 | |
|---|
| 522 | bool |
|---|
| 523 | xen_vdi_get_uuid(xen_session *session, char **result, xen_vdi vdi) |
|---|
| 524 | { |
|---|
| 525 | abstract_value param_values[] = |
|---|
| 526 | { |
|---|
| 527 | { .type = &abstract_type_string, |
|---|
| 528 | .u.string_val = vdi } |
|---|
| 529 | }; |
|---|
| 530 | |
|---|
| 531 | abstract_type result_type = abstract_type_string; |
|---|
| 532 | |
|---|
| 533 | *result = NULL; |
|---|
| 534 | XEN_CALL_("VDI.get_uuid"); |
|---|
| 535 | return session->ok; |
|---|
| 536 | } |
|---|