1 /* 2 * libvirt-host.h 3 * Summary: APIs for management of hosts 4 * Description: Provides APIs for the management of hosts 5 * 6 * Copyright (C) 2006-2014 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_HOST_H 24 # define LIBVIRT_HOST_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 * virConnect: 33 * 34 * a virConnect is a private structure representing a connection to 35 * the Hypervisor. 36 */ 37 typedef struct _virConnect virConnect; 38 39 /** 40 * virConnectPtr: 41 * 42 * a virConnectPtr is pointer to a virConnect private structure, this is the 43 * type used to reference a connection to the Hypervisor in the API. 44 */ 45 typedef virConnect *virConnectPtr; 46 47 /** 48 * virNodeSuspendTarget: 49 * 50 * Flags to indicate which system-wide sleep state the host must be 51 * transitioned to. 52 */ 53 typedef enum { 54 VIR_NODE_SUSPEND_TARGET_MEM = 0, 55 VIR_NODE_SUSPEND_TARGET_DISK = 1, 56 VIR_NODE_SUSPEND_TARGET_HYBRID = 2, 57 58 # ifdef VIR_ENUM_SENTINELS 59 VIR_NODE_SUSPEND_TARGET_LAST /* This constant is subject to change */ 60 # endif 61 } virNodeSuspendTarget; 62 63 /** 64 * virStream: 65 * 66 * a virStream is a private structure representing a data stream. 67 */ 68 typedef struct _virStream virStream; 69 70 /** 71 * virStreamPtr: 72 * 73 * a virStreamPtr is pointer to a virStream private structure, this is the 74 * type used to reference a data stream in the API. 75 */ 76 typedef virStream *virStreamPtr; 77 78 /** 79 * VIR_SECURITY_LABEL_BUFLEN: 80 * 81 * Macro providing the maximum length of the virSecurityLabel label string. 82 * Note that this value is based on that used by Labeled NFS. 83 */ 84 # define VIR_SECURITY_LABEL_BUFLEN (4096 + 1) 85 86 /** 87 * virSecurityLabel: 88 * 89 * a virSecurityLabel is a structure filled by virDomainGetSecurityLabel(), 90 * providing the security label and associated attributes for the specified 91 * domain. 92 */ 93 typedef struct _virSecurityLabel virSecurityLabel; 94 95 struct _virSecurityLabel { 96 char label[VIR_SECURITY_LABEL_BUFLEN]; /* security label string */ 97 int enforcing; /* 1 if security policy is being enforced for domain */ 98 }; 99 100 /** 101 * virSecurityLabelPtr: 102 * 103 * a virSecurityLabelPtr is a pointer to a virSecurityLabel. 104 */ 105 typedef virSecurityLabel *virSecurityLabelPtr; 106 107 /** 108 * VIR_SECURITY_MODEL_BUFLEN: 109 * 110 * Macro providing the maximum length of the virSecurityModel model string. 111 */ 112 # define VIR_SECURITY_MODEL_BUFLEN (256 + 1) 113 114 /** 115 * VIR_SECURITY_DOI_BUFLEN: 116 * 117 * Macro providing the maximum length of the virSecurityModel doi string. 118 */ 119 # define VIR_SECURITY_DOI_BUFLEN (256 + 1) 120 121 /** 122 * virSecurityModel: 123 * 124 * a virSecurityModel is a structure filled by virNodeGetSecurityModel(), 125 * providing the per-hypervisor security model and DOI attributes for the 126 * specified domain. 127 */ 128 typedef struct _virSecurityModel virSecurityModel; 129 130 struct _virSecurityModel { 131 char model[VIR_SECURITY_MODEL_BUFLEN]; /* security model string */ 132 char doi[VIR_SECURITY_DOI_BUFLEN]; /* domain of interpretation */ 133 }; 134 135 /** 136 * virSecurityModelPtr: 137 * 138 * a virSecurityModelPtr is a pointer to a virSecurityModel. 139 */ 140 typedef virSecurityModel *virSecurityModelPtr; 141 142 143 /* data types related to virNodePtr */ 144 145 /** 146 * virNodeInfoPtr: 147 * 148 * a virNodeInfo is a structure filled by virNodeGetInfo() and providing 149 * the information for the Node. 150 * 151 * Note that the information in this struct is not guaranteed to be an 152 * accurate relection of the system hardware. See the virNodeGetInfo() 153 * API documentation for further guidance. 154 */ 155 156 typedef struct _virNodeInfo virNodeInfo; 157 158 struct _virNodeInfo { 159 char model[32]; /* string indicating the CPU model */ 160 unsigned long memory; /* memory size in kilobytes */ 161 unsigned int cpus; /* the number of active CPUs */ 162 unsigned int mhz; /* expected CPU frequency, 0 if not known or 163 on unusual architectures */ 164 unsigned int nodes; /* the number of NUMA cell, 1 for unusual NUMA 165 topologies or uniform memory access; check 166 capabilities XML for the actual NUMA topology */ 167 unsigned int sockets; /* number of CPU sockets per node if nodes > 1, 168 1 in case of unusual NUMA topology */ 169 unsigned int cores; /* number of cores per socket, total number of 170 processors in case of unusual NUMA topology */ 171 unsigned int threads; /* number of threads per core, 1 in case of 172 unusual numa topology */ 173 }; 174 175 /** 176 * VIR_NODE_CPU_STATS_FIELD_LENGTH: 177 * 178 * Macro providing the field length of virNodeCPUStats 179 */ 180 # define VIR_NODE_CPU_STATS_FIELD_LENGTH 80 181 182 /** 183 * VIR_NODE_CPU_STATS_ALL_CPUS: 184 * 185 * Value for specifying request for the total CPU time/utilization 186 */ 187 typedef enum { 188 VIR_NODE_CPU_STATS_ALL_CPUS = -1, 189 } virNodeGetCPUStatsAllCPUs; 190 191 /** 192 * VIR_NODE_CPU_STATS_KERNEL: 193 * 194 * Macro for the cumulative CPU time which was spent by the kernel, 195 * since the node booting up (in nanoseconds). 196 */ 197 # define VIR_NODE_CPU_STATS_KERNEL "kernel" 198 199 /** 200 * VIR_NODE_CPU_STATS_USER: 201 * 202 * The cumulative CPU time which was spent by user processes, 203 * since the node booting up (in nanoseconds). 204 */ 205 # define VIR_NODE_CPU_STATS_USER "user" 206 207 /** 208 * VIR_NODE_CPU_STATS_IDLE: 209 * 210 * The cumulative idle CPU time, 211 * since the node booting up (in nanoseconds). 212 */ 213 # define VIR_NODE_CPU_STATS_IDLE "idle" 214 215 /** 216 * VIR_NODE_CPU_STATS_IOWAIT: 217 * 218 * The cumulative I/O wait CPU time, 219 * since the node booting up (in nanoseconds). 220 */ 221 # define VIR_NODE_CPU_STATS_IOWAIT "iowait" 222 223 /** 224 * VIR_NODE_CPU_STATS_INTR: 225 * 226 * The cumulative interrupt CPU time, 227 * since the node booting up (in nanoseconds). 228 */ 229 # define VIR_NODE_CPU_STATS_INTR "intr" 230 231 /** 232 * VIR_NODE_CPU_STATS_UTILIZATION: 233 * 234 * The CPU utilization of a node. 235 * The usage value is in percent and 100% represents all CPUs of 236 * the node. 237 */ 238 # define VIR_NODE_CPU_STATS_UTILIZATION "utilization" 239 240 /** 241 * virNodeCPUStats: 242 * 243 * a virNodeCPUStats is a structure filled by virNodeGetCPUStats() 244 * providing information about the CPU stats of the node. 245 */ 246 typedef struct _virNodeCPUStats virNodeCPUStats; 247 248 struct _virNodeCPUStats { 249 char field[VIR_NODE_CPU_STATS_FIELD_LENGTH]; 250 unsigned long long value; 251 }; 252 253 /** 254 * VIR_NODE_MEMORY_STATS_FIELD_LENGTH: 255 * 256 * Macro providing the field length of virNodeMemoryStats 257 */ 258 # define VIR_NODE_MEMORY_STATS_FIELD_LENGTH 80 259 260 /** 261 * VIR_NODE_MEMORY_STATS_ALL_CELLS: 262 * 263 * Value for specifying request for the total memory of all cells. 264 */ 265 typedef enum { 266 VIR_NODE_MEMORY_STATS_ALL_CELLS = -1, 267 } virNodeGetMemoryStatsAllCells; 268 269 /** 270 * VIR_NODE_MEMORY_STATS_TOTAL: 271 * 272 * Macro for the total memory of specified cell: 273 * it represents the maximum memory. 274 */ 275 # define VIR_NODE_MEMORY_STATS_TOTAL "total" 276 277 /** 278 * VIR_NODE_MEMORY_STATS_FREE: 279 * 280 * Macro for the free memory of specified cell: 281 * On Linux, it includes buffer and cached memory, in case of 282 * VIR_NODE_MEMORY_STATS_ALL_CELLS. 283 */ 284 # define VIR_NODE_MEMORY_STATS_FREE "free" 285 286 /** 287 * VIR_NODE_MEMORY_STATS_BUFFERS: 288 * 289 * Macro for the buffer memory: On Linux, it is only returned in case of 290 * VIR_NODE_MEMORY_STATS_ALL_CELLS. 291 */ 292 # define VIR_NODE_MEMORY_STATS_BUFFERS "buffers" 293 294 /** 295 * VIR_NODE_MEMORY_STATS_CACHED: 296 * 297 * Macro for the cached memory: On Linux, it is only returned in case of 298 * VIR_NODE_MEMORY_STATS_ALL_CELLS. 299 */ 300 # define VIR_NODE_MEMORY_STATS_CACHED "cached" 301 302 /** 303 * virNodeMemoryStats: 304 * 305 * a virNodeMemoryStats is a structure filled by virNodeGetMemoryStats() 306 * providing information about the memory of the node. 307 */ 308 typedef struct _virNodeMemoryStats virNodeMemoryStats; 309 310 struct _virNodeMemoryStats { 311 char field[VIR_NODE_MEMORY_STATS_FIELD_LENGTH]; 312 unsigned long long value; 313 }; 314 315 /* 316 * VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN: 317 * 318 * Macro for typed parameter that represents how many present pages 319 * to scan before the shared memory service goes to sleep. 320 */ 321 # define VIR_NODE_MEMORY_SHARED_PAGES_TO_SCAN "shm_pages_to_scan" 322 323 /* 324 * VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS: 325 * 326 * Macro for typed parameter that represents how many milliseconds 327 * the shared memory service should sleep before next scan. 328 */ 329 # define VIR_NODE_MEMORY_SHARED_SLEEP_MILLISECS "shm_sleep_millisecs" 330 331 /* 332 * VIR_NODE_MEMORY_SHARED_PAGES_SHARED: 333 * 334 * Macro for typed parameter that represents how many the shared 335 * memory pages are being used. 336 */ 337 # define VIR_NODE_MEMORY_SHARED_PAGES_SHARED "shm_pages_shared" 338 339 /* 340 * VIR_NODE_MEMORY_SHARED_PAGES_SHARING: 341 * 342 * Macro for typed parameter that represents how many sites are 343 * sharing the pages i.e. how much saved. 344 */ 345 # define VIR_NODE_MEMORY_SHARED_PAGES_SHARING "shm_pages_sharing" 346 347 /* 348 * VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED: 349 * 350 * Macro for typed parameter that represents how many pages unique 351 * but repeatedly checked for merging. 352 */ 353 # define VIR_NODE_MEMORY_SHARED_PAGES_UNSHARED "shm_pages_unshared" 354 355 /* 356 * VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE: 357 * 358 * Macro for typed parameter that represents how many pages changing 359 * too fast to be placed in a tree. 360 */ 361 # define VIR_NODE_MEMORY_SHARED_PAGES_VOLATILE "shm_pages_volatile" 362 363 /* 364 * VIR_NODE_MEMORY_SHARED_FULL_SCANS: 365 * 366 * Macro for typed parameter that represents how many times all 367 * mergeable areas have been scanned. 368 */ 369 # define VIR_NODE_MEMORY_SHARED_FULL_SCANS "shm_full_scans" 370 371 /* 372 * VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES: 373 * 374 * Macro for typed parameter that represents whether pages from 375 * different NUMA nodes can be merged. The parameter has type int, 376 * when its value is 0, only pages which physically reside in the 377 * memory area of same NUMA node are merged; When its value is 1, 378 * pages from all nodes can be merged. Other values are reserved 379 * for future use. 380 */ 381 # define VIR_NODE_MEMORY_SHARED_MERGE_ACROSS_NODES "shm_merge_across_nodes" 382 383 384 int virNodeGetMemoryParameters(virConnectPtr conn, 385 virTypedParameterPtr params, 386 int *nparams, 387 unsigned int flags); 388 389 int virNodeSetMemoryParameters(virConnectPtr conn, 390 virTypedParameterPtr params, 391 int nparams, 392 unsigned int flags); 393 394 /* 395 * node CPU map 396 */ 397 int virNodeGetCPUMap(virConnectPtr conn, 398 unsigned char **cpumap, 399 unsigned int *online, 400 unsigned int flags); 401 402 403 /** 404 * VIR_NODEINFO_MAXCPUS: 405 * @nodeinfo: virNodeInfo instance 406 * 407 * This macro is to calculate the total number of CPUs supported 408 * but not necessary active in the host. 409 */ 410 411 412 # define VIR_NODEINFO_MAXCPUS(nodeinfo) ((nodeinfo).nodes*(nodeinfo).sockets*(nodeinfo).cores*(nodeinfo).threads) 413 414 /** 415 * virNodeInfoPtr: 416 * 417 * a virNodeInfoPtr is a pointer to a virNodeInfo structure. 418 */ 419 420 typedef virNodeInfo *virNodeInfoPtr; 421 422 /** 423 * virNodeCPUStatsPtr: 424 * 425 * a virNodeCPUStatsPtr is a pointer to a virNodeCPUStats structure. 426 */ 427 428 typedef virNodeCPUStats *virNodeCPUStatsPtr; 429 430 /** 431 * virNodeMemoryStatsPtr: 432 * 433 * a virNodeMemoryStatsPtr is a pointer to a virNodeMemoryStats structure. 434 */ 435 436 typedef virNodeMemoryStats *virNodeMemoryStatsPtr; 437 438 439 /** 440 * 441 * SEV Parameters 442 */ 443 444 /** 445 * VIR_NODE_SEV_PDH: 446 * 447 * Macro represents the Platform Diffie-Hellman key, as VIR_TYPED_PARAMS_STRING. 448 */ 449 # define VIR_NODE_SEV_PDH "pdh" 450 451 /** 452 * VIR_NODE_SEV_CERT_CHAIN: 453 * 454 * Macro represents the platform certificate chain that includes the platform 455 * endorsement key (PEK), owner certificate authority (OCD) and chip 456 * endorsement key (CEK), as VIR_TYPED_PARAMS_STRING. 457 */ 458 # define VIR_NODE_SEV_CERT_CHAIN "cert-chain" 459 460 /** 461 * VIR_NODE_SEV_CBITPOS: 462 * 463 * Macro represents the CBit Position used by hypervisor when SEV is enabled. 464 */ 465 # define VIR_NODE_SEV_CBITPOS "cbitpos" 466 467 /** 468 * VIR_NODE_SEV_REDUCED_PHYS_BITS: 469 * 470 * Macro represents the number of bits we lose in physical address space 471 * when SEV is enabled in the guest. 472 */ 473 # define VIR_NODE_SEV_REDUCED_PHYS_BITS "reduced-phys-bits" 474 475 int virNodeGetSEVInfo (virConnectPtr conn, 476 virTypedParameterPtr *params, 477 int *nparams, 478 unsigned int flags); 479 480 /** 481 * virConnectFlags 482 * 483 * Flags when opening a connection to a hypervisor 484 */ 485 typedef enum { 486 VIR_CONNECT_RO = (1 << 0), /* A readonly connection */ 487 VIR_CONNECT_NO_ALIASES = (1 << 1), /* Don't try to resolve URI aliases */ 488 } virConnectFlags; 489 490 491 typedef enum { 492 VIR_CRED_USERNAME = 1, /* Identity to act as */ 493 VIR_CRED_AUTHNAME = 2, /* Identify to authorize as */ 494 VIR_CRED_LANGUAGE = 3, /* RFC 1766 languages, comma separated */ 495 VIR_CRED_CNONCE = 4, /* client supplies a nonce */ 496 VIR_CRED_PASSPHRASE = 5, /* Passphrase secret */ 497 VIR_CRED_ECHOPROMPT = 6, /* Challenge response */ 498 VIR_CRED_NOECHOPROMPT = 7, /* Challenge response */ 499 VIR_CRED_REALM = 8, /* Authentication realm */ 500 VIR_CRED_EXTERNAL = 9, /* Externally managed credential */ 501 502 # ifdef VIR_ENUM_SENTINELS 503 VIR_CRED_LAST /* More may be added - expect the unexpected */ 504 # endif 505 } virConnectCredentialType; 506 507 struct _virConnectCredential { 508 int type; /* One of virConnectCredentialType constants */ 509 const char *prompt; /* Prompt to show to user */ 510 const char *challenge; /* Additional challenge to show */ 511 const char *defresult; /* Optional default result */ 512 char *result; /* Result to be filled with user response (or defresult) */ 513 unsigned int resultlen; /* Length of the result */ 514 }; 515 516 typedef struct _virConnectCredential virConnectCredential; 517 typedef virConnectCredential *virConnectCredentialPtr; 518 519 520 /** 521 * virConnectAuthCallbackPtr: 522 * @cred: list of virConnectCredential object to fetch from user 523 * @ncred: size of cred list 524 * @cbdata: opaque data passed to virConnectOpenAuth 525 * 526 * When authentication requires one or more interactions, this callback 527 * is invoked. For each interaction supplied, data must be gathered 528 * from the user and filled in to the 'result' and 'resultlen' fields. 529 * If an interaction cannot be filled, fill in NULL and 0. 530 * 531 * Returns 0 if all interactions were filled, or -1 upon error 532 */ 533 typedef int (*virConnectAuthCallbackPtr)(virConnectCredentialPtr cred, 534 unsigned int ncred, 535 void *cbdata); 536 537 struct _virConnectAuth { 538 int *credtype; /* List of supported virConnectCredentialType values */ 539 unsigned int ncredtype; 540 541 virConnectAuthCallbackPtr cb; /* Callback used to collect credentials */ 542 void *cbdata; 543 }; 544 545 546 typedef struct _virConnectAuth virConnectAuth; 547 typedef virConnectAuth *virConnectAuthPtr; 548 549 VIR_EXPORT_VAR virConnectAuthPtr virConnectAuthPtrDefault; 550 551 /** 552 * VIR_UUID_BUFLEN: 553 * 554 * This macro provides the length of the buffer required 555 * for virDomainGetUUID() 556 */ 557 558 # define VIR_UUID_BUFLEN (16) 559 560 /** 561 * VIR_UUID_STRING_BUFLEN: 562 * 563 * This macro provides the length of the buffer required 564 * for virDomainGetUUIDString() 565 */ 566 567 # define VIR_UUID_STRING_BUFLEN (36+1) 568 569 570 int virGetVersion (unsigned long *libVer, 571 const char *type, 572 unsigned long *typeVer); 573 574 /* 575 * Connection and disconnections to the Hypervisor 576 */ 577 int virInitialize (void); 578 579 virConnectPtr virConnectOpen (const char *name); 580 virConnectPtr virConnectOpenReadOnly (const char *name); 581 virConnectPtr virConnectOpenAuth (const char *name, 582 virConnectAuthPtr auth, 583 unsigned int flags); 584 int virConnectRef (virConnectPtr conn); 585 int virConnectClose (virConnectPtr conn); 586 587 /** 588 * VIR_CONNECT_IDENTITY_USER_NAME: 589 * 590 * The operating system user name as VIR_TYPED_PARAM_STRING. 591 */ 592 # define VIR_CONNECT_IDENTITY_USER_NAME "user-name" 593 594 /** 595 * VIR_CONNECT_IDENTITY_UNIX_USER_ID: 596 * 597 * The UNIX user ID as VIR_TYPED_PARAM_ULLONG. 598 */ 599 # define VIR_CONNECT_IDENTITY_UNIX_USER_ID "unix-user-id" 600 601 /** 602 * VIR_CONNECT_IDENTITY_GROUP_NAME: 603 * 604 * The operating system group name as VIR_TYPED_PARAM_STRING. 605 */ 606 # define VIR_CONNECT_IDENTITY_GROUP_NAME "group-name" 607 608 /** 609 * VIR_CONNECT_IDENTITY_UNIX_GROUP_ID: 610 * 611 * The UNIX group ID as VIR_TYPED_PARAM_ULLONG. 612 */ 613 # define VIR_CONNECT_IDENTITY_UNIX_GROUP_ID "unix-group-id" 614 615 /** 616 * VIR_CONNECT_IDENTITY_PROCESS_ID: 617 * 618 * The operating system process ID as VIR_TYPED_PARAM_LLONG. 619 */ 620 # define VIR_CONNECT_IDENTITY_PROCESS_ID "process-id" 621 622 /** 623 * VIR_CONNECT_IDENTITY_PROCESS_TIME: 624 * 625 * The operating system process start time as VIR_TYPED_PARAM_ULLONG. 626 * 627 * The units the time is measured in vary according to the 628 * host operating system. On Linux this is usually clock 629 * ticks (as reported in /proc/$PID/stat field 22). 630 */ 631 # define VIR_CONNECT_IDENTITY_PROCESS_TIME "process-time" 632 633 /** 634 * VIR_CONNECT_IDENTITY_SASL_USER_NAME: 635 * 636 * The SASL authenticated username as VIR_TYPED_PARAM_STRING 637 */ 638 # define VIR_CONNECT_IDENTITY_SASL_USER_NAME "sasl-user-name" 639 640 /** 641 * VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME: 642 * 643 * The TLS x509 certificate distinguished named as VIR_TYPED_PARAM_STRING 644 */ 645 # define VIR_CONNECT_IDENTITY_X509_DISTINGUISHED_NAME "x509-distinguished-name" 646 647 /** 648 * VIR_CONNECT_IDENTITY_SELINUX_CONTEXT: 649 * 650 * The application's SELinux context as VIR_TYPED_PARAM_STRING. 651 */ 652 # define VIR_CONNECT_IDENTITY_SELINUX_CONTEXT "selinux-context" 653 654 655 int virConnectSetIdentity (virConnectPtr conn, 656 virTypedParameterPtr params, 657 int nparams, 658 unsigned int flags); 659 660 const char * virConnectGetType (virConnectPtr conn); 661 int virConnectGetVersion (virConnectPtr conn, 662 unsigned long *hvVer); 663 int virConnectGetLibVersion (virConnectPtr conn, 664 unsigned long *libVer); 665 char * virConnectGetHostname (virConnectPtr conn); 666 char * virConnectGetURI (virConnectPtr conn); 667 char * virConnectGetSysinfo (virConnectPtr conn, 668 unsigned int flags); 669 670 int virConnectSetKeepAlive(virConnectPtr conn, 671 int interval, 672 unsigned int count); 673 /** 674 * virConnectCloseFunc: 675 * @conn: virConnect connection 676 * @reason: reason why the connection was closed (one of virConnectCloseReason) 677 * @opaque: opaque user data 678 * 679 * A callback function to be registered, and called when the connection 680 * is closed. 681 */ 682 typedef void (*virConnectCloseFunc)(virConnectPtr conn, 683 int reason, 684 void *opaque); 685 686 int virConnectRegisterCloseCallback(virConnectPtr conn, 687 virConnectCloseFunc cb, 688 void *opaque, 689 virFreeCallback freecb); 690 int virConnectUnregisterCloseCallback(virConnectPtr conn, 691 virConnectCloseFunc cb); 692 693 /* 694 * Capabilities of the connection / driver. 695 */ 696 697 int virConnectGetMaxVcpus (virConnectPtr conn, 698 const char *type); 699 int virNodeGetInfo (virConnectPtr conn, 700 virNodeInfoPtr info); 701 char * virConnectGetCapabilities (virConnectPtr conn); 702 703 int virNodeGetCPUStats (virConnectPtr conn, 704 int cpuNum, 705 virNodeCPUStatsPtr params, 706 int *nparams, 707 unsigned int flags); 708 709 int virNodeGetMemoryStats (virConnectPtr conn, 710 int cellNum, 711 virNodeMemoryStatsPtr params, 712 int *nparams, 713 unsigned int flags); 714 715 unsigned long long virNodeGetFreeMemory (virConnectPtr conn); 716 717 int virNodeGetSecurityModel (virConnectPtr conn, 718 virSecurityModelPtr secmodel); 719 720 int virNodeSuspendForDuration (virConnectPtr conn, 721 unsigned int target, 722 unsigned long long duration, 723 unsigned int flags); 724 725 /* 726 * NUMA support 727 */ 728 729 int virNodeGetCellsFreeMemory(virConnectPtr conn, 730 unsigned long long *freeMems, 731 int startCell, 732 int maxCells); 733 734 735 int virConnectIsEncrypted(virConnectPtr conn); 736 int virConnectIsSecure(virConnectPtr conn); 737 int virConnectIsAlive(virConnectPtr conn); 738 739 /* 740 * CPU specification API 741 */ 742 743 typedef enum { 744 VIR_CPU_COMPARE_ERROR = -1, 745 VIR_CPU_COMPARE_INCOMPATIBLE = 0, 746 VIR_CPU_COMPARE_IDENTICAL = 1, 747 VIR_CPU_COMPARE_SUPERSET = 2, 748 749 # ifdef VIR_ENUM_SENTINELS 750 VIR_CPU_COMPARE_LAST 751 # endif 752 } virCPUCompareResult; 753 754 typedef enum { 755 VIR_CONNECT_COMPARE_CPU_FAIL_INCOMPATIBLE = (1 << 0), /* treat incompatible 756 CPUs as failure */ 757 VIR_CONNECT_COMPARE_CPU_VALIDATE_XML = (1 << 1), /* validate the xml 758 document */ 759 } virConnectCompareCPUFlags; 760 761 int virConnectCompareCPU(virConnectPtr conn, 762 const char *xmlDesc, 763 unsigned int flags); 764 int virConnectCompareHypervisorCPU(virConnectPtr conn, 765 const char *emulator, 766 const char *arch, 767 const char *machine, 768 const char *virttype, 769 const char *xmlCPU, 770 unsigned int flags); 771 772 int virConnectGetCPUModelNames(virConnectPtr conn, 773 const char *arch, 774 char ***models, 775 unsigned int flags); 776 777 /** 778 * virConnectBaselineCPUFlags 779 * 780 * Flags when getting XML description of a computed CPU 781 */ 782 typedef enum { 783 VIR_CONNECT_BASELINE_CPU_EXPAND_FEATURES = (1 << 0), /* show all features */ 784 VIR_CONNECT_BASELINE_CPU_MIGRATABLE = (1 << 1), /* filter out non-migratable features */ 785 } virConnectBaselineCPUFlags; 786 787 char *virConnectBaselineCPU(virConnectPtr conn, 788 const char **xmlCPUs, 789 unsigned int ncpus, 790 unsigned int flags); 791 char *virConnectBaselineHypervisorCPU(virConnectPtr conn, 792 const char *emulator, 793 const char *arch, 794 const char *machine, 795 const char *virttype, 796 const char **xmlCPUs, 797 unsigned int ncpus, 798 unsigned int flags); 799 800 801 int virNodeGetFreePages(virConnectPtr conn, 802 unsigned int npages, 803 unsigned int *pages, 804 int startcell, 805 unsigned int cellcount, 806 unsigned long long *counts, 807 unsigned int flags); 808 809 typedef enum { 810 VIR_NODE_ALLOC_PAGES_ADD = 0, /* Add @pageCounts to the pages pool. This 811 can be used only to size up the pool. */ 812 VIR_NODE_ALLOC_PAGES_SET = (1 << 0), /* Don't add @pageCounts, instead set 813 passed number of pages. This can be 814 used to free allocated pages. */ 815 } virNodeAllocPagesFlags; 816 817 int virNodeAllocPages(virConnectPtr conn, 818 unsigned int npages, 819 unsigned int *pageSizes, 820 unsigned long long *pageCounts, 821 int startCell, 822 unsigned int cellCount, 823 unsigned int flags); 824 825 826 #endif /* LIBVIRT_HOST_H */ 827