1 /* 2 * libvirt-domain.h 3 * Summary: APIs for management of domains 4 * Description: Provides APIs for the management of domains 5 * 6 * Copyright (C) 2006-2015 Red Hat, Inc. 7 * 8 * This library is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU Lesser General Public 10 * License as published by the Free Software Foundation; either 11 * version 2.1 of the License, or (at your option) any later version. 12 * 13 * This library is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16 * Lesser General Public License for more details. 17 * 18 * You should have received a copy of the GNU Lesser General Public 19 * License along with this library. If not, see 20 * <http://www.gnu.org/licenses/>. 21 */ 22 23 #ifndef LIBVIRT_DOMAIN_H 24 # define LIBVIRT_DOMAIN_H 25 26 # ifndef __VIR_LIBVIRT_H_INCLUDES__ 27 # error "Don't include this file directly, only use libvirt/libvirt.h" 28 # endif 29 30 31 /** 32 * virDomain: 33 * 34 * a virDomain is a private structure representing a domain. 35 */ 36 typedef struct _virDomain virDomain; 37 38 /** 39 * virDomainPtr: 40 * 41 * a virDomainPtr is pointer to a virDomain private structure, this is the 42 * type used to reference a domain in the API. 43 */ 44 typedef virDomain *virDomainPtr; 45 46 /** 47 * virDomainState: 48 * 49 * A domain may be in different states at a given point in time 50 */ 51 typedef enum { 52 VIR_DOMAIN_NOSTATE = 0, /* no state */ 53 VIR_DOMAIN_RUNNING = 1, /* the domain is running */ 54 VIR_DOMAIN_BLOCKED = 2, /* the domain is blocked on resource */ 55 VIR_DOMAIN_PAUSED = 3, /* the domain is paused by user */ 56 VIR_DOMAIN_SHUTDOWN= 4, /* the domain is being shut down */ 57 VIR_DOMAIN_SHUTOFF = 5, /* the domain is shut off */ 58 VIR_DOMAIN_CRASHED = 6, /* the domain is crashed */ 59 VIR_DOMAIN_PMSUSPENDED = 7, /* the domain is suspended by guest 60 power management */ 61 62 # ifdef VIR_ENUM_SENTINELS 63 VIR_DOMAIN_LAST 64 /* 65 * NB: this enum value will increase over time as new events are 66 * added to the libvirt API. It reflects the last state supported 67 * by this version of the libvirt API. 68 */ 69 # endif 70 } virDomainState; 71 72 typedef enum { 73 VIR_DOMAIN_NOSTATE_UNKNOWN = 0, 74 75 # ifdef VIR_ENUM_SENTINELS 76 VIR_DOMAIN_NOSTATE_LAST 77 # endif 78 } virDomainNostateReason; 79 80 typedef enum { 81 VIR_DOMAIN_RUNNING_UNKNOWN = 0, 82 VIR_DOMAIN_RUNNING_BOOTED = 1, /* normal startup from boot */ 83 VIR_DOMAIN_RUNNING_MIGRATED = 2, /* migrated from another host */ 84 VIR_DOMAIN_RUNNING_RESTORED = 3, /* restored from a state file */ 85 VIR_DOMAIN_RUNNING_FROM_SNAPSHOT = 4, /* restored from snapshot */ 86 VIR_DOMAIN_RUNNING_UNPAUSED = 5, /* returned from paused state */ 87 VIR_DOMAIN_RUNNING_MIGRATION_CANCELED = 6, /* returned from migration */ 88 VIR_DOMAIN_RUNNING_SAVE_CANCELED = 7, /* returned from failed save process */ 89 VIR_DOMAIN_RUNNING_WAKEUP = 8, /* returned from pmsuspended due to 90 wakeup event */ 91 VIR_DOMAIN_RUNNING_CRASHED = 9, /* resumed from crashed */ 92 VIR_DOMAIN_RUNNING_POSTCOPY = 10, /* running in post-copy migration mode */ 93 94 # ifdef VIR_ENUM_SENTINELS 95 VIR_DOMAIN_RUNNING_LAST 96 # endif 97 } virDomainRunningReason; 98 99 typedef enum { 100 VIR_DOMAIN_BLOCKED_UNKNOWN = 0, /* the reason is unknown */ 101 102 # ifdef VIR_ENUM_SENTINELS 103 VIR_DOMAIN_BLOCKED_LAST 104 # endif 105 } virDomainBlockedReason; 106 107 typedef enum { 108 VIR_DOMAIN_PAUSED_UNKNOWN = 0, /* the reason is unknown */ 109 VIR_DOMAIN_PAUSED_USER = 1, /* paused on user request */ 110 VIR_DOMAIN_PAUSED_MIGRATION = 2, /* paused for offline migration */ 111 VIR_DOMAIN_PAUSED_SAVE = 3, /* paused for save */ 112 VIR_DOMAIN_PAUSED_DUMP = 4, /* paused for offline core dump */ 113 VIR_DOMAIN_PAUSED_IOERROR = 5, /* paused due to a disk I/O error */ 114 VIR_DOMAIN_PAUSED_WATCHDOG = 6, /* paused due to a watchdog event */ 115 VIR_DOMAIN_PAUSED_FROM_SNAPSHOT = 7, /* paused after restoring from snapshot */ 116 VIR_DOMAIN_PAUSED_SHUTTING_DOWN = 8, /* paused during shutdown process */ 117 VIR_DOMAIN_PAUSED_SNAPSHOT = 9, /* paused while creating a snapshot */ 118 VIR_DOMAIN_PAUSED_CRASHED = 10, /* paused due to a guest crash */ 119 VIR_DOMAIN_PAUSED_STARTING_UP = 11, /* the domain is being started */ 120 VIR_DOMAIN_PAUSED_POSTCOPY = 12, /* paused for post-copy migration */ 121 VIR_DOMAIN_PAUSED_POSTCOPY_FAILED = 13, /* paused after failed post-copy */ 122 123 # ifdef VIR_ENUM_SENTINELS 124 VIR_DOMAIN_PAUSED_LAST 125 # endif 126 } virDomainPausedReason; 127 128 typedef enum { 129 VIR_DOMAIN_SHUTDOWN_UNKNOWN = 0, /* the reason is unknown */ 130 VIR_DOMAIN_SHUTDOWN_USER = 1, /* shutting down on user request */ 131 132 # ifdef VIR_ENUM_SENTINELS 133 VIR_DOMAIN_SHUTDOWN_LAST 134 # endif 135 } virDomainShutdownReason; 136 137 typedef enum { 138 VIR_DOMAIN_SHUTOFF_UNKNOWN = 0, /* the reason is unknown */ 139 VIR_DOMAIN_SHUTOFF_SHUTDOWN = 1, /* normal shutdown */ 140 VIR_DOMAIN_SHUTOFF_DESTROYED = 2, /* forced poweroff */ 141 VIR_DOMAIN_SHUTOFF_CRASHED = 3, /* domain crashed */ 142 VIR_DOMAIN_SHUTOFF_MIGRATED = 4, /* migrated to another host */ 143 VIR_DOMAIN_SHUTOFF_SAVED = 5, /* saved to a file */ 144 VIR_DOMAIN_SHUTOFF_FAILED = 6, /* domain failed to start */ 145 VIR_DOMAIN_SHUTOFF_FROM_SNAPSHOT = 7, /* restored from a snapshot which was 146 * taken while domain was shutoff */ 147 VIR_DOMAIN_SHUTOFF_DAEMON = 8, /* daemon decides to kill domain 148 during reconnection processing */ 149 # ifdef VIR_ENUM_SENTINELS 150 VIR_DOMAIN_SHUTOFF_LAST 151 # endif 152 } virDomainShutoffReason; 153 154 typedef enum { 155 VIR_DOMAIN_CRASHED_UNKNOWN = 0, /* crashed for unknown reason */ 156 VIR_DOMAIN_CRASHED_PANICKED = 1, /* domain panicked */ 157 158 # ifdef VIR_ENUM_SENTINELS 159 VIR_DOMAIN_CRASHED_LAST 160 # endif 161 } virDomainCrashedReason; 162 163 typedef enum { 164 VIR_DOMAIN_PMSUSPENDED_UNKNOWN = 0, 165 166 # ifdef VIR_ENUM_SENTINELS 167 VIR_DOMAIN_PMSUSPENDED_LAST 168 # endif 169 } virDomainPMSuspendedReason; 170 171 typedef enum { 172 VIR_DOMAIN_PMSUSPENDED_DISK_UNKNOWN = 0, 173 174 # ifdef VIR_ENUM_SENTINELS 175 VIR_DOMAIN_PMSUSPENDED_DISK_LAST 176 # endif 177 } virDomainPMSuspendedDiskReason; 178 179 /** 180 * virDomainControlState: 181 * 182 * Current state of a control interface to the domain. 183 */ 184 typedef enum { 185 VIR_DOMAIN_CONTROL_OK = 0, /* operational, ready to accept commands */ 186 VIR_DOMAIN_CONTROL_JOB = 1, /* background job is running (can be 187 monitored by virDomainGetJobInfo); only 188 limited set of commands may be allowed */ 189 VIR_DOMAIN_CONTROL_OCCUPIED = 2, /* occupied by a running command */ 190 VIR_DOMAIN_CONTROL_ERROR = 3, /* unusable, domain cannot be fully 191 operated, possible reason is provided 192 in the details field */ 193 194 # ifdef VIR_ENUM_SENTINELS 195 VIR_DOMAIN_CONTROL_LAST 196 # endif 197 } virDomainControlState; 198 199 /** 200 * virDomainControlErrorReason: 201 * 202 * Reason for the error state. 203 */ 204 typedef enum { 205 VIR_DOMAIN_CONTROL_ERROR_REASON_NONE = 0, /* server didn't provide a 206 reason */ 207 VIR_DOMAIN_CONTROL_ERROR_REASON_UNKNOWN = 1, /* unknown reason for the 208 error */ 209 VIR_DOMAIN_CONTROL_ERROR_REASON_MONITOR = 2, /* monitor connection is 210 broken */ 211 VIR_DOMAIN_CONTROL_ERROR_REASON_INTERNAL = 3, /* error caused due to 212 internal failure in libvirt 213 */ 214 # ifdef VIR_ENUM_SENTINELS 215 VIR_DOMAIN_CONTROL_ERROR_REASON_LAST 216 # endif 217 } virDomainControlErrorReason; 218 219 /** 220 * virDomainControlInfo: 221 * 222 * Structure filled in by virDomainGetControlInfo and providing details about 223 * current state of control interface to a domain. 224 */ 225 typedef struct _virDomainControlInfo virDomainControlInfo; 226 struct _virDomainControlInfo { 227 unsigned int state; /* control state, one of virDomainControlState */ 228 unsigned int details; /* state details, currently 0 except for ERROR 229 state (one of virDomainControlErrorReason) */ 230 unsigned long long stateTime; /* for how long (in msec) control interface 231 has been in current state (except for OK 232 and ERROR states) */ 233 }; 234 235 /** 236 * virDomainControlInfoPtr: 237 * 238 * Pointer to virDomainControlInfo structure. 239 */ 240 typedef virDomainControlInfo *virDomainControlInfoPtr; 241 242 /** 243 * virDomainModificationImpact: 244 * 245 * Several modification APIs take flags to determine whether a change 246 * to the domain affects just the running instance, just the 247 * persistent definition, or both at the same time. The counterpart 248 * query APIs also take the same flags to determine whether to query 249 * the running instance or persistent definition, although both cannot 250 * be queried at once. 251 * 252 * The use of VIR_DOMAIN_AFFECT_CURRENT will resolve to either 253 * VIR_DOMAIN_AFFECT_LIVE or VIR_DOMAIN_AFFECT_CONFIG according to 254 * current domain state. VIR_DOMAIN_AFFECT_LIVE requires a running 255 * domain, and VIR_DOMAIN_AFFECT_CONFIG requires a persistent domain 256 * (whether or not it is running). 257 * 258 * These enums should not conflict with those of virTypedParameterFlags. 259 */ 260 typedef enum { 261 VIR_DOMAIN_AFFECT_CURRENT = 0, /* Affect current domain state. */ 262 VIR_DOMAIN_AFFECT_LIVE = 1 << 0, /* Affect running domain state. */ 263 VIR_DOMAIN_AFFECT_CONFIG = 1 << 1, /* Affect persistent domain state. */ 264 /* 1 << 2 is reserved for virTypedParameterFlags */ 265 } virDomainModificationImpact; 266 267 /** 268 * virDomainInfoPtr: 269 * 270 * a virDomainInfo is a structure filled by virDomainGetInfo() and extracting 271 * runtime information for a given active Domain 272 */ 273 274 typedef struct _virDomainInfo virDomainInfo; 275 276 struct _virDomainInfo { 277 unsigned char state; /* the running state, one of virDomainState */ 278 unsigned long maxMem; /* the maximum memory in KBytes allowed */ 279 unsigned long memory; /* the memory in KBytes used by the domain */ 280 unsigned short nrVirtCpu; /* the number of virtual CPUs for the domain */ 281 unsigned long long cpuTime; /* the CPU time used in nanoseconds */ 282 }; 283 284 /** 285 * virDomainInfoPtr: 286 * 287 * a virDomainInfoPtr is a pointer to a virDomainInfo structure. 288 */ 289 290 typedef virDomainInfo *virDomainInfoPtr; 291 292 /** 293 * virDomainCreateFlags: 294 * 295 * Flags OR'ed together to provide specific behaviour when creating a 296 * Domain. 297 */ 298 typedef enum { 299 VIR_DOMAIN_NONE = 0, /* Default behavior */ 300 VIR_DOMAIN_START_PAUSED = 1 << 0, /* Launch guest in paused state */ 301 VIR_DOMAIN_START_AUTODESTROY = 1 << 1, /* Automatically kill guest when virConnectPtr is closed */ 302 VIR_DOMAIN_START_BYPASS_CACHE = 1 << 2, /* Avoid file system cache pollution */ 303 VIR_DOMAIN_START_FORCE_BOOT = 1 << 3, /* Boot, discarding any managed save */ 304 VIR_DOMAIN_START_VALIDATE = 1 << 4, /* Validate the XML document against schema */ 305 } virDomainCreateFlags; 306 307 308 /* Management of scheduler parameters */ 309 310 /** 311 * VIR_DOMAIN_SCHEDULER_CPU_SHARES: 312 * 313 * Macro represents proportional weight of the scheduler used on the 314 * host cpu, when using the posix scheduler, as a ullong. 315 */ 316 # define VIR_DOMAIN_SCHEDULER_CPU_SHARES "cpu_shares" 317 318 /** 319 * VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD: 320 * 321 * Macro represents the enforcement period for a quota, in microseconds, 322 * for whole domain, when using the posix scheduler, as a ullong. 323 */ 324 # define VIR_DOMAIN_SCHEDULER_GLOBAL_PERIOD "global_period" 325 326 /** 327 * VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA: 328 * 329 * Macro represents the maximum bandwidth to be used within a period for 330 * whole domain, when using the posix scheduler, as an llong. 331 */ 332 # define VIR_DOMAIN_SCHEDULER_GLOBAL_QUOTA "global_quota" 333 334 /** 335 * VIR_DOMAIN_SCHEDULER_VCPU_PERIOD: 336 * 337 * Macro represents the enforcement period for a quota, in microseconds, 338 * for vcpus only, when using the posix scheduler, as a ullong. 339 */ 340 # define VIR_DOMAIN_SCHEDULER_VCPU_PERIOD "vcpu_period" 341 342 /** 343 * VIR_DOMAIN_SCHEDULER_VCPU_QUOTA: 344 * 345 * Macro represents the maximum bandwidth to be used within a period for 346 * vcpus only, when using the posix scheduler, as an llong. 347 */ 348 # define VIR_DOMAIN_SCHEDULER_VCPU_QUOTA "vcpu_quota" 349 350 /** 351 * VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD: 352 * 353 * Macro represents the enforcement period for a quota in microseconds, 354 * when using the posix scheduler, for all emulator activity not tied to 355 * vcpus, as a ullong. 356 */ 357 # define VIR_DOMAIN_SCHEDULER_EMULATOR_PERIOD "emulator_period" 358 359 /** 360 * VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA: 361 * 362 * Macro represents the maximum bandwidth to be used within a period for 363 * all emulator activity not tied to vcpus, when using the posix scheduler, 364 * as an llong. 365 */ 366 # define VIR_DOMAIN_SCHEDULER_EMULATOR_QUOTA "emulator_quota" 367 368 /** 369 * VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD: 370 * 371 * Macro represents the enforcement period for a quota, in microseconds, 372 * for IOThreads only, when using the posix scheduler, as a ullong. 373 */ 374 # define VIR_DOMAIN_SCHEDULER_IOTHREAD_PERIOD "iothread_period" 375 376 /** 377 * VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA: 378 * 379 * Macro represents the maximum bandwidth to be used within a period for 380 * IOThreads only, when using the posix scheduler, as an llong. 381 */ 382 # define VIR_DOMAIN_SCHEDULER_IOTHREAD_QUOTA "iothread_quota" 383 384 /** 385 * VIR_DOMAIN_SCHEDULER_WEIGHT: 386 * 387 * Macro represents the relative weight, when using the credit 388 * scheduler, as a uint. 389 */ 390 # define VIR_DOMAIN_SCHEDULER_WEIGHT "weight" 391 392 /** 393 * VIR_DOMAIN_SCHEDULER_CAP: 394 * 395 * Macro represents the maximum scheduler cap, when using the credit 396 * scheduler, as a uint. 397 */ 398 # define VIR_DOMAIN_SCHEDULER_CAP "cap" 399 400 /** 401 * VIR_DOMAIN_SCHEDULER_RESERVATION: 402 * 403 * Macro represents the scheduler reservation value, when using the 404 * allocation scheduler, as an llong. 405 */ 406 # define VIR_DOMAIN_SCHEDULER_RESERVATION "reservation" 407 408 /** 409 * VIR_DOMAIN_SCHEDULER_LIMIT: 410 * 411 * Macro represents the scheduler limit value, when using the 412 * allocation scheduler, as an llong. 413 */ 414 # define VIR_DOMAIN_SCHEDULER_LIMIT "limit" 415 416 /** 417 * VIR_DOMAIN_SCHEDULER_SHARES: 418 * 419 * Macro represents the scheduler shares value, when using the 420 * allocation scheduler, as an int. 421 */ 422 # define VIR_DOMAIN_SCHEDULER_SHARES "shares" 423 424 /* 425 * Fetch scheduler parameters, caller allocates 'params' field of size 'nparams' 426 */ 427 int virDomainGetSchedulerParameters (virDomainPtr domain, 428 virTypedParameterPtr params, 429 int *nparams); 430 int virDomainGetSchedulerParametersFlags (virDomainPtr domain, 431 virTypedParameterPtr params, 432 int *nparams, 433 unsigned int flags); 434 435 /* 436 * Change scheduler parameters 437 */ 438 int virDomainSetSchedulerParameters (virDomainPtr domain, 439 virTypedParameterPtr params, 440 int nparams); 441 int virDomainSetSchedulerParametersFlags (virDomainPtr domain, 442 virTypedParameterPtr params, 443 int nparams, 444 unsigned int flags); 445 446 /** 447 * virDomainBlockStats: 448 * 449 * Block device stats for virDomainBlockStats. 450 * 451 * Hypervisors may return a field set to ((long long)-1) which indicates 452 * that the hypervisor does not support that statistic. 453 * 454 * NB. Here 'long long' means 64 bit integer. 455 */ 456 typedef struct _virDomainBlockStats virDomainBlockStatsStruct; 457 458 struct _virDomainBlockStats { 459 long long rd_req; /* number of read requests */ 460 long long rd_bytes; /* number of read bytes */ 461 long long wr_req; /* number of write requests */ 462 long long wr_bytes; /* number of written bytes */ 463 long long errs; /* In Xen this returns the mysterious 'oo_req'. */ 464 }; 465 466 /** 467 * virDomainBlockStatsPtr: 468 * 469 * A pointer to a virDomainBlockStats structure 470 */ 471 typedef virDomainBlockStatsStruct *virDomainBlockStatsPtr; 472 473 474 /** 475 * VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH: 476 * 477 * Macro providing the field length of parameter names when using 478 * virDomainBlockStatsFlags(). 479 */ 480 # define VIR_DOMAIN_BLOCK_STATS_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH 481 482 /** 483 * VIR_DOMAIN_BLOCK_STATS_READ_BYTES: 484 * 485 * Macro represents the total number of read bytes of the 486 * block device, as an llong. 487 */ 488 # define VIR_DOMAIN_BLOCK_STATS_READ_BYTES "rd_bytes" 489 490 /** 491 * VIR_DOMAIN_BLOCK_STATS_READ_REQ: 492 * 493 * Macro represents the total read requests of the 494 * block device, as an llong. 495 */ 496 # define VIR_DOMAIN_BLOCK_STATS_READ_REQ "rd_operations" 497 498 /** 499 * VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES: 500 * 501 * Macro represents the total time spend on cache reads in 502 * nano-seconds of the block device, as an llong. 503 */ 504 # define VIR_DOMAIN_BLOCK_STATS_READ_TOTAL_TIMES "rd_total_times" 505 506 /** 507 * VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES: 508 * 509 * Macro represents the total number of write bytes of the 510 * block device, as an llong. 511 */ 512 # define VIR_DOMAIN_BLOCK_STATS_WRITE_BYTES "wr_bytes" 513 514 /** 515 * VIR_DOMAIN_BLOCK_STATS_WRITE_REQ: 516 * 517 * Macro represents the total write requests of the 518 * block device, as an llong. 519 */ 520 # define VIR_DOMAIN_BLOCK_STATS_WRITE_REQ "wr_operations" 521 522 /** 523 * VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES: 524 * 525 * Macro represents the total time spend on cache writes in 526 * nano-seconds of the block device, as an llong. 527 */ 528 # define VIR_DOMAIN_BLOCK_STATS_WRITE_TOTAL_TIMES "wr_total_times" 529 530 /** 531 * VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ: 532 * 533 * Macro represents the total flush requests of the 534 * block device, as an llong. 535 */ 536 # define VIR_DOMAIN_BLOCK_STATS_FLUSH_REQ "flush_operations" 537 538 /** 539 * VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES: 540 * 541 * Macro represents the total time spend on cache flushing in 542 * nano-seconds of the block device, as an llong. 543 */ 544 # define VIR_DOMAIN_BLOCK_STATS_FLUSH_TOTAL_TIMES "flush_total_times" 545 546 /** 547 * VIR_DOMAIN_BLOCK_STATS_ERRS: 548 * 549 * In Xen this returns the mysterious 'oo_req', as an llong. 550 */ 551 # define VIR_DOMAIN_BLOCK_STATS_ERRS "errs" 552 553 /** 554 * virDomainInterfaceStats: 555 * 556 * Network interface stats for virDomainInterfaceStats. 557 * 558 * Hypervisors may return a field set to ((long long)-1) which indicates 559 * that the hypervisor does not support that statistic. 560 * 561 * NB. Here 'long long' means 64 bit integer. 562 */ 563 typedef struct _virDomainInterfaceStats virDomainInterfaceStatsStruct; 564 565 struct _virDomainInterfaceStats { 566 long long rx_bytes; 567 long long rx_packets; 568 long long rx_errs; 569 long long rx_drop; 570 long long tx_bytes; 571 long long tx_packets; 572 long long tx_errs; 573 long long tx_drop; 574 }; 575 576 /** 577 * virDomainInterfaceStatsPtr: 578 * 579 * A pointer to a virDomainInterfaceStats structure 580 */ 581 typedef virDomainInterfaceStatsStruct *virDomainInterfaceStatsPtr; 582 583 /** 584 * Memory Statistics Tags: 585 */ 586 typedef enum { 587 /* The total amount of data read from swap space (in kB). */ 588 VIR_DOMAIN_MEMORY_STAT_SWAP_IN = 0, 589 /* The total amount of memory written out to swap space (in kB). */ 590 VIR_DOMAIN_MEMORY_STAT_SWAP_OUT = 1, 591 592 /* 593 * Page faults occur when a process makes a valid access to virtual memory 594 * that is not available. When servicing the page fault, if disk IO is 595 * required, it is considered a major fault. If not, it is a minor fault. 596 * These are expressed as the number of faults that have occurred. 597 */ 598 VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT = 2, 599 VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT = 3, 600 601 /* 602 * The amount of memory left completely unused by the system. Memory that 603 * is available but used for reclaimable caches should NOT be reported as 604 * free. This value is expressed in kB. 605 */ 606 VIR_DOMAIN_MEMORY_STAT_UNUSED = 4, 607 608 /* 609 * The total amount of usable memory as seen by the domain. This value 610 * may be less than the amount of memory assigned to the domain if a 611 * balloon driver is in use or if the guest OS does not initialize all 612 * assigned pages. This value is expressed in kB. 613 */ 614 VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5, 615 616 /* Current balloon value (in KB). */ 617 VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6, 618 619 /* Resident Set Size of the process running the domain. This value 620 * is in kB */ 621 VIR_DOMAIN_MEMORY_STAT_RSS = 7, 622 623 /* 624 * How much the balloon can be inflated without pushing the guest system 625 * to swap, corresponds to 'Available' in /proc/meminfo 626 */ 627 VIR_DOMAIN_MEMORY_STAT_USABLE = 8, 628 629 /* Timestamp of the last update of statistics, in seconds. */ 630 VIR_DOMAIN_MEMORY_STAT_LAST_UPDATE = 9, 631 632 /* 633 * The amount of memory, that can be quickly reclaimed without 634 * additional I/O (in kB). Typically these pages are used for caching files 635 * from disk. 636 */ 637 VIR_DOMAIN_MEMORY_STAT_DISK_CACHES = 10, 638 639 /* 640 * The number of successful huge page allocations from inside the domain via 641 * virtio balloon. 642 */ 643 VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGALLOC = 11, 644 645 /* 646 * The number of failed huge page allocations from inside the domain via 647 * virtio balloon. 648 */ 649 VIR_DOMAIN_MEMORY_STAT_HUGETLB_PGFAIL = 12, 650 651 /* 652 * The number of statistics supported by this version of the interface. 653 * To add new statistics, add them to the enum and increase this value. 654 */ 655 VIR_DOMAIN_MEMORY_STAT_NR = 13, 656 657 # ifdef VIR_ENUM_SENTINELS 658 VIR_DOMAIN_MEMORY_STAT_LAST = VIR_DOMAIN_MEMORY_STAT_NR 659 # endif 660 } virDomainMemoryStatTags; 661 662 typedef struct _virDomainMemoryStat virDomainMemoryStatStruct; 663 664 struct _virDomainMemoryStat { 665 int tag; 666 unsigned long long val; 667 }; 668 669 typedef virDomainMemoryStatStruct *virDomainMemoryStatPtr; 670 671 672 /* Domain core dump flags. */ 673 typedef enum { 674 VIR_DUMP_CRASH = (1 << 0), /* crash after dump */ 675 VIR_DUMP_LIVE = (1 << 1), /* live dump */ 676 VIR_DUMP_BYPASS_CACHE = (1 << 2), /* avoid file system cache pollution */ 677 VIR_DUMP_RESET = (1 << 3), /* reset domain after dump finishes */ 678 VIR_DUMP_MEMORY_ONLY = (1 << 4), /* use dump-guest-memory */ 679 } virDomainCoreDumpFlags; 680 681 /** 682 * virDomainCoreDumpFormat: 683 * 684 * Values for specifying different formats of domain core dumps. 685 */ 686 typedef enum { 687 VIR_DOMAIN_CORE_DUMP_FORMAT_RAW, /* dump guest memory in raw format */ 688 VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB, /* kdump-compressed format, with 689 * zlib compression */ 690 VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO, /* kdump-compressed format, with 691 * lzo compression */ 692 VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY, /* kdump-compressed format, with 693 * snappy compression */ 694 VIR_DOMAIN_CORE_DUMP_FORMAT_WIN_DMP, /* Windows full crashdump format */ 695 # ifdef VIR_ENUM_SENTINELS 696 VIR_DOMAIN_CORE_DUMP_FORMAT_LAST 697 /* 698 * NB: this enum value will increase over time as new formats are 699 * added to the libvirt API. It reflects the last state supported 700 * by this version of the libvirt API. 701 */ 702 # endif 703 } virDomainCoreDumpFormat; 704 705 /* Domain migration flags. */ 706 typedef enum { 707 /* Do not pause the domain during migration. The domain's memory will 708 * be transferred to the destination host while the domain is running. 709 * The migration may never converge if the domain is changing its memory 710 * faster then it can be transferred. The domain can be manually paused 711 * anytime during migration using virDomainSuspend. 712 */ 713 VIR_MIGRATE_LIVE = (1 << 0), 714 715 /* Tell the source libvirtd to connect directly to the destination host. 716 * Without this flag the client (e.g., virsh) connects to both hosts and 717 * controls the migration process. In peer-to-peer mode, the source 718 * libvirtd controls the migration by calling the destination daemon 719 * directly. 720 */ 721 VIR_MIGRATE_PEER2PEER = (1 << 1), 722 723 /* Tunnel migration data over libvirtd connection. Without this flag the 724 * source hypervisor sends migration data directly to the destination 725 * hypervisor. This flag can only be used when VIR_MIGRATE_PEER2PEER is 726 * set as well. 727 * 728 * Note the less-common spelling that we're stuck with: 729 * VIR_MIGRATE_TUNNELLED should be VIR_MIGRATE_TUNNELED. 730 */ 731 VIR_MIGRATE_TUNNELLED = (1 << 2), 732 733 /* Define the domain as persistent on the destination host after successful 734 * migration. If the domain was persistent on the source host and 735 * VIR_MIGRATE_UNDEFINE_SOURCE is not used, it will end up persistent on 736 * both hosts. 737 */ 738 VIR_MIGRATE_PERSIST_DEST = (1 << 3), 739 740 /* Undefine the domain on the source host once migration successfully 741 * finishes. 742 */ 743 VIR_MIGRATE_UNDEFINE_SOURCE = (1 << 4), 744 745 /* Leave the domain suspended on the destination host. virDomainResume (on 746 * the virDomainPtr returned by the migration API) has to be called 747 * explicitly to resume domain's virtual CPUs. 748 */ 749 VIR_MIGRATE_PAUSED = (1 << 5), 750 751 /* Migrate full disk images in addition to domain's memory. By default 752 * only non-shared non-readonly disk images are transferred. The 753 * VIR_MIGRATE_PARAM_MIGRATE_DISKS parameter can be used to specify which 754 * disks should be migrated. 755 * 756 * This flag and VIR_MIGRATE_NON_SHARED_INC are mutually exclusive. 757 */ 758 VIR_MIGRATE_NON_SHARED_DISK = (1 << 6), 759 760 /* Migrate disk images in addition to domain's memory. This is similar to 761 * VIR_MIGRATE_NON_SHARED_DISK, but only the top level of each disk's 762 * backing chain is copied. That is, the rest of the backing chain is 763 * expected to be present on the destination and to be exactly the same as 764 * on the source host. 765 * 766 * This flag and VIR_MIGRATE_NON_SHARED_DISK are mutually exclusive. 767 */ 768 VIR_MIGRATE_NON_SHARED_INC = (1 << 7), 769 770 /* Protect against domain configuration changes during the migration 771 * process. This flag is used automatically when both sides support it. 772 * Explicitly setting this flag will cause migration to fail if either the 773 * source or the destination does not support it. 774 */ 775 VIR_MIGRATE_CHANGE_PROTECTION = (1 << 8), 776 777 /* Force migration even if it is considered unsafe. In some cases libvirt 778 * may refuse to migrate the domain because doing so may lead to potential 779 * problems such as data corruption, and thus the migration is considered 780 * unsafe. For a QEMU domain this may happen if the domain uses disks 781 * without explicitly setting cache mode to "none". Migrating such domains 782 * is unsafe unless the disk images are stored on coherent clustered 783 * filesystem, such as GFS2 or GPFS. 784 */ 785 VIR_MIGRATE_UNSAFE = (1 << 9), 786 787 /* Migrate a domain definition without starting the domain on the 788 * destination and without stopping it on the source host. Offline 789 * migration requires VIR_MIGRATE_PERSIST_DEST to be set. 790 * 791 * Offline migration may not copy disk storage or any other file based 792 * storage (such as UEFI variables). 793 */ 794 VIR_MIGRATE_OFFLINE = (1 << 10), 795 796 /* Compress migration data. The compression methods can be specified using 797 * VIR_MIGRATE_PARAM_COMPRESSION. A hypervisor default method will be used 798 * if this parameter is omitted. Individual compression methods can be 799 * tuned via their specific VIR_MIGRATE_PARAM_COMPRESSION_* parameters. 800 */ 801 VIR_MIGRATE_COMPRESSED = (1 << 11), 802 803 /* Cancel migration if a soft error (such as I/O error) happens during 804 * migration. 805 */ 806 VIR_MIGRATE_ABORT_ON_ERROR = (1 << 12), 807 808 /* Enable algorithms that ensure a live migration will eventually converge. 809 * This usually means the domain will be slowed down to make sure it does 810 * not change its memory faster than a hypervisor can transfer the changed 811 * memory to the destination host. VIR_MIGRATE_PARAM_AUTO_CONVERGE_* 812 * parameters can be used to tune the algorithm. 813 */ 814 VIR_MIGRATE_AUTO_CONVERGE = (1 << 13), 815 816 /* This flag can be used with RDMA migration (i.e., when 817 * VIR_MIGRATE_PARAM_URI starts with "rdma://") to tell the hypervisor 818 * to pin all domain's memory at once before migration starts rather then 819 * letting it pin memory pages as needed. This means that all memory pages 820 * belonging to the domain will be locked in host's memory and the host 821 * will not be allowed to swap them out. 822 * 823 * For QEMU/KVM this requires hard_limit memory tuning element (in the 824 * domain XML) to be used and set to the maximum memory configured for the 825 * domain plus any memory consumed by the QEMU process itself. Beware of 826 * setting the memory limit too high (and thus allowing the domain to lock 827 * most of the host's memory). Doing so may be dangerous to both the 828 * domain and the host itself since the host's kernel may run out of 829 * memory. 830 */ 831 VIR_MIGRATE_RDMA_PIN_ALL = (1 << 14), 832 833 /* Setting the VIR_MIGRATE_POSTCOPY flag tells libvirt to enable post-copy 834 * migration. However, the migration will start normally and 835 * virDomainMigrateStartPostCopy needs to be called to switch it into the 836 * post-copy mode. See virDomainMigrateStartPostCopy for more details. 837 */ 838 VIR_MIGRATE_POSTCOPY = (1 << 15), 839 840 /* Setting the VIR_MIGRATE_TLS flag will cause the migration to attempt 841 * to use the TLS environment configured by the hypervisor in order to 842 * perform the migration. If incorrectly configured on either source or 843 * destination, the migration will fail. 844 */ 845 VIR_MIGRATE_TLS = (1 << 16), 846 847 /* Send memory pages to the destination host through several network 848 * connections. See VIR_MIGRATE_PARAM_PARALLEL_* parameters for 849 * configuring the parallel migration. 850 */ 851 VIR_MIGRATE_PARALLEL = (1 << 17), 852 853 } virDomainMigrateFlags; 854 855 856 /** 857 * VIR_MIGRATE_PARAM_URI: 858 * 859 * virDomainMigrate* params field: URI to use for initiating domain migration 860 * as VIR_TYPED_PARAM_STRING. It takes a hypervisor specific format. The 861 * uri_transports element of the hypervisor capabilities XML includes details 862 * of the supported URI schemes. When omitted libvirt will auto-generate 863 * suitable default URI. It is typically only necessary to specify this URI if 864 * the destination host has multiple interfaces and a specific interface is 865 * required to transmit migration data. 866 * 867 * This field may not be used when VIR_MIGRATE_TUNNELLED flag is set. 868 */ 869 # define VIR_MIGRATE_PARAM_URI "migrate_uri" 870 871 /** 872 * VIR_MIGRATE_PARAM_DEST_NAME: 873 * 874 * virDomainMigrate* params field: the name to be used for the domain on the 875 * destination host as VIR_TYPED_PARAM_STRING. Omitting this parameter keeps 876 * the domain name the same. This field is only allowed to be used with 877 * hypervisors that support domain renaming during migration. 878 */ 879 # define VIR_MIGRATE_PARAM_DEST_NAME "destination_name" 880 881 /** 882 * VIR_MIGRATE_PARAM_DEST_XML: 883 * 884 * virDomainMigrate* params field: the new configuration to be used for the 885 * domain on the destination host as VIR_TYPED_PARAM_STRING. The configuration 886 * must include an identical set of virtual devices, to ensure a stable guest 887 * ABI across migration. Only parameters related to host side configuration 888 * can be changed in the XML. Hypervisors which support this field will forbid 889 * migration if the provided XML would cause a change in the guest ABI. This 890 * field cannot be used to rename the domain during migration (use 891 * VIR_MIGRATE_PARAM_DEST_NAME field for that purpose). Domain name in the 892 * destination XML must match the original domain name. 893 * 894 * Omitting this parameter keeps the original domain configuration. Using this 895 * field with hypervisors that do not support changing domain configuration 896 * during migration will result in a failure. 897 */ 898 # define VIR_MIGRATE_PARAM_DEST_XML "destination_xml" 899 900 /** 901 * VIR_MIGRATE_PARAM_PERSIST_XML: 902 * 903 * virDomainMigrate* params field: the new persistent configuration to be used 904 * for the domain on the destination host as VIR_TYPED_PARAM_STRING. 905 * This field cannot be used to rename the domain during migration (use 906 * VIR_MIGRATE_PARAM_DEST_NAME field for that purpose). Domain name in the 907 * destination XML must match the original domain name. 908 * 909 * Omitting this parameter keeps the original domain persistent configuration. 910 * Using this field with hypervisors that do not support changing domain 911 * configuration during migration will result in a failure. 912 */ 913 # define VIR_MIGRATE_PARAM_PERSIST_XML "persistent_xml" 914 915 /** 916 * VIR_MIGRATE_PARAM_BANDWIDTH: 917 * 918 * virDomainMigrate* params field: the maximum bandwidth (in MiB/s) that will 919 * be used for migration as VIR_TYPED_PARAM_ULLONG. If set to 0 or omitted, 920 * libvirt will choose a suitable default. Some hypervisors do not support this 921 * feature and will return an error if this field is used and is not 0. 922 */ 923 # define VIR_MIGRATE_PARAM_BANDWIDTH "bandwidth" 924 925 /** 926 * VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY: 927 * 928 * virDomainMigrate* params field: the maximum bandwidth (in MiB/s) that will 929 * be used for post-copy phase of a migration as VIR_TYPED_PARAM_ULLONG. If set 930 * to 0 or omitted, post-copy migration speed will not be limited. 931 */ 932 # define VIR_MIGRATE_PARAM_BANDWIDTH_POSTCOPY "bandwidth.postcopy" 933 934 /** 935 * VIR_MIGRATE_PARAM_GRAPHICS_URI: 936 * 937 * virDomainMigrate* params field: URI to use for migrating client's connection 938 * to domain's graphical console as VIR_TYPED_PARAM_STRING. If specified, the 939 * client will be asked to automatically reconnect using these parameters 940 * instead of the automatically computed ones. This can be useful if, e.g., the 941 * client does not have a direct access to the network virtualization hosts are 942 * connected to and needs to connect through a proxy. The URI is formed as 943 * follows: 944 * 945 * protocol://hostname[:port]/[?parameters] 946 * 947 * where protocol is either "spice" or "vnc" and parameters is a list of 948 * protocol specific parameters separated by '&'. Currently recognized 949 * parameters are "tlsPort" and "tlsSubject". For example, 950 * 951 * spice://target.host.com:1234/?tlsPort=4567 952 */ 953 # define VIR_MIGRATE_PARAM_GRAPHICS_URI "graphics_uri" 954 955 /** 956 * VIR_MIGRATE_PARAM_LISTEN_ADDRESS: 957 * 958 * virDomainMigrate* params field: The listen address that hypervisor on the 959 * destination side should bind to for incoming migration. Both IPv4 and IPv6 960 * addresses are accepted as well as hostnames (the resolving is done on 961 * destination). Some hypervisors do not support this feature and will return 962 * an error if this field is used. 963 */ 964 # define VIR_MIGRATE_PARAM_LISTEN_ADDRESS "listen_address" 965 966 /** 967 * VIR_MIGRATE_PARAM_MIGRATE_DISKS: 968 * 969 * virDomainMigrate* params multiple field: The multiple values that list 970 * the block devices to be migrated. At the moment this is only supported 971 * by the QEMU driver but not for the tunnelled migration. 972 */ 973 # define VIR_MIGRATE_PARAM_MIGRATE_DISKS "migrate_disks" 974 975 /** 976 * VIR_MIGRATE_PARAM_DISKS_PORT: 977 * 978 * virDomainMigrate* params field: port that destination server should use 979 * for incoming disks migration. Type is VIR_TYPED_PARAM_INT. If set to 0 or 980 * omitted, libvirt will choose a suitable default. At the moment this is only 981 * supported by the QEMU driver. 982 */ 983 # define VIR_MIGRATE_PARAM_DISKS_PORT "disks_port" 984 985 /** 986 * VIR_MIGRATE_PARAM_DISKS_URI: 987 * 988 * virDomainMigrate* params field: URI used for incoming disks migration. Type 989 * is VIR_TYPED_PARAM_STRING. Only schemes "tcp" and "unix" are accepted. TCP 990 * URI can currently only provide a server and port to listen on (and connect 991 * to), UNIX URI may only provide a path component for a UNIX socket. This is 992 * currently only supported by the QEMU driver. UNIX URI is only usable if the 993 * management application makes sure that socket created with this name on the 994 * destination will be reachable from the source under the same exact path. 995 */ 996 # define VIR_MIGRATE_PARAM_DISKS_URI "disks_uri" 997 998 /** 999 * VIR_MIGRATE_PARAM_COMPRESSION: 1000 * 1001 * virDomainMigrate* params multiple field: name of the method used to 1002 * compress migration traffic. Supported compression methods: xbzrle, mt. 1003 * The parameter may be specified multiple times if more than one method 1004 * should be used. 1005 */ 1006 # define VIR_MIGRATE_PARAM_COMPRESSION "compression" 1007 1008 /** 1009 * VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL: 1010 * 1011 * virDomainMigrate* params field: the level of compression for multithread 1012 * compression as VIR_TYPED_PARAM_INT. Accepted values are in range 0-9. 1013 * 0 is no compression, 1 is maximum speed and 9 is maximum compression. 1014 */ 1015 # define VIR_MIGRATE_PARAM_COMPRESSION_MT_LEVEL "compression.mt.level" 1016 1017 /** 1018 * VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS: 1019 * 1020 * virDomainMigrate* params field: the number of compression threads for 1021 * multithread compression as VIR_TYPED_PARAM_INT. 1022 */ 1023 # define VIR_MIGRATE_PARAM_COMPRESSION_MT_THREADS "compression.mt.threads" 1024 1025 /** 1026 * VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS: 1027 * 1028 * virDomainMigrate* params field: the number of decompression threads for 1029 * multithread compression as VIR_TYPED_PARAM_INT. 1030 */ 1031 # define VIR_MIGRATE_PARAM_COMPRESSION_MT_DTHREADS "compression.mt.dthreads" 1032 1033 /** 1034 * VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE: 1035 * 1036 * virDomainMigrate* params field: the size of page cache for xbzrle 1037 * compression as VIR_TYPED_PARAM_ULLONG. 1038 */ 1039 # define VIR_MIGRATE_PARAM_COMPRESSION_XBZRLE_CACHE "compression.xbzrle.cache" 1040 1041 /** 1042 * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL: 1043 * 1044 * virDomainMigrate* params field: the initial percentage guest CPUs are 1045 * throttled to when auto-convergence decides migration is not converging. 1046 * As VIR_TYPED_PARAM_INT. 1047 */ 1048 # define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL "auto_converge.initial" 1049 1050 /** 1051 * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT: 1052 * 1053 * virDomainMigrate* params field: the increment added to 1054 * VIR_MIGRATE_PARAM_AUTO_CONVERGE_INITIAL whenever the hypervisor decides 1055 * the current rate is not enough to ensure convergence of the migration. 1056 * As VIR_TYPED_PARAM_INT. 1057 */ 1058 # define VIR_MIGRATE_PARAM_AUTO_CONVERGE_INCREMENT "auto_converge.increment" 1059 1060 /** 1061 * VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS: 1062 * 1063 * virDomainMigrate* params field: number of connections used during parallel 1064 * migration. As VIR_TYPED_PARAM_INT. 1065 */ 1066 # define VIR_MIGRATE_PARAM_PARALLEL_CONNECTIONS "parallel.connections" 1067 1068 /** 1069 * VIR_MIGRATE_PARAM_TLS_DESTINATION: 1070 * 1071 * virDomainMigrate* params field: override the destination host name used for 1072 * TLS verification. As VIR_TYPED_PARAM_STRING. 1073 * 1074 * Normally the TLS certificate from the destination host must match the host's 1075 * name for TLS verification to succeed. When the certificate does not match 1076 * the destination hostname and the expected certificate's hostname is known, 1077 * this parameter can be used to pass this expected hostname when starting 1078 * the migration. 1079 */ 1080 # define VIR_MIGRATE_PARAM_TLS_DESTINATION "tls.destination" 1081 1082 /* Domain migration. */ 1083 virDomainPtr virDomainMigrate (virDomainPtr domain, virConnectPtr dconn, 1084 unsigned long flags, const char *dname, 1085 const char *uri, unsigned long bandwidth); 1086 virDomainPtr virDomainMigrate2(virDomainPtr domain, virConnectPtr dconn, 1087 const char *dxml, 1088 unsigned long flags, const char *dname, 1089 const char *uri, unsigned long bandwidth); 1090 virDomainPtr virDomainMigrate3(virDomainPtr domain, 1091 virConnectPtr dconn, 1092 virTypedParameterPtr params, 1093 unsigned int nparams, 1094 unsigned int flags); 1095 1096 int virDomainMigrateToURI (virDomainPtr domain, const char *duri, 1097 unsigned long flags, const char *dname, 1098 unsigned long bandwidth); 1099 1100 int virDomainMigrateToURI2(virDomainPtr domain, 1101 const char *dconnuri, 1102 const char *miguri, 1103 const char *dxml, 1104 unsigned long flags, 1105 const char *dname, 1106 unsigned long bandwidth); 1107 int virDomainMigrateToURI3(virDomainPtr domain, 1108 const char *dconnuri, 1109 virTypedParameterPtr params, 1110 unsigned int nparams, 1111 unsigned int flags); 1112 1113 int virDomainMigrateGetMaxDowntime(virDomainPtr domain, 1114 unsigned long long *downtime, 1115 unsigned int flags); 1116 1117 int virDomainMigrateSetMaxDowntime (virDomainPtr domain, 1118 unsigned long long downtime, 1119 unsigned int flags); 1120 1121 int virDomainMigrateGetCompressionCache(virDomainPtr domain, 1122 unsigned long long *cacheSize, 1123 unsigned int flags); 1124 int virDomainMigrateSetCompressionCache(virDomainPtr domain, 1125 unsigned long long cacheSize, 1126 unsigned int flags); 1127 1128 /* Domain migration speed flags. */ 1129 typedef enum { 1130 /* Set or get maximum speed of post-copy migration. */ 1131 VIR_DOMAIN_MIGRATE_MAX_SPEED_POSTCOPY = (1 << 0), 1132 } virDomainMigrateMaxSpeedFlags; 1133 1134 int virDomainMigrateSetMaxSpeed(virDomainPtr domain, 1135 unsigned long bandwidth, 1136 unsigned int flags); 1137 1138 int virDomainMigrateGetMaxSpeed(virDomainPtr domain, 1139 unsigned long *bandwidth, 1140 unsigned int flags); 1141 1142 int virDomainMigrateStartPostCopy(virDomainPtr domain, 1143 unsigned int flags); 1144 1145 char * virConnectGetDomainCapabilities(virConnectPtr conn, 1146 const char *emulatorbin, 1147 const char *arch, 1148 const char *machine, 1149 const char *virttype, 1150 unsigned int flags); 1151 1152 /* 1153 * Gather list of running domains 1154 */ 1155 int virConnectListDomains (virConnectPtr conn, 1156 int *ids, 1157 int maxids); 1158 1159 /* 1160 * Number of domains 1161 */ 1162 int virConnectNumOfDomains (virConnectPtr conn); 1163 1164 1165 /* 1166 * Get connection from domain. 1167 */ 1168 virConnectPtr virDomainGetConnect (virDomainPtr domain); 1169 1170 /* 1171 * Domain creation and destruction 1172 */ 1173 1174 virDomainPtr virDomainCreateXML (virConnectPtr conn, 1175 const char *xmlDesc, 1176 unsigned int flags); 1177 virDomainPtr virDomainCreateXMLWithFiles(virConnectPtr conn, 1178 const char *xmlDesc, 1179 unsigned int nfiles, 1180 int *files, 1181 unsigned int flags); 1182 virDomainPtr virDomainLookupByName (virConnectPtr conn, 1183 const char *name); 1184 virDomainPtr virDomainLookupByID (virConnectPtr conn, 1185 int id); 1186 virDomainPtr virDomainLookupByUUID (virConnectPtr conn, 1187 const unsigned char *uuid); 1188 virDomainPtr virDomainLookupByUUIDString (virConnectPtr conn, 1189 const char *uuid); 1190 1191 typedef enum { 1192 VIR_DOMAIN_SHUTDOWN_DEFAULT = 0, /* hypervisor choice */ 1193 VIR_DOMAIN_SHUTDOWN_ACPI_POWER_BTN = (1 << 0), /* Send ACPI event */ 1194 VIR_DOMAIN_SHUTDOWN_GUEST_AGENT = (1 << 1), /* Use guest agent */ 1195 VIR_DOMAIN_SHUTDOWN_INITCTL = (1 << 2), /* Use initctl */ 1196 VIR_DOMAIN_SHUTDOWN_SIGNAL = (1 << 3), /* Send a signal */ 1197 VIR_DOMAIN_SHUTDOWN_PARAVIRT = (1 << 4), /* Use paravirt guest control */ 1198 } virDomainShutdownFlagValues; 1199 1200 int virDomainShutdown (virDomainPtr domain); 1201 int virDomainShutdownFlags (virDomainPtr domain, 1202 unsigned int flags); 1203 1204 typedef enum { 1205 VIR_DOMAIN_REBOOT_DEFAULT = 0, /* hypervisor choice */ 1206 VIR_DOMAIN_REBOOT_ACPI_POWER_BTN = (1 << 0), /* Send ACPI event */ 1207 VIR_DOMAIN_REBOOT_GUEST_AGENT = (1 << 1), /* Use guest agent */ 1208 VIR_DOMAIN_REBOOT_INITCTL = (1 << 2), /* Use initctl */ 1209 VIR_DOMAIN_REBOOT_SIGNAL = (1 << 3), /* Send a signal */ 1210 VIR_DOMAIN_REBOOT_PARAVIRT = (1 << 4), /* Use paravirt guest control */ 1211 } virDomainRebootFlagValues; 1212 1213 int virDomainReboot (virDomainPtr domain, 1214 unsigned int flags); 1215 int virDomainReset (virDomainPtr domain, 1216 unsigned int flags); 1217 1218 int virDomainDestroy (virDomainPtr domain); 1219 1220 /** 1221 * virDomainDestroyFlagsValues: 1222 * 1223 * Flags used to provide specific behaviour to the 1224 * virDomainDestroyFlags() function 1225 */ 1226 typedef enum { 1227 VIR_DOMAIN_DESTROY_DEFAULT = 0, /* Default behavior - could lead to data loss!! */ 1228 VIR_DOMAIN_DESTROY_GRACEFUL = 1 << 0, /* only SIGTERM, no SIGKILL */ 1229 } virDomainDestroyFlagsValues; 1230 1231 int virDomainDestroyFlags (virDomainPtr domain, 1232 unsigned int flags); 1233 int virDomainRef (virDomainPtr domain); 1234 int virDomainFree (virDomainPtr domain); 1235 1236 /* 1237 * Domain suspend/resume 1238 */ 1239 int virDomainSuspend (virDomainPtr domain); 1240 int virDomainResume (virDomainPtr domain); 1241 int virDomainPMSuspendForDuration (virDomainPtr domain, 1242 unsigned int target, 1243 unsigned long long duration, 1244 unsigned int flags); 1245 int virDomainPMWakeup (virDomainPtr domain, 1246 unsigned int flags); 1247 /* 1248 * Domain save/restore 1249 */ 1250 1251 /** 1252 * virDomainSaveRestoreFlags: 1253 * Flags for use in virDomainSaveFlags(), virDomainManagedSave(), 1254 * virDomainRestoreFlags(), and virDomainSaveImageDefineXML(). Not all 1255 * flags apply to all these functions. 1256 */ 1257 typedef enum { 1258 VIR_DOMAIN_SAVE_BYPASS_CACHE = 1 << 0, /* Avoid file system cache pollution */ 1259 VIR_DOMAIN_SAVE_RUNNING = 1 << 1, /* Favor running over paused */ 1260 VIR_DOMAIN_SAVE_PAUSED = 1 << 2, /* Favor paused over running */ 1261 } virDomainSaveRestoreFlags; 1262 1263 int virDomainSave (virDomainPtr domain, 1264 const char *to); 1265 int virDomainSaveFlags (virDomainPtr domain, 1266 const char *to, 1267 const char *dxml, 1268 unsigned int flags); 1269 int virDomainRestore (virConnectPtr conn, 1270 const char *from); 1271 int virDomainRestoreFlags (virConnectPtr conn, 1272 const char *from, 1273 const char *dxml, 1274 unsigned int flags); 1275 1276 /* See below for virDomainSaveImageXMLFlags */ 1277 char * virDomainSaveImageGetXMLDesc (virConnectPtr conn, 1278 const char *file, 1279 unsigned int flags); 1280 int virDomainSaveImageDefineXML (virConnectPtr conn, 1281 const char *file, 1282 const char *dxml, 1283 unsigned int flags); 1284 1285 /* 1286 * Managed domain save 1287 */ 1288 int virDomainManagedSave (virDomainPtr dom, 1289 unsigned int flags); 1290 int virDomainHasManagedSaveImage(virDomainPtr dom, 1291 unsigned int flags); 1292 int virDomainManagedSaveRemove(virDomainPtr dom, 1293 unsigned int flags); 1294 char * virDomainManagedSaveGetXMLDesc(virDomainPtr domain, 1295 unsigned int flags); 1296 int virDomainManagedSaveDefineXML(virDomainPtr domain, 1297 const char *dxml, 1298 unsigned int flags); 1299 1300 1301 /* 1302 * Domain core dump 1303 */ 1304 int virDomainCoreDump (virDomainPtr domain, 1305 const char *to, 1306 unsigned int flags); 1307 1308 /* 1309 * Domain core dump with format specified 1310 */ 1311 int virDomainCoreDumpWithFormat (virDomainPtr domain, 1312 const char *to, 1313 unsigned int dumpformat, 1314 unsigned int flags); 1315 1316 /* 1317 * Screenshot of current domain console 1318 */ 1319 char * virDomainScreenshot (virDomainPtr domain, 1320 virStreamPtr stream, 1321 unsigned int screen, 1322 unsigned int flags); 1323 1324 /* 1325 * Domain runtime information, and collecting CPU statistics 1326 */ 1327 1328 int virDomainGetInfo (virDomainPtr domain, 1329 virDomainInfoPtr info); 1330 int virDomainGetState (virDomainPtr domain, 1331 int *state, 1332 int *reason, 1333 unsigned int flags); 1334 1335 /** 1336 * VIR_DOMAIN_CPU_STATS_CPUTIME: 1337 * cpu usage (sum of both vcpu and hypervisor usage) in nanoseconds, 1338 * as a ullong 1339 */ 1340 # define VIR_DOMAIN_CPU_STATS_CPUTIME "cpu_time" 1341 1342 /** 1343 * VIR_DOMAIN_CPU_STATS_USERTIME: 1344 * cpu time charged to user instructions in nanoseconds, as a ullong 1345 */ 1346 # define VIR_DOMAIN_CPU_STATS_USERTIME "user_time" 1347 1348 /** 1349 * VIR_DOMAIN_CPU_STATS_SYSTEMTIME: 1350 * cpu time charged to system instructions in nanoseconds, as a ullong 1351 */ 1352 # define VIR_DOMAIN_CPU_STATS_SYSTEMTIME "system_time" 1353 1354 /** 1355 * VIR_DOMAIN_CPU_STATS_VCPUTIME: 1356 * vcpu usage in nanoseconds (cpu_time excluding hypervisor time), 1357 * as a ullong 1358 */ 1359 # define VIR_DOMAIN_CPU_STATS_VCPUTIME "vcpu_time" 1360 1361 int virDomainGetCPUStats(virDomainPtr domain, 1362 virTypedParameterPtr params, 1363 unsigned int nparams, 1364 int start_cpu, 1365 unsigned int ncpus, 1366 unsigned int flags); 1367 1368 int virDomainGetControlInfo (virDomainPtr domain, 1369 virDomainControlInfoPtr info, 1370 unsigned int flags); 1371 1372 /* 1373 * Return scheduler type in effect 'sedf', 'credit', 'linux' 1374 */ 1375 char * virDomainGetSchedulerType(virDomainPtr domain, 1376 int *nparams); 1377 1378 1379 /* Manage blkio parameters. */ 1380 1381 /** 1382 * VIR_DOMAIN_BLKIO_WEIGHT: 1383 * 1384 * Macro for the Blkio tunable weight: it represents the io weight 1385 * the guest can use, as a uint. 1386 */ 1387 1388 # define VIR_DOMAIN_BLKIO_WEIGHT "weight" 1389 1390 /** 1391 * VIR_DOMAIN_BLKIO_DEVICE_WEIGHT: 1392 * 1393 * Macro for the blkio tunable weight_device: it represents the 1394 * per-device weight, as a string. The string is parsed as a 1395 * series of /path/to/device,weight elements, separated by ','. 1396 */ 1397 1398 # define VIR_DOMAIN_BLKIO_DEVICE_WEIGHT "device_weight" 1399 1400 /** 1401 * VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS: 1402 * 1403 * Macro for the blkio tunable throttle.read_iops_device: it represents 1404 * the number of reading the block device per second, as a string. The 1405 * string is parsed as a series of /path/to/device, read_iops elements, 1406 * separated by ','. 1407 */ 1408 1409 # define VIR_DOMAIN_BLKIO_DEVICE_READ_IOPS "device_read_iops_sec" 1410 1411 1412 /** 1413 * VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS: 1414 * 1415 * Macro for the blkio tunable throttle.write_iops_device: it represents 1416 * the number of writing the block device per second, as a string. The 1417 * string is parsed as a series of /path/to/device, write_iops elements, 1418 * separated by ','. 1419 */ 1420 # define VIR_DOMAIN_BLKIO_DEVICE_WRITE_IOPS "device_write_iops_sec" 1421 1422 1423 /** 1424 * VIR_DOMAIN_BLKIO_DEVICE_READ_BPS: 1425 * 1426 * Macro for the blkio tunable throttle.read_iops_device: it represents 1427 * the bytes of reading the block device per second, as a string. The 1428 * string is parsed as a series of /path/to/device, read_bps elements, 1429 * separated by ','. 1430 */ 1431 # define VIR_DOMAIN_BLKIO_DEVICE_READ_BPS "device_read_bytes_sec" 1432 1433 1434 /** 1435 * VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS: 1436 * 1437 * Macro for the blkio tunable throttle.read_iops_device: it represents 1438 * the number of reading the block device per second, as a string. The 1439 * string is parsed as a series of /path/to/device, write_bps elements, 1440 * separated by ','. 1441 */ 1442 # define VIR_DOMAIN_BLKIO_DEVICE_WRITE_BPS "device_write_bytes_sec" 1443 1444 1445 /* Set Blkio tunables for the domain */ 1446 int virDomainSetBlkioParameters(virDomainPtr domain, 1447 virTypedParameterPtr params, 1448 int nparams, unsigned int flags); 1449 int virDomainGetBlkioParameters(virDomainPtr domain, 1450 virTypedParameterPtr params, 1451 int *nparams, unsigned int flags); 1452 1453 /* Manage memory parameters. */ 1454 1455 /** 1456 * VIR_DOMAIN_MEMORY_PARAM_UNLIMITED: 1457 * 1458 * Macro providing the virMemoryParameter value that indicates "unlimited" 1459 */ 1460 1461 # define VIR_DOMAIN_MEMORY_PARAM_UNLIMITED 9007199254740991LL /* = INT64_MAX >> 10 */ 1462 1463 /** 1464 * VIR_DOMAIN_MEMORY_HARD_LIMIT: 1465 * 1466 * Macro for the memory tunable hard_limit: it represents the maximum memory 1467 * the guest can use, as a ullong. 1468 */ 1469 1470 # define VIR_DOMAIN_MEMORY_HARD_LIMIT "hard_limit" 1471 1472 /** 1473 * VIR_DOMAIN_MEMORY_SOFT_LIMIT: 1474 * 1475 * Macro for the memory tunable soft_limit: it represents the memory upper 1476 * limit enforced during memory contention, as a ullong. 1477 */ 1478 1479 # define VIR_DOMAIN_MEMORY_SOFT_LIMIT "soft_limit" 1480 1481 /** 1482 * VIR_DOMAIN_MEMORY_MIN_GUARANTEE: 1483 * 1484 * Macro for the memory tunable min_guarantee: it represents the minimum 1485 * memory guaranteed to be reserved for the guest, as a ullong. 1486 */ 1487 1488 # define VIR_DOMAIN_MEMORY_MIN_GUARANTEE "min_guarantee" 1489 1490 /** 1491 * VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT: 1492 * 1493 * Macro for the swap tunable swap_hard_limit: it represents the maximum swap 1494 * plus memory the guest can use, as a ullong. This limit has to be more than 1495 * VIR_DOMAIN_MEMORY_HARD_LIMIT. 1496 */ 1497 1498 # define VIR_DOMAIN_MEMORY_SWAP_HARD_LIMIT "swap_hard_limit" 1499 1500 /* Set memory tunables for the domain */ 1501 int virDomainSetMemoryParameters(virDomainPtr domain, 1502 virTypedParameterPtr params, 1503 int nparams, unsigned int flags); 1504 int virDomainGetMemoryParameters(virDomainPtr domain, 1505 virTypedParameterPtr params, 1506 int *nparams, unsigned int flags); 1507 1508 /* Memory size modification flags. */ 1509 typedef enum { 1510 /* See virDomainModificationImpact for these flags. */ 1511 VIR_DOMAIN_MEM_CURRENT = VIR_DOMAIN_AFFECT_CURRENT, 1512 VIR_DOMAIN_MEM_LIVE = VIR_DOMAIN_AFFECT_LIVE, 1513 VIR_DOMAIN_MEM_CONFIG = VIR_DOMAIN_AFFECT_CONFIG, 1514 1515 /* Additionally, these flags may be bitwise-OR'd in. */ 1516 VIR_DOMAIN_MEM_MAXIMUM = (1 << 2), /* affect Max rather than current */ 1517 } virDomainMemoryModFlags; 1518 1519 1520 /* Manage numa parameters */ 1521 1522 /** 1523 * virDomainNumatuneMemMode: 1524 * Representation of the various modes in the <numatune> element of 1525 * a domain. 1526 */ 1527 typedef enum { 1528 VIR_DOMAIN_NUMATUNE_MEM_STRICT = 0, 1529 VIR_DOMAIN_NUMATUNE_MEM_PREFERRED = 1, 1530 VIR_DOMAIN_NUMATUNE_MEM_INTERLEAVE = 2, 1531 VIR_DOMAIN_NUMATUNE_MEM_RESTRICTIVE = 3, 1532 1533 # ifdef VIR_ENUM_SENTINELS 1534 VIR_DOMAIN_NUMATUNE_MEM_LAST /* This constant is subject to change */ 1535 # endif 1536 } virDomainNumatuneMemMode; 1537 1538 /** 1539 * VIR_DOMAIN_NUMA_NODESET: 1540 * 1541 * Macro for typed parameter name that lists the numa nodeset of a 1542 * domain, as a string. 1543 */ 1544 # define VIR_DOMAIN_NUMA_NODESET "numa_nodeset" 1545 1546 /** 1547 * VIR_DOMAIN_NUMA_MODE: 1548 * 1549 * Macro for typed parameter name that lists the numa mode of a domain, 1550 * as an int containing a virDomainNumatuneMemMode value. 1551 */ 1552 # define VIR_DOMAIN_NUMA_MODE "numa_mode" 1553 1554 int virDomainSetNumaParameters(virDomainPtr domain, 1555 virTypedParameterPtr params, 1556 int nparams, unsigned int flags); 1557 int virDomainGetNumaParameters(virDomainPtr domain, 1558 virTypedParameterPtr params, 1559 int *nparams, unsigned int flags); 1560 1561 /* 1562 * Dynamic control of domains 1563 */ 1564 const char * virDomainGetName (virDomainPtr domain); 1565 unsigned int virDomainGetID (virDomainPtr domain); 1566 int virDomainGetUUID (virDomainPtr domain, 1567 unsigned char *uuid); 1568 int virDomainGetUUIDString (virDomainPtr domain, 1569 char *buf); 1570 char * virDomainGetOSType (virDomainPtr domain); 1571 unsigned long virDomainGetMaxMemory (virDomainPtr domain); 1572 int virDomainSetMaxMemory (virDomainPtr domain, 1573 unsigned long memory); 1574 int virDomainSetMemory (virDomainPtr domain, 1575 unsigned long memory); 1576 int virDomainSetMemoryFlags (virDomainPtr domain, 1577 unsigned long memory, 1578 unsigned int flags); 1579 int virDomainSetMemoryStatsPeriod (virDomainPtr domain, 1580 int period, 1581 unsigned int flags); 1582 int virDomainGetMaxVcpus (virDomainPtr domain); 1583 int virDomainGetSecurityLabel (virDomainPtr domain, 1584 virSecurityLabelPtr seclabel); 1585 1586 typedef enum { 1587 VIR_DOMAIN_GET_HOSTNAME_LEASE = (1 << 0), /* Parse DHCP lease file */ 1588 VIR_DOMAIN_GET_HOSTNAME_AGENT = (1 << 1), /* Query qemu guest agent */ 1589 } virDomainGetHostnameFlags; 1590 1591 char * virDomainGetHostname (virDomainPtr domain, 1592 unsigned int flags); 1593 int virDomainGetSecurityLabelList (virDomainPtr domain, 1594 virSecurityLabelPtr* seclabels); 1595 1596 typedef enum { 1597 VIR_DOMAIN_METADATA_DESCRIPTION = 0, /* Operate on <description> */ 1598 VIR_DOMAIN_METADATA_TITLE = 1, /* Operate on <title> */ 1599 VIR_DOMAIN_METADATA_ELEMENT = 2, /* Operate on <metadata> */ 1600 1601 # ifdef VIR_ENUM_SENTINELS 1602 VIR_DOMAIN_METADATA_LAST 1603 # endif 1604 } virDomainMetadataType; 1605 1606 int 1607 virDomainSetMetadata(virDomainPtr domain, 1608 int type, 1609 const char *metadata, 1610 const char *key, 1611 const char *uri, 1612 unsigned int flags); 1613 1614 char * 1615 virDomainGetMetadata(virDomainPtr domain, 1616 int type, 1617 const char *uri, 1618 unsigned int flags); 1619 1620 /* 1621 * XML domain description 1622 */ 1623 /** 1624 * virDomainXMLFlags: 1625 * 1626 * Flags available for virDomainGetXMLDesc 1627 */ 1628 1629 typedef enum { 1630 VIR_DOMAIN_XML_SECURE = (1 << 0), /* dump security sensitive information too */ 1631 VIR_DOMAIN_XML_INACTIVE = (1 << 1), /* dump inactive domain information */ 1632 VIR_DOMAIN_XML_UPDATE_CPU = (1 << 2), /* update guest CPU requirements according to host CPU */ 1633 VIR_DOMAIN_XML_MIGRATABLE = (1 << 3), /* dump XML suitable for migration */ 1634 } virDomainXMLFlags; 1635 1636 typedef enum { 1637 VIR_DOMAIN_SAVE_IMAGE_XML_SECURE = VIR_DOMAIN_XML_SECURE, /* dump security sensitive information too */ 1638 } virDomainSaveImageXMLFlags; 1639 1640 char * virDomainGetXMLDesc (virDomainPtr domain, 1641 unsigned int flags); 1642 1643 1644 char * virConnectDomainXMLFromNative(virConnectPtr conn, 1645 const char *nativeFormat, 1646 const char *nativeConfig, 1647 unsigned int flags); 1648 char * virConnectDomainXMLToNative(virConnectPtr conn, 1649 const char *nativeFormat, 1650 const char *domainXml, 1651 unsigned int flags); 1652 1653 int virDomainBlockStats (virDomainPtr dom, 1654 const char *disk, 1655 virDomainBlockStatsPtr stats, 1656 size_t size); 1657 int virDomainBlockStatsFlags (virDomainPtr dom, 1658 const char *disk, 1659 virTypedParameterPtr params, 1660 int *nparams, 1661 unsigned int flags); 1662 int virDomainInterfaceStats (virDomainPtr dom, 1663 const char *device, 1664 virDomainInterfaceStatsPtr stats, 1665 size_t size); 1666 1667 /* Management of interface parameters */ 1668 1669 /** 1670 * VIR_DOMAIN_BANDWIDTH_IN_AVERAGE: 1671 * 1672 * Macro represents the inbound average of NIC bandwidth, as a uint. 1673 */ 1674 # define VIR_DOMAIN_BANDWIDTH_IN_AVERAGE "inbound.average" 1675 1676 /** 1677 * VIR_DOMAIN_BANDWIDTH_IN_PEAK: 1678 * 1679 * Macro represents the inbound peak of NIC bandwidth, as a uint. 1680 */ 1681 # define VIR_DOMAIN_BANDWIDTH_IN_PEAK "inbound.peak" 1682 1683 /** 1684 * VIR_DOMAIN_BANDWIDTH_IN_BURST: 1685 * 1686 * Macro represents the inbound burst of NIC bandwidth, as a uint. 1687 */ 1688 # define VIR_DOMAIN_BANDWIDTH_IN_BURST "inbound.burst" 1689 1690 /** 1691 * VIR_DOMAIN_BANDWIDTH_IN_FLOOR: 1692 * 1693 * Macro represents the inbound floor of NIC bandwidth, as a uint. 1694 */ 1695 # define VIR_DOMAIN_BANDWIDTH_IN_FLOOR "inbound.floor" 1696 1697 /** 1698 * VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE: 1699 * 1700 * Macro represents the outbound average of NIC bandwidth, as a uint. 1701 */ 1702 # define VIR_DOMAIN_BANDWIDTH_OUT_AVERAGE "outbound.average" 1703 1704 /** 1705 * VIR_DOMAIN_BANDWIDTH_OUT_PEAK: 1706 * 1707 * Macro represents the outbound peak of NIC bandwidth, as a uint. 1708 */ 1709 # define VIR_DOMAIN_BANDWIDTH_OUT_PEAK "outbound.peak" 1710 1711 /** 1712 * VIR_DOMAIN_BANDWIDTH_OUT_BURST: 1713 * 1714 * Macro represents the outbound burst of NIC bandwidth, as a uint. 1715 */ 1716 # define VIR_DOMAIN_BANDWIDTH_OUT_BURST "outbound.burst" 1717 1718 int virDomainSetInterfaceParameters (virDomainPtr dom, 1719 const char *device, 1720 virTypedParameterPtr params, 1721 int nparams, unsigned int flags); 1722 int virDomainGetInterfaceParameters (virDomainPtr dom, 1723 const char *device, 1724 virTypedParameterPtr params, 1725 int *nparams, unsigned int flags); 1726 1727 /* Management of domain block devices */ 1728 1729 int virDomainBlockPeek (virDomainPtr dom, 1730 const char *disk, 1731 unsigned long long offset, 1732 size_t size, 1733 void *buffer, 1734 unsigned int flags); 1735 1736 /** 1737 * virDomainBlockResizeFlags: 1738 * 1739 * Flags available for virDomainBlockResize(). 1740 */ 1741 typedef enum { 1742 VIR_DOMAIN_BLOCK_RESIZE_BYTES = 1 << 0, /* size in bytes instead of KiB */ 1743 } virDomainBlockResizeFlags; 1744 1745 int virDomainBlockResize (virDomainPtr dom, 1746 const char *disk, 1747 unsigned long long size, 1748 unsigned int flags); 1749 1750 /** virDomainBlockInfo: 1751 * 1752 * This struct provides information about the size of a block device 1753 * backing store. 1754 * 1755 * Examples: 1756 * 1757 * - Fully allocated raw file in filesystem: 1758 * * capacity, allocation, physical: All the same 1759 * 1760 * - Sparse raw file in filesystem: 1761 * * capacity, size: logical size of the file 1762 * * allocation: disk space occupied by file 1763 * 1764 * - qcow2 file in filesystem 1765 * * capacity: logical size from qcow2 header 1766 * * allocation: disk space occupied by file 1767 * * physical: reported size of qcow2 file 1768 * 1769 * - qcow2 file in a block device 1770 * * capacity: logical size from qcow2 header 1771 * * allocation: highest qcow extent written for an active domain 1772 * * physical: size of the block device container 1773 */ 1774 typedef struct _virDomainBlockInfo virDomainBlockInfo; 1775 typedef virDomainBlockInfo *virDomainBlockInfoPtr; 1776 struct _virDomainBlockInfo { 1777 unsigned long long capacity; /* logical size in bytes of the 1778 * image (how much storage the 1779 * guest will see) */ 1780 unsigned long long allocation; /* host storage in bytes occupied 1781 * by the image (such as highest 1782 * allocated extent if there are no 1783 * holes, similar to 'du') */ 1784 unsigned long long physical; /* host physical size in bytes of 1785 * the image container (last 1786 * offset, similar to 'ls') */ 1787 }; 1788 1789 int virDomainGetBlockInfo(virDomainPtr dom, 1790 const char *disk, 1791 virDomainBlockInfoPtr info, 1792 unsigned int flags); 1793 1794 /* Management of domain memory */ 1795 1796 int virDomainMemoryStats (virDomainPtr dom, 1797 virDomainMemoryStatPtr stats, 1798 unsigned int nr_stats, 1799 unsigned int flags); 1800 1801 /* Memory peeking flags. */ 1802 1803 typedef enum { 1804 VIR_MEMORY_VIRTUAL = 1 << 0, /* addresses are virtual addresses */ 1805 VIR_MEMORY_PHYSICAL = 1 << 1, /* addresses are physical addresses */ 1806 } virDomainMemoryFlags; 1807 1808 int virDomainMemoryPeek (virDomainPtr dom, 1809 unsigned long long start, 1810 size_t size, 1811 void *buffer, 1812 unsigned int flags); 1813 1814 typedef enum { 1815 VIR_DOMAIN_DEFINE_VALIDATE = (1 << 0), /* Validate the XML document against schema */ 1816 } virDomainDefineFlags; 1817 1818 /* 1819 * defined but not running domains 1820 */ 1821 virDomainPtr virDomainDefineXML (virConnectPtr conn, 1822 const char *xml); 1823 1824 virDomainPtr virDomainDefineXMLFlags (virConnectPtr conn, 1825 const char *xml, 1826 unsigned int flags); 1827 int virDomainUndefine (virDomainPtr domain); 1828 1829 typedef enum { 1830 VIR_DOMAIN_UNDEFINE_MANAGED_SAVE = (1 << 0), /* Also remove any 1831 managed save */ 1832 VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA = (1 << 1), /* If last use of domain, 1833 then also remove any 1834 snapshot metadata */ 1835 VIR_DOMAIN_UNDEFINE_NVRAM = (1 << 2), /* Also remove any 1836 nvram file */ 1837 VIR_DOMAIN_UNDEFINE_KEEP_NVRAM = (1 << 3), /* Keep nvram file */ 1838 VIR_DOMAIN_UNDEFINE_CHECKPOINTS_METADATA = (1 << 4), /* If last use of domain, 1839 then also remove any 1840 checkpoint metadata */ 1841 1842 /* Future undefine control flags should come here. */ 1843 } virDomainUndefineFlagsValues; 1844 1845 1846 int virDomainUndefineFlags (virDomainPtr domain, 1847 unsigned int flags); 1848 int virConnectNumOfDefinedDomains (virConnectPtr conn); 1849 int virConnectListDefinedDomains (virConnectPtr conn, 1850 char **const names, 1851 int maxnames); 1852 /** 1853 * virConnectListAllDomainsFlags: 1854 * 1855 * Flags used to tune which domains are listed by virConnectListAllDomains(). 1856 * Note that these flags come in groups; if all bits from a group are 0, 1857 * then that group is not used to filter results. 1858 */ 1859 typedef enum { 1860 VIR_CONNECT_LIST_DOMAINS_ACTIVE = 1 << 0, 1861 VIR_CONNECT_LIST_DOMAINS_INACTIVE = 1 << 1, 1862 1863 VIR_CONNECT_LIST_DOMAINS_PERSISTENT = 1 << 2, 1864 VIR_CONNECT_LIST_DOMAINS_TRANSIENT = 1 << 3, 1865 1866 VIR_CONNECT_LIST_DOMAINS_RUNNING = 1 << 4, 1867 VIR_CONNECT_LIST_DOMAINS_PAUSED = 1 << 5, 1868 VIR_CONNECT_LIST_DOMAINS_SHUTOFF = 1 << 6, 1869 VIR_CONNECT_LIST_DOMAINS_OTHER = 1 << 7, 1870 1871 VIR_CONNECT_LIST_DOMAINS_MANAGEDSAVE = 1 << 8, 1872 VIR_CONNECT_LIST_DOMAINS_NO_MANAGEDSAVE = 1 << 9, 1873 1874 VIR_CONNECT_LIST_DOMAINS_AUTOSTART = 1 << 10, 1875 VIR_CONNECT_LIST_DOMAINS_NO_AUTOSTART = 1 << 11, 1876 1877 VIR_CONNECT_LIST_DOMAINS_HAS_SNAPSHOT = 1 << 12, 1878 VIR_CONNECT_LIST_DOMAINS_NO_SNAPSHOT = 1 << 13, 1879 1880 VIR_CONNECT_LIST_DOMAINS_HAS_CHECKPOINT = 1 << 14, 1881 VIR_CONNECT_LIST_DOMAINS_NO_CHECKPOINT = 1 << 15, 1882 } virConnectListAllDomainsFlags; 1883 1884 int virConnectListAllDomains (virConnectPtr conn, 1885 virDomainPtr **domains, 1886 unsigned int flags); 1887 int virDomainCreate (virDomainPtr domain); 1888 int virDomainCreateWithFlags (virDomainPtr domain, 1889 unsigned int flags); 1890 1891 int virDomainCreateWithFiles (virDomainPtr domain, 1892 unsigned int nfiles, 1893 int *files, 1894 unsigned int flags); 1895 1896 int virDomainGetAutostart (virDomainPtr domain, 1897 int *autostart); 1898 int virDomainSetAutostart (virDomainPtr domain, 1899 int autostart); 1900 1901 /** 1902 * virVcpuInfo: structure for information about a virtual CPU in a domain. 1903 */ 1904 1905 typedef enum { 1906 VIR_VCPU_OFFLINE = 0, /* the virtual CPU is offline */ 1907 VIR_VCPU_RUNNING = 1, /* the virtual CPU is running */ 1908 VIR_VCPU_BLOCKED = 2, /* the virtual CPU is blocked on resource */ 1909 1910 # ifdef VIR_ENUM_SENTINELS 1911 VIR_VCPU_LAST 1912 # endif 1913 } virVcpuState; 1914 1915 typedef enum { 1916 VIR_VCPU_INFO_CPU_OFFLINE = -1, /* the vCPU is offline */ 1917 VIR_VCPU_INFO_CPU_UNAVAILABLE = -2, /* the hypervisor does not expose real CPU information */ 1918 } virVcpuHostCpuState; 1919 1920 typedef struct _virVcpuInfo virVcpuInfo; 1921 struct _virVcpuInfo { 1922 unsigned int number; /* virtual CPU number */ 1923 int state; /* value from virVcpuState */ 1924 unsigned long long cpuTime; /* CPU time used, in nanoseconds */ 1925 int cpu; /* real CPU number, or one of the values from virVcpuHostCpuState */ 1926 }; 1927 typedef virVcpuInfo *virVcpuInfoPtr; 1928 1929 /* Flags for controlling virtual CPU hot-plugging. */ 1930 typedef enum { 1931 /* See virDomainModificationImpact for these flags. */ 1932 VIR_DOMAIN_VCPU_CURRENT = VIR_DOMAIN_AFFECT_CURRENT, 1933 VIR_DOMAIN_VCPU_LIVE = VIR_DOMAIN_AFFECT_LIVE, 1934 VIR_DOMAIN_VCPU_CONFIG = VIR_DOMAIN_AFFECT_CONFIG, 1935 1936 /* Additionally, these flags may be bitwise-OR'd in. */ 1937 VIR_DOMAIN_VCPU_MAXIMUM = (1 << 2), /* Max rather than current count */ 1938 VIR_DOMAIN_VCPU_GUEST = (1 << 3), /* Modify state of the cpu in the guest */ 1939 VIR_DOMAIN_VCPU_HOTPLUGGABLE = (1 << 4), /* Make vcpus added hot(un)pluggable */ 1940 } virDomainVcpuFlags; 1941 1942 int virDomainSetVcpus (virDomainPtr domain, 1943 unsigned int nvcpus); 1944 int virDomainSetVcpusFlags (virDomainPtr domain, 1945 unsigned int nvcpus, 1946 unsigned int flags); 1947 int virDomainGetVcpusFlags (virDomainPtr domain, 1948 unsigned int flags); 1949 1950 int virDomainPinVcpu (virDomainPtr domain, 1951 unsigned int vcpu, 1952 unsigned char *cpumap, 1953 int maplen); 1954 int virDomainPinVcpuFlags (virDomainPtr domain, 1955 unsigned int vcpu, 1956 unsigned char *cpumap, 1957 int maplen, 1958 unsigned int flags); 1959 1960 int virDomainGetVcpuPinInfo (virDomainPtr domain, 1961 int ncpumaps, 1962 unsigned char *cpumaps, 1963 int maplen, 1964 unsigned int flags); 1965 1966 int virDomainPinEmulator (virDomainPtr domain, 1967 unsigned char *cpumap, 1968 int maplen, 1969 unsigned int flags); 1970 1971 int virDomainGetEmulatorPinInfo (virDomainPtr domain, 1972 unsigned char *cpumaps, 1973 int maplen, 1974 unsigned int flags); 1975 1976 /** 1977 * virIOThreadInfo: 1978 * 1979 * The data structure for information about all IOThreads in a domain 1980 */ 1981 typedef struct _virDomainIOThreadInfo virDomainIOThreadInfo; 1982 typedef virDomainIOThreadInfo *virDomainIOThreadInfoPtr; 1983 struct _virDomainIOThreadInfo { 1984 unsigned int iothread_id; /* IOThread ID */ 1985 unsigned char *cpumap; /* CPU map for thread. A pointer to an */ 1986 /* array of real CPUs (in 8-bit bytes) */ 1987 int cpumaplen; /* cpumap size */ 1988 }; 1989 1990 void virDomainIOThreadInfoFree(virDomainIOThreadInfoPtr info); 1991 1992 int virDomainGetIOThreadInfo(virDomainPtr domain, 1993 virDomainIOThreadInfoPtr **info, 1994 unsigned int flags); 1995 int virDomainPinIOThread(virDomainPtr domain, 1996 unsigned int iothread_id, 1997 unsigned char *cpumap, 1998 int maplen, 1999 unsigned int flags); 2000 int virDomainAddIOThread(virDomainPtr domain, 2001 unsigned int iothread_id, 2002 unsigned int flags); 2003 int virDomainDelIOThread(virDomainPtr domain, 2004 unsigned int iothread_id, 2005 unsigned int flags); 2006 2007 /* IOThread set parameters */ 2008 2009 /** 2010 * VIR_DOMAIN_IOTHREAD_POLL_MAX_NS: 2011 * 2012 * The maximum polling time that can be used by polling algorithm in ns. 2013 * The polling time starts at 0 (zero) and is the time spent by the guest 2014 * to process IOThread data before returning the CPU to the host. The 2015 * polling time will be dynamically modified over time based on the 2016 * poll_grow and poll_shrink parameters provided. A value set too large 2017 * will cause more CPU time to be allocated the guest. A value set too 2018 * small will not provide enough cycles for the guest to process data. 2019 * The polling interval is not available for statistical purposes. 2020 */ 2021 # define VIR_DOMAIN_IOTHREAD_POLL_MAX_NS "poll_max_ns" 2022 2023 /** 2024 * VIR_DOMAIN_IOTHREAD_POLL_GROW: 2025 * 2026 * This provides a value for the dynamic polling adjustment algorithm to 2027 * use to grow its polling interval up to the poll_max_ns value. A value 2028 * of 0 (zero) allows the hypervisor to choose its own value. The algorithm 2029 * to use for adjustment is hypervisor specific. 2030 */ 2031 # define VIR_DOMAIN_IOTHREAD_POLL_GROW "poll_grow" 2032 2033 /** 2034 * VIR_DOMAIN_IOTHREAD_POLL_SHRINK: 2035 * 2036 * This provides a value for the dynamic polling adjustment algorithm to 2037 * use to shrink its polling interval when the polling interval exceeds 2038 * the poll_max_ns value. A value of 0 (zero) allows the hypervisor to 2039 * choose its own value. The algorithm to use for adjustment is hypervisor 2040 * specific. 2041 */ 2042 # define VIR_DOMAIN_IOTHREAD_POLL_SHRINK "poll_shrink" 2043 2044 int virDomainSetIOThreadParams(virDomainPtr domain, 2045 unsigned int iothread_id, 2046 virTypedParameterPtr params, 2047 int nparams, 2048 unsigned int flags); 2049 2050 2051 /** 2052 * VIR_USE_CPU: 2053 * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT) 2054 * @cpu: the physical CPU number 2055 * 2056 * This macro is to be used in conjunction with virDomainPinVcpu() API. 2057 * It sets the bit (CPU usable) of the related cpu in cpumap. 2058 */ 2059 2060 # define VIR_USE_CPU(cpumap, cpu) ((cpumap)[(cpu) / 8] |= (1 << ((cpu) % 8))) 2061 2062 /** 2063 * VIR_UNUSE_CPU: 2064 * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN/OUT) 2065 * @cpu: the physical CPU number 2066 * 2067 * This macro is to be used in conjunction with virDomainPinVcpu() API. 2068 * It resets the bit (CPU not usable) of the related cpu in cpumap. 2069 */ 2070 2071 # define VIR_UNUSE_CPU(cpumap, cpu) ((cpumap)[(cpu) / 8] &= ~(1 << ((cpu) % 8))) 2072 2073 /** 2074 * VIR_CPU_USED: 2075 * @cpumap: pointer to a bit map of real CPUs (in 8-bit bytes) (IN) 2076 * @cpu: the physical CPU number 2077 * 2078 * This macro can be used in conjunction with virNodeGetCPUMap() API. 2079 * It returns non-zero if the bit of the related CPU is set. 2080 */ 2081 2082 # define VIR_CPU_USED(cpumap, cpu) ((cpumap)[(cpu) / 8] & (1 << ((cpu) % 8))) 2083 2084 /** 2085 * VIR_CPU_MAPLEN: 2086 * @cpu: number of physical CPUs 2087 * 2088 * This macro is to be used in conjunction with virDomainPinVcpu() API. 2089 * It returns the length (in bytes) required to store the complete 2090 * CPU map between a single virtual & all physical CPUs of a domain. 2091 */ 2092 2093 # define VIR_CPU_MAPLEN(cpu) (((cpu) + 7) / 8) 2094 2095 2096 int virDomainGetVcpus (virDomainPtr domain, 2097 virVcpuInfoPtr info, 2098 int maxinfo, 2099 unsigned char *cpumaps, 2100 int maplen); 2101 2102 /** 2103 * VIR_CPU_USABLE: 2104 * @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN) 2105 * @maplen: the length (in bytes) of one cpumap 2106 * @vcpu: the virtual CPU number 2107 * @cpu: the physical CPU number 2108 * 2109 * This macro is to be used in conjunction with virDomainGetVcpus() API. 2110 * VIR_CPU_USABLE macro returns a non-zero value (true) if the cpu 2111 * is usable by the vcpu, and 0 otherwise. 2112 */ 2113 2114 # define VIR_CPU_USABLE(cpumaps, maplen, vcpu, cpu) \ 2115 VIR_CPU_USED(VIR_GET_CPUMAP(cpumaps, maplen, vcpu), cpu) 2116 2117 /** 2118 * VIR_COPY_CPUMAP: 2119 * @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN) 2120 * @maplen: the length (in bytes) of one cpumap 2121 * @vcpu: the virtual CPU number 2122 * @cpumap: pointer to a cpumap (in 8-bit bytes) (OUT) 2123 * This cpumap must be previously allocated by the caller 2124 * (ie: malloc(maplen)) 2125 * 2126 * This macro is to be used in conjunction with virDomainGetVcpus() and 2127 * virDomainPinVcpu() APIs. VIR_COPY_CPUMAP macro extracts the cpumap of 2128 * the specified vcpu from cpumaps array and copies it into cpumap to be used 2129 * later by virDomainPinVcpu() API. 2130 */ 2131 # define VIR_COPY_CPUMAP(cpumaps, maplen, vcpu, cpumap) \ 2132 memcpy(cpumap, VIR_GET_CPUMAP(cpumaps, maplen, vcpu), maplen) 2133 2134 2135 /** 2136 * VIR_GET_CPUMAP: 2137 * @cpumaps: pointer to an array of cpumap (in 8-bit bytes) (IN) 2138 * @maplen: the length (in bytes) of one cpumap 2139 * @vcpu: the virtual CPU number 2140 * 2141 * This macro is to be used in conjunction with virDomainGetVcpus() and 2142 * virDomainPinVcpu() APIs. VIR_GET_CPUMAP macro returns a pointer to the 2143 * cpumap of the specified vcpu from cpumaps array. 2144 */ 2145 # define VIR_GET_CPUMAP(cpumaps, maplen, vcpu) (&((cpumaps)[(vcpu) * (maplen)])) 2146 2147 2148 typedef enum { 2149 /* See virDomainModificationImpact for these flags. */ 2150 VIR_DOMAIN_DEVICE_MODIFY_CURRENT = VIR_DOMAIN_AFFECT_CURRENT, 2151 VIR_DOMAIN_DEVICE_MODIFY_LIVE = VIR_DOMAIN_AFFECT_LIVE, 2152 VIR_DOMAIN_DEVICE_MODIFY_CONFIG = VIR_DOMAIN_AFFECT_CONFIG, 2153 2154 /* Additionally, these flags may be bitwise-OR'd in. */ 2155 VIR_DOMAIN_DEVICE_MODIFY_FORCE = (1 << 2), /* Forcibly modify device 2156 (ex. force eject a cdrom) */ 2157 } virDomainDeviceModifyFlags; 2158 2159 int virDomainAttachDevice(virDomainPtr domain, const char *xml); 2160 int virDomainDetachDevice(virDomainPtr domain, const char *xml); 2161 2162 int virDomainAttachDeviceFlags(virDomainPtr domain, 2163 const char *xml, unsigned int flags); 2164 int virDomainDetachDeviceFlags(virDomainPtr domain, 2165 const char *xml, unsigned int flags); 2166 int virDomainUpdateDeviceFlags(virDomainPtr domain, 2167 const char *xml, unsigned int flags); 2168 2169 int virDomainDetachDeviceAlias(virDomainPtr domain, 2170 const char *alias, unsigned int flags); 2171 2172 typedef struct _virDomainStatsRecord virDomainStatsRecord; 2173 typedef virDomainStatsRecord *virDomainStatsRecordPtr; 2174 struct _virDomainStatsRecord { 2175 virDomainPtr dom; 2176 virTypedParameterPtr params; 2177 int nparams; 2178 }; 2179 2180 typedef enum { 2181 VIR_DOMAIN_STATS_STATE = (1 << 0), /* return domain state */ 2182 VIR_DOMAIN_STATS_CPU_TOTAL = (1 << 1), /* return domain CPU info */ 2183 VIR_DOMAIN_STATS_BALLOON = (1 << 2), /* return domain balloon info */ 2184 VIR_DOMAIN_STATS_VCPU = (1 << 3), /* return domain virtual CPU info */ 2185 VIR_DOMAIN_STATS_INTERFACE = (1 << 4), /* return domain interfaces info */ 2186 VIR_DOMAIN_STATS_BLOCK = (1 << 5), /* return domain block info */ 2187 VIR_DOMAIN_STATS_PERF = (1 << 6), /* return domain perf event info */ 2188 VIR_DOMAIN_STATS_IOTHREAD = (1 << 7), /* return iothread poll info */ 2189 VIR_DOMAIN_STATS_MEMORY = (1 << 8), /* return domain memory info */ 2190 VIR_DOMAIN_STATS_DIRTYRATE = (1 << 9), /* return domain dirty rate info */ 2191 } virDomainStatsTypes; 2192 2193 typedef enum { 2194 VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = VIR_CONNECT_LIST_DOMAINS_ACTIVE, 2195 VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE = VIR_CONNECT_LIST_DOMAINS_INACTIVE, 2196 2197 VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT = VIR_CONNECT_LIST_DOMAINS_PERSISTENT, 2198 VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT = VIR_CONNECT_LIST_DOMAINS_TRANSIENT, 2199 2200 VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING = VIR_CONNECT_LIST_DOMAINS_RUNNING, 2201 VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED = VIR_CONNECT_LIST_DOMAINS_PAUSED, 2202 VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF = VIR_CONNECT_LIST_DOMAINS_SHUTOFF, 2203 VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER = VIR_CONNECT_LIST_DOMAINS_OTHER, 2204 2205 VIR_CONNECT_GET_ALL_DOMAINS_STATS_NOWAIT = 1 << 29, /* report statistics that can be obtained 2206 immediately without any blocking */ 2207 VIR_CONNECT_GET_ALL_DOMAINS_STATS_BACKING = 1 << 30, /* include backing chain for block stats */ 2208 VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 1U << 31, /* enforce requested stats */ 2209 } virConnectGetAllDomainStatsFlags; 2210 2211 int virConnectGetAllDomainStats(virConnectPtr conn, 2212 unsigned int stats, 2213 virDomainStatsRecordPtr **retStats, 2214 unsigned int flags); 2215 2216 int virDomainListGetStats(virDomainPtr *doms, 2217 unsigned int stats, 2218 virDomainStatsRecordPtr **retStats, 2219 unsigned int flags); 2220 2221 void virDomainStatsRecordListFree(virDomainStatsRecordPtr *stats); 2222 2223 /* 2224 * Perf Event API 2225 */ 2226 2227 /** 2228 * VIR_PERF_PARAM_CMT: 2229 * 2230 * Macro for typed parameter name that represents CMT perf event 2231 * which can be used to measure the usage of cache (bytes) by 2232 * applications running on the platform. It corresponds to the 2233 * "perf.cmt" field in the *Stats APIs. 2234 */ 2235 # define VIR_PERF_PARAM_CMT "cmt" 2236 2237 /** 2238 * VIR_PERF_PARAM_MBMT: 2239 * 2240 * Macro for typed parameter name that represents MBMT perf event 2241 * which can be used to monitor total system bandwidth (bytes/s) 2242 * from one level of cache to another. It corresponds to the 2243 * "perf.mbmt" field in the *Stats APIs. 2244 2245 */ 2246 # define VIR_PERF_PARAM_MBMT "mbmt" 2247 2248 /** 2249 * VIR_PERF_PARAM_MBML: 2250 * 2251 * Macro for typed parameter name that represents MBML perf event 2252 * which can be used to monitor the amount of data (bytes/s) sent 2253 * through the memory controller on the socket. It corresponds to 2254 * the "perf.mbml" field in the *Stats APIs. 2255 */ 2256 # define VIR_PERF_PARAM_MBML "mbml" 2257 2258 /** 2259 * VIR_PERF_PARAM_CACHE_MISSES: 2260 * 2261 * Macro for typed parameter name that represents cache_misses perf 2262 * event which can be used to measure the count of cache misses by 2263 * applications running on the platform. It corresponds to the 2264 * "perf.cache_misses" field in the *Stats APIs. 2265 */ 2266 # define VIR_PERF_PARAM_CACHE_MISSES "cache_misses" 2267 2268 /** 2269 * VIR_PERF_PARAM_CACHE_REFERENCES: 2270 * 2271 * Macro for typed parameter name that represents cache_references 2272 * perf event which can be used to measure the count of cache hits 2273 * by applications running on the platform. It corresponds to the 2274 * "perf.cache_references" field in the *Stats APIs. 2275 */ 2276 # define VIR_PERF_PARAM_CACHE_REFERENCES "cache_references" 2277 2278 /** 2279 * VIR_PERF_PARAM_INSTRUCTIONS: 2280 * 2281 * Macro for typed parameter name that represents instructions perf 2282 * event which can be used to measure the count of instructions 2283 * by applications running on the platform. It corresponds to the 2284 * "perf.instructions" field in the *Stats APIs. 2285 */ 2286 # define VIR_PERF_PARAM_INSTRUCTIONS "instructions" 2287 2288 /** 2289 * VIR_PERF_PARAM_CPU_CYCLES: 2290 * 2291 * Macro for typed parameter name that represents cpu_cycles perf event 2292 * describing the total/elapsed cpu cycles. This can be used to measure 2293 * how many cpu cycles one instruction needs. 2294 * It corresponds to the "perf.cpu_cycles" field in the *Stats APIs. 2295 */ 2296 # define VIR_PERF_PARAM_CPU_CYCLES "cpu_cycles" 2297 2298 /** 2299 * VIR_PERF_PARAM_BRANCH_INSTRUCTIONS: 2300 * 2301 * Macro for typed parameter name that represents branch_instructions 2302 * perf event which can be used to measure the count of branch instructions 2303 * by applications running on the platform. It corresponds to the 2304 * "perf.branch_instructions" field in the *Stats APIs. 2305 */ 2306 # define VIR_PERF_PARAM_BRANCH_INSTRUCTIONS "branch_instructions" 2307 2308 /** 2309 * VIR_PERF_PARAM_BRANCH_MISSES: 2310 * 2311 * Macro for typed parameter name that represents branch_misses 2312 * perf event which can be used to measure the count of branch misses 2313 * by applications running on the platform. It corresponds to the 2314 * "perf.branch_misses" field in the *Stats APIs. 2315 */ 2316 # define VIR_PERF_PARAM_BRANCH_MISSES "branch_misses" 2317 2318 /** 2319 * VIR_PERF_PARAM_BUS_CYCLES: 2320 * 2321 * Macro for typed parameter name that represents bus_cycles 2322 * perf event which can be used to measure the count of bus cycles 2323 * by applications running on the platform. It corresponds to the 2324 * "perf.bus_cycles" field in the *Stats APIs. 2325 */ 2326 # define VIR_PERF_PARAM_BUS_CYCLES "bus_cycles" 2327 2328 /** 2329 * VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND: 2330 * 2331 * Macro for typed parameter name that represents stalled_cycles_frontend 2332 * perf event which can be used to measure the count of stalled cpu cycles 2333 * in the frontend of the instruction processor pipeline by applications 2334 * running on the platform. It corresponds to the 2335 * "perf.stalled_cycles_frontend" field in the *Stats APIs. 2336 */ 2337 # define VIR_PERF_PARAM_STALLED_CYCLES_FRONTEND "stalled_cycles_frontend" 2338 2339 /** 2340 * VIR_PERF_PARAM_STALLED_CYCLES_BACKEND: 2341 * 2342 * Macro for typed parameter name that represents stalled_cycles_backend 2343 * perf event which can be used to measure the count of stalled cpu cycles 2344 * in the backend of the instruction processor pipeline by application 2345 * running on the platform. It corresponds to the 2346 * "perf.stalled_cycles_backend" field in the *Stats APIs. 2347 */ 2348 # define VIR_PERF_PARAM_STALLED_CYCLES_BACKEND "stalled_cycles_backend" 2349 2350 /** 2351 * VIR_PERF_PARAM_REF_CPU_CYCLES: 2352 * 2353 * Macro for typed parameter name that represents ref_cpu_cycles 2354 * perf event which can be used to measure the count of total cpu 2355 * cycles not affected by CPU frequency scaling by applications 2356 * running on the platform. It corresponds to the 2357 * "perf.ref_cpu_cycles" field in the *Stats APIs. 2358 */ 2359 # define VIR_PERF_PARAM_REF_CPU_CYCLES "ref_cpu_cycles" 2360 2361 /** 2362 * VIR_PERF_PARAM_CPU_CLOCK: 2363 * 2364 * Macro for typed parameter name that represents cpu_clock 2365 * perf event which can be used to measure the count of cpu 2366 * clock time by applications running on the platform. It 2367 * corresponds to the "perf.cpu_clock" field in the *Stats 2368 * APIs. 2369 */ 2370 # define VIR_PERF_PARAM_CPU_CLOCK "cpu_clock" 2371 2372 /** 2373 * VIR_PERF_PARAM_TASK_CLOCK: 2374 * 2375 * Macro for typed parameter name that represents task_clock 2376 * perf event which can be used to measure the count of task 2377 * clock time by applications running on the platform. It 2378 * corresponds to the "perf.task_clock" field in the *Stats 2379 * APIs. 2380 */ 2381 # define VIR_PERF_PARAM_TASK_CLOCK "task_clock" 2382 2383 /** 2384 * VIR_PERF_PARAM_PAGE_FAULTS: 2385 * 2386 * Macro for typed parameter name that represents page_faults 2387 * perf event which can be used to measure the count of page 2388 * faults by applications running on the platform. It corresponds 2389 * to the "perf.page_faults" field in the *Stats APIs. 2390 */ 2391 # define VIR_PERF_PARAM_PAGE_FAULTS "page_faults" 2392 2393 /** 2394 * VIR_PERF_PARAM_CONTEXT_SWITCHES: 2395 * 2396 * Macro for typed parameter name that represents context_switches 2397 * perf event which can be used to measure the count of context 2398 * switches by applications running on the platform. It corresponds 2399 * to the "perf.context_switches" field in the *Stats APIs. 2400 */ 2401 # define VIR_PERF_PARAM_CONTEXT_SWITCHES "context_switches" 2402 2403 /** 2404 * VIR_PERF_PARAM_CPU_MIGRATIONS: 2405 * 2406 * Macro for typed parameter name that represents cpu_migrations 2407 * perf event which can be used to measure the count of cpu 2408 * migrations by applications running on the platform. It corresponds 2409 * to the "perf.cpu_migrations" field in the *Stats APIs. 2410 */ 2411 # define VIR_PERF_PARAM_CPU_MIGRATIONS "cpu_migrations" 2412 2413 /** 2414 * VIR_PERF_PARAM_PAGE_FAULTS_MIN: 2415 * 2416 * Macro for typed parameter name that represents page_faults_min 2417 * perf event which can be used to measure the count of minor page 2418 * faults by applications running on the platform. It corresponds 2419 * to the "perf.page_faults_min" field in the *Stats APIs. 2420 */ 2421 # define VIR_PERF_PARAM_PAGE_FAULTS_MIN "page_faults_min" 2422 2423 /** 2424 * VIR_PERF_PARAM_PAGE_FAULTS_MAJ: 2425 * 2426 * Macro for typed parameter name that represents page_faults_maj 2427 * perf event which can be used to measure the count of major page 2428 * faults by applications running on the platform. It corresponds 2429 * to the "perf.page_faults_maj" field in the *Stats APIs. 2430 */ 2431 # define VIR_PERF_PARAM_PAGE_FAULTS_MAJ "page_faults_maj" 2432 2433 /** 2434 * VIR_PERF_PARAM_ALIGNMENT_FAULTS: 2435 * 2436 * Macro for typed parameter name that represents alignment_faults 2437 * perf event which can be used to measure the count of alignment 2438 * faults by applications running on the platform. It corresponds 2439 * to the "perf.alignment_faults" field in the *Stats APIs. 2440 */ 2441 # define VIR_PERF_PARAM_ALIGNMENT_FAULTS "alignment_faults" 2442 2443 /** 2444 * VIR_PERF_PARAM_EMULATION_FAULTS: 2445 * 2446 * Macro for typed parameter name that represents emulation_faults 2447 * perf event which can be used to measure the count of emulation 2448 * faults by applications running on the platform. It corresponds 2449 * to the "perf.emulation_faults" field in the *Stats APIs. 2450 */ 2451 # define VIR_PERF_PARAM_EMULATION_FAULTS "emulation_faults" 2452 2453 int virDomainGetPerfEvents(virDomainPtr dom, 2454 virTypedParameterPtr *params, 2455 int *nparams, 2456 unsigned int flags); 2457 int virDomainSetPerfEvents(virDomainPtr dom, 2458 virTypedParameterPtr params, 2459 int nparams, 2460 unsigned int flags); 2461 2462 /* 2463 * BlockJob API 2464 */ 2465 2466 /** 2467 * virDomainBlockJobType: 2468 * 2469 * Describes various possible block jobs. 2470 */ 2471 typedef enum { 2472 /* Placeholder */ 2473 VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0, 2474 2475 /* Block Pull (virDomainBlockPull, or virDomainBlockRebase without 2476 * flags), job ends on completion */ 2477 VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1, 2478 2479 /* Block Copy (virDomainBlockCopy, or virDomainBlockRebase with 2480 * flags), job exists as long as mirroring is active */ 2481 VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2, 2482 2483 /* Block Commit (virDomainBlockCommit without flags), job ends on 2484 * completion */ 2485 VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3, 2486 2487 /* Active Block Commit (virDomainBlockCommit with flags), job 2488 * exists as long as sync is active */ 2489 VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4, 2490 2491 /* Backup (virDomainBackupBegin) */ 2492 VIR_DOMAIN_BLOCK_JOB_TYPE_BACKUP = 5, 2493 2494 # ifdef VIR_ENUM_SENTINELS 2495 VIR_DOMAIN_BLOCK_JOB_TYPE_LAST 2496 # endif 2497 } virDomainBlockJobType; 2498 2499 /** 2500 * virDomainBlockJobAbortFlags: 2501 * 2502 * VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC: Request only, do not wait for completion 2503 * VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT: Pivot to new file when ending a copy or 2504 * active commit job 2505 */ 2506 typedef enum { 2507 VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC = 1 << 0, 2508 VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT = 1 << 1, 2509 } virDomainBlockJobAbortFlags; 2510 2511 int virDomainBlockJobAbort(virDomainPtr dom, const char *disk, 2512 unsigned int flags); 2513 2514 /* Flags for use with virDomainGetBlockJobInfo */ 2515 typedef enum { 2516 VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES = 1 << 0, /* bandwidth in bytes/s 2517 instead of MiB/s */ 2518 } virDomainBlockJobInfoFlags; 2519 2520 /* An iterator for monitoring block job operations */ 2521 typedef unsigned long long virDomainBlockJobCursor; 2522 2523 typedef struct _virDomainBlockJobInfo virDomainBlockJobInfo; 2524 struct _virDomainBlockJobInfo { 2525 int type; /* virDomainBlockJobType */ 2526 unsigned long bandwidth; /* either bytes/s or MiB/s, according to flags */ 2527 2528 /* 2529 * The following fields provide an indication of block job progress. @cur 2530 * indicates the current position and will be between 0 and @end. @end is 2531 * the final cursor position for this operation and represents completion. 2532 * To approximate progress, divide @cur by @end. 2533 */ 2534 virDomainBlockJobCursor cur; 2535 virDomainBlockJobCursor end; 2536 }; 2537 typedef virDomainBlockJobInfo *virDomainBlockJobInfoPtr; 2538 2539 int virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk, 2540 virDomainBlockJobInfoPtr info, 2541 unsigned int flags); 2542 2543 /* Flags for use with virDomainBlockJobSetSpeed */ 2544 typedef enum { 2545 VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES = 1 << 0, /* bandwidth in bytes/s 2546 instead of MiB/s */ 2547 } virDomainBlockJobSetSpeedFlags; 2548 2549 int virDomainBlockJobSetSpeed(virDomainPtr dom, const char *disk, 2550 unsigned long bandwidth, unsigned int flags); 2551 2552 /* Flags for use with virDomainBlockPull (values chosen to be a subset 2553 * of the flags for virDomainBlockRebase) */ 2554 typedef enum { 2555 VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES = 1 << 6, /* bandwidth in bytes/s 2556 instead of MiB/s */ 2557 } virDomainBlockPullFlags; 2558 2559 int virDomainBlockPull(virDomainPtr dom, const char *disk, 2560 unsigned long bandwidth, unsigned int flags); 2561 2562 /** 2563 * virDomainBlockRebaseFlags: 2564 * 2565 * Flags available for virDomainBlockRebase(). 2566 */ 2567 typedef enum { 2568 VIR_DOMAIN_BLOCK_REBASE_SHALLOW = 1 << 0, /* Limit copy to top of source 2569 backing chain */ 2570 VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT = 1 << 1, /* Reuse existing external 2571 file for a copy */ 2572 VIR_DOMAIN_BLOCK_REBASE_COPY_RAW = 1 << 2, /* Make destination file raw */ 2573 VIR_DOMAIN_BLOCK_REBASE_COPY = 1 << 3, /* Start a copy job */ 2574 VIR_DOMAIN_BLOCK_REBASE_RELATIVE = 1 << 4, /* Keep backing chain 2575 referenced using relative 2576 names */ 2577 VIR_DOMAIN_BLOCK_REBASE_COPY_DEV = 1 << 5, /* Treat destination as block 2578 device instead of file */ 2579 VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES = 1 << 6, /* bandwidth in bytes/s 2580 instead of MiB/s */ 2581 } virDomainBlockRebaseFlags; 2582 2583 int virDomainBlockRebase(virDomainPtr dom, const char *disk, 2584 const char *base, unsigned long bandwidth, 2585 unsigned int flags); 2586 2587 /** 2588 * virDomainBlockCopyFlags: 2589 * 2590 * Flags available for virDomainBlockCopy(). 2591 */ 2592 typedef enum { 2593 VIR_DOMAIN_BLOCK_COPY_SHALLOW = 1 << 0, /* Limit copy to top of source 2594 backing chain */ 2595 VIR_DOMAIN_BLOCK_COPY_REUSE_EXT = 1 << 1, /* Reuse existing external 2596 file for a copy */ 2597 VIR_DOMAIN_BLOCK_COPY_TRANSIENT_JOB = 1 << 2, /* Don't force usage of 2598 recoverable job for the 2599 copy operation */ 2600 } virDomainBlockCopyFlags; 2601 2602 /** 2603 * VIR_DOMAIN_BLOCK_COPY_BANDWIDTH: 2604 * Macro for the virDomainBlockCopy bandwidth tunable: it represents 2605 * the maximum bandwidth in bytes/s, and is used while getting the 2606 * copy operation into the mirrored phase, with a type of ullong. For 2607 * compatibility with virDomainBlockJobSetSpeed(), values larger than 2608 * 2^52 bytes/sec (a 32-bit MiB/s value) may be rejected on input due 2609 * to overflow considerations (but do you really have an interface 2610 * with that much bandwidth?), and values larger than 2^31 bytes/sec 2611 * may cause overflow problems if queried in bytes/sec. Hypervisors 2612 * may further restrict the set of valid values. Specifying 0 is the 2613 * same as omitting this parameter, to request no bandwidth limiting. 2614 * Some hypervisors may lack support for this parameter, while still 2615 * allowing a subsequent change of bandwidth via 2616 * virDomainBlockJobSetSpeed(). The actual speed can be determined 2617 * with virDomainGetBlockJobInfo(). 2618 */ 2619 # define VIR_DOMAIN_BLOCK_COPY_BANDWIDTH "bandwidth" 2620 2621 /** 2622 * VIR_DOMAIN_BLOCK_COPY_GRANULARITY: 2623 * Macro for the virDomainBlockCopy granularity tunable: it represents 2624 * the granularity in bytes at which the copy operation recognizes 2625 * dirty blocks that need copying, as an unsigned int. Hypervisors may 2626 * restrict this to be a power of two or fall within a certain 2627 * range. Specifying 0 is the same as omitting this parameter, to 2628 * request the hypervisor default. 2629 */ 2630 # define VIR_DOMAIN_BLOCK_COPY_GRANULARITY "granularity" 2631 2632 /** 2633 * VIR_DOMAIN_BLOCK_COPY_BUF_SIZE: 2634 * Macro for the virDomainBlockCopy buffer size tunable: it represents 2635 * how much data in bytes can be in flight between source and destination, 2636 * as an unsigned long long. Specifying 0 is the same as omitting this 2637 * parameter, to request the hypervisor default. 2638 */ 2639 # define VIR_DOMAIN_BLOCK_COPY_BUF_SIZE "buf-size" 2640 2641 int virDomainBlockCopy(virDomainPtr dom, const char *disk, 2642 const char *destxml, 2643 virTypedParameterPtr params, 2644 int nparams, 2645 unsigned int flags); 2646 2647 /** 2648 * virDomainBlockCommitFlags: 2649 * 2650 * Flags available for virDomainBlockCommit(). 2651 */ 2652 typedef enum { 2653 VIR_DOMAIN_BLOCK_COMMIT_SHALLOW = 1 << 0, /* NULL base means next backing 2654 file, not whole chain */ 2655 VIR_DOMAIN_BLOCK_COMMIT_DELETE = 1 << 1, /* Delete any files that are now 2656 invalid after their contents 2657 have been committed */ 2658 VIR_DOMAIN_BLOCK_COMMIT_ACTIVE = 1 << 2, /* Allow a two-phase commit when 2659 top is the active layer */ 2660 VIR_DOMAIN_BLOCK_COMMIT_RELATIVE = 1 << 3, /* keep the backing chain 2661 referenced using relative 2662 names */ 2663 VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = 1 << 4, /* bandwidth in bytes/s 2664 instead of MiB/s */ 2665 } virDomainBlockCommitFlags; 2666 2667 int virDomainBlockCommit(virDomainPtr dom, const char *disk, const char *base, 2668 const char *top, unsigned long bandwidth, 2669 unsigned int flags); 2670 2671 2672 /* Block I/O throttling support */ 2673 2674 /** 2675 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC: 2676 * 2677 * Macro for the BlockIoTune tunable weight: it represents the total 2678 * bytes per second permitted through a block device, as a ullong. 2679 */ 2680 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC "total_bytes_sec" 2681 2682 /** 2683 * VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC: 2684 * 2685 * Macro for the BlockIoTune tunable weight: it represents the read 2686 * bytes per second permitted through a block device, as a ullong. 2687 */ 2688 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC "read_bytes_sec" 2689 2690 /** 2691 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC: 2692 * 2693 * Macro for the BlockIoTune tunable weight: it represents the write 2694 * bytes per second permitted through a block device, as a ullong. 2695 */ 2696 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC "write_bytes_sec" 2697 2698 /** 2699 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC: 2700 * 2701 * Macro for the BlockIoTune tunable weight: it represents the total 2702 * I/O operations per second permitted through a block device, as a ullong. 2703 */ 2704 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC "total_iops_sec" 2705 2706 /** 2707 * VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC: 2708 * 2709 * Macro for the BlockIoTune tunable weight: it represents the read 2710 * I/O operations per second permitted through a block device, as a ullong. 2711 */ 2712 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC "read_iops_sec" 2713 2714 /** 2715 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC: 2716 * Macro for the BlockIoTune tunable weight: it represents the write 2717 * I/O operations per second permitted through a block device, as a ullong. 2718 */ 2719 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC "write_iops_sec" 2720 2721 /** 2722 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX: 2723 * 2724 * Macro for the BlockIoTune tunable weight: it represents the maximum total 2725 * bytes per second permitted through a block device, as a ullong. 2726 */ 2727 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX "total_bytes_sec_max" 2728 2729 /** 2730 * VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX: 2731 * 2732 * Macro for the BlockIoTune tunable weight: it represents the maximum read 2733 * bytes per second permitted through a block device, as a ullong. 2734 */ 2735 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX "read_bytes_sec_max" 2736 2737 /** 2738 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX: 2739 * 2740 * Macro for the BlockIoTune tunable weight: it represents the maximum write 2741 * bytes per second permitted through a block device, as a ullong. 2742 */ 2743 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX "write_bytes_sec_max" 2744 2745 /** 2746 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX: 2747 * 2748 * Macro for the BlockIoTune tunable weight: it represents the maximum 2749 * I/O operations per second permitted through a block device, as a ullong. 2750 */ 2751 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX "total_iops_sec_max" 2752 2753 /** 2754 * VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX: 2755 * 2756 * Macro for the BlockIoTune tunable weight: it represents the maximum read 2757 * I/O operations per second permitted through a block device, as a ullong. 2758 */ 2759 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX "read_iops_sec_max" 2760 2761 /** 2762 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX: 2763 * Macro for the BlockIoTune tunable weight: it represents the maximum write 2764 * I/O operations per second permitted through a block device, as a ullong. 2765 */ 2766 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX "write_iops_sec_max" 2767 2768 /** 2769 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH: 2770 * 2771 * Macro for the BlockIoTune tunable weight: it represents the duration in 2772 * seconds for the burst allowed by total_bytes_sec_max, as a ullong. 2773 */ 2774 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_BYTES_SEC_MAX_LENGTH "total_bytes_sec_max_length" 2775 2776 /** 2777 * VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH: 2778 * 2779 * Macro for the BlockIoTune tunable weight: it represents the duration in 2780 * seconds for the burst allowed by read_bytes_sec_max, as a ullong. 2781 */ 2782 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_BYTES_SEC_MAX_LENGTH "read_bytes_sec_max_length" 2783 2784 /** 2785 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH: 2786 * 2787 * Macro for the BlockIoTune tunable weight: it represents the duration in 2788 * seconds for the burst allowed by write_bytes_sec_max, as a ullong. 2789 */ 2790 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_BYTES_SEC_MAX_LENGTH "write_bytes_sec_max_length" 2791 2792 /** 2793 * VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH: 2794 * 2795 * Macro for the BlockIoTune tunable weight: it represents the duration in 2796 * seconds for the burst allowed by total_iops_sec_max, as a ullong. 2797 */ 2798 # define VIR_DOMAIN_BLOCK_IOTUNE_TOTAL_IOPS_SEC_MAX_LENGTH "total_iops_sec_max_length" 2799 2800 /** 2801 * VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH: 2802 * 2803 * Macro for the BlockIoTune tunable weight: it represents the duration in 2804 * seconds for the burst allowed by read_iops_sec_max, as a ullong. 2805 */ 2806 # define VIR_DOMAIN_BLOCK_IOTUNE_READ_IOPS_SEC_MAX_LENGTH "read_iops_sec_max_length" 2807 2808 /** 2809 * VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH: 2810 * 2811 * Macro for the BlockIoTune tunable weight: it represents the duration in 2812 * seconds for the burst allowed by write_iops_sec_max, as a ullong. 2813 */ 2814 # define VIR_DOMAIN_BLOCK_IOTUNE_WRITE_IOPS_SEC_MAX_LENGTH "write_iops_sec_max_length" 2815 2816 /** 2817 * VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC: 2818 * Macro for the BlockIoTune tunable weight: it represents the size 2819 * I/O operations per second permitted through a block device, as a ullong. 2820 */ 2821 # define VIR_DOMAIN_BLOCK_IOTUNE_SIZE_IOPS_SEC "size_iops_sec" 2822 2823 /** 2824 * VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME: 2825 * Macro for the BlockIoTune tunable weight: it represents a group name to 2826 * allow sharing of I/O throttling quota between multiple drives, as a string. 2827 */ 2828 # define VIR_DOMAIN_BLOCK_IOTUNE_GROUP_NAME "group_name" 2829 2830 int 2831 virDomainSetBlockIoTune(virDomainPtr dom, 2832 const char *disk, 2833 virTypedParameterPtr params, 2834 int nparams, 2835 unsigned int flags); 2836 int 2837 virDomainGetBlockIoTune(virDomainPtr dom, 2838 const char *disk, 2839 virTypedParameterPtr params, 2840 int *nparams, 2841 unsigned int flags); 2842 2843 /** 2844 * virDomainDiskErrorCode: 2845 * 2846 * Disk I/O error. 2847 */ 2848 typedef enum { 2849 VIR_DOMAIN_DISK_ERROR_NONE = 0, /* no error */ 2850 VIR_DOMAIN_DISK_ERROR_UNSPEC = 1, /* unspecified I/O error */ 2851 VIR_DOMAIN_DISK_ERROR_NO_SPACE = 2, /* no space left on the device */ 2852 2853 # ifdef VIR_ENUM_SENTINELS 2854 VIR_DOMAIN_DISK_ERROR_LAST 2855 # endif 2856 } virDomainDiskErrorCode; 2857 2858 /** 2859 * virDomainDiskError: 2860 * 2861 */ 2862 typedef struct _virDomainDiskError virDomainDiskError; 2863 typedef virDomainDiskError *virDomainDiskErrorPtr; 2864 2865 struct _virDomainDiskError { 2866 char *disk; /* disk target */ 2867 int error; /* virDomainDiskErrorCode */ 2868 }; 2869 2870 int virDomainGetDiskErrors(virDomainPtr dom, 2871 virDomainDiskErrorPtr errors, 2872 unsigned int maxerrors, 2873 unsigned int flags); 2874 2875 2876 2877 /** 2878 * virKeycodeSet: 2879 * 2880 * Enum to specify which keycode mapping is in use for virDomainSendKey(). 2881 */ 2882 typedef enum { 2883 VIR_KEYCODE_SET_LINUX = 0, 2884 VIR_KEYCODE_SET_XT = 1, 2885 VIR_KEYCODE_SET_ATSET1 = 2, 2886 VIR_KEYCODE_SET_ATSET2 = 3, 2887 VIR_KEYCODE_SET_ATSET3 = 4, 2888 VIR_KEYCODE_SET_OSX = 5, 2889 VIR_KEYCODE_SET_XT_KBD = 6, 2890 VIR_KEYCODE_SET_USB = 7, 2891 VIR_KEYCODE_SET_WIN32 = 8, 2892 VIR_KEYCODE_SET_QNUM = 9, 2893 2894 # ifdef VIR_ENUM_SENTINELS 2895 VIR_KEYCODE_SET_LAST 2896 /* 2897 * NB: this enum value will increase over time as new events are 2898 * added to the libvirt API. It reflects the last keycode set supported 2899 * by this version of the libvirt API. 2900 */ 2901 # endif 2902 } virKeycodeSet; 2903 2904 /** 2905 * VIR_KEYCODE_SET_RFB: 2906 * 2907 * Compatibility alias for VIR_KEYCODE_SET_QNUM, which replaced it since 4.2.0. 2908 */ 2909 # define VIR_KEYCODE_SET_RFB VIR_KEYCODE_SET_QNUM 2910 2911 /** 2912 * VIR_DOMAIN_SEND_KEY_MAX_KEYS: 2913 * 2914 * Maximum number of keycodes that can be sent in one virDomainSendKey() call. 2915 */ 2916 # define VIR_DOMAIN_SEND_KEY_MAX_KEYS 16 2917 2918 int virDomainSendKey(virDomainPtr domain, 2919 unsigned int codeset, 2920 unsigned int holdtime, 2921 unsigned int *keycodes, 2922 int nkeycodes, 2923 unsigned int flags); 2924 2925 /* 2926 * These just happen to match Linux signal numbers. The numbers 2927 * will be mapped to whatever the SIGNUM is in the guest OS in 2928 * question by the agent delivering the signal. The names are 2929 * based on the POSIX / XSI signal standard though. 2930 * 2931 * Do not rely on all values matching Linux though. It is possible 2932 * this enum might be extended with new signals which have no 2933 * mapping in Linux. 2934 */ 2935 typedef enum { 2936 VIR_DOMAIN_PROCESS_SIGNAL_NOP = 0, /* No constant in POSIX/Linux */ 2937 VIR_DOMAIN_PROCESS_SIGNAL_HUP = 1, /* SIGHUP */ 2938 VIR_DOMAIN_PROCESS_SIGNAL_INT = 2, /* SIGINT */ 2939 VIR_DOMAIN_PROCESS_SIGNAL_QUIT = 3, /* SIGQUIT */ 2940 VIR_DOMAIN_PROCESS_SIGNAL_ILL = 4, /* SIGILL */ 2941 VIR_DOMAIN_PROCESS_SIGNAL_TRAP = 5, /* SIGTRAP */ 2942 VIR_DOMAIN_PROCESS_SIGNAL_ABRT = 6, /* SIGABRT */ 2943 VIR_DOMAIN_PROCESS_SIGNAL_BUS = 7, /* SIGBUS */ 2944 VIR_DOMAIN_PROCESS_SIGNAL_FPE = 8, /* SIGFPE */ 2945 VIR_DOMAIN_PROCESS_SIGNAL_KILL = 9, /* SIGKILL */ 2946 2947 VIR_DOMAIN_PROCESS_SIGNAL_USR1 = 10, /* SIGUSR1 */ 2948 VIR_DOMAIN_PROCESS_SIGNAL_SEGV = 11, /* SIGSEGV */ 2949 VIR_DOMAIN_PROCESS_SIGNAL_USR2 = 12, /* SIGUSR2 */ 2950 VIR_DOMAIN_PROCESS_SIGNAL_PIPE = 13, /* SIGPIPE */ 2951 VIR_DOMAIN_PROCESS_SIGNAL_ALRM = 14, /* SIGALRM */ 2952 VIR_DOMAIN_PROCESS_SIGNAL_TERM = 15, /* SIGTERM */ 2953 VIR_DOMAIN_PROCESS_SIGNAL_STKFLT = 16, /* Not in POSIX (SIGSTKFLT on Linux )*/ 2954 VIR_DOMAIN_PROCESS_SIGNAL_CHLD = 17, /* SIGCHLD */ 2955 VIR_DOMAIN_PROCESS_SIGNAL_CONT = 18, /* SIGCONT */ 2956 VIR_DOMAIN_PROCESS_SIGNAL_STOP = 19, /* SIGSTOP */ 2957 2958 VIR_DOMAIN_PROCESS_SIGNAL_TSTP = 20, /* SIGTSTP */ 2959 VIR_DOMAIN_PROCESS_SIGNAL_TTIN = 21, /* SIGTTIN */ 2960 VIR_DOMAIN_PROCESS_SIGNAL_TTOU = 22, /* SIGTTOU */ 2961 VIR_DOMAIN_PROCESS_SIGNAL_URG = 23, /* SIGURG */ 2962 VIR_DOMAIN_PROCESS_SIGNAL_XCPU = 24, /* SIGXCPU */ 2963 VIR_DOMAIN_PROCESS_SIGNAL_XFSZ = 25, /* SIGXFSZ */ 2964 VIR_DOMAIN_PROCESS_SIGNAL_VTALRM = 26, /* SIGVTALRM */ 2965 VIR_DOMAIN_PROCESS_SIGNAL_PROF = 27, /* SIGPROF */ 2966 VIR_DOMAIN_PROCESS_SIGNAL_WINCH = 28, /* Not in POSIX (SIGWINCH on Linux) */ 2967 VIR_DOMAIN_PROCESS_SIGNAL_POLL = 29, /* SIGPOLL (also known as SIGIO on Linux) */ 2968 2969 VIR_DOMAIN_PROCESS_SIGNAL_PWR = 30, /* Not in POSIX (SIGPWR on Linux) */ 2970 VIR_DOMAIN_PROCESS_SIGNAL_SYS = 31, /* SIGSYS (also known as SIGUNUSED on Linux) */ 2971 VIR_DOMAIN_PROCESS_SIGNAL_RT0 = 32, /* SIGRTMIN */ 2972 VIR_DOMAIN_PROCESS_SIGNAL_RT1 = 33, /* SIGRTMIN + 1 */ 2973 VIR_DOMAIN_PROCESS_SIGNAL_RT2 = 34, /* SIGRTMIN + 2 */ 2974 VIR_DOMAIN_PROCESS_SIGNAL_RT3 = 35, /* SIGRTMIN + 3 */ 2975 VIR_DOMAIN_PROCESS_SIGNAL_RT4 = 36, /* SIGRTMIN + 4 */ 2976 VIR_DOMAIN_PROCESS_SIGNAL_RT5 = 37, /* SIGRTMIN + 5 */ 2977 VIR_DOMAIN_PROCESS_SIGNAL_RT6 = 38, /* SIGRTMIN + 6 */ 2978 VIR_DOMAIN_PROCESS_SIGNAL_RT7 = 39, /* SIGRTMIN + 7 */ 2979 2980 VIR_DOMAIN_PROCESS_SIGNAL_RT8 = 40, /* SIGRTMIN + 8 */ 2981 VIR_DOMAIN_PROCESS_SIGNAL_RT9 = 41, /* SIGRTMIN + 9 */ 2982 VIR_DOMAIN_PROCESS_SIGNAL_RT10 = 42, /* SIGRTMIN + 10 */ 2983 VIR_DOMAIN_PROCESS_SIGNAL_RT11 = 43, /* SIGRTMIN + 11 */ 2984 VIR_DOMAIN_PROCESS_SIGNAL_RT12 = 44, /* SIGRTMIN + 12 */ 2985 VIR_DOMAIN_PROCESS_SIGNAL_RT13 = 45, /* SIGRTMIN + 13 */ 2986 VIR_DOMAIN_PROCESS_SIGNAL_RT14 = 46, /* SIGRTMIN + 14 */ 2987 VIR_DOMAIN_PROCESS_SIGNAL_RT15 = 47, /* SIGRTMIN + 15 */ 2988 VIR_DOMAIN_PROCESS_SIGNAL_RT16 = 48, /* SIGRTMIN + 16 */ 2989 VIR_DOMAIN_PROCESS_SIGNAL_RT17 = 49, /* SIGRTMIN + 17 */ 2990 2991 VIR_DOMAIN_PROCESS_SIGNAL_RT18 = 50, /* SIGRTMIN + 18 */ 2992 VIR_DOMAIN_PROCESS_SIGNAL_RT19 = 51, /* SIGRTMIN + 19 */ 2993 VIR_DOMAIN_PROCESS_SIGNAL_RT20 = 52, /* SIGRTMIN + 20 */ 2994 VIR_DOMAIN_PROCESS_SIGNAL_RT21 = 53, /* SIGRTMIN + 21 */ 2995 VIR_DOMAIN_PROCESS_SIGNAL_RT22 = 54, /* SIGRTMIN + 22 */ 2996 VIR_DOMAIN_PROCESS_SIGNAL_RT23 = 55, /* SIGRTMIN + 23 */ 2997 VIR_DOMAIN_PROCESS_SIGNAL_RT24 = 56, /* SIGRTMIN + 24 */ 2998 VIR_DOMAIN_PROCESS_SIGNAL_RT25 = 57, /* SIGRTMIN + 25 */ 2999 VIR_DOMAIN_PROCESS_SIGNAL_RT26 = 58, /* SIGRTMIN + 26 */ 3000 VIR_DOMAIN_PROCESS_SIGNAL_RT27 = 59, /* SIGRTMIN + 27 */ 3001 3002 VIR_DOMAIN_PROCESS_SIGNAL_RT28 = 60, /* SIGRTMIN + 28 */ 3003 VIR_DOMAIN_PROCESS_SIGNAL_RT29 = 61, /* SIGRTMIN + 29 */ 3004 VIR_DOMAIN_PROCESS_SIGNAL_RT30 = 62, /* SIGRTMIN + 30 */ 3005 VIR_DOMAIN_PROCESS_SIGNAL_RT31 = 63, /* SIGRTMIN + 31 */ 3006 VIR_DOMAIN_PROCESS_SIGNAL_RT32 = 64, /* SIGRTMIN + 32 / SIGRTMAX */ 3007 3008 # ifdef VIR_ENUM_SENTINELS 3009 VIR_DOMAIN_PROCESS_SIGNAL_LAST 3010 # endif 3011 } virDomainProcessSignal; 3012 3013 int virDomainSendProcessSignal(virDomainPtr domain, 3014 long long pid_value, 3015 unsigned int signum, 3016 unsigned int flags); 3017 3018 /* 3019 * Deprecated calls 3020 */ 3021 virDomainPtr virDomainCreateLinux (virConnectPtr conn, 3022 const char *xmlDesc, 3023 unsigned int flags); 3024 3025 3026 /* 3027 * Domain Event Notification 3028 */ 3029 3030 /** 3031 * virDomainEventType: 3032 * 3033 * a virDomainEventType is emitted during domain lifecycle events 3034 */ 3035 typedef enum { 3036 VIR_DOMAIN_EVENT_DEFINED = 0, 3037 VIR_DOMAIN_EVENT_UNDEFINED = 1, 3038 VIR_DOMAIN_EVENT_STARTED = 2, 3039 VIR_DOMAIN_EVENT_SUSPENDED = 3, 3040 VIR_DOMAIN_EVENT_RESUMED = 4, 3041 VIR_DOMAIN_EVENT_STOPPED = 5, 3042 VIR_DOMAIN_EVENT_SHUTDOWN = 6, 3043 VIR_DOMAIN_EVENT_PMSUSPENDED = 7, 3044 VIR_DOMAIN_EVENT_CRASHED = 8, 3045 3046 # ifdef VIR_ENUM_SENTINELS 3047 VIR_DOMAIN_EVENT_LAST 3048 # endif 3049 } virDomainEventType; 3050 3051 /** 3052 * virDomainEventDefinedDetailType: 3053 * 3054 * Details on the cause of a 'defined' lifecycle event 3055 */ 3056 typedef enum { 3057 VIR_DOMAIN_EVENT_DEFINED_ADDED = 0, /* Newly created config file */ 3058 VIR_DOMAIN_EVENT_DEFINED_UPDATED = 1, /* Changed config file */ 3059 VIR_DOMAIN_EVENT_DEFINED_RENAMED = 2, /* Domain was renamed */ 3060 VIR_DOMAIN_EVENT_DEFINED_FROM_SNAPSHOT = 3, /* Config was restored from a snapshot */ 3061 3062 # ifdef VIR_ENUM_SENTINELS 3063 VIR_DOMAIN_EVENT_DEFINED_LAST 3064 # endif 3065 } virDomainEventDefinedDetailType; 3066 3067 /** 3068 * virDomainEventUndefinedDetailType: 3069 * 3070 * Details on the cause of an 'undefined' lifecycle event 3071 */ 3072 typedef enum { 3073 VIR_DOMAIN_EVENT_UNDEFINED_REMOVED = 0, /* Deleted the config file */ 3074 VIR_DOMAIN_EVENT_UNDEFINED_RENAMED = 1, /* Domain was renamed */ 3075 3076 # ifdef VIR_ENUM_SENTINELS 3077 VIR_DOMAIN_EVENT_UNDEFINED_LAST 3078 # endif 3079 } virDomainEventUndefinedDetailType; 3080 3081 /** 3082 * virDomainEventStartedDetailType: 3083 * 3084 * Details on the cause of a 'started' lifecycle event 3085 */ 3086 typedef enum { 3087 VIR_DOMAIN_EVENT_STARTED_BOOTED = 0, /* Normal startup from boot */ 3088 VIR_DOMAIN_EVENT_STARTED_MIGRATED = 1, /* Incoming migration from another host */ 3089 VIR_DOMAIN_EVENT_STARTED_RESTORED = 2, /* Restored from a state file */ 3090 VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT = 3, /* Restored from snapshot */ 3091 VIR_DOMAIN_EVENT_STARTED_WAKEUP = 4, /* Started due to wakeup event */ 3092 3093 # ifdef VIR_ENUM_SENTINELS 3094 VIR_DOMAIN_EVENT_STARTED_LAST 3095 # endif 3096 } virDomainEventStartedDetailType; 3097 3098 /** 3099 * virDomainEventSuspendedDetailType: 3100 * 3101 * Details on the cause of a 'suspended' lifecycle event 3102 */ 3103 typedef enum { 3104 VIR_DOMAIN_EVENT_SUSPENDED_PAUSED = 0, /* Normal suspend due to admin pause */ 3105 VIR_DOMAIN_EVENT_SUSPENDED_MIGRATED = 1, /* Suspended for offline migration */ 3106 VIR_DOMAIN_EVENT_SUSPENDED_IOERROR = 2, /* Suspended due to a disk I/O error */ 3107 VIR_DOMAIN_EVENT_SUSPENDED_WATCHDOG = 3, /* Suspended due to a watchdog firing */ 3108 VIR_DOMAIN_EVENT_SUSPENDED_RESTORED = 4, /* Restored from paused state file */ 3109 VIR_DOMAIN_EVENT_SUSPENDED_FROM_SNAPSHOT = 5, /* Restored from paused snapshot */ 3110 VIR_DOMAIN_EVENT_SUSPENDED_API_ERROR = 6, /* suspended after failure during libvirt API call */ 3111 VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY = 7, /* suspended for post-copy migration */ 3112 VIR_DOMAIN_EVENT_SUSPENDED_POSTCOPY_FAILED = 8, /* suspended after failed post-copy */ 3113 3114 # ifdef VIR_ENUM_SENTINELS 3115 VIR_DOMAIN_EVENT_SUSPENDED_LAST 3116 # endif 3117 } virDomainEventSuspendedDetailType; 3118 3119 /** 3120 * virDomainEventResumedDetailType: 3121 * 3122 * Details on the cause of a 'resumed' lifecycle event 3123 */ 3124 typedef enum { 3125 VIR_DOMAIN_EVENT_RESUMED_UNPAUSED = 0, /* Normal resume due to admin unpause */ 3126 VIR_DOMAIN_EVENT_RESUMED_MIGRATED = 1, /* Resumed for completion of migration */ 3127 VIR_DOMAIN_EVENT_RESUMED_FROM_SNAPSHOT = 2, /* Resumed from snapshot */ 3128 VIR_DOMAIN_EVENT_RESUMED_POSTCOPY = 3, /* Resumed, but migration is still 3129 running in post-copy mode */ 3130 3131 # ifdef VIR_ENUM_SENTINELS 3132 VIR_DOMAIN_EVENT_RESUMED_LAST 3133 # endif 3134 } virDomainEventResumedDetailType; 3135 3136 /** 3137 * virDomainEventStoppedDetailType: 3138 * 3139 * Details on the cause of a 'stopped' lifecycle event 3140 */ 3141 typedef enum { 3142 VIR_DOMAIN_EVENT_STOPPED_SHUTDOWN = 0, /* Normal shutdown */ 3143 VIR_DOMAIN_EVENT_STOPPED_DESTROYED = 1, /* Forced poweroff from host */ 3144 VIR_DOMAIN_EVENT_STOPPED_CRASHED = 2, /* Guest crashed */ 3145 VIR_DOMAIN_EVENT_STOPPED_MIGRATED = 3, /* Migrated off to another host */ 3146 VIR_DOMAIN_EVENT_STOPPED_SAVED = 4, /* Saved to a state file */ 3147 VIR_DOMAIN_EVENT_STOPPED_FAILED = 5, /* Host emulator/mgmt failed */ 3148 VIR_DOMAIN_EVENT_STOPPED_FROM_SNAPSHOT = 6, /* offline snapshot loaded */ 3149 3150 # ifdef VIR_ENUM_SENTINELS 3151 VIR_DOMAIN_EVENT_STOPPED_LAST 3152 # endif 3153 } virDomainEventStoppedDetailType; 3154 3155 3156 /** 3157 * virDomainEventShutdownDetailType: 3158 * 3159 * Details on the cause of a 'shutdown' lifecycle event 3160 */ 3161 typedef enum { 3162 /* Guest finished shutdown sequence */ 3163 VIR_DOMAIN_EVENT_SHUTDOWN_FINISHED = 0, 3164 3165 /* Domain finished shutting down after request from the guest itself 3166 * (e.g. hardware-specific action) */ 3167 VIR_DOMAIN_EVENT_SHUTDOWN_GUEST = 1, 3168 3169 /* Domain finished shutting down after request from the host (e.g. killed by 3170 * a signal) */ 3171 VIR_DOMAIN_EVENT_SHUTDOWN_HOST = 2, 3172 3173 # ifdef VIR_ENUM_SENTINELS 3174 VIR_DOMAIN_EVENT_SHUTDOWN_LAST 3175 # endif 3176 } virDomainEventShutdownDetailType; 3177 3178 /** 3179 * virDomainEventPMSuspendedDetailType: 3180 * 3181 * Details on the cause of a 'pmsuspended' lifecycle event 3182 */ 3183 typedef enum { 3184 VIR_DOMAIN_EVENT_PMSUSPENDED_MEMORY = 0, /* Guest was PM suspended to memory */ 3185 VIR_DOMAIN_EVENT_PMSUSPENDED_DISK = 1, /* Guest was PM suspended to disk */ 3186 3187 # ifdef VIR_ENUM_SENTINELS 3188 VIR_DOMAIN_EVENT_PMSUSPENDED_LAST 3189 # endif 3190 } virDomainEventPMSuspendedDetailType; 3191 3192 /** 3193 * virDomainEventCrashedDetailType: 3194 * 3195 * Details on the cause of a 'crashed' lifecycle event 3196 */ 3197 typedef enum { 3198 VIR_DOMAIN_EVENT_CRASHED_PANICKED = 0, /* Guest was panicked */ 3199 VIR_DOMAIN_EVENT_CRASHED_CRASHLOADED = 1, /* Guest was crashloaded */ 3200 3201 # ifdef VIR_ENUM_SENTINELS 3202 VIR_DOMAIN_EVENT_CRASHED_LAST 3203 # endif 3204 } virDomainEventCrashedDetailType; 3205 3206 /** 3207 * virDomainMemoryFailureRecipientType: 3208 * 3209 * Recipient of a memory failure event. 3210 */ 3211 typedef enum { 3212 /* memory failure at hypersivor memory address space */ 3213 VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_HYPERVISOR = 0, 3214 3215 /* memory failure at guest memory address space */ 3216 VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_GUEST = 1, 3217 3218 # ifdef VIR_ENUM_SENTINELS 3219 VIR_DOMAIN_EVENT_MEMORY_FAILURE_RECIPIENT_LAST 3220 # endif 3221 } virDomainMemoryFailureRecipientType; 3222 3223 3224 /** 3225 * virDomainMemoryFailureActionType: 3226 * 3227 * Action of a memory failure event. 3228 */ 3229 typedef enum { 3230 /* the memory failure could be ignored. This will only be the case for 3231 * action-optional failures. */ 3232 VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_IGNORE = 0, 3233 3234 /* memory failure occurred in guest memory, the guest enabled MCE handling 3235 * mechanism, and hypervisor could inject the MCE into the guest 3236 * successfully. */ 3237 VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_INJECT = 1, 3238 3239 /* the failure is unrecoverable. This occurs for action-required failures 3240 * if the recipient is the hypervisor; hypervisor will exit. */ 3241 VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_FATAL = 2, 3242 3243 /* the failure is unrecoverable but confined to the guest. This occurs if 3244 * the recipient is a guest which is not ready to handle memory failures. */ 3245 VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_RESET = 3, 3246 3247 # ifdef VIR_ENUM_SENTINELS 3248 VIR_DOMAIN_EVENT_MEMORY_FAILURE_ACTION_LAST 3249 # endif 3250 } virDomainMemoryFailureActionType; 3251 3252 3253 typedef enum { 3254 /* whether a memory failure event is action-required or action-optional 3255 * (e.g. a failure during memory scrub). */ 3256 VIR_DOMAIN_MEMORY_FAILURE_ACTION_REQUIRED = (1 << 0), 3257 3258 /* whether the failure occurred while the previous failure was still in 3259 * progress. */ 3260 VIR_DOMAIN_MEMORY_FAILURE_RECURSIVE = (1 << 1), 3261 } virDomainMemoryFailureFlags; 3262 3263 3264 /** 3265 * virConnectDomainEventCallback: 3266 * @conn: virConnect connection 3267 * @dom: The domain on which the event occurred 3268 * @event: The specific virDomainEventType which occurred 3269 * @detail: event specific detail information 3270 * @opaque: opaque user data 3271 * 3272 * A callback function to be registered, and called when a domain event occurs 3273 * 3274 * Returns 0 (the return value is currently ignored) 3275 */ 3276 typedef int (*virConnectDomainEventCallback)(virConnectPtr conn, 3277 virDomainPtr dom, 3278 int event, 3279 int detail, 3280 void *opaque); 3281 3282 int virConnectDomainEventRegister(virConnectPtr conn, 3283 virConnectDomainEventCallback cb, 3284 void *opaque, 3285 virFreeCallback freecb); 3286 3287 int virConnectDomainEventDeregister(virConnectPtr conn, 3288 virConnectDomainEventCallback cb); 3289 3290 3291 int virDomainIsActive(virDomainPtr dom); 3292 int virDomainIsPersistent(virDomainPtr dom); 3293 int virDomainIsUpdated(virDomainPtr dom); 3294 3295 typedef enum { 3296 VIR_DOMAIN_JOB_NONE = 0, /* No job is active */ 3297 VIR_DOMAIN_JOB_BOUNDED = 1, /* Job with a finite completion time */ 3298 VIR_DOMAIN_JOB_UNBOUNDED = 2, /* Job without a finite completion time */ 3299 VIR_DOMAIN_JOB_COMPLETED = 3, /* Job has finished, but isn't cleaned up */ 3300 VIR_DOMAIN_JOB_FAILED = 4, /* Job hit error, but isn't cleaned up */ 3301 VIR_DOMAIN_JOB_CANCELLED = 5, /* Job was aborted, but isn't cleaned up */ 3302 3303 # ifdef VIR_ENUM_SENTINELS 3304 VIR_DOMAIN_JOB_LAST 3305 # endif 3306 } virDomainJobType; 3307 3308 typedef struct _virDomainJobInfo virDomainJobInfo; 3309 typedef virDomainJobInfo *virDomainJobInfoPtr; 3310 struct _virDomainJobInfo { 3311 /* One of virDomainJobType */ 3312 int type; 3313 3314 /* Time is measured in milliseconds */ 3315 unsigned long long timeElapsed; /* Always set */ 3316 unsigned long long timeRemaining; /* Only for VIR_DOMAIN_JOB_BOUNDED */ 3317 3318 /* Data is measured in bytes unless otherwise specified 3319 * and is measuring the job as a whole. 3320 * 3321 * For VIR_DOMAIN_JOB_UNBOUNDED, dataTotal may be less 3322 * than the final sum of dataProcessed + dataRemaining 3323 * in the event that the hypervisor has to repeat some 3324 * data, such as due to dirtied pages during migration. 3325 * 3326 * For VIR_DOMAIN_JOB_BOUNDED, dataTotal shall always 3327 * equal the sum of dataProcessed + dataRemaining. 3328 */ 3329 unsigned long long dataTotal; 3330 unsigned long long dataProcessed; 3331 unsigned long long dataRemaining; 3332 3333 /* As above, but only tracking guest memory progress */ 3334 unsigned long long memTotal; 3335 unsigned long long memProcessed; 3336 unsigned long long memRemaining; 3337 3338 /* As above, but only tracking guest disk file progress */ 3339 unsigned long long fileTotal; 3340 unsigned long long fileProcessed; 3341 unsigned long long fileRemaining; 3342 }; 3343 3344 /** 3345 * virDomainGetJobStatsFlags: 3346 * 3347 * Flags OR'ed together to provide specific behavior when querying domain 3348 * job statistics. 3349 */ 3350 typedef enum { 3351 VIR_DOMAIN_JOB_STATS_COMPLETED = 1 << 0, /* return stats of a recently 3352 * completed job */ 3353 VIR_DOMAIN_JOB_STATS_KEEP_COMPLETED = 1 << 1, /* don't remove completed 3354 stats when reading them */ 3355 } virDomainGetJobStatsFlags; 3356 3357 int virDomainGetJobInfo(virDomainPtr dom, 3358 virDomainJobInfoPtr info); 3359 int virDomainGetJobStats(virDomainPtr domain, 3360 int *type, 3361 virTypedParameterPtr *params, 3362 int *nparams, 3363 unsigned int flags); 3364 int virDomainAbortJob(virDomainPtr dom); 3365 3366 typedef enum { 3367 VIR_DOMAIN_JOB_OPERATION_UNKNOWN = 0, 3368 VIR_DOMAIN_JOB_OPERATION_START = 1, 3369 VIR_DOMAIN_JOB_OPERATION_SAVE = 2, 3370 VIR_DOMAIN_JOB_OPERATION_RESTORE = 3, 3371 VIR_DOMAIN_JOB_OPERATION_MIGRATION_IN = 4, 3372 VIR_DOMAIN_JOB_OPERATION_MIGRATION_OUT = 5, 3373 VIR_DOMAIN_JOB_OPERATION_SNAPSHOT = 6, 3374 VIR_DOMAIN_JOB_OPERATION_SNAPSHOT_REVERT = 7, 3375 VIR_DOMAIN_JOB_OPERATION_DUMP = 8, 3376 VIR_DOMAIN_JOB_OPERATION_BACKUP = 9, 3377 3378 # ifdef VIR_ENUM_SENTINELS 3379 VIR_DOMAIN_JOB_OPERATION_LAST 3380 # endif 3381 } virDomainJobOperation; 3382 3383 /** 3384 * VIR_DOMAIN_JOB_OPERATION: 3385 * 3386 * virDomainGetJobStats field: the operation which started the job as 3387 * VIR_TYPED_PARAM_INT. The values correspond to the items in 3388 * virDomainJobOperation enum. 3389 */ 3390 # define VIR_DOMAIN_JOB_OPERATION "operation" 3391 3392 /** 3393 * VIR_DOMAIN_JOB_TIME_ELAPSED: 3394 * 3395 * virDomainGetJobStats field: time (ms) since the beginning of the 3396 * job, as VIR_TYPED_PARAM_ULLONG. 3397 * 3398 * This field corresponds to timeElapsed field in virDomainJobInfo. 3399 */ 3400 # define VIR_DOMAIN_JOB_TIME_ELAPSED "time_elapsed" 3401 3402 /** 3403 * VIR_DOMAIN_JOB_TIME_ELAPSED_NET: 3404 * 3405 * virDomainGetJobStats field: time (ms) since the beginning of the 3406 * migration job NOT including the time required to transfer control 3407 * flow from the source host to the destination host, 3408 * as VIR_TYPED_PARAM_ULLONG. 3409 */ 3410 # define VIR_DOMAIN_JOB_TIME_ELAPSED_NET "time_elapsed_net" 3411 3412 /** 3413 * VIR_DOMAIN_JOB_TIME_REMAINING: 3414 * 3415 * virDomainGetJobStats field: remaining time (ms) for VIR_DOMAIN_JOB_BOUNDED 3416 * jobs, as VIR_TYPED_PARAM_ULLONG. 3417 * 3418 * This field corresponds to timeRemaining field in virDomainJobInfo. 3419 */ 3420 # define VIR_DOMAIN_JOB_TIME_REMAINING "time_remaining" 3421 3422 /** 3423 * VIR_DOMAIN_JOB_DOWNTIME: 3424 * 3425 * virDomainGetJobStats field: downtime (ms) that is expected to happen 3426 * during migration, as VIR_TYPED_PARAM_ULLONG. The real computed downtime 3427 * between the time guest CPUs were paused and the time they were resumed 3428 * is reported for completed migration. 3429 */ 3430 # define VIR_DOMAIN_JOB_DOWNTIME "downtime" 3431 3432 /** 3433 * VIR_DOMAIN_JOB_DOWNTIME_NET: 3434 * 3435 * virDomainGetJobStats field: real measured downtime (ms) NOT including 3436 * the time required to transfer control flow from the source host to the 3437 * destination host, as VIR_TYPED_PARAM_ULLONG. 3438 */ 3439 # define VIR_DOMAIN_JOB_DOWNTIME_NET "downtime_net" 3440 3441 /** 3442 * VIR_DOMAIN_JOB_SETUP_TIME: 3443 * 3444 * virDomainGetJobStats field: total time in milliseconds spent preparing 3445 * the migration in the 'setup' phase before the iterations begin, as 3446 * VIR_TYPED_PARAM_ULLONG. 3447 */ 3448 # define VIR_DOMAIN_JOB_SETUP_TIME "setup_time" 3449 3450 /** 3451 * VIR_DOMAIN_JOB_DATA_TOTAL: 3452 * 3453 * virDomainGetJobStats field: total number of bytes supposed to be 3454 * transferred, as VIR_TYPED_PARAM_ULLONG. For VIR_DOMAIN_JOB_UNBOUNDED 3455 * jobs, this may be less than the sum of VIR_DOMAIN_JOB_DATA_PROCESSED and 3456 * VIR_DOMAIN_JOB_DATA_REMAINING in the event that the hypervisor has to 3457 * repeat some data, e.g., due to dirtied pages during migration. For 3458 * VIR_DOMAIN_JOB_BOUNDED jobs, VIR_DOMAIN_JOB_DATA_TOTAL shall always equal 3459 * VIR_DOMAIN_JOB_DATA_PROCESSED + VIR_DOMAIN_JOB_DATA_REMAINING. 3460 * 3461 * This field corresponds to dataTotal field in virDomainJobInfo. 3462 */ 3463 # define VIR_DOMAIN_JOB_DATA_TOTAL "data_total" 3464 3465 /** 3466 * VIR_DOMAIN_JOB_DATA_PROCESSED: 3467 * 3468 * virDomainGetJobStats field: number of bytes transferred from the 3469 * beginning of the job, as VIR_TYPED_PARAM_ULLONG. 3470 * 3471 * This field corresponds to dataProcessed field in virDomainJobInfo. 3472 */ 3473 # define VIR_DOMAIN_JOB_DATA_PROCESSED "data_processed" 3474 3475 /** 3476 * VIR_DOMAIN_JOB_DATA_REMAINING: 3477 * 3478 * virDomainGetJobStats field: number of bytes that still need to be 3479 * transferred, as VIR_TYPED_PARAM_ULLONG. 3480 * 3481 * This field corresponds to dataRemaining field in virDomainJobInfo. 3482 */ 3483 # define VIR_DOMAIN_JOB_DATA_REMAINING "data_remaining" 3484 3485 /** 3486 * VIR_DOMAIN_JOB_MEMORY_TOTAL: 3487 * 3488 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_TOTAL but only 3489 * tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. 3490 * 3491 * This field corresponds to memTotal field in virDomainJobInfo. 3492 */ 3493 # define VIR_DOMAIN_JOB_MEMORY_TOTAL "memory_total" 3494 3495 /** 3496 * VIR_DOMAIN_JOB_MEMORY_PROCESSED: 3497 * 3498 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_PROCESSED but only 3499 * tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. 3500 * 3501 * This field corresponds to memProcessed field in virDomainJobInfo. 3502 */ 3503 # define VIR_DOMAIN_JOB_MEMORY_PROCESSED "memory_processed" 3504 3505 /** 3506 * VIR_DOMAIN_JOB_MEMORY_REMAINING: 3507 * 3508 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_REMAINING but only 3509 * tracking guest memory progress, as VIR_TYPED_PARAM_ULLONG. 3510 * 3511 * This field corresponds to memRemaining field in virDomainJobInfo. 3512 */ 3513 # define VIR_DOMAIN_JOB_MEMORY_REMAINING "memory_remaining" 3514 3515 /** 3516 * VIR_DOMAIN_JOB_MEMORY_CONSTANT: 3517 * 3518 * virDomainGetJobStats field: number of pages filled with a constant 3519 * byte (all bytes in a single page are identical) transferred since the 3520 * beginning of the migration job, as VIR_TYPED_PARAM_ULLONG. 3521 * 3522 * The most common example of such pages are zero pages, i.e., pages filled 3523 * with zero bytes. 3524 */ 3525 # define VIR_DOMAIN_JOB_MEMORY_CONSTANT "memory_constant" 3526 3527 /** 3528 * VIR_DOMAIN_JOB_MEMORY_NORMAL: 3529 * 3530 * virDomainGetJobStats field: number of pages that were transferred without 3531 * any kind of compression (i.e., pages which were not filled with a constant 3532 * byte and which could not be compressed) transferred since the beginning 3533 * of the migration job, as VIR_TYPED_PARAM_ULLONG. 3534 */ 3535 # define VIR_DOMAIN_JOB_MEMORY_NORMAL "memory_normal" 3536 3537 /** 3538 * VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES: 3539 * 3540 * virDomainGetJobStats field: number of bytes transferred as normal pages, 3541 * as VIR_TYPED_PARAM_ULLONG. 3542 * 3543 * See VIR_DOMAIN_JOB_MEMORY_NORMAL for more details. 3544 */ 3545 # define VIR_DOMAIN_JOB_MEMORY_NORMAL_BYTES "memory_normal_bytes" 3546 3547 /** 3548 * VIR_DOMAIN_JOB_MEMORY_BPS: 3549 * 3550 * virDomainGetJobStats field: network throughput used while migrating 3551 * memory in Bytes per second, as VIR_TYPED_PARAM_ULLONG. 3552 */ 3553 # define VIR_DOMAIN_JOB_MEMORY_BPS "memory_bps" 3554 3555 /** VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE: 3556 * 3557 * virDomainGetJobStats field: number of memory pages dirtied by the guest 3558 * per second, as VIR_TYPED_PARAM_ULLONG. This statistics makes sense only 3559 * when live migration is running. 3560 */ 3561 # define VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE "memory_dirty_rate" 3562 3563 /** 3564 * VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE: 3565 * 3566 * virDomainGetJobStats field: memory page size in bytes, as 3567 * VIR_TYPED_PARAM_ULLONG. If present, this parameter can be used to 3568 * convert other page based statistics, such as 3569 * VIR_DOMAIN_JOB_MEMORY_DIRTY_RATE or VIR_DOMAIN_JOB_COMPRESSION_PAGES 3570 * to bytes. 3571 */ 3572 # define VIR_DOMAIN_JOB_MEMORY_PAGE_SIZE "memory_page_size" 3573 3574 /** 3575 * VIR_DOMAIN_JOB_MEMORY_ITERATION: 3576 * 3577 * virDomainGetJobStats field: current iteration over domain's memory 3578 * during live migration, as VIR_TYPED_PARAM_ULLONG. This is set to zero 3579 * when memory starts to be transferred and the value is increased by one 3580 * every time a new iteration is started to transfer memory pages dirtied 3581 * since the last iteration. 3582 */ 3583 # define VIR_DOMAIN_JOB_MEMORY_ITERATION "memory_iteration" 3584 3585 /** 3586 * VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS: 3587 * 3588 * virDomainGetJobStats field: number page requests received from the 3589 * destination host during post-copy migration, as VIR_TYPED_PARAM_ULLONG. 3590 * This counter is incremented whenever the migrated domain tries to access 3591 * a memory page which has not been transferred from the source host yet. 3592 */ 3593 # define VIR_DOMAIN_JOB_MEMORY_POSTCOPY_REQS "memory_postcopy_requests" 3594 3595 /** 3596 * VIR_DOMAIN_JOB_DISK_TOTAL: 3597 * 3598 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_TOTAL but only 3599 * tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. 3600 * 3601 * This field corresponds to fileTotal field in virDomainJobInfo. 3602 */ 3603 # define VIR_DOMAIN_JOB_DISK_TOTAL "disk_total" 3604 3605 /** 3606 * VIR_DOMAIN_JOB_DISK_PROCESSED: 3607 * 3608 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_PROCESSED but only 3609 * tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. 3610 * 3611 * This field corresponds to fileProcessed field in virDomainJobInfo. 3612 */ 3613 # define VIR_DOMAIN_JOB_DISK_PROCESSED "disk_processed" 3614 3615 /** 3616 * VIR_DOMAIN_JOB_DISK_REMAINING: 3617 * 3618 * virDomainGetJobStats field: as VIR_DOMAIN_JOB_DATA_REMAINING but only 3619 * tracking guest disk progress, as VIR_TYPED_PARAM_ULLONG. 3620 * 3621 * This field corresponds to fileRemaining field in virDomainJobInfo. 3622 */ 3623 # define VIR_DOMAIN_JOB_DISK_REMAINING "disk_remaining" 3624 3625 /** 3626 * VIR_DOMAIN_JOB_DISK_BPS: 3627 * 3628 * virDomainGetJobStats field: network throughput used while migrating 3629 * disks in Bytes per second, as VIR_TYPED_PARAM_ULLONG. 3630 */ 3631 # define VIR_DOMAIN_JOB_DISK_BPS "disk_bps" 3632 3633 /** 3634 * VIR_DOMAIN_JOB_COMPRESSION_CACHE: 3635 * 3636 * virDomainGetJobStats field: size of the cache (in bytes) used for 3637 * compressing repeatedly transferred memory pages during live migration, 3638 * as VIR_TYPED_PARAM_ULLONG. 3639 */ 3640 # define VIR_DOMAIN_JOB_COMPRESSION_CACHE "compression_cache" 3641 3642 /** 3643 * VIR_DOMAIN_JOB_COMPRESSION_BYTES: 3644 * 3645 * virDomainGetJobStats field: number of compressed bytes transferred 3646 * since the beginning of migration, as VIR_TYPED_PARAM_ULLONG. 3647 */ 3648 # define VIR_DOMAIN_JOB_COMPRESSION_BYTES "compression_bytes" 3649 3650 /** 3651 * VIR_DOMAIN_JOB_COMPRESSION_PAGES: 3652 * 3653 * virDomainGetJobStats field: number of compressed pages transferred 3654 * since the beginning of migration, as VIR_TYPED_PARAM_ULLONG. 3655 */ 3656 # define VIR_DOMAIN_JOB_COMPRESSION_PAGES "compression_pages" 3657 3658 /** 3659 * VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES: 3660 * 3661 * virDomainGetJobStats field: number of repeatedly changing pages that 3662 * were not found in compression cache and thus could not be compressed, 3663 * as VIR_TYPED_PARAM_ULLONG. 3664 */ 3665 # define VIR_DOMAIN_JOB_COMPRESSION_CACHE_MISSES "compression_cache_misses" 3666 3667 /** 3668 * VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW: 3669 * 3670 * virDomainGetJobStats field: number of repeatedly changing pages that 3671 * were found in compression cache but were sent uncompressed because 3672 * the result of compression was larger than the original page as a whole, 3673 * as VIR_TYPED_PARAM_ULLONG. 3674 */ 3675 # define VIR_DOMAIN_JOB_COMPRESSION_OVERFLOW "compression_overflow" 3676 3677 /** 3678 * VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE: 3679 * 3680 * virDomainGetJobStats field: current percentage guest CPUs are throttled 3681 * to when auto-convergence decided migration was not converging, as 3682 * VIR_TYPED_PARAM_INT. 3683 */ 3684 # define VIR_DOMAIN_JOB_AUTO_CONVERGE_THROTTLE "auto_converge_throttle" 3685 3686 /** 3687 * VIR_DOMAIN_JOB_SUCCESS: 3688 * 3689 * virDomainGetJobStats field: Present only in statistics for a completed job. 3690 * Successful completion of the job as VIR_TYPED_PARAM_BOOLEAN. 3691 */ 3692 # define VIR_DOMAIN_JOB_SUCCESS "success" 3693 3694 /** 3695 * VIR_DOMAIN_JOB_ERRMSG: 3696 * 3697 * virDomainGetJobStats field: Present only in statistics for a completed job. 3698 * Optional error message for a failed job. 3699 */ 3700 # define VIR_DOMAIN_JOB_ERRMSG "errmsg" 3701 3702 3703 /** 3704 * VIR_DOMAIN_JOB_DISK_TEMP_USED: 3705 * virDomainGetJobStats field: current usage of temporary disk space for the 3706 * job in bytes as VIR_TYPED_PARAM_ULLONG. 3707 */ 3708 # define VIR_DOMAIN_JOB_DISK_TEMP_USED "disk_temp_used" 3709 3710 /** 3711 * VIR_DOMAIN_JOB_DISK_TEMP_TOTAL: 3712 * virDomainGetJobStats field: possible total temporary disk space for the 3713 * job in bytes as VIR_TYPED_PARAM_ULLONG. 3714 */ 3715 # define VIR_DOMAIN_JOB_DISK_TEMP_TOTAL "disk_temp_total" 3716 3717 /** 3718 * virConnectDomainEventGenericCallback: 3719 * @conn: the connection pointer 3720 * @dom: the domain pointer 3721 * @opaque: application specified data 3722 * 3723 * A generic domain event callback handler, for use with 3724 * virConnectDomainEventRegisterAny(). Specific events usually 3725 * have a customization with extra parameters, often with @opaque being 3726 * passed in a different parameter position; use VIR_DOMAIN_EVENT_CALLBACK() 3727 * when registering an appropriate handler. 3728 */ 3729 typedef void (*virConnectDomainEventGenericCallback)(virConnectPtr conn, 3730 virDomainPtr dom, 3731 void *opaque); 3732 3733 /** 3734 * virConnectDomainEventRTCChangeCallback: 3735 * @conn: connection object 3736 * @dom: domain on which the event occurred 3737 * @utcoffset: the new RTC offset from UTC, measured in seconds 3738 * @opaque: application specified data 3739 * 3740 * The callback signature to use when registering for an event of type 3741 * VIR_DOMAIN_EVENT_ID_RTC_CHANGE with virConnectDomainEventRegisterAny() 3742 */ 3743 typedef void (*virConnectDomainEventRTCChangeCallback)(virConnectPtr conn, 3744 virDomainPtr dom, 3745 long long utcoffset, 3746 void *opaque); 3747 3748 /** 3749 * virDomainEventWatchdogAction: 3750 * 3751 * The action that is to be taken due to the watchdog device firing 3752 */ 3753 typedef enum { 3754 VIR_DOMAIN_EVENT_WATCHDOG_NONE = 0, /* No action, watchdog ignored */ 3755 VIR_DOMAIN_EVENT_WATCHDOG_PAUSE, /* Guest CPUs are paused */ 3756 VIR_DOMAIN_EVENT_WATCHDOG_RESET, /* Guest CPUs are reset */ 3757 VIR_DOMAIN_EVENT_WATCHDOG_POWEROFF, /* Guest is forcibly powered off */ 3758 VIR_DOMAIN_EVENT_WATCHDOG_SHUTDOWN, /* Guest is requested to gracefully shutdown */ 3759 VIR_DOMAIN_EVENT_WATCHDOG_DEBUG, /* No action, a debug message logged */ 3760 VIR_DOMAIN_EVENT_WATCHDOG_INJECTNMI,/* Inject a non-maskable interrupt into guest */ 3761 3762 # ifdef VIR_ENUM_SENTINELS 3763 VIR_DOMAIN_EVENT_WATCHDOG_LAST 3764 # endif 3765 } virDomainEventWatchdogAction; 3766 3767 /** 3768 * virConnectDomainEventWatchdogCallback: 3769 * @conn: connection object 3770 * @dom: domain on which the event occurred 3771 * @action: action that is to be taken due to watchdog firing 3772 * @opaque: application specified data 3773 * 3774 * The callback signature to use when registering for an event of type 3775 * VIR_DOMAIN_EVENT_ID_WATCHDOG with virConnectDomainEventRegisterAny() 3776 * 3777 */ 3778 typedef void (*virConnectDomainEventWatchdogCallback)(virConnectPtr conn, 3779 virDomainPtr dom, 3780 int action, 3781 void *opaque); 3782 3783 /** 3784 * virDomainEventIOErrorAction: 3785 * 3786 * The action that is to be taken due to an IO error occurring 3787 */ 3788 typedef enum { 3789 VIR_DOMAIN_EVENT_IO_ERROR_NONE = 0, /* No action, IO error ignored */ 3790 VIR_DOMAIN_EVENT_IO_ERROR_PAUSE, /* Guest CPUs are paused */ 3791 VIR_DOMAIN_EVENT_IO_ERROR_REPORT, /* IO error reported to guest OS */ 3792 3793 # ifdef VIR_ENUM_SENTINELS 3794 VIR_DOMAIN_EVENT_IO_ERROR_LAST 3795 # endif 3796 } virDomainEventIOErrorAction; 3797 3798 3799 /** 3800 * virConnectDomainEventIOErrorCallback: 3801 * @conn: connection object 3802 * @dom: domain on which the event occurred 3803 * @srcPath: The host file on which the IO error occurred 3804 * @devAlias: The guest device alias associated with the path 3805 * @action: action that is to be taken due to the IO error 3806 * @opaque: application specified data 3807 * 3808 * The callback signature to use when registering for an event of type 3809 * VIR_DOMAIN_EVENT_ID_IO_ERROR with virConnectDomainEventRegisterAny() 3810 */ 3811 typedef void (*virConnectDomainEventIOErrorCallback)(virConnectPtr conn, 3812 virDomainPtr dom, 3813 const char *srcPath, 3814 const char *devAlias, 3815 int action, 3816 void *opaque); 3817 3818 /** 3819 * virConnectDomainEventIOErrorReasonCallback: 3820 * @conn: connection object 3821 * @dom: domain on which the event occurred 3822 * @srcPath: The host file on which the IO error occurred 3823 * @devAlias: The guest device alias associated with the path 3824 * @action: action that is to be taken due to the IO error 3825 * @reason: the cause of the IO error 3826 * @opaque: application specified data 3827 * 3828 * The callback signature to use when registering for an event of type 3829 * VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON with virConnectDomainEventRegisterAny() 3830 * 3831 * If the I/O error is known to be caused by an ENOSPC condition in 3832 * the host (where resizing the disk to be larger will allow the guest 3833 * to be resumed as if nothing happened), @reason will be "enospc". 3834 * Otherwise, @reason will be "", although future strings may be added 3835 * if determination of other error types becomes possible. 3836 * 3837 */ 3838 typedef void (*virConnectDomainEventIOErrorReasonCallback)(virConnectPtr conn, 3839 virDomainPtr dom, 3840 const char *srcPath, 3841 const char *devAlias, 3842 int action, 3843 const char *reason, 3844 void *opaque); 3845 3846 /** 3847 * virDomainEventGraphicsPhase: 3848 * 3849 * The phase of the graphics client connection 3850 */ 3851 typedef enum { 3852 VIR_DOMAIN_EVENT_GRAPHICS_CONNECT = 0, /* Initial socket connection established */ 3853 VIR_DOMAIN_EVENT_GRAPHICS_INITIALIZE, /* Authentication & setup completed */ 3854 VIR_DOMAIN_EVENT_GRAPHICS_DISCONNECT, /* Final socket disconnection */ 3855 3856 # ifdef VIR_ENUM_SENTINELS 3857 VIR_DOMAIN_EVENT_GRAPHICS_LAST 3858 # endif 3859 } virDomainEventGraphicsPhase; 3860 3861 /** 3862 * virDomainEventGraphicsAddressType: 3863 * 3864 * The type of address for the connection 3865 */ 3866 typedef enum { 3867 VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV4, /* IPv4 address */ 3868 VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_IPV6, /* IPv6 address */ 3869 VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_UNIX, /* UNIX socket path */ 3870 3871 # ifdef VIR_ENUM_SENTINELS 3872 VIR_DOMAIN_EVENT_GRAPHICS_ADDRESS_LAST 3873 # endif 3874 } virDomainEventGraphicsAddressType; 3875 3876 3877 /** 3878 * virDomainEventGraphicsAddress: 3879 * 3880 * The data structure containing connection address details 3881 * 3882 */ 3883 struct _virDomainEventGraphicsAddress { 3884 int family; /* Address family, virDomainEventGraphicsAddressType */ 3885 char *node; /* Address of node (eg IP address, or UNIX path) */ 3886 char *service; /* Service name/number (eg TCP port, or NULL) */ 3887 }; 3888 typedef struct _virDomainEventGraphicsAddress virDomainEventGraphicsAddress; 3889 typedef virDomainEventGraphicsAddress *virDomainEventGraphicsAddressPtr; 3890 3891 3892 /** 3893 * virDomainEventGraphicsSubjectIdentity: 3894 * 3895 * The data structure representing a single identity 3896 * 3897 * The types of identity differ according to the authentication scheme, 3898 * some examples are 'x509dname' and 'saslUsername'. 3899 */ 3900 struct _virDomainEventGraphicsSubjectIdentity { 3901 char *type; /* Type of identity */ 3902 char *name; /* Identity value */ 3903 }; 3904 typedef struct _virDomainEventGraphicsSubjectIdentity virDomainEventGraphicsSubjectIdentity; 3905 typedef virDomainEventGraphicsSubjectIdentity *virDomainEventGraphicsSubjectIdentityPtr; 3906 3907 3908 /** 3909 * virDomainEventGraphicsSubject: 3910 * 3911 * The data structure representing an authenticated subject 3912 * 3913 * A subject will have zero or more identities. The types of 3914 * identity differ according to the authentication scheme 3915 */ 3916 struct _virDomainEventGraphicsSubject { 3917 int nidentity; /* Number of identities in array*/ 3918 virDomainEventGraphicsSubjectIdentityPtr identities; /* Array of identities for subject */ 3919 }; 3920 typedef struct _virDomainEventGraphicsSubject virDomainEventGraphicsSubject; 3921 typedef virDomainEventGraphicsSubject *virDomainEventGraphicsSubjectPtr; 3922 3923 3924 /** 3925 * virConnectDomainEventGraphicsCallback: 3926 * @conn: connection object 3927 * @dom: domain on which the event occurred 3928 * @phase: the phase of the connection 3929 * @local: the local server address 3930 * @remote: the remote client address 3931 * @authScheme: the authentication scheme activated 3932 * @subject: the authenticated subject (user) 3933 * @opaque: application specified data 3934 * 3935 * The callback signature to use when registering for an event of type 3936 * VIR_DOMAIN_EVENT_ID_GRAPHICS with virConnectDomainEventRegisterAny() 3937 */ 3938 typedef void (*virConnectDomainEventGraphicsCallback)(virConnectPtr conn, 3939 virDomainPtr dom, 3940 int phase, 3941 const virDomainEventGraphicsAddress *local, 3942 const virDomainEventGraphicsAddress *remote, 3943 const char *authScheme, 3944 const virDomainEventGraphicsSubject *subject, 3945 void *opaque); 3946 3947 /** 3948 * virConnectDomainEventBlockJobStatus: 3949 * 3950 * Tracks status of a virDomainBlockPull(), virDomainBlockRebase(), 3951 * virDomainBlockCopy(), or virDomainBlockCommit() operation 3952 */ 3953 typedef enum { 3954 VIR_DOMAIN_BLOCK_JOB_COMPLETED = 0, 3955 VIR_DOMAIN_BLOCK_JOB_FAILED = 1, 3956 VIR_DOMAIN_BLOCK_JOB_CANCELED = 2, 3957 VIR_DOMAIN_BLOCK_JOB_READY = 3, 3958 3959 # ifdef VIR_ENUM_SENTINELS 3960 VIR_DOMAIN_BLOCK_JOB_LAST 3961 # endif 3962 } virConnectDomainEventBlockJobStatus; 3963 3964 /** 3965 * virConnectDomainEventBlockJobCallback: 3966 * @conn: connection object 3967 * @dom: domain on which the event occurred 3968 * @disk: name associated with the affected disk (filename or target 3969 * device, depending on how the callback was registered) 3970 * @type: type of block job (virDomainBlockJobType) 3971 * @status: status of the operation (virConnectDomainEventBlockJobStatus) 3972 * @opaque: application specified data 3973 * 3974 * The string returned for @disk can be used in any of the libvirt API 3975 * that operate on a particular disk of the domain, and depends on what 3976 * event type was registered with virConnectDomainEventRegisterAny(). 3977 * If the callback was registered using the older type of 3978 * VIR_DOMAIN_EVENT_ID_BLOCK_JOB, then @disk contains the absolute file 3979 * name of the host resource for the active layer of the disk; however, 3980 * this name is unstable (pivoting via block copy or active block commit 3981 * will change which file is active, giving a different name for the two 3982 * events associated with the same job) and cannot be relied on if the 3983 * active layer is associated with a network resource. If the callback 3984 * was registered using the newer type of VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2, 3985 * then @disk will contain the device target shorthand (the <target 3986 * dev='...'/> sub-element, such as "vda"). 3987 */ 3988 typedef void (*virConnectDomainEventBlockJobCallback)(virConnectPtr conn, 3989 virDomainPtr dom, 3990 const char *disk, 3991 int type, 3992 int status, 3993 void *opaque); 3994 3995 /** 3996 * virConnectDomainEventDiskChangeReason: 3997 * 3998 * The reason describing why this callback is called 3999 */ 4000 typedef enum { 4001 /* Removable media changed to empty according to startup policy as source 4002 * was missing. oldSrcPath is set, newSrcPath is NULL */ 4003 VIR_DOMAIN_EVENT_DISK_CHANGE_MISSING_ON_START = 0, 4004 4005 /* Disk was dropped from domain as source file was missing. 4006 * oldSrcPath is set, newSrcPath is NULL */ 4007 VIR_DOMAIN_EVENT_DISK_DROP_MISSING_ON_START = 1, 4008 4009 # ifdef VIR_ENUM_SENTINELS 4010 VIR_DOMAIN_EVENT_DISK_CHANGE_LAST 4011 # endif 4012 } virConnectDomainEventDiskChangeReason; 4013 4014 /** 4015 * virConnectDomainEventDiskChangeCallback: 4016 * @conn: connection object 4017 * @dom: domain on which the event occurred 4018 * @oldSrcPath: old source path 4019 * @newSrcPath: new source path 4020 * @devAlias: device alias name 4021 * @reason: reason why this callback was called; any of 4022 * virConnectDomainEventDiskChangeReason 4023 * @opaque: application specified data 4024 * 4025 * This callback occurs when disk gets changed. However, 4026 * not all @reason will cause both @oldSrcPath and @newSrcPath 4027 * to be non-NULL. Please see virConnectDomainEventDiskChangeReason 4028 * for more details. 4029 * 4030 * The callback signature to use when registering for an event of type 4031 * VIR_DOMAIN_EVENT_ID_DISK_CHANGE with virConnectDomainEventRegisterAny() 4032 */ 4033 typedef void (*virConnectDomainEventDiskChangeCallback)(virConnectPtr conn, 4034 virDomainPtr dom, 4035 const char *oldSrcPath, 4036 const char *newSrcPath, 4037 const char *devAlias, 4038 int reason, 4039 void *opaque); 4040 4041 /** 4042 * virConnectDomainEventTrayChangeReason: 4043 * 4044 * The reason describing why the callback was called 4045 */ 4046 typedef enum { 4047 VIR_DOMAIN_EVENT_TRAY_CHANGE_OPEN = 0, 4048 VIR_DOMAIN_EVENT_TRAY_CHANGE_CLOSE, 4049 4050 # ifdef VIR_ENUM_SENTINELS 4051 VIR_DOMAIN_EVENT_TRAY_CHANGE_LAST 4052 # endif 4053 } virDomainEventTrayChangeReason; 4054 4055 /** 4056 * virConnectDomainEventTrayChangeCallback: 4057 * @conn: connection object 4058 * @dom: domain on which the event occurred 4059 * @devAlias: device alias 4060 * @reason: why the tray status was changed? 4061 * @opaque: application specified data 4062 * 4063 * This callback occurs when the tray of a removable device is moved. 4064 * 4065 * The callback signature to use when registering for an event of type 4066 * VIR_DOMAIN_EVENT_ID_TRAY_CHANGE with virConnectDomainEventRegisterAny() 4067 */ 4068 typedef void (*virConnectDomainEventTrayChangeCallback)(virConnectPtr conn, 4069 virDomainPtr dom, 4070 const char *devAlias, 4071 int reason, 4072 void *opaque); 4073 4074 /** 4075 * virConnectDomainEventPMWakeupCallback: 4076 * @conn: connection object 4077 * @dom: domain on which the event occurred 4078 * @reason: reason why the callback was called, unused currently, 4079 * always passes 0 4080 * @opaque: application specified data 4081 * 4082 * This callback occurs when the guest is woken up. 4083 * 4084 * The callback signature to use when registering for an event of type 4085 * VIR_DOMAIN_EVENT_ID_PMWAKEUP with virConnectDomainEventRegisterAny() 4086 */ 4087 typedef void (*virConnectDomainEventPMWakeupCallback)(virConnectPtr conn, 4088 virDomainPtr dom, 4089 int reason, 4090 void *opaque); 4091 4092 /** 4093 * virConnectDomainEventPMSuspendCallback: 4094 * @conn: connection object 4095 * @dom: domain on which the event occurred 4096 * @reason: reason why the callback was called, unused currently, 4097 * always passes 0 4098 * @opaque: application specified data 4099 * 4100 * This callback occurs when the guest is suspended. 4101 * 4102 * The callback signature to use when registering for an event of type 4103 * VIR_DOMAIN_EVENT_ID_PMSUSPEND with virConnectDomainEventRegisterAny() 4104 */ 4105 typedef void (*virConnectDomainEventPMSuspendCallback)(virConnectPtr conn, 4106 virDomainPtr dom, 4107 int reason, 4108 void *opaque); 4109 4110 4111 /** 4112 * virConnectDomainEventBalloonChangeCallback: 4113 * @conn: connection object 4114 * @dom: domain on which the event occurred 4115 * @actual: the new balloon level measured in kibibytes(blocks of 1024 bytes) 4116 * @opaque: application specified data 4117 * 4118 * The callback signature to use when registering for an event of type 4119 * VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE with virConnectDomainEventRegisterAny() 4120 */ 4121 typedef void (*virConnectDomainEventBalloonChangeCallback)(virConnectPtr conn, 4122 virDomainPtr dom, 4123 unsigned long long actual, 4124 void *opaque); 4125 4126 /** 4127 * virConnectDomainEventPMSuspendDiskCallback: 4128 * @conn: connection object 4129 * @dom: domain on which the event occurred 4130 * @reason: reason why the callback was called, unused currently, 4131 * always passes 0 4132 * @opaque: application specified data 4133 * 4134 * This callback occurs when the guest is suspended to disk. 4135 * 4136 * The callback signature to use when registering for an event of type 4137 * VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK with virConnectDomainEventRegisterAny() 4138 */ 4139 typedef void (*virConnectDomainEventPMSuspendDiskCallback)(virConnectPtr conn, 4140 virDomainPtr dom, 4141 int reason, 4142 void *opaque); 4143 4144 /** 4145 * virConnectDomainEventDeviceRemovedCallback: 4146 * @conn: connection object 4147 * @dom: domain on which the event occurred 4148 * @devAlias: device alias 4149 * @opaque: application specified data 4150 * 4151 * This callback occurs when a device is removed from the domain. 4152 * 4153 * The callback signature to use when registering for an event of type 4154 * VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED with virConnectDomainEventRegisterAny() 4155 */ 4156 typedef void (*virConnectDomainEventDeviceRemovedCallback)(virConnectPtr conn, 4157 virDomainPtr dom, 4158 const char *devAlias, 4159 void *opaque); 4160 4161 /** 4162 * virConnectDomainEventDeviceAddedCallback: 4163 * @conn: connection object 4164 * @dom: domain on which the event occurred 4165 * @devAlias: device alias 4166 * @opaque: application specified data 4167 * 4168 * This callback occurs when a device is added to the domain. 4169 * 4170 * The callback signature to use when registering for an event of type 4171 * VIR_DOMAIN_EVENT_ID_DEVICE_ADDED with virConnectDomainEventRegisterAny() 4172 */ 4173 typedef void (*virConnectDomainEventDeviceAddedCallback)(virConnectPtr conn, 4174 virDomainPtr dom, 4175 const char *devAlias, 4176 void *opaque); 4177 4178 4179 /** 4180 * virConnectDomainEventDeviceRemovalFailedCallback: 4181 * @conn: connection object 4182 * @dom: domain on which the event occurred 4183 * @devAlias: device alias 4184 * @opaque: application specified data 4185 * 4186 * This callback occurs when it's certain that removal of a device failed. 4187 * 4188 * The callback signature to use when registering for an event of type 4189 * VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED with 4190 * virConnectDomainEventRegisterAny(). 4191 */ 4192 typedef void (*virConnectDomainEventDeviceRemovalFailedCallback)(virConnectPtr conn, 4193 virDomainPtr dom, 4194 const char *devAlias, 4195 void *opaque); 4196 4197 /** 4198 * virConnectDomainEventMetadataChangeCallback: 4199 * @conn: connection object 4200 * @dom: domain on which the event occurred 4201 * @type: a value from virDomainMetadataTypea 4202 * @nsuri: XML namespace URI 4203 * @opaque: application specified data 4204 * 4205 * This callback is triggered when the domain XML metadata is changed 4206 * 4207 * The callback signature to use when registering for an event of type 4208 * VIR_DOMAIN_EVENT_ID_METADATA_CHANGE with virConnectDomainEventRegisterAny(). 4209 */ 4210 typedef void (*virConnectDomainEventMetadataChangeCallback)(virConnectPtr conn, 4211 virDomainPtr dom, 4212 int type, 4213 const char *nsuri, 4214 void *opaque); 4215 4216 4217 /** 4218 * virConnectDomainEventMigrationIterationCallback: 4219 * @conn: connection object 4220 * @dom: domain on which the event occurred 4221 * @iteration: current iteration over domain's memory 4222 * @opaque: application specific data 4223 * 4224 * This callback occurs during live migration when a new iteration over 4225 * domain's memory starts. The @iteration value is increased by one every 4226 * time a new iteration is started to transfer memory pages dirtied since 4227 * the last iteration. 4228 * 4229 * The callback signature to use when registering for an event of type 4230 * VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION with 4231 * virConnectDomainEventRegisterAny(). 4232 */ 4233 typedef void (*virConnectDomainEventMigrationIterationCallback)(virConnectPtr conn, 4234 virDomainPtr dom, 4235 int iteration, 4236 void *opaque); 4237 4238 /** 4239 * virConnectDomainEventJobCompletedCallback: 4240 * @conn: connection object 4241 * @dom: domain on which the event occurred 4242 * @params: job statistics stored as an array of virTypedParameter 4243 * @nparams: size of the params array 4244 * @opaque: application specific data 4245 * 4246 * This callback occurs when a job (such as migration or backup) running on 4247 * the domain is completed. 4248 * 4249 * The params array will contain statistics of the just completed 4250 * job as virDomainGetJobStats would return. The callback must not free @params 4251 * (the array will be freed once the callback finishes). 4252 * 4253 * The callback signature to use when registering for an event of type 4254 * VIR_DOMAIN_EVENT_ID_JOB_COMPLETED with 4255 * virConnectDomainEventRegisterAny(). 4256 */ 4257 typedef void (*virConnectDomainEventJobCompletedCallback)(virConnectPtr conn, 4258 virDomainPtr dom, 4259 virTypedParameterPtr params, 4260 int nparams, 4261 void *opaque); 4262 4263 /** 4264 * VIR_DOMAIN_TUNABLE_CPU_VCPUPIN: 4265 * 4266 * Macro represents formatted pinning for one vcpu specified by id which is 4267 * appended to the parameter name, for example "cputune.vcpupin1", 4268 * as VIR_TYPED_PARAM_STRING. 4269 */ 4270 # define VIR_DOMAIN_TUNABLE_CPU_VCPUPIN "cputune.vcpupin%u" 4271 4272 /** 4273 * VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN: 4274 * 4275 * Macro represents formatted pinning for emulator process, 4276 * as VIR_TYPED_PARAM_STRING. 4277 */ 4278 # define VIR_DOMAIN_TUNABLE_CPU_EMULATORPIN "cputune.emulatorpin" 4279 4280 /** 4281 * VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN: 4282 * 4283 * Macro represents formatted pinning for one IOThread specified by id which is 4284 * appended to the parameter name, for example "cputune.iothreadpin1", 4285 * as VIR_TYPED_PARAM_STRING. 4286 */ 4287 # define VIR_DOMAIN_TUNABLE_CPU_IOTHREADSPIN "cputune.iothreadpin%u" 4288 4289 /** 4290 * VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES: 4291 * 4292 * Macro represents proportional weight of the scheduler used on the 4293 * host cpu, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG. 4294 */ 4295 # define VIR_DOMAIN_TUNABLE_CPU_CPU_SHARES "cputune.cpu_shares" 4296 4297 /** 4298 * VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD: 4299 * 4300 * Macro represents the enforcement period for a quota, in microseconds, 4301 * for whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG. 4302 */ 4303 # define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_PERIOD "cputune.global_period" 4304 4305 /** 4306 * VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA: 4307 * 4308 * Macro represents the maximum bandwidth to be used within a period for 4309 * whole domain, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG. 4310 */ 4311 # define VIR_DOMAIN_TUNABLE_CPU_GLOBAL_QUOTA "cputune.global_quota" 4312 4313 /** 4314 * VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD: 4315 * 4316 * Macro represents the enforcement period for a quota, in microseconds, 4317 * for vcpus only, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG. 4318 */ 4319 # define VIR_DOMAIN_TUNABLE_CPU_VCPU_PERIOD "cputune.vcpu_period" 4320 4321 /** 4322 * VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA: 4323 * 4324 * Macro represents the maximum bandwidth to be used within a period for 4325 * vcpus only, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG. 4326 */ 4327 # define VIR_DOMAIN_TUNABLE_CPU_VCPU_QUOTA "cputune.vcpu_quota" 4328 4329 /** 4330 * VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD: 4331 * 4332 * Macro represents the enforcement period for a quota in microseconds, 4333 * when using the posix scheduler, for all emulator activity not tied to 4334 * vcpus, as VIR_TYPED_PARAM_ULLONG. 4335 */ 4336 # define VIR_DOMAIN_TUNABLE_CPU_EMULATOR_PERIOD "cputune.emulator_period" 4337 4338 /** 4339 * VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA: 4340 * 4341 * Macro represents the maximum bandwidth to be used within a period for 4342 * all emulator activity not tied to vcpus, when using the posix scheduler, 4343 * as an VIR_TYPED_PARAM_LLONG. 4344 */ 4345 # define VIR_DOMAIN_TUNABLE_CPU_EMULATOR_QUOTA "cputune.emulator_quota" 4346 4347 /** 4348 * VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD: 4349 * 4350 * Macro represents the enforcement period for a quota, in microseconds, for 4351 * iothreads only, when using the posix scheduler, as VIR_TYPED_PARAM_ULLONG. 4352 */ 4353 # define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_PERIOD "cputune.iothread_period" 4354 4355 /** 4356 * VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA: 4357 * 4358 * Macro represents the maximum bandwidth to be used within a period for 4359 * iothreads only, when using the posix scheduler, as VIR_TYPED_PARAM_LLONG. 4360 */ 4361 # define VIR_DOMAIN_TUNABLE_CPU_IOTHREAD_QUOTA "cputune.iothread_quota" 4362 4363 /** 4364 * VIR_DOMAIN_TUNABLE_BLKDEV_DISK: 4365 * 4366 * Macro represents the name of guest disk for which the values are updated, 4367 * as VIR_TYPED_PARAM_STRING. 4368 */ 4369 # define VIR_DOMAIN_TUNABLE_BLKDEV_DISK "blkdeviotune.disk" 4370 4371 /** 4372 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC: 4373 * 4374 * Macro represents the total throughput limit in bytes per second, 4375 * as VIR_TYPED_PARAM_ULLONG. 4376 */ 4377 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC "blkdeviotune.total_bytes_sec" 4378 4379 /** 4380 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC: 4381 * 4382 * Macro represents the read throughput limit in bytes per second, 4383 * as VIR_TYPED_PARAM_ULLONG. 4384 */ 4385 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC "blkdeviotune.read_bytes_sec" 4386 4387 /** 4388 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC: 4389 * 4390 * Macro represents the write throughput limit in bytes per second, 4391 * as VIR_TYPED_PARAM_ULLONG. 4392 */ 4393 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC "blkdeviotune.write_bytes_sec" 4394 4395 /** 4396 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC: 4397 * 4398 * Macro represents the total I/O operations per second, 4399 * as VIR_TYPED_PARAM_ULLONG. 4400 */ 4401 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC "blkdeviotune.total_iops_sec" 4402 4403 /** 4404 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC: 4405 * 4406 * Macro represents the read I/O operations per second, 4407 * as VIR_TYPED_PARAM_ULLONG. 4408 */ 4409 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC "blkdeviotune.read_iops_sec" 4410 4411 /** 4412 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC: 4413 * 4414 * Macro represents the write I/O operations per second, 4415 * as VIR_TYPED_PARAM_ULLONG. 4416 */ 4417 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC "blkdeviotune.write_iops_sec" 4418 4419 /** 4420 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX: 4421 * 4422 * Macro represents the total throughput limit during bursts in 4423 * maximum bytes per second, as VIR_TYPED_PARAM_ULLONG. 4424 */ 4425 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX "blkdeviotune.total_bytes_sec_max" 4426 4427 /** 4428 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX: 4429 * 4430 * Macro represents the read throughput limit during bursts in 4431 * maximum bytes per second, as VIR_TYPED_PARAM_ULLONG. 4432 */ 4433 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX "blkdeviotune.read_bytes_sec_max" 4434 4435 /** 4436 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX: 4437 * 4438 * Macro represents the write throughput limit during bursts in 4439 * maximum bytes per second, as VIR_TYPED_PARAM_ULLONG. 4440 */ 4441 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX "blkdeviotune.write_bytes_sec_max" 4442 4443 /** 4444 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX: 4445 * 4446 * Macro represents the total maximum I/O operations per second during bursts, 4447 * as VIR_TYPED_PARAM_ULLONG. 4448 */ 4449 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX "blkdeviotune.total_iops_sec_max" 4450 4451 /** 4452 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX: 4453 * 4454 * Macro represents the read maximum I/O operations per second during bursts, 4455 * as VIR_TYPED_PARAM_ULLONG. 4456 */ 4457 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX "blkdeviotune.read_iops_sec_max" 4458 4459 /** 4460 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX: 4461 * 4462 * Macro represents the write maximum I/O operations per second during bursts, 4463 * as VIR_TYPED_PARAM_ULLONG. 4464 */ 4465 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX "blkdeviotune.write_iops_sec_max" 4466 4467 /** 4468 * VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC: 4469 * 4470 * Macro represents the size maximum I/O operations per second, 4471 * as VIR_TYPED_PARAM_ULLONG. 4472 */ 4473 # define VIR_DOMAIN_TUNABLE_BLKDEV_SIZE_IOPS_SEC "blkdeviotune.size_iops_sec" 4474 4475 /** 4476 * VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME: 4477 * 4478 * Macro represents the group name to be used, 4479 * as VIR_TYPED_PARAM_STRING. 4480 */ 4481 # define VIR_DOMAIN_TUNABLE_BLKDEV_GROUP_NAME "blkdeviotune.group_name" 4482 4483 /** 4484 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH: 4485 * 4486 * Macro represents the length in seconds allowed for a burst period 4487 * for the blkdeviotune.total_bytes_sec_max, 4488 * as VIR_TYPED_PARAM_ULLONG. 4489 */ 4490 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_BYTES_SEC_MAX_LENGTH "blkdeviotune.total_bytes_sec_max_length" 4491 4492 /** 4493 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH: 4494 * 4495 * Macro represents the length in seconds allowed for a burst period 4496 * for the blkdeviotune.read_bytes_sec_max 4497 * as VIR_TYPED_PARAM_ULLONG. 4498 */ 4499 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_BYTES_SEC_MAX_LENGTH "blkdeviotune.read_bytes_sec_max_length" 4500 4501 /** 4502 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH: 4503 * 4504 * Macro represents the length in seconds allowed for a burst period 4505 * for the blkdeviotune.write_bytes_sec_max 4506 * as VIR_TYPED_PARAM_ULLONG. 4507 */ 4508 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_BYTES_SEC_MAX_LENGTH "blkdeviotune.write_bytes_sec_max_length" 4509 4510 /** 4511 * VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH: 4512 * 4513 * Macro represents the length in seconds allowed for a burst period 4514 * for the blkdeviotune.total_iops_sec_max 4515 * as VIR_TYPED_PARAM_ULLONG. 4516 */ 4517 # define VIR_DOMAIN_TUNABLE_BLKDEV_TOTAL_IOPS_SEC_MAX_LENGTH "blkdeviotune.total_iops_sec_max_length" 4518 4519 /** 4520 * VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH: 4521 * 4522 * Macro represents the length in seconds allowed for a burst period 4523 * for the blkdeviotune.read_iops_sec_max 4524 * as VIR_TYPED_PARAM_ULLONG. 4525 */ 4526 # define VIR_DOMAIN_TUNABLE_BLKDEV_READ_IOPS_SEC_MAX_LENGTH "blkdeviotune.read_iops_sec_max_length" 4527 4528 /** 4529 * VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH: 4530 * 4531 * Macro represents the length in seconds allowed for a burst period 4532 * for the blkdeviotune.write_iops_sec_max 4533 * as VIR_TYPED_PARAM_ULLONG. 4534 */ 4535 # define VIR_DOMAIN_TUNABLE_BLKDEV_WRITE_IOPS_SEC_MAX_LENGTH "blkdeviotune.write_iops_sec_max_length" 4536 4537 /** 4538 * virConnectDomainEventTunableCallback: 4539 * @conn: connection object 4540 * @dom: domain on which the event occurred 4541 * @params: changed tunable values stored as array of virTypedParameter 4542 * @nparams: size of the array 4543 * @opaque: application specified data 4544 * 4545 * This callback occurs when tunable values are updated. The params must not 4546 * be freed in the callback handler as it's done internally after the callback 4547 * handler is executed. 4548 * 4549 * Currently supported name spaces: 4550 * "cputune.*" 4551 * "blkdeviotune.*" 4552 * 4553 * The callback signature to use when registering for an event of type 4554 * VIR_DOMAIN_EVENT_ID_TUNABLE with virConnectDomainEventRegisterAny() 4555 */ 4556 typedef void (*virConnectDomainEventTunableCallback)(virConnectPtr conn, 4557 virDomainPtr dom, 4558 virTypedParameterPtr params, 4559 int nparams, 4560 void *opaque); 4561 4562 4563 typedef enum { 4564 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_CONNECTED = 1, /* agent connected */ 4565 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_DISCONNECTED = 2, /* agent disconnected */ 4566 4567 # ifdef VIR_ENUM_SENTINELS 4568 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_STATE_LAST 4569 # endif 4570 } virConnectDomainEventAgentLifecycleState; 4571 4572 typedef enum { 4573 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_UNKNOWN = 0, /* unknown state change reason */ 4574 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_DOMAIN_STARTED = 1, /* state changed due to domain start */ 4575 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_CHANNEL = 2, /* channel state changed */ 4576 4577 # ifdef VIR_ENUM_SENTINELS 4578 VIR_CONNECT_DOMAIN_EVENT_AGENT_LIFECYCLE_REASON_LAST 4579 # endif 4580 } virConnectDomainEventAgentLifecycleReason; 4581 4582 /** 4583 * virConnectDomainEventAgentLifecycleCallback: 4584 * @conn: connection object 4585 * @dom: domain on which the event occurred 4586 * @state: new state of the guest agent, one of virConnectDomainEventAgentLifecycleState 4587 * @reason: reason for state change; one of virConnectDomainEventAgentLifecycleReason 4588 * @opaque: application specified data 4589 * 4590 * This callback occurs when libvirt detects a change in the state of a guest 4591 * agent. 4592 * 4593 * The callback signature to use when registering for an event of type 4594 * VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE with virConnectDomainEventRegisterAny() 4595 */ 4596 typedef void (*virConnectDomainEventAgentLifecycleCallback)(virConnectPtr conn, 4597 virDomainPtr dom, 4598 int state, 4599 int reason, 4600 void *opaque); 4601 4602 4603 /** 4604 * virConnectDomainEventBlockThresholdCallback: 4605 * @conn: connection object 4606 * @dom: domain on which the event occurred 4607 * @dev: name associated with the affected disk or storage backing chain 4608 * element 4609 * @path: for local storage, the path of the backing chain element 4610 * @threshold: threshold offset in bytes 4611 * @excess: number of bytes written beyond the threshold 4612 * @opaque: application specified data 4613 * 4614 * The callback occurs when the hypervisor detects that the given storage 4615 * element was written beyond the point specified by @threshold. The excess 4616 * data size written beyond @threshold is reported by @excess (if supported 4617 * by the hypervisor, 0 otherwise). The event is useful for thin-provisioned 4618 * storage. 4619 * 4620 * The threshold size can be set via the virDomainSetBlockThreshold API. 4621 * 4622 * The callback signature to use when registering for an event of type 4623 * VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD with virConnectDomainEventRegisterAny() 4624 */ 4625 typedef void (*virConnectDomainEventBlockThresholdCallback)(virConnectPtr conn, 4626 virDomainPtr dom, 4627 const char *dev, 4628 const char *path, 4629 unsigned long long threshold, 4630 unsigned long long excess, 4631 void *opaque); 4632 4633 /** 4634 * virConnectDomainEventMemoryFailureCallback: 4635 * @conn: connection object 4636 * @dom: domain on which the event occurred 4637 * @recipient: the recipient of hardware memory failure 4638 * (virDomainMemoryFailureRecipientType) 4639 * @action: the action of hardware memory failure 4640 * (virDomainMemoryFailureActionType) 4641 * @flags: the flags of hardware memory failure 4642 * @opaque: application specified data 4643 * 4644 * The callback occurs when the hypervisor handles the hardware memory 4645 * corrupted event. 4646 * 4647 * The callback signature to use when registering for an event of type 4648 * VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE with virConnectDomainEventRegisterAny() 4649 */ 4650 typedef void (*virConnectDomainEventMemoryFailureCallback)(virConnectPtr conn, 4651 virDomainPtr dom, 4652 int recipient, 4653 int action, 4654 unsigned int flags, 4655 void *opaque); 4656 4657 4658 /** 4659 * virConnectDomainEventMemoryDeviceSizeChangeCallback: 4660 * @conn: connection object 4661 * @dom: domain on which the event occurred 4662 * @alias: memory device alias 4663 * @size: new current size of memory device (in KiB) 4664 * @opaque: application specified data 4665 * 4666 * The callback occurs when the guest acknowledges request to change size of 4667 * memory device (so far only virtio-mem model supports this). The @size then 4668 * reflects the new amount of guest visible memory (in kibibytes). 4669 * 4670 * The callback signature to use when registering for an event of type 4671 * VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE with 4672 * virConnectDomainEventRegisterAny(). 4673 */ 4674 typedef void (*virConnectDomainEventMemoryDeviceSizeChangeCallback)(virConnectPtr conn, 4675 virDomainPtr dom, 4676 const char *alias, 4677 unsigned long long size, 4678 void *opaque); 4679 4680 4681 /** 4682 * VIR_DOMAIN_EVENT_CALLBACK: 4683 * 4684 * Used to cast the event specific callback into the generic one 4685 * for use for virConnectDomainEventRegisterAny() 4686 */ 4687 # define VIR_DOMAIN_EVENT_CALLBACK(cb) ((virConnectDomainEventGenericCallback)(cb)) 4688 4689 4690 /** 4691 * virDomainEventID: 4692 * 4693 * An enumeration of supported eventId parameters for 4694 * virConnectDomainEventRegisterAny(). Each event id determines which 4695 * signature of callback function will be used. 4696 */ 4697 typedef enum { 4698 VIR_DOMAIN_EVENT_ID_LIFECYCLE = 0, /* virConnectDomainEventCallback */ 4699 VIR_DOMAIN_EVENT_ID_REBOOT = 1, /* virConnectDomainEventGenericCallback */ 4700 VIR_DOMAIN_EVENT_ID_RTC_CHANGE = 2, /* virConnectDomainEventRTCChangeCallback */ 4701 VIR_DOMAIN_EVENT_ID_WATCHDOG = 3, /* virConnectDomainEventWatchdogCallback */ 4702 VIR_DOMAIN_EVENT_ID_IO_ERROR = 4, /* virConnectDomainEventIOErrorCallback */ 4703 VIR_DOMAIN_EVENT_ID_GRAPHICS = 5, /* virConnectDomainEventGraphicsCallback */ 4704 VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON = 6, /* virConnectDomainEventIOErrorReasonCallback */ 4705 VIR_DOMAIN_EVENT_ID_CONTROL_ERROR = 7, /* virConnectDomainEventGenericCallback */ 4706 VIR_DOMAIN_EVENT_ID_BLOCK_JOB = 8, /* virConnectDomainEventBlockJobCallback */ 4707 VIR_DOMAIN_EVENT_ID_DISK_CHANGE = 9, /* virConnectDomainEventDiskChangeCallback */ 4708 VIR_DOMAIN_EVENT_ID_TRAY_CHANGE = 10, /* virConnectDomainEventTrayChangeCallback */ 4709 VIR_DOMAIN_EVENT_ID_PMWAKEUP = 11, /* virConnectDomainEventPMWakeupCallback */ 4710 VIR_DOMAIN_EVENT_ID_PMSUSPEND = 12, /* virConnectDomainEventPMSuspendCallback */ 4711 VIR_DOMAIN_EVENT_ID_BALLOON_CHANGE = 13, /* virConnectDomainEventBalloonChangeCallback */ 4712 VIR_DOMAIN_EVENT_ID_PMSUSPEND_DISK = 14, /* virConnectDomainEventPMSuspendDiskCallback */ 4713 VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED = 15, /* virConnectDomainEventDeviceRemovedCallback */ 4714 VIR_DOMAIN_EVENT_ID_BLOCK_JOB_2 = 16, /* virConnectDomainEventBlockJobCallback */ 4715 VIR_DOMAIN_EVENT_ID_TUNABLE = 17, /* virConnectDomainEventTunableCallback */ 4716 VIR_DOMAIN_EVENT_ID_AGENT_LIFECYCLE = 18,/* virConnectDomainEventAgentLifecycleCallback */ 4717 VIR_DOMAIN_EVENT_ID_DEVICE_ADDED = 19, /* virConnectDomainEventDeviceAddedCallback */ 4718 VIR_DOMAIN_EVENT_ID_MIGRATION_ITERATION = 20, /* virConnectDomainEventMigrationIterationCallback */ 4719 VIR_DOMAIN_EVENT_ID_JOB_COMPLETED = 21, /* virConnectDomainEventJobCompletedCallback */ 4720 VIR_DOMAIN_EVENT_ID_DEVICE_REMOVAL_FAILED = 22, /* virConnectDomainEventDeviceRemovalFailedCallback */ 4721 VIR_DOMAIN_EVENT_ID_METADATA_CHANGE = 23, /* virConnectDomainEventMetadataChangeCallback */ 4722 VIR_DOMAIN_EVENT_ID_BLOCK_THRESHOLD = 24, /* virConnectDomainEventBlockThresholdCallback */ 4723 VIR_DOMAIN_EVENT_ID_MEMORY_FAILURE = 25, /* virConnectDomainEventMemoryFailureCallback */ 4724 VIR_DOMAIN_EVENT_ID_MEMORY_DEVICE_SIZE_CHANGE = 26, /* virConnectDomainEventMemoryDeviceSizeChangeCallback */ 4725 4726 # ifdef VIR_ENUM_SENTINELS 4727 VIR_DOMAIN_EVENT_ID_LAST 4728 /* 4729 * NB: this enum value will increase over time as new events are 4730 * added to the libvirt API. It reflects the last event ID supported 4731 * by this version of the libvirt API. 4732 */ 4733 # endif 4734 } virDomainEventID; 4735 4736 4737 /* Use VIR_DOMAIN_EVENT_CALLBACK() to cast the 'cb' parameter */ 4738 int virConnectDomainEventRegisterAny(virConnectPtr conn, 4739 virDomainPtr dom, /* Optional, to filter */ 4740 int eventID, 4741 virConnectDomainEventGenericCallback cb, 4742 void *opaque, 4743 virFreeCallback freecb); 4744 4745 int virConnectDomainEventDeregisterAny(virConnectPtr conn, 4746 int callbackID); 4747 4748 4749 /** 4750 * virDomainConsoleFlags 4751 * 4752 * Since 0.9.10 4753 */ 4754 typedef enum { 4755 4756 VIR_DOMAIN_CONSOLE_FORCE = (1 << 0), /* abort a (possibly) active console 4757 connection to force a new 4758 connection */ 4759 VIR_DOMAIN_CONSOLE_SAFE = (1 << 1), /* check if the console driver supports 4760 safe console operations */ 4761 } virDomainConsoleFlags; 4762 4763 int virDomainOpenConsole(virDomainPtr dom, 4764 const char *dev_name, 4765 virStreamPtr st, 4766 unsigned int flags); 4767 4768 /** 4769 * virDomainChannelFlags 4770 * 4771 * Since 1.0.2 4772 */ 4773 typedef enum { 4774 VIR_DOMAIN_CHANNEL_FORCE = (1 << 0), /* abort a (possibly) active channel 4775 connection to force a new 4776 connection */ 4777 } virDomainChannelFlags; 4778 4779 int virDomainOpenChannel(virDomainPtr dom, 4780 const char *name, 4781 virStreamPtr st, 4782 unsigned int flags); 4783 4784 typedef enum { 4785 VIR_DOMAIN_OPEN_GRAPHICS_SKIPAUTH = (1 << 0), 4786 } virDomainOpenGraphicsFlags; 4787 4788 int virDomainOpenGraphics(virDomainPtr dom, 4789 unsigned int idx, 4790 int fd, 4791 unsigned int flags); 4792 4793 int virDomainOpenGraphicsFD(virDomainPtr dom, 4794 unsigned int idx, 4795 unsigned int flags); 4796 4797 int virDomainInjectNMI(virDomainPtr domain, unsigned int flags); 4798 4799 int virDomainFSTrim(virDomainPtr dom, 4800 const char *mountPoint, 4801 unsigned long long minimum, 4802 unsigned int flags); 4803 4804 int virDomainFSFreeze(virDomainPtr dom, 4805 const char **mountpoints, 4806 unsigned int nmountpoints, 4807 unsigned int flags); 4808 4809 int virDomainFSThaw(virDomainPtr dom, 4810 const char **mountpoints, 4811 unsigned int nmountpoints, 4812 unsigned int flags); 4813 4814 /** 4815 * virDomainFSInfo: 4816 * 4817 * The data structure containing mounted file systems within a guset 4818 * 4819 */ 4820 typedef struct _virDomainFSInfo virDomainFSInfo; 4821 typedef virDomainFSInfo *virDomainFSInfoPtr; 4822 struct _virDomainFSInfo { 4823 char *mountpoint; /* path to mount point */ 4824 char *name; /* device name in the guest (e.g. "sda1") */ 4825 char *fstype; /* filesystem type */ 4826 size_t ndevAlias; /* number of elements in devAlias */ 4827 char **devAlias; /* array of disk device aliases */ 4828 }; 4829 4830 void virDomainFSInfoFree(virDomainFSInfoPtr info); 4831 4832 int virDomainGetFSInfo(virDomainPtr dom, 4833 virDomainFSInfoPtr **info, 4834 unsigned int flags); 4835 4836 int virDomainGetTime(virDomainPtr dom, 4837 long long *seconds, 4838 unsigned int *nseconds, 4839 unsigned int flags); 4840 4841 typedef enum { 4842 VIR_DOMAIN_TIME_SYNC = (1 << 0), /* Re-sync domain time from domain's RTC */ 4843 } virDomainSetTimeFlags; 4844 4845 int virDomainSetTime(virDomainPtr dom, 4846 long long seconds, 4847 unsigned int nseconds, 4848 unsigned int flags); 4849 4850 /** 4851 * virSchedParameterType: 4852 * 4853 * A scheduler parameter field type. Provided for backwards 4854 * compatibility; virTypedParameterType is the preferred enum since 4855 * 0.9.2. 4856 */ 4857 typedef enum { 4858 VIR_DOMAIN_SCHED_FIELD_INT = VIR_TYPED_PARAM_INT, 4859 VIR_DOMAIN_SCHED_FIELD_UINT = VIR_TYPED_PARAM_UINT, 4860 VIR_DOMAIN_SCHED_FIELD_LLONG = VIR_TYPED_PARAM_LLONG, 4861 VIR_DOMAIN_SCHED_FIELD_ULLONG = VIR_TYPED_PARAM_ULLONG, 4862 VIR_DOMAIN_SCHED_FIELD_DOUBLE = VIR_TYPED_PARAM_DOUBLE, 4863 VIR_DOMAIN_SCHED_FIELD_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, 4864 } virSchedParameterType; 4865 4866 /** 4867 * VIR_DOMAIN_SCHED_FIELD_LENGTH: 4868 * 4869 * Macro providing the field length of virSchedParameter. Provided 4870 * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the 4871 * preferred value since 0.9.2. 4872 */ 4873 # define VIR_DOMAIN_SCHED_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH 4874 4875 /** 4876 * virSchedParameter: 4877 * 4878 * a virSchedParameter is the set of scheduler parameters. 4879 * Provided for backwards compatibility; virTypedParameter is the 4880 * preferred alias since 0.9.2. 4881 */ 4882 # define _virSchedParameter _virTypedParameter 4883 typedef struct _virTypedParameter virSchedParameter; 4884 4885 /** 4886 * virSchedParameterPtr: 4887 * 4888 * a virSchedParameterPtr is a pointer to a virSchedParameter structure. 4889 * Provided for backwards compatibility; virTypedParameterPtr is the 4890 * preferred alias since 0.9.2. 4891 */ 4892 typedef virSchedParameter *virSchedParameterPtr; 4893 4894 /** 4895 * virBlkioParameterType: 4896 * 4897 * A blkio parameter field type. Provided for backwards 4898 * compatibility; virTypedParameterType is the preferred enum since 4899 * 0.9.2. 4900 */ 4901 typedef enum { 4902 VIR_DOMAIN_BLKIO_PARAM_INT = VIR_TYPED_PARAM_INT, 4903 VIR_DOMAIN_BLKIO_PARAM_UINT = VIR_TYPED_PARAM_UINT, 4904 VIR_DOMAIN_BLKIO_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, 4905 VIR_DOMAIN_BLKIO_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, 4906 VIR_DOMAIN_BLKIO_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, 4907 VIR_DOMAIN_BLKIO_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, 4908 } virBlkioParameterType; 4909 4910 /** 4911 * VIR_DOMAIN_BLKIO_FIELD_LENGTH: 4912 * 4913 * Macro providing the field length of virBlkioParameter. Provided 4914 * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the 4915 * preferred value since 0.9.2. 4916 */ 4917 # define VIR_DOMAIN_BLKIO_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH 4918 4919 /** 4920 * virBlkioParameter: 4921 * 4922 * a virBlkioParameter is the set of blkio parameters. 4923 * Provided for backwards compatibility; virTypedParameter is the 4924 * preferred alias since 0.9.2. 4925 */ 4926 # define _virBlkioParameter _virTypedParameter 4927 typedef struct _virTypedParameter virBlkioParameter; 4928 4929 /** 4930 * virBlkioParameterPtr: 4931 * 4932 * a virBlkioParameterPtr is a pointer to a virBlkioParameter structure. 4933 * Provided for backwards compatibility; virTypedParameterPtr is the 4934 * preferred alias since 0.9.2. 4935 */ 4936 typedef virBlkioParameter *virBlkioParameterPtr; 4937 4938 /** 4939 * virMemoryParameterType: 4940 * 4941 * A memory parameter field type. Provided for backwards 4942 * compatibility; virTypedParameterType is the preferred enum since 4943 * 0.9.2. 4944 */ 4945 typedef enum { 4946 VIR_DOMAIN_MEMORY_PARAM_INT = VIR_TYPED_PARAM_INT, 4947 VIR_DOMAIN_MEMORY_PARAM_UINT = VIR_TYPED_PARAM_UINT, 4948 VIR_DOMAIN_MEMORY_PARAM_LLONG = VIR_TYPED_PARAM_LLONG, 4949 VIR_DOMAIN_MEMORY_PARAM_ULLONG = VIR_TYPED_PARAM_ULLONG, 4950 VIR_DOMAIN_MEMORY_PARAM_DOUBLE = VIR_TYPED_PARAM_DOUBLE, 4951 VIR_DOMAIN_MEMORY_PARAM_BOOLEAN = VIR_TYPED_PARAM_BOOLEAN, 4952 } virMemoryParameterType; 4953 4954 /** 4955 * VIR_DOMAIN_MEMORY_FIELD_LENGTH: 4956 * 4957 * Macro providing the field length of virMemoryParameter. Provided 4958 * for backwards compatibility; VIR_TYPED_PARAM_FIELD_LENGTH is the 4959 * preferred value since 0.9.2. 4960 */ 4961 # define VIR_DOMAIN_MEMORY_FIELD_LENGTH VIR_TYPED_PARAM_FIELD_LENGTH 4962 4963 /** 4964 * virMemoryParameter: 4965 * 4966 * a virMemoryParameter is the set of scheduler parameters. 4967 * Provided for backwards compatibility; virTypedParameter is the 4968 * preferred alias since 0.9.2. 4969 */ 4970 # define _virMemoryParameter _virTypedParameter 4971 typedef struct _virTypedParameter virMemoryParameter; 4972 4973 /** 4974 * virMemoryParameterPtr: 4975 * 4976 * a virMemoryParameterPtr is a pointer to a virMemoryParameter structure. 4977 * Provided for backwards compatibility; virTypedParameterPtr is the 4978 * preferred alias since 0.9.2. 4979 */ 4980 typedef virMemoryParameter *virMemoryParameterPtr; 4981 4982 typedef enum { 4983 VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE = 0, /* Parse DHCP lease file */ 4984 VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT = 1, /* Query qemu guest agent */ 4985 VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP = 2, /* Query ARP tables */ 4986 4987 # ifdef VIR_ENUM_SENTINELS 4988 VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LAST 4989 # endif 4990 } virDomainInterfaceAddressesSource; 4991 4992 typedef struct _virDomainInterfaceIPAddress virDomainIPAddress; 4993 typedef virDomainIPAddress *virDomainIPAddressPtr; 4994 struct _virDomainInterfaceIPAddress { 4995 int type; /* virIPAddrType */ 4996 char *addr; /* IP address */ 4997 unsigned int prefix; /* IP address prefix */ 4998 }; 4999 5000 typedef struct _virDomainInterface virDomainInterface; 5001 typedef virDomainInterface *virDomainInterfacePtr; 5002 struct _virDomainInterface { 5003 char *name; /* interface name */ 5004 char *hwaddr; /* hardware address, may be NULL */ 5005 unsigned int naddrs; /* number of items in @addrs */ 5006 virDomainIPAddressPtr addrs; /* array of IP addresses */ 5007 }; 5008 5009 int virDomainInterfaceAddresses(virDomainPtr dom, 5010 virDomainInterfacePtr **ifaces, 5011 unsigned int source, 5012 unsigned int flags); 5013 5014 void virDomainInterfaceFree(virDomainInterfacePtr iface); 5015 5016 typedef enum { 5017 VIR_DOMAIN_PASSWORD_ENCRYPTED = 1 << 0, /* the password is already encrypted */ 5018 } virDomainSetUserPasswordFlags; 5019 5020 int virDomainSetUserPassword(virDomainPtr dom, 5021 const char *user, 5022 const char *password, 5023 unsigned int flags); 5024 5025 int virDomainRename(virDomainPtr dom, 5026 const char *new_name, 5027 unsigned int flags); 5028 5029 int virDomainGetGuestVcpus(virDomainPtr domain, 5030 virTypedParameterPtr *params, 5031 unsigned int *nparams, 5032 unsigned int flags); 5033 5034 int virDomainSetGuestVcpus(virDomainPtr domain, 5035 const char *cpumap, 5036 int state, 5037 unsigned int flags); 5038 5039 int virDomainSetVcpu(virDomainPtr domain, 5040 const char *vcpumap, 5041 int state, 5042 unsigned int flags); 5043 5044 int virDomainSetBlockThreshold(virDomainPtr domain, 5045 const char *dev, 5046 unsigned long long threshold, 5047 unsigned int flags); 5048 5049 typedef enum { 5050 VIR_DOMAIN_LIFECYCLE_POWEROFF = 0, 5051 VIR_DOMAIN_LIFECYCLE_REBOOT = 1, 5052 VIR_DOMAIN_LIFECYCLE_CRASH = 2, 5053 5054 # ifdef VIR_ENUM_SENTINELS 5055 VIR_DOMAIN_LIFECYCLE_LAST 5056 # endif 5057 } virDomainLifecycle; 5058 5059 typedef enum { 5060 VIR_DOMAIN_LIFECYCLE_ACTION_DESTROY = 0, 5061 VIR_DOMAIN_LIFECYCLE_ACTION_RESTART = 1, 5062 VIR_DOMAIN_LIFECYCLE_ACTION_RESTART_RENAME = 2, 5063 VIR_DOMAIN_LIFECYCLE_ACTION_PRESERVE = 3, 5064 VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_DESTROY = 4, 5065 VIR_DOMAIN_LIFECYCLE_ACTION_COREDUMP_RESTART = 5, 5066 5067 # ifdef VIR_ENUM_SENTINELS 5068 VIR_DOMAIN_LIFECYCLE_ACTION_LAST 5069 # endif 5070 } virDomainLifecycleAction; 5071 5072 int virDomainSetLifecycleAction(virDomainPtr domain, 5073 unsigned int type, 5074 unsigned int action, 5075 unsigned int flags); 5076 5077 /** 5078 * Launch Security API 5079 */ 5080 5081 /** 5082 * VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT: 5083 * 5084 * Macro represents the launch measurement of the SEV guest, 5085 * as VIR_TYPED_PARAM_STRING. 5086 */ 5087 # define VIR_DOMAIN_LAUNCH_SECURITY_SEV_MEASUREMENT "sev-measurement" 5088 5089 int virDomainGetLaunchSecurityInfo(virDomainPtr domain, 5090 virTypedParameterPtr *params, 5091 int *nparams, 5092 unsigned int flags); 5093 5094 typedef enum { 5095 VIR_DOMAIN_GUEST_INFO_USERS = (1 << 0), /* return active users */ 5096 VIR_DOMAIN_GUEST_INFO_OS = (1 << 1), /* return OS information */ 5097 VIR_DOMAIN_GUEST_INFO_TIMEZONE = (1 << 2), /* return timezone information */ 5098 VIR_DOMAIN_GUEST_INFO_HOSTNAME = (1 << 3), /* return hostname information */ 5099 VIR_DOMAIN_GUEST_INFO_FILESYSTEM = (1 << 4), /* return filesystem information */ 5100 VIR_DOMAIN_GUEST_INFO_DISKS = (1 << 5), /* return disks information */ 5101 VIR_DOMAIN_GUEST_INFO_INTERFACES = (1 << 6), /* return interfaces information */ 5102 } virDomainGuestInfoTypes; 5103 5104 int virDomainGetGuestInfo(virDomainPtr domain, 5105 unsigned int types, 5106 virTypedParameterPtr *params, 5107 int *nparams, 5108 unsigned int flags); 5109 5110 typedef enum { 5111 VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_BLOCK = -2, 5112 VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_DEFAULT = -1, 5113 VIR_DOMAIN_AGENT_RESPONSE_TIMEOUT_NOWAIT = 0, 5114 } virDomainAgentResponseTimeoutValues; 5115 5116 int virDomainAgentSetResponseTimeout(virDomainPtr domain, 5117 int timeout, 5118 unsigned int flags); 5119 5120 typedef enum { 5121 VIR_DOMAIN_BACKUP_BEGIN_REUSE_EXTERNAL = (1 << 0), /* reuse separately 5122 provided images */ 5123 } virDomainBackupBeginFlags; 5124 5125 int virDomainBackupBegin(virDomainPtr domain, 5126 const char *backupXML, 5127 const char *checkpointXML, 5128 unsigned int flags); 5129 5130 char *virDomainBackupGetXMLDesc(virDomainPtr domain, 5131 unsigned int flags); 5132 5133 int virDomainAuthorizedSSHKeysGet(virDomainPtr domain, 5134 const char *user, 5135 char ***keys, 5136 unsigned int flags); 5137 5138 typedef enum { 5139 VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_APPEND = (1 << 0), /* don't truncate file, just append */ 5140 VIR_DOMAIN_AUTHORIZED_SSH_KEYS_SET_REMOVE = (1 << 1), /* remove keys, instead of adding them */ 5141 5142 } virDomainAuthorizedSSHKeysSetFlags; 5143 5144 int virDomainAuthorizedSSHKeysSet(virDomainPtr domain, 5145 const char *user, 5146 const char **keys, 5147 unsigned int nkeys, 5148 unsigned int flags); 5149 5150 typedef enum { 5151 VIR_DOMAIN_MESSAGE_DEPRECATION = (1 << 0), 5152 VIR_DOMAIN_MESSAGE_TAINTING = (1 << 1), 5153 } virDomainMessageType; 5154 5155 int virDomainGetMessages(virDomainPtr domain, 5156 char ***msgs, 5157 unsigned int flags); 5158 5159 /** 5160 * virDomainDirtyRateStatus: 5161 * 5162 * Details on the cause of a dirty rate calculation status. 5163 */ 5164 typedef enum { 5165 VIR_DOMAIN_DIRTYRATE_UNSTARTED = 0, /* the dirtyrate calculation has 5166 not been started */ 5167 VIR_DOMAIN_DIRTYRATE_MEASURING = 1, /* the dirtyrate calculation is 5168 measuring */ 5169 VIR_DOMAIN_DIRTYRATE_MEASURED = 2, /* the dirtyrate calculation is 5170 completed */ 5171 5172 # ifdef VIR_ENUM_SENTINELS 5173 VIR_DOMAIN_DIRTYRATE_LAST 5174 # endif 5175 } virDomainDirtyRateStatus; 5176 5177 int virDomainStartDirtyRateCalc(virDomainPtr domain, 5178 int seconds, 5179 unsigned int flags); 5180 5181 #endif /* LIBVIRT_DOMAIN_H */ 5182