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 | #ifndef XEN_VM_H |
---|
20 | #define XEN_VM_H |
---|
21 | |
---|
22 | #include <xen/api/xen_common.h> |
---|
23 | #include <xen/api/xen_console_decl.h> |
---|
24 | #include <xen/api/xen_crashdump_decl.h> |
---|
25 | #include <xen/api/xen_host_decl.h> |
---|
26 | #include <xen/api/xen_on_crash_behaviour.h> |
---|
27 | #include <xen/api/xen_on_normal_exit.h> |
---|
28 | #include <xen/api/xen_string_string_map.h> |
---|
29 | #include <xen/api/xen_vbd_decl.h> |
---|
30 | #include <xen/api/xen_vdi_decl.h> |
---|
31 | #include <xen/api/xen_vif_decl.h> |
---|
32 | #include <xen/api/xen_vm_decl.h> |
---|
33 | #include <xen/api/xen_vm_guest_metrics_decl.h> |
---|
34 | #include <xen/api/xen_vm_metrics_decl.h> |
---|
35 | #include <xen/api/xen_vm_power_state.h> |
---|
36 | #include <xen/api/xen_vtpm_decl.h> |
---|
37 | |
---|
38 | |
---|
39 | /* |
---|
40 | * The VM class. |
---|
41 | * |
---|
42 | * A virtual machine (or 'guest'). |
---|
43 | */ |
---|
44 | |
---|
45 | |
---|
46 | /** |
---|
47 | * Free the given xen_vm. The given handle must have been allocated by |
---|
48 | * this library. |
---|
49 | */ |
---|
50 | extern void |
---|
51 | xen_vm_free(xen_vm vm); |
---|
52 | |
---|
53 | |
---|
54 | typedef struct xen_vm_set |
---|
55 | { |
---|
56 | size_t size; |
---|
57 | xen_vm *contents[]; |
---|
58 | } xen_vm_set; |
---|
59 | |
---|
60 | /** |
---|
61 | * Allocate a xen_vm_set of the given size. |
---|
62 | */ |
---|
63 | extern xen_vm_set * |
---|
64 | xen_vm_set_alloc(size_t size); |
---|
65 | |
---|
66 | /** |
---|
67 | * Free the given xen_vm_set. The given set must have been allocated |
---|
68 | * by this library. |
---|
69 | */ |
---|
70 | extern void |
---|
71 | xen_vm_set_free(xen_vm_set *set); |
---|
72 | |
---|
73 | |
---|
74 | typedef struct xen_vm_record |
---|
75 | { |
---|
76 | xen_vm handle; |
---|
77 | char *uuid; |
---|
78 | enum xen_vm_power_state power_state; |
---|
79 | char *name_label; |
---|
80 | char *name_description; |
---|
81 | int64_t user_version; |
---|
82 | bool is_a_template; |
---|
83 | bool auto_power_on; |
---|
84 | struct xen_vdi_record_opt *suspend_vdi; |
---|
85 | struct xen_host_record_opt *resident_on; |
---|
86 | int64_t memory_static_max; |
---|
87 | int64_t memory_dynamic_max; |
---|
88 | int64_t memory_dynamic_min; |
---|
89 | int64_t memory_static_min; |
---|
90 | xen_string_string_map *vcpus_params; |
---|
91 | int64_t vcpus_max; |
---|
92 | int64_t vcpus_at_startup; |
---|
93 | enum xen_on_normal_exit actions_after_shutdown; |
---|
94 | enum xen_on_normal_exit actions_after_reboot; |
---|
95 | enum xen_on_crash_behaviour actions_after_crash; |
---|
96 | struct xen_console_record_opt_set *consoles; |
---|
97 | struct xen_vif_record_opt_set *vifs; |
---|
98 | struct xen_vbd_record_opt_set *vbds; |
---|
99 | struct xen_crashdump_record_opt_set *crash_dumps; |
---|
100 | struct xen_vtpm_record_opt_set *vtpms; |
---|
101 | char *pv_bootloader; |
---|
102 | char *pv_kernel; |
---|
103 | char *pv_ramdisk; |
---|
104 | char *pv_args; |
---|
105 | char *pv_bootloader_args; |
---|
106 | char *hvm_boot_policy; |
---|
107 | xen_string_string_map *hvm_boot_params; |
---|
108 | xen_string_string_map *platform; |
---|
109 | char *pci_bus; |
---|
110 | xen_string_string_map *other_config; |
---|
111 | int64_t domid; |
---|
112 | bool is_control_domain; |
---|
113 | struct xen_vm_metrics_record_opt *metrics; |
---|
114 | struct xen_vm_guest_metrics_record_opt *guest_metrics; |
---|
115 | } xen_vm_record; |
---|
116 | |
---|
117 | /** |
---|
118 | * Allocate a xen_vm_record. |
---|
119 | */ |
---|
120 | extern xen_vm_record * |
---|
121 | xen_vm_record_alloc(void); |
---|
122 | |
---|
123 | /** |
---|
124 | * Free the given xen_vm_record, and all referenced values. The given |
---|
125 | * record must have been allocated by this library. |
---|
126 | */ |
---|
127 | extern void |
---|
128 | xen_vm_record_free(xen_vm_record *record); |
---|
129 | |
---|
130 | |
---|
131 | typedef struct xen_vm_record_opt |
---|
132 | { |
---|
133 | bool is_record; |
---|
134 | union |
---|
135 | { |
---|
136 | xen_vm handle; |
---|
137 | xen_vm_record *record; |
---|
138 | } u; |
---|
139 | } xen_vm_record_opt; |
---|
140 | |
---|
141 | /** |
---|
142 | * Allocate a xen_vm_record_opt. |
---|
143 | */ |
---|
144 | extern xen_vm_record_opt * |
---|
145 | xen_vm_record_opt_alloc(void); |
---|
146 | |
---|
147 | /** |
---|
148 | * Free the given xen_vm_record_opt, and all referenced values. The |
---|
149 | * given record_opt must have been allocated by this library. |
---|
150 | */ |
---|
151 | extern void |
---|
152 | xen_vm_record_opt_free(xen_vm_record_opt *record_opt); |
---|
153 | |
---|
154 | |
---|
155 | typedef struct xen_vm_record_set |
---|
156 | { |
---|
157 | size_t size; |
---|
158 | xen_vm_record *contents[]; |
---|
159 | } xen_vm_record_set; |
---|
160 | |
---|
161 | /** |
---|
162 | * Allocate a xen_vm_record_set of the given size. |
---|
163 | */ |
---|
164 | extern xen_vm_record_set * |
---|
165 | xen_vm_record_set_alloc(size_t size); |
---|
166 | |
---|
167 | /** |
---|
168 | * Free the given xen_vm_record_set, and all referenced values. The |
---|
169 | * given set must have been allocated by this library. |
---|
170 | */ |
---|
171 | extern void |
---|
172 | xen_vm_record_set_free(xen_vm_record_set *set); |
---|
173 | |
---|
174 | |
---|
175 | |
---|
176 | typedef struct xen_vm_record_opt_set |
---|
177 | { |
---|
178 | size_t size; |
---|
179 | xen_vm_record_opt *contents[]; |
---|
180 | } xen_vm_record_opt_set; |
---|
181 | |
---|
182 | /** |
---|
183 | * Allocate a xen_vm_record_opt_set of the given size. |
---|
184 | */ |
---|
185 | extern xen_vm_record_opt_set * |
---|
186 | xen_vm_record_opt_set_alloc(size_t size); |
---|
187 | |
---|
188 | /** |
---|
189 | * Free the given xen_vm_record_opt_set, and all referenced values. |
---|
190 | * The given set must have been allocated by this library. |
---|
191 | */ |
---|
192 | extern void |
---|
193 | xen_vm_record_opt_set_free(xen_vm_record_opt_set *set); |
---|
194 | |
---|
195 | |
---|
196 | /** |
---|
197 | * Get a record containing the current state of the given VM. |
---|
198 | */ |
---|
199 | extern bool |
---|
200 | xen_vm_get_record(xen_session *session, xen_vm_record **result, xen_vm vm); |
---|
201 | |
---|
202 | |
---|
203 | /** |
---|
204 | * Get a reference to the VM instance with the specified UUID. |
---|
205 | */ |
---|
206 | extern bool |
---|
207 | xen_vm_get_by_uuid(xen_session *session, xen_vm *result, char *uuid); |
---|
208 | |
---|
209 | |
---|
210 | /** |
---|
211 | * Create a new VM instance, and return its handle. |
---|
212 | */ |
---|
213 | extern bool |
---|
214 | xen_vm_create(xen_session *session, xen_vm *result, xen_vm_record *record); |
---|
215 | |
---|
216 | |
---|
217 | /** |
---|
218 | * Destroy the specified VM. The VM is completely removed from the |
---|
219 | * system. This function can only be called when the VM is in the Halted |
---|
220 | * State. |
---|
221 | */ |
---|
222 | extern bool |
---|
223 | xen_vm_destroy(xen_session *session, xen_vm vm); |
---|
224 | |
---|
225 | |
---|
226 | /** |
---|
227 | * Get all the VM instances with the given label. |
---|
228 | */ |
---|
229 | extern bool |
---|
230 | xen_vm_get_by_name_label(xen_session *session, struct xen_vm_set **result, char *label); |
---|
231 | |
---|
232 | |
---|
233 | /** |
---|
234 | * Get the uuid field of the given VM. |
---|
235 | */ |
---|
236 | extern bool |
---|
237 | xen_vm_get_uuid(xen_session *session, char **result, xen_vm vm); |
---|
238 | |
---|
239 | |
---|
240 | /** |
---|
241 | * Get the power_state field of the given VM. |
---|
242 | */ |
---|
243 | extern bool |
---|
244 | xen_vm_get_power_state(xen_session *session, enum xen_vm_power_state *result, xen_vm vm); |
---|
245 | |
---|
246 | |
---|
247 | /** |
---|
248 | * Get the name/label field of the given VM. |
---|
249 | */ |
---|
250 | extern bool |
---|
251 | xen_vm_get_name_label(xen_session *session, char **result, xen_vm vm); |
---|
252 | |
---|
253 | |
---|
254 | /** |
---|
255 | * Get the name/description field of the given VM. |
---|
256 | */ |
---|
257 | extern bool |
---|
258 | xen_vm_get_name_description(xen_session *session, char **result, xen_vm vm); |
---|
259 | |
---|
260 | |
---|
261 | /** |
---|
262 | * Get the user_version field of the given VM. |
---|
263 | */ |
---|
264 | extern bool |
---|
265 | xen_vm_get_user_version(xen_session *session, int64_t *result, xen_vm vm); |
---|
266 | |
---|
267 | |
---|
268 | /** |
---|
269 | * Get the is_a_template field of the given VM. |
---|
270 | */ |
---|
271 | extern bool |
---|
272 | xen_vm_get_is_a_template(xen_session *session, bool *result, xen_vm vm); |
---|
273 | |
---|
274 | |
---|
275 | /** |
---|
276 | * Get the auto_power_on field of the given VM. |
---|
277 | */ |
---|
278 | extern bool |
---|
279 | xen_vm_get_auto_power_on(xen_session *session, bool *result, xen_vm vm); |
---|
280 | |
---|
281 | |
---|
282 | /** |
---|
283 | * Get the suspend_VDI field of the given VM. |
---|
284 | */ |
---|
285 | extern bool |
---|
286 | xen_vm_get_suspend_vdi(xen_session *session, xen_vdi *result, xen_vm vm); |
---|
287 | |
---|
288 | |
---|
289 | /** |
---|
290 | * Get the resident_on field of the given VM. |
---|
291 | */ |
---|
292 | extern bool |
---|
293 | xen_vm_get_resident_on(xen_session *session, xen_host *result, xen_vm vm); |
---|
294 | |
---|
295 | |
---|
296 | /** |
---|
297 | * Get the memory/static_max field of the given VM. |
---|
298 | */ |
---|
299 | extern bool |
---|
300 | xen_vm_get_memory_static_max(xen_session *session, int64_t *result, xen_vm vm); |
---|
301 | |
---|
302 | |
---|
303 | /** |
---|
304 | * Get the memory/dynamic_max field of the given VM. |
---|
305 | */ |
---|
306 | extern bool |
---|
307 | xen_vm_get_memory_dynamic_max(xen_session *session, int64_t *result, xen_vm vm); |
---|
308 | |
---|
309 | |
---|
310 | /** |
---|
311 | * Get the memory/dynamic_min field of the given VM. |
---|
312 | */ |
---|
313 | extern bool |
---|
314 | xen_vm_get_memory_dynamic_min(xen_session *session, int64_t *result, xen_vm vm); |
---|
315 | |
---|
316 | |
---|
317 | /** |
---|
318 | * Get the memory/static_min field of the given VM. |
---|
319 | */ |
---|
320 | extern bool |
---|
321 | xen_vm_get_memory_static_min(xen_session *session, int64_t *result, xen_vm vm); |
---|
322 | |
---|
323 | |
---|
324 | /** |
---|
325 | * Get the VCPUs/params field of the given VM. |
---|
326 | */ |
---|
327 | extern bool |
---|
328 | xen_vm_get_vcpus_params(xen_session *session, xen_string_string_map **result, xen_vm vm); |
---|
329 | |
---|
330 | |
---|
331 | /** |
---|
332 | * Get the VCPUs/max field of the given VM. |
---|
333 | */ |
---|
334 | extern bool |
---|
335 | xen_vm_get_vcpus_max(xen_session *session, int64_t *result, xen_vm vm); |
---|
336 | |
---|
337 | |
---|
338 | /** |
---|
339 | * Get the VCPUs/at_startup field of the given VM. |
---|
340 | */ |
---|
341 | extern bool |
---|
342 | xen_vm_get_vcpus_at_startup(xen_session *session, int64_t *result, xen_vm vm); |
---|
343 | |
---|
344 | |
---|
345 | /** |
---|
346 | * Get the actions/after_shutdown field of the given VM. |
---|
347 | */ |
---|
348 | extern bool |
---|
349 | xen_vm_get_actions_after_shutdown(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm); |
---|
350 | |
---|
351 | |
---|
352 | /** |
---|
353 | * Get the actions/after_reboot field of the given VM. |
---|
354 | */ |
---|
355 | extern bool |
---|
356 | xen_vm_get_actions_after_reboot(xen_session *session, enum xen_on_normal_exit *result, xen_vm vm); |
---|
357 | |
---|
358 | |
---|
359 | /** |
---|
360 | * Get the actions/after_crash field of the given VM. |
---|
361 | */ |
---|
362 | extern bool |
---|
363 | xen_vm_get_actions_after_crash(xen_session *session, enum xen_on_crash_behaviour *result, xen_vm vm); |
---|
364 | |
---|
365 | |
---|
366 | /** |
---|
367 | * Get the consoles field of the given VM. |
---|
368 | */ |
---|
369 | extern bool |
---|
370 | xen_vm_get_consoles(xen_session *session, struct xen_console_set **result, xen_vm vm); |
---|
371 | |
---|
372 | |
---|
373 | /** |
---|
374 | * Get the VIFs field of the given VM. |
---|
375 | */ |
---|
376 | extern bool |
---|
377 | xen_vm_get_vifs(xen_session *session, struct xen_vif_set **result, xen_vm vm); |
---|
378 | |
---|
379 | |
---|
380 | /** |
---|
381 | * Get the VBDs field of the given VM. |
---|
382 | */ |
---|
383 | extern bool |
---|
384 | xen_vm_get_vbds(xen_session *session, struct xen_vbd_set **result, xen_vm vm); |
---|
385 | |
---|
386 | |
---|
387 | /** |
---|
388 | * Get the crash_dumps field of the given VM. |
---|
389 | */ |
---|
390 | extern bool |
---|
391 | xen_vm_get_crash_dumps(xen_session *session, struct xen_crashdump_set **result, xen_vm vm); |
---|
392 | |
---|
393 | |
---|
394 | /** |
---|
395 | * Get the VTPMs field of the given VM. |
---|
396 | */ |
---|
397 | extern bool |
---|
398 | xen_vm_get_vtpms(xen_session *session, struct xen_vtpm_set **result, xen_vm vm); |
---|
399 | |
---|
400 | |
---|
401 | /** |
---|
402 | * Get the PV/bootloader field of the given VM. |
---|
403 | */ |
---|
404 | extern bool |
---|
405 | xen_vm_get_pv_bootloader(xen_session *session, char **result, xen_vm vm); |
---|
406 | |
---|
407 | |
---|
408 | /** |
---|
409 | * Get the PV/kernel field of the given VM. |
---|
410 | */ |
---|
411 | extern bool |
---|
412 | xen_vm_get_pv_kernel(xen_session *session, char **result, xen_vm vm); |
---|
413 | |
---|
414 | |
---|
415 | /** |
---|
416 | * Get the PV/ramdisk field of the given VM. |
---|
417 | */ |
---|
418 | extern bool |
---|
419 | xen_vm_get_pv_ramdisk(xen_session *session, char **result, xen_vm vm); |
---|
420 | |
---|
421 | |
---|
422 | /** |
---|
423 | * Get the PV/args field of the given VM. |
---|
424 | */ |
---|
425 | extern bool |
---|
426 | xen_vm_get_pv_args(xen_session *session, char **result, xen_vm vm); |
---|
427 | |
---|
428 | |
---|
429 | /** |
---|
430 | * Get the PV/bootloader_args field of the given VM. |
---|
431 | */ |
---|
432 | extern bool |
---|
433 | xen_vm_get_pv_bootloader_args(xen_session *session, char **result, xen_vm vm); |
---|
434 | |
---|
435 | |
---|
436 | /** |
---|
437 | * Get the HVM/boot_policy field of the given VM. |
---|
438 | */ |
---|
439 | extern bool |
---|
440 | xen_vm_get_hvm_boot_policy(xen_session *session, char **result, xen_vm vm); |
---|
441 | |
---|
442 | |
---|
443 | /** |
---|
444 | * Get the HVM/boot_params field of the given VM. |
---|
445 | */ |
---|
446 | extern bool |
---|
447 | xen_vm_get_hvm_boot_params(xen_session *session, xen_string_string_map **result, xen_vm vm); |
---|
448 | |
---|
449 | |
---|
450 | /** |
---|
451 | * Get the platform field of the given VM. |
---|
452 | */ |
---|
453 | extern bool |
---|
454 | xen_vm_get_platform(xen_session *session, xen_string_string_map **result, xen_vm vm); |
---|
455 | |
---|
456 | |
---|
457 | /** |
---|
458 | * Get the PCI_bus field of the given VM. |
---|
459 | */ |
---|
460 | extern bool |
---|
461 | xen_vm_get_pci_bus(xen_session *session, char **result, xen_vm vm); |
---|
462 | |
---|
463 | |
---|
464 | /** |
---|
465 | * Get the other_config field of the given VM. |
---|
466 | */ |
---|
467 | extern bool |
---|
468 | xen_vm_get_other_config(xen_session *session, xen_string_string_map **result, xen_vm vm); |
---|
469 | |
---|
470 | |
---|
471 | /** |
---|
472 | * Get the domid field of the given VM. |
---|
473 | */ |
---|
474 | extern bool |
---|
475 | xen_vm_get_domid(xen_session *session, int64_t *result, xen_vm vm); |
---|
476 | |
---|
477 | |
---|
478 | /** |
---|
479 | * Get the is_control_domain field of the given VM. |
---|
480 | */ |
---|
481 | extern bool |
---|
482 | xen_vm_get_is_control_domain(xen_session *session, bool *result, xen_vm vm); |
---|
483 | |
---|
484 | |
---|
485 | /** |
---|
486 | * Get the metrics field of the given VM. |
---|
487 | */ |
---|
488 | extern bool |
---|
489 | xen_vm_get_metrics(xen_session *session, xen_vm_metrics *result, xen_vm vm); |
---|
490 | |
---|
491 | |
---|
492 | /** |
---|
493 | * Get the guest_metrics field of the given VM. |
---|
494 | */ |
---|
495 | extern bool |
---|
496 | xen_vm_get_guest_metrics(xen_session *session, xen_vm_guest_metrics *result, xen_vm vm); |
---|
497 | |
---|
498 | |
---|
499 | /** |
---|
500 | * Set the name/label field of the given VM. |
---|
501 | */ |
---|
502 | extern bool |
---|
503 | xen_vm_set_name_label(xen_session *session, xen_vm vm, char *label); |
---|
504 | |
---|
505 | |
---|
506 | /** |
---|
507 | * Set the name/description field of the given VM. |
---|
508 | */ |
---|
509 | extern bool |
---|
510 | xen_vm_set_name_description(xen_session *session, xen_vm vm, char *description); |
---|
511 | |
---|
512 | |
---|
513 | /** |
---|
514 | * Set the user_version field of the given VM. |
---|
515 | */ |
---|
516 | extern bool |
---|
517 | xen_vm_set_user_version(xen_session *session, xen_vm vm, int64_t user_version); |
---|
518 | |
---|
519 | |
---|
520 | /** |
---|
521 | * Set the is_a_template field of the given VM. |
---|
522 | */ |
---|
523 | extern bool |
---|
524 | xen_vm_set_is_a_template(xen_session *session, xen_vm vm, bool is_a_template); |
---|
525 | |
---|
526 | |
---|
527 | /** |
---|
528 | * Set the auto_power_on field of the given VM. |
---|
529 | */ |
---|
530 | extern bool |
---|
531 | xen_vm_set_auto_power_on(xen_session *session, xen_vm vm, bool auto_power_on); |
---|
532 | |
---|
533 | |
---|
534 | /** |
---|
535 | * Set the memory/static_max field of the given VM. |
---|
536 | */ |
---|
537 | extern bool |
---|
538 | xen_vm_set_memory_static_max(xen_session *session, xen_vm vm, int64_t static_max); |
---|
539 | |
---|
540 | |
---|
541 | /** |
---|
542 | * Set the memory/dynamic_max field of the given VM. |
---|
543 | */ |
---|
544 | extern bool |
---|
545 | xen_vm_set_memory_dynamic_max(xen_session *session, xen_vm vm, int64_t dynamic_max); |
---|
546 | |
---|
547 | |
---|
548 | /** |
---|
549 | * Set the memory/dynamic_min field of the given VM. |
---|
550 | */ |
---|
551 | extern bool |
---|
552 | xen_vm_set_memory_dynamic_min(xen_session *session, xen_vm vm, int64_t dynamic_min); |
---|
553 | |
---|
554 | |
---|
555 | /** |
---|
556 | * Set the memory/static_min field of the given VM. |
---|
557 | */ |
---|
558 | extern bool |
---|
559 | xen_vm_set_memory_static_min(xen_session *session, xen_vm vm, int64_t static_min); |
---|
560 | |
---|
561 | |
---|
562 | /** |
---|
563 | * Set the VCPUs/params field of the given VM. |
---|
564 | */ |
---|
565 | extern bool |
---|
566 | xen_vm_set_vcpus_params(xen_session *session, xen_vm vm, xen_string_string_map *params); |
---|
567 | |
---|
568 | |
---|
569 | /** |
---|
570 | * Add the given key-value pair to the VCPUs/params field of the given |
---|
571 | * VM. |
---|
572 | */ |
---|
573 | extern bool |
---|
574 | xen_vm_add_to_vcpus_params(xen_session *session, xen_vm vm, char *key, char *value); |
---|
575 | |
---|
576 | |
---|
577 | /** |
---|
578 | * Remove the given key and its corresponding value from the |
---|
579 | * VCPUs/params field of the given VM. If the key is not in that Map, then do |
---|
580 | * nothing. |
---|
581 | */ |
---|
582 | extern bool |
---|
583 | xen_vm_remove_from_vcpus_params(xen_session *session, xen_vm vm, char *key); |
---|
584 | |
---|
585 | |
---|
586 | /** |
---|
587 | * Set the VCPUs/max field of the given VM. |
---|
588 | */ |
---|
589 | extern bool |
---|
590 | xen_vm_set_vcpus_max(xen_session *session, xen_vm vm, int64_t max); |
---|
591 | |
---|
592 | |
---|
593 | /** |
---|
594 | * Set the VCPUs/at_startup field of the given VM. |
---|
595 | */ |
---|
596 | extern bool |
---|
597 | xen_vm_set_vcpus_at_startup(xen_session *session, xen_vm vm, int64_t at_startup); |
---|
598 | |
---|
599 | |
---|
600 | /** |
---|
601 | * Set the actions/after_shutdown field of the given VM. |
---|
602 | */ |
---|
603 | extern bool |
---|
604 | xen_vm_set_actions_after_shutdown(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_shutdown); |
---|
605 | |
---|
606 | |
---|
607 | /** |
---|
608 | * Set the actions/after_reboot field of the given VM. |
---|
609 | */ |
---|
610 | extern bool |
---|
611 | xen_vm_set_actions_after_reboot(xen_session *session, xen_vm vm, enum xen_on_normal_exit after_reboot); |
---|
612 | |
---|
613 | |
---|
614 | /** |
---|
615 | * Set the actions/after_crash field of the given VM. |
---|
616 | */ |
---|
617 | extern bool |
---|
618 | xen_vm_set_actions_after_crash(xen_session *session, xen_vm vm, enum xen_on_crash_behaviour after_crash); |
---|
619 | |
---|
620 | |
---|
621 | /** |
---|
622 | * Set the PV/bootloader field of the given VM. |
---|
623 | */ |
---|
624 | extern bool |
---|
625 | xen_vm_set_pv_bootloader(xen_session *session, xen_vm vm, char *bootloader); |
---|
626 | |
---|
627 | |
---|
628 | /** |
---|
629 | * Set the PV/kernel field of the given VM. |
---|
630 | */ |
---|
631 | extern bool |
---|
632 | xen_vm_set_pv_kernel(xen_session *session, xen_vm vm, char *kernel); |
---|
633 | |
---|
634 | |
---|
635 | /** |
---|
636 | * Set the PV/ramdisk field of the given VM. |
---|
637 | */ |
---|
638 | extern bool |
---|
639 | xen_vm_set_pv_ramdisk(xen_session *session, xen_vm vm, char *ramdisk); |
---|
640 | |
---|
641 | |
---|
642 | /** |
---|
643 | * Set the PV/args field of the given VM. |
---|
644 | */ |
---|
645 | extern bool |
---|
646 | xen_vm_set_pv_args(xen_session *session, xen_vm vm, char *args); |
---|
647 | |
---|
648 | |
---|
649 | /** |
---|
650 | * Set the PV/bootloader_args field of the given VM. |
---|
651 | */ |
---|
652 | extern bool |
---|
653 | xen_vm_set_pv_bootloader_args(xen_session *session, xen_vm vm, char *bootloader_args); |
---|
654 | |
---|
655 | |
---|
656 | /** |
---|
657 | * Set the HVM/boot_policy field of the given VM. |
---|
658 | */ |
---|
659 | extern bool |
---|
660 | xen_vm_set_hvm_boot_policy(xen_session *session, xen_vm vm, char *boot_policy); |
---|
661 | |
---|
662 | |
---|
663 | /** |
---|
664 | * Set the HVM/boot_params field of the given VM. |
---|
665 | */ |
---|
666 | extern bool |
---|
667 | xen_vm_set_hvm_boot_params(xen_session *session, xen_vm vm, xen_string_string_map *boot_params); |
---|
668 | |
---|
669 | |
---|
670 | /** |
---|
671 | * Add the given key-value pair to the HVM/boot_params field of the |
---|
672 | * given VM. |
---|
673 | */ |
---|
674 | extern bool |
---|
675 | xen_vm_add_to_hvm_boot_params(xen_session *session, xen_vm vm, char *key, char *value); |
---|
676 | |
---|
677 | |
---|
678 | /** |
---|
679 | * Remove the given key and its corresponding value from the |
---|
680 | * HVM/boot_params field of the given VM. If the key is not in that Map, then |
---|
681 | * do nothing. |
---|
682 | */ |
---|
683 | extern bool |
---|
684 | xen_vm_remove_from_hvm_boot_params(xen_session *session, xen_vm vm, char *key); |
---|
685 | |
---|
686 | |
---|
687 | /** |
---|
688 | * Set the platform field of the given VM. |
---|
689 | */ |
---|
690 | extern bool |
---|
691 | xen_vm_set_platform(xen_session *session, xen_vm vm, xen_string_string_map *platform); |
---|
692 | |
---|
693 | |
---|
694 | /** |
---|
695 | * Add the given key-value pair to the platform field of the given VM. |
---|
696 | */ |
---|
697 | extern bool |
---|
698 | xen_vm_add_to_platform(xen_session *session, xen_vm vm, char *key, char *value); |
---|
699 | |
---|
700 | |
---|
701 | /** |
---|
702 | * Remove the given key and its corresponding value from the platform |
---|
703 | * field of the given VM. If the key is not in that Map, then do nothing. |
---|
704 | */ |
---|
705 | extern bool |
---|
706 | xen_vm_remove_from_platform(xen_session *session, xen_vm vm, char *key); |
---|
707 | |
---|
708 | |
---|
709 | /** |
---|
710 | * Set the PCI_bus field of the given VM. |
---|
711 | */ |
---|
712 | extern bool |
---|
713 | xen_vm_set_pci_bus(xen_session *session, xen_vm vm, char *pci_bus); |
---|
714 | |
---|
715 | |
---|
716 | /** |
---|
717 | * Set the other_config field of the given VM. |
---|
718 | */ |
---|
719 | extern bool |
---|
720 | xen_vm_set_other_config(xen_session *session, xen_vm vm, xen_string_string_map *other_config); |
---|
721 | |
---|
722 | |
---|
723 | /** |
---|
724 | * Add the given key-value pair to the other_config field of the given |
---|
725 | * VM. |
---|
726 | */ |
---|
727 | extern bool |
---|
728 | xen_vm_add_to_other_config(xen_session *session, xen_vm vm, char *key, char *value); |
---|
729 | |
---|
730 | |
---|
731 | /** |
---|
732 | * Remove the given key and its corresponding value from the |
---|
733 | * other_config field of the given VM. If the key is not in that Map, then do |
---|
734 | * nothing. |
---|
735 | */ |
---|
736 | extern bool |
---|
737 | xen_vm_remove_from_other_config(xen_session *session, xen_vm vm, char *key); |
---|
738 | |
---|
739 | |
---|
740 | /** |
---|
741 | * Clones the specified VM, making a new VM. Clone automatically |
---|
742 | * exploits the capabilities of the underlying storage repository in which the |
---|
743 | * VM's disk images are stored (e.g. Copy on Write). This function can only |
---|
744 | * be called when the VM is in the Halted State. |
---|
745 | */ |
---|
746 | extern bool |
---|
747 | xen_vm_clone(xen_session *session, xen_vm *result, xen_vm vm, char *new_name); |
---|
748 | |
---|
749 | |
---|
750 | /** |
---|
751 | * Start the specified VM. This function can only be called with the |
---|
752 | * VM is in the Halted State. |
---|
753 | */ |
---|
754 | extern bool |
---|
755 | xen_vm_start(xen_session *session, xen_vm vm, bool start_paused); |
---|
756 | |
---|
757 | |
---|
758 | /** |
---|
759 | * Pause the specified VM. This can only be called when the specified |
---|
760 | * VM is in the Running state. |
---|
761 | */ |
---|
762 | extern bool |
---|
763 | xen_vm_pause(xen_session *session, xen_vm vm); |
---|
764 | |
---|
765 | |
---|
766 | /** |
---|
767 | * Resume the specified VM. This can only be called when the specified |
---|
768 | * VM is in the Paused state. |
---|
769 | */ |
---|
770 | extern bool |
---|
771 | xen_vm_unpause(xen_session *session, xen_vm vm); |
---|
772 | |
---|
773 | |
---|
774 | /** |
---|
775 | * Attempt to cleanly shutdown the specified VM. (Note: this may not be |
---|
776 | * supported---e.g. if a guest agent is not installed). |
---|
777 | * |
---|
778 | * Once shutdown has been completed perform poweroff action specified in guest |
---|
779 | * configuration. |
---|
780 | * |
---|
781 | * This can only be called when the specified VM is in the Running state. |
---|
782 | */ |
---|
783 | extern bool |
---|
784 | xen_vm_clean_shutdown(xen_session *session, xen_vm vm); |
---|
785 | |
---|
786 | |
---|
787 | /** |
---|
788 | * Attempt to cleanly shutdown the specified VM (Note: this may not be |
---|
789 | * supported---e.g. if a guest agent is not installed). |
---|
790 | * |
---|
791 | * Once shutdown has been completed perform reboot action specified in guest |
---|
792 | * configuration. |
---|
793 | * |
---|
794 | * This can only be called when the specified VM is in the Running state. |
---|
795 | */ |
---|
796 | extern bool |
---|
797 | xen_vm_clean_reboot(xen_session *session, xen_vm vm); |
---|
798 | |
---|
799 | |
---|
800 | /** |
---|
801 | * Stop executing the specified VM without attempting a clean shutdown. |
---|
802 | * Then perform poweroff action specified in VM configuration. |
---|
803 | */ |
---|
804 | extern bool |
---|
805 | xen_vm_hard_shutdown(xen_session *session, xen_vm vm); |
---|
806 | |
---|
807 | |
---|
808 | /** |
---|
809 | * Stop executing the specified VM without attempting a clean shutdown. |
---|
810 | * Then perform reboot action specified in VM configuration |
---|
811 | */ |
---|
812 | extern bool |
---|
813 | xen_vm_hard_reboot(xen_session *session, xen_vm vm); |
---|
814 | |
---|
815 | |
---|
816 | /** |
---|
817 | * Suspend the specified VM to disk. This can only be called when the |
---|
818 | * specified VM is in the Running state. |
---|
819 | */ |
---|
820 | extern bool |
---|
821 | xen_vm_suspend(xen_session *session, xen_vm vm); |
---|
822 | |
---|
823 | |
---|
824 | /** |
---|
825 | * Awaken the specified VM and resume it. This can only be called when |
---|
826 | * the specified VM is in the Suspended state. |
---|
827 | */ |
---|
828 | extern bool |
---|
829 | xen_vm_resume(xen_session *session, xen_vm vm, bool start_paused); |
---|
830 | |
---|
831 | |
---|
832 | /** |
---|
833 | * Set this VM's VCPUs/at_startup value, and set the same value on the |
---|
834 | * VM, if running |
---|
835 | */ |
---|
836 | extern bool |
---|
837 | xen_vm_set_vcpus_number_live(xen_session *session, xen_vm self, int64_t nvcpu); |
---|
838 | |
---|
839 | |
---|
840 | /** |
---|
841 | * Add the given key-value pair to VM.VCPUs_params, and apply that |
---|
842 | * value on the running VM. |
---|
843 | */ |
---|
844 | extern bool |
---|
845 | xen_vm_add_to_vcpus_params_live(xen_session *session, xen_vm self, char *key, char *value); |
---|
846 | |
---|
847 | |
---|
848 | /** |
---|
849 | * Set memory_dynamic_max in database and on running VM. |
---|
850 | */ |
---|
851 | extern bool |
---|
852 | xen_vm_set_memory_dynamic_max_live(xen_session *session, xen_vm self, int64_t max); |
---|
853 | |
---|
854 | |
---|
855 | /** |
---|
856 | * Set memory_dynamic_min in database and on running VM. |
---|
857 | */ |
---|
858 | extern bool |
---|
859 | xen_vm_set_memory_dynamic_min_live(xen_session *session, xen_vm self, int64_t min); |
---|
860 | |
---|
861 | |
---|
862 | /** |
---|
863 | * Send the given key as a sysrq to this VM. The key is specified as a |
---|
864 | * single character (a String of length 1). This can only be called when the |
---|
865 | * specified VM is in the Running state. |
---|
866 | */ |
---|
867 | extern bool |
---|
868 | xen_vm_send_sysrq(xen_session *session, xen_vm vm, char *key); |
---|
869 | |
---|
870 | |
---|
871 | /** |
---|
872 | * Send the named trigger to this VM. This can only be called when the |
---|
873 | * specified VM is in the Running state. |
---|
874 | */ |
---|
875 | extern bool |
---|
876 | xen_vm_send_trigger(xen_session *session, xen_vm vm, char *trigger); |
---|
877 | |
---|
878 | |
---|
879 | /** |
---|
880 | * Migrate the VM to another host. This can only be called when the |
---|
881 | * specified VM is in the Running state. |
---|
882 | */ |
---|
883 | extern bool |
---|
884 | xen_vm_migrate(xen_session *session, xen_vm vm, char *dest, bool live, xen_string_string_map *options); |
---|
885 | |
---|
886 | |
---|
887 | /** |
---|
888 | * Return a list of all the VMs known to the system. |
---|
889 | */ |
---|
890 | extern bool |
---|
891 | xen_vm_get_all(xen_session *session, struct xen_vm_set **result); |
---|
892 | |
---|
893 | |
---|
894 | #endif |
---|