-
Notifications
You must be signed in to change notification settings - Fork 803
/
Copy pathlibvirt-php.php
2054 lines (1821 loc) · 78.4 KB
/
libvirt-php.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
declare(strict_types=1);
/**
* Stubs for libvirt-php
* https://libvirt.org/php/
* https://github.com/inode64/phpstorm-stubs
*/
/* Domain metadata constants */
const VIR_DOMAIN_METADATA_DESCRIPTION = 0;
const VIR_DOMAIN_METADATA_TITLE = 1;
const VIR_DOMAIN_METADATA_ELEMENT = 2;
const VIR_DOMAIN_AFFECT_CURRENT = VIR_DOMAIN_AFFECT_CURRENT;
const VIR_DOMAIN_AFFECT_LIVE = 1;
const VIR_DOMAIN_AFFECT_CONFIG = 2;
const VIR_DOMAIN_STATS_STATE = 1;
const VIR_DOMAIN_STATS_CPU_TOTAL = 2;
const VIR_DOMAIN_STATS_BALLOON = 4;
const VIR_DOMAIN_STATS_VCPU = 8;
const VIR_DOMAIN_STATS_INTERFACE = 16;
const VIR_DOMAIN_STATS_BLOCK = 32;
/* XML constants */
const VIR_DOMAIN_XML_SECURE = 1;
const VIR_DOMAIN_XML_INACTIVE = 2;
const VIR_DOMAIN_XML_UPDATE_CPU = 4;
const VIR_DOMAIN_XML_MIGRATABLE = 8;
const VIR_NODE_CPU_STATS_ALL_CPUS = -1;
/* Domain constants */
const VIR_DOMAIN_NOSTATE = 0;
const VIR_DOMAIN_RUNNING = 1;
const VIR_DOMAIN_BLOCKED = 2;
const VIR_DOMAIN_PAUSED = 3;
const VIR_DOMAIN_SHUTDOWN = 4;
const VIR_DOMAIN_SHUTOFF = 5;
const VIR_DOMAIN_CRASHED = 6;
const VIR_DOMAIN_PMSUSPENDED = 7;
/* Volume constants */
const VIR_STORAGE_VOL_RESIZE_ALLOCATE = 1;
const VIR_STORAGE_VOL_RESIZE_DELTA = 2;
const VIR_STORAGE_VOL_RESIZE_SHRINK = 4;
const VIR_STORAGE_VOL_CREATE_PREALLOC_METADATA = 1;
const VIR_STORAGE_VOL_CREATE_REFLINK = 2;
/* Domain vCPU flags */
const VIR_DOMAIN_VCPU_CONFIG = VIR_DOMAIN_AFFECT_CONFIG;
const VIR_DOMAIN_VCPU_CURRENT = VIR_DOMAIN_AFFECT_CURRENT;
const VIR_DOMAIN_VCPU_LIVE = VIR_DOMAIN_AFFECT_LIVE;
const VIR_DOMAIN_VCPU_MAXIMUM = 4;
const VIR_DOMAIN_VCPU_GUEST = 8;
/* Domain snapshot constants */
const VIR_SNAPSHOT_DELETE_CHILDREN = 1;
const VIR_SNAPSHOT_DELETE_METADATA_ONLY = 2;
const VIR_SNAPSHOT_DELETE_CHILDREN_ONLY = 4;
const VIR_SNAPSHOT_CREATE_REDEFINE = 1;
const VIR_SNAPSHOT_CREATE_CURRENT = 2;
const VIR_SNAPSHOT_CREATE_NO_METADATA = 4;
const VIR_SNAPSHOT_CREATE_HALT = 8;
const VIR_SNAPSHOT_CREATE_DISK_ONLY = 16;
const VIR_SNAPSHOT_CREATE_REUSE_EXT = 32;
const VIR_SNAPSHOT_CREATE_QUIESCE = 64;
const VIR_SNAPSHOT_CREATE_ATOMIC = 128;
const VIR_SNAPSHOT_CREATE_LIVE = 256;
const VIR_SNAPSHOT_LIST_DESCENDANTS = 1;
const VIR_SNAPSHOT_LIST_ROOTS = 1;
const VIR_SNAPSHOT_LIST_METADATA = 2;
const VIR_SNAPSHOT_LIST_LEAVES = 4;
const VIR_SNAPSHOT_LIST_NO_LEAVES = 8;
const VIR_SNAPSHOT_LIST_NO_METADATA = 16;
const VIR_SNAPSHOT_LIST_INACTIVE = 32;
const VIR_SNAPSHOT_LIST_ACTIVE = 64;
const VIR_SNAPSHOT_LIST_DISK_ONLY = 128;
const VIR_SNAPSHOT_LIST_INTERNAL = 256;
const VIR_SNAPSHOT_LIST_EXTERNAL = 512;
const VIR_SNAPSHOT_REVERT_RUNNING = 1;
const VIR_SNAPSHOT_REVERT_PAUSED = 2;
const VIR_SNAPSHOT_REVERT_FORCE = 4;
/* Create flags */
const VIR_DOMAIN_NONE = 0;
const VIR_DOMAIN_START_PAUSED = 1;
const VIR_DOMAIN_START_AUTODESTROY = 2;
const VIR_DOMAIN_START_BYPASS_CACHE = 4;
const VIR_DOMAIN_START_FORCE_BOOT = 8;
const VIR_DOMAIN_START_VALIDATE = 16;
/* Memory constants */
const VIR_MEMORY_VIRTUAL = 1;
const VIR_MEMORY_PHYSICAL = 2;
/* Version checking constants */
const VIR_VERSION_BINDING = 1;
const VIR_VERSION_LIBVIRT = 2;
/* Network constants */
const VIR_NETWORKS_ACTIVE = 1;
const VIR_NETWORKS_INACTIVE = 2;
const VIR_NETWORKS_ALL = VIR_NETWORKS_ACTIVE|VIR_NETWORKS_INACTIVE;
const VIR_CONNECT_LIST_NETWORKS_INACTIVE = 1;
const VIR_CONNECT_LIST_NETWORKS_ACTIVE = 2;
const VIR_CONNECT_LIST_NETWORKS_PERSISTENT = 4;
const VIR_CONNECT_LIST_NETWORKS_TRANSIENT = 8;
const VIR_CONNECT_LIST_NETWORKS_AUTOSTART = 16;
const VIR_CONNECT_LIST_NETWORKS_NO_AUTOSTART = 32;
/* Credential constants */
const VIR_CRED_USERNAME = 1;
const VIR_CRED_AUTHNAME = 2;
/* RFC 1766 languages */
const VIR_CRED_LANGUAGE = 3;
/* Client supplied a nonce */
const VIR_CRED_CNONCE = 4;
/* Passphrase secret */
const VIR_CRED_PASSPHRASE = 5;
/* Challenge response */
const VIR_CRED_ECHOPROMPT = 6;
/* Challenge response */
const VIR_CRED_NOECHOPROMPT = 7;
/* Authentication realm */
const VIR_CRED_REALM = 8;
/* Externally managed credential More may be added - expect the unexpected */
const VIR_CRED_EXTERNAL = 9;
/* Domain memory constants */
/* The total amount of memory written out to swap space (in kB). */
const VIR_DOMAIN_MEMORY_STAT_SWAP_IN = 0;
/* Page faults occur when a process makes a valid access to virtual memory that is not available. */
/* When servicing the page fault, if disk IO is * required, it is considered a major fault. If not, */
/* it is a minor fault. * These are expressed as the number of faults that have occurred. */
const VIR_DOMAIN_MEMORY_STAT_SWAP_OUT = 1;
const VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT = 2;
/* The amount of memory left completely unused by the system. Memory that is available but used for */
/* reclaimable caches should NOT be reported as free. This value is expressed in kB. */
const VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT = 3;
/* The total amount of usable memory as seen by the domain. This value * may be less than the amount */
/* of memory assigned to the domain if a * balloon driver is in use or if the guest OS does not initialize */
/* all * assigned pages. This value is expressed in kB. */
const VIR_DOMAIN_MEMORY_STAT_UNUSED = 4;
/* The number of statistics supported by this version of the interface. To add new statistics, add them */
/* to the enum and increase this value. */
const VIR_DOMAIN_MEMORY_STAT_AVAILABLE = 5;
/* Current balloon value (in KB). */
const VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON = 6;
/* Resident Set Size of the process running the domain. This value is in kB */
const VIR_DOMAIN_MEMORY_STAT_RSS = 7;
/* The number of statistics supported by this version of the interface. */
/* To add new statistics, add them to the enum and increase this value. */
const VIR_DOMAIN_MEMORY_STAT_NR = 8;
/* Job constants */
const VIR_DOMAIN_JOB_NONE = 0;
/* Job with a finite completion time */
const VIR_DOMAIN_JOB_BOUNDED = 1;
/* Job without a finite completion time */
const VIR_DOMAIN_JOB_UNBOUNDED = 2;
/* Job has finished but it's not cleaned up yet */
const VIR_DOMAIN_JOB_COMPLETED = 3;
/* Job hit error but it's not cleaned up yet */
const VIR_DOMAIN_JOB_FAILED = 4;
/* Job was aborted but it's not cleanup up yet */
const VIR_DOMAIN_JOB_CANCELLED = 5;
const VIR_DOMAIN_BLOCK_COMMIT_SHALLOW = 1;
const VIR_DOMAIN_BLOCK_COMMIT_DELETE = 2;
const VIR_DOMAIN_BLOCK_COMMIT_ACTIVE = 4;
const VIR_DOMAIN_BLOCK_COMMIT_RELATIVE = 8;
const VIR_DOMAIN_BLOCK_COMMIT_BANDWIDTH_BYTES = 16;
const VIR_DOMAIN_BLOCK_COPY_SHALLOW = 1;
const VIR_DOMAIN_BLOCK_COPY_REUSE_EXT = 2;
const VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC = 1;
const VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT = 2;
const VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_BYTES = 1;
const VIR_DOMAIN_BLOCK_JOB_INFO_BANDWIDTH_BYTES = 1;
const VIR_DOMAIN_BLOCK_JOB_TYPE_UNKNOWN = 0;
const VIR_DOMAIN_BLOCK_JOB_TYPE_PULL = 1;
const VIR_DOMAIN_BLOCK_JOB_TYPE_COPY = 2;
const VIR_DOMAIN_BLOCK_JOB_TYPE_COMMIT = 3;
const VIR_DOMAIN_BLOCK_JOB_TYPE_ACTIVE_COMMIT = 4;
const VIR_DOMAIN_BLOCK_PULL_BANDWIDTH_BYTES = 128;
const VIR_DOMAIN_BLOCK_REBASE_SHALLOW = 1;
const VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT = 2;
const VIR_DOMAIN_BLOCK_REBASE_COPY_RAW = 4;
const VIR_DOMAIN_BLOCK_REBASE_COPY = 8;
const VIR_DOMAIN_BLOCK_REBASE_RELATIVE = 16;
const VIR_DOMAIN_BLOCK_REBASE_COPY_DEV = 32;
const VIR_DOMAIN_BLOCK_REBASE_BANDWIDTH_BYTES = 64;
const VIR_DOMAIN_BLOCK_RESIZE_BYTES = 1;
/* Migration constants */
const VIR_MIGRATE_LIVE = 1;
/* direct source -> dest host control channel Note the less-common spelling that we're stuck with: */
/* VIR_MIGRATE_TUNNELLED should be VIR_MIGRATE_TUNNELED */
const VIR_MIGRATE_PEER2PEER = 2;
/* tunnel migration data over libvirtd connection */
const VIR_MIGRATE_TUNNELLED = 4;
/* persist the VM on the destination */
const VIR_MIGRATE_PERSIST_DEST = 8;
/* undefine the VM on the source */
const VIR_MIGRATE_UNDEFINE_SOURCE = 16;
/* pause on remote side */
const VIR_MIGRATE_PAUSED = 32;
/* migration with non-shared storage with full disk copy */
const VIR_MIGRATE_NON_SHARED_DISK = 64;
/* migration with non-shared storage with incremental copy (same base image shared between source and destination) */
const VIR_MIGRATE_NON_SHARED_INC = 128;
/* protect for changing domain configuration through the whole migration process; this will be used automatically
when supported */
const VIR_MIGRATE_CHANGE_PROTECTION = 256;
/* force migration even if it is considered unsafe */
const VIR_MIGRATE_UNSAFE = 512;
/* offline migrate */
const VIR_MIGRATE_OFFLINE = 1024;
/* compress data during migration */
const VIR_MIGRATE_COMPRESSED = 2048;
/* abort migration on I/O errors happened during migration */
const VIR_MIGRATE_ABORT_ON_ERROR = 4096;
/* force convergence */
const VIR_MIGRATE_AUTO_CONVERGE = 8192;
/* Modify device allocation based on current domain state */
const VIR_DOMAIN_DEVICE_MODIFY_CURRENT = 0;
/* Modify live device allocation */
const VIR_DOMAIN_DEVICE_MODIFY_LIVE = 1;
/* Modify persisted device allocation */
const VIR_DOMAIN_DEVICE_MODIFY_CONFIG = 2;
/* Forcibly modify device (ex. force eject a cdrom) */
const VIR_DOMAIN_DEVICE_MODIFY_FORCE = 4;
/* REGISTER_LONG_CONSTANT */
const VIR_STORAGE_POOL_BUILD_NEW = 0;
/* Repair / reinitialize */
const VIR_STORAGE_POOL_BUILD_REPAIR = 1;
/* Extend existing pool */
const VIR_STORAGE_POOL_BUILD_RESIZE = 2;
/* Domain flags */
const VIR_DOMAIN_FLAG_FEATURE_ACPI = 1;
const VIR_DOMAIN_FLAG_FEATURE_APIC = 2;
const VIR_DOMAIN_FLAG_FEATURE_PAE = 4;
const VIR_DOMAIN_FLAG_CLOCK_LOCALTIME = 8;
const VIR_DOMAIN_FLAG_TEST_LOCAL_VNC = 16;
const VIR_DOMAIN_FLAG_SOUND_AC97 = 32;
const VIR_DOMAIN_DISK_FILE = 1;
const VIR_DOMAIN_DISK_BLOCK = 2;
const VIR_DOMAIN_DISK_ACCESS_ALL = 4;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_ACTIVE = 1;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_INACTIVE = 2;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_OTHER = 4;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_PAUSED = 8;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_PERSISTENT = 16;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_RUNNING = 32;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_SHUTOFF = 64;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_TRANSIENT = 128;
const VIR_CONNECT_GET_ALL_DOMAINS_STATS_ENFORCE_STATS = 2 ^ 31;
const VIR_DOMAIN_MEM_CONFIG = VIR_DOMAIN_AFFECT_CONFIG;
const VIR_DOMAIN_MEM_CURRENT = VIR_DOMAIN_AFFECT_CURRENT;
const VIR_DOMAIN_MEM_LIVE = VIR_DOMAIN_AFFECT_LIVE;
const VIR_DOMAIN_MEM_MAXIMUM = 4;
const VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE = 0;
const VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_AGENT = 1;
const VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_ARP = VIR_DOMAIN_INTERFACE_ADDRESSES_SRC_LEASE;
/* Connect flags */
const VIR_CONNECT_FLAG_SOUNDHW_GET_NAMES = 1;
/* Keycodeset constants */
const VIR_KEYCODE_SET_LINUX = 0;
const VIR_KEYCODE_SET_XT = 1;
const VIR_KEYCODE_SET_ATSET1 = 6;
const VIR_KEYCODE_SET_ATSET2 = 2;
const VIR_KEYCODE_SET_ATSET3 = 3;
const VIR_KEYCODE_SET_OSX = 4;
const VIR_KEYCODE_SET_XT_KBD = 5;
const VIR_KEYCODE_SET_USB = 6;
const VIR_KEYCODE_SET_WIN32 = 7;
const VIR_KEYCODE_SET_RFB = 8;
/* virDomainUndefineFlagsValues */
const VIR_DOMAIN_UNDEFINE_MANAGED_SAVE = 1;
const VIR_DOMAIN_UNDEFINE_SNAPSHOTS_METADATA = 2;
const VIR_DOMAIN_UNDEFINE_NVRAM = 4;
const VIR_DOMAIN_UNDEFINE_KEEP_NVRAM = 8;
/* Connect functions */
/**
* Function is used to connect to the specified libvirt daemon using the specified URL, user can also set the readonly
* flag and/or set credentials for connection
* @param string $url URI for connection
* @param bool $readonly [optional] flag whether to use read-only connection or not, default true
* @param array $credentials [optional] array of connection credentials
* @return resource libvirt connection resource
* @since 0.4.1(-1)
*/
function libvirt_connect(string $url, bool $readonly = true, array $credentials) {}
/**
* Query statistics for all domains on a given connection
* @param resource $conn resource for connection
* @param int $stats [optional] the statistic groups from VIR_DOMAIN_STATS_*
* @param int $flags [optional] the statistic groups from VIR_DOMAIN_STATS_*
* @return array|false assoc array with statistics or false on error
* @since 0.5.1(-1)
*/
function libvirt_connect_get_all_domain_stats($conn, int $stats = 0, int $flags = 0): array|false {}
/**
* Function is used to get the capabilities information from the connection
* @param resource $conn resource for connection
* @param string|null $xpath [optional] xPath query to be applied on the result
* @return string capabilities XML from the connection or FALSE for error
* @since 0.4.1(-2)
*/
function libvirt_connect_get_capabilities($conn, ?string $xpath): string {}
/**
* Function is used to get the emulator for requested connection/architecture
* @param resource $conn libvirt connection resource
* @param string|null $arch [optional] architecture string, can be NULL to get default
* @return string path to the emulator
* @since 0.4.5
*/
function libvirt_connect_get_emulator($conn, ?string $arch): string {}
/**
* Function is used to get the information whether the connection is encrypted or not
* @param resource $conn resource for connection
* @return int 1 if encrypted, 0 if not encrypted, -1 on error
* @since 0.4.1(-2)
*/
function libvirt_connect_get_encrypted($conn): int {}
/**
* Function is used to get the hostname of the guest associated with the connection
* @param resource $conn resource for connection
* @return string|false hostname of the host node or FALSE for error
* @since 0.4.1(-1)
*/
function libvirt_connect_get_hostname($conn): string|false {}
/**
* Function is used to get the information about the hypervisor on the connection identified by the connection pointer
* @param resource $conn libvirt-php: PHP API Reference guide
* @return array array of hypervisor information if available
*/
function libvirt_connect_get_hypervisor($conn): array {}
/**
* Function is used to get the information about the connection
* @param resource $conn resource for connection
* @return array array of information about the connection
* @since 0.4.1(-2)
*/
function libvirt_connect_get_information($conn): array {}
/**
* Function is used to get machine types supported by hypervisor on the connection
* @param resource $conn resource for connection
* @return array array of machine types for the connection incl. maxCpus if appropriate
* @since 0.4.9
*/
function libvirt_connect_get_machine_types($conn): array {}
/**
* Function is used to get maximum number of VCPUs per VM on the hypervisor connection
* @param resource $conn resource for connection
* @return int|false number of VCPUs available per VM on the connection or FALSE for error
* @since 0.4.1(-2)
*/
function libvirt_connect_get_maxvcpus($conn): int|false {}
/**
* Function is used to get NIC models for requested connection/architecture
* @param resource $conn libvirt connection resource
* @param string|null $arch [optional] architecture string, can be NULL to get default
* @return array array of models
* @since 0.4.9
*/
function libvirt_connect_get_nic_models($conn, ?string $arch): array {}
/**
* Function is used to get the information whether the connection is secure or not
* @param resource $conn resource for connection
* @return int 1 if secure, 0 if not secure, -1 on error
* @since 0.4.1(-2)
*/
function libvirt_connect_get_secure($conn): int {}
/**
* Function is used to get sound hardware models for requested connection/architecture
* @param resource $conn libvirt connection resource
* @param string|null $arch [optional] architecture string, can be NULL to get default
* @param int $flags [optional] flags for getting sound hardware. Can be either 0 or VIR_CONNECT_SOUNDHW_GET_NAMES
* @return array array of models
* @since 0.4.9
*/
function libvirt_connect_get_soundhw_models($conn, ?string $arch, int $flags = 0): array {}
/**
* Function is used to get the system information from connection if available
* @param resource $conn resource for connection
* @return string|false XML description of system information from the connection or FALSE for error
* @since 0.4.1(-2)
*/
function libvirt_connect_get_sysinfo($conn): string|false {}
/**
* Function is used to get the connection URI. This is useful to check the hypervisor type of host machine
* when using "null" uri to libvirt_connect()
* @param resource $conn resource for connection
* @return string|false connection URI string or FALSE for error
* @since 0.4.1(-1)
*/
function libvirt_connect_get_uri($conn): string|false {}
/* Domain functions */
/**
* Function is used to attach a virtual device to a domain
* @param resource $res libvirt domain resource
* @param string $xml XML description of one device
* @param int $flags [optional] flags
* @return bool TRUE for success, FALSE on error
* @since 0.5.3
*/
function libvirt_domain_attach_device($res, string $xml, int $flags = 0): bool {}
/**
* Function is used to commit block job
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $disk path to the block device, or device shorthand
* @param string|null $base [optional] path to backing file to merge into, or device shorthand, or NULL for default
* @param string|null $top [optional] path to file within backing chain that contains data to be merged,
* or device shorthand, or NULL to merge all possible data
* @param int $bandwidth [optional] specify bandwidth limit; flags determine the unit
* @param int $flags [optional] bitwise-OR of VIR_DOMAIN_BLOCK_COMMIT_*
* @return bool true on success fail on error
* @since 0.5.2(-1)
*/
function libvirt_domain_block_commit($res, string $disk, ?string $base, ?string $top, int $bandwidth = 0, int $flags = 0): bool {}
/**
* Function is used to abort block job
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $path device path to resize
* @param int $flags [optional] bitwise-OR of VIR_DOMAIN_BLOCK_JOB_ABORT_*
* @return bool true on success fail on error
* @since 0.5.1(-1)
*/
function libvirt_domain_block_job_abort($res, string $path, int $flags = 0): bool {}
/**
* Function is used to attach a virtual device to a domain
* @param resource $res libvirt domain resource
* @param string $disk path to the block device, or device shorthand
* @param int $flags [optional] bitwise-OR of VIR_DOMAIN_BLOCK_COMMIT_*
* @return array Array with status virDomainGetBlockJobInfo and blockjob information
* @since 0.5.2(-1)
*/
function libvirt_domain_block_job_info($res, string $disk, int $flags = 0): array {}
/**
* Function is used to set speed of block job
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $path device path to resize
* @param int $bandwidth bandwidth
* @param int $flags [optional] bitwise-OR of VIR_DOMAIN_BLOCK_JOB_SPEED_BANDWIDTH_*
* @return bool true on success fail on error
* @since 0.4.1(-1)
*/
function libvirt_domain_block_job_set_speed($res, string $path, int $bandwidth, int $flags = 0): bool {}
/**
* Function is used to resize the domain's block device
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $path device path to resize
* @param int $size size of device
* @param int $flags [optional] bitwise-OR of VIR_DOMAIN_BLOCK_RESIZE_*
* @return bool true on success fail on error
* @since 0.5.1(-1)
*/
function libvirt_domain_block_resize($res, string $path, int $size, int $flags = 0): bool {}
/**
* Function is used to get the domain's block stats
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $path device path to get statistics about
* @return array domain block stats array, fields are rd_req, rd_bytes, wr_req, wr_bytes and errs
* @since 0.4.1(-1)
*/
function libvirt_domain_block_stats($res, string $path): array {}
/**
* Function is used to change the domain boot devices
* @param resource $res libvirt domain resource
* @param string $first first boot device to be set
* @param string $second second boot device to be set
* @param int $flags [optional] flags
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_change_boot_devices($res, string $first, string $second, int $flags = 0) {}
/**
* Function is used to change the domain memory allocation
* @param resource $res libvirt domain resource
* @param int $allocMem number of MiBs to be set as immediate memory value
* @param int $allocMax number of MiBs to be set as the maximum allocation
* @param int $flags [optional] flags
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_change_memory($res, int $allocMem, int $allocMax, int $flags = 0) {}
/**
* Function is used to change the VCPU count for the domain
* @param resource $res libvirt domain resource
* @param int $numCpus number of VCPUs to be set for the guest
* @param int $flags [optional] flags for virDomainSetVcpusFlags
* (available at http://libvirt.org/html/libvirt-libvirt.html#virDomainVcpuFlags)
* @return bool true on success, false on error
* @since 0.4.2
*/
function libvirt_domain_change_vcpus($res, int $numCpus, int $flags = 0): bool {}
/**
* Function is used to dump core of the domain identified by it's resource
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $to to
* @return bool TRUE for success, FALSE on error
* @since 0.4.1(-2)
*/
function libvirt_domain_core_dump($res, string $to): bool {}
/**
* Function is used to create the domain identified by it's resource
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return bool result of domain creation (startup)
* @since 0.4.1(-1)
*/
function libvirt_domain_create($res): bool {}
/**
* Function is used to create the domain identified by it's resource
* @param resource $conn libvirt connection resource
* @param string $xml XML string to create guest from
* @param int $flags [optional] flags
* @return resource newly started/created domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_create_xml($conn, string $xml, int $flags = 0) {}
/**
* Function is used to define the domain from XML string
* @param resource $conn libvirt connection resource
* @param string $xml XML string to define guest from
* @return resource newly defined domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_define_xml($conn, string $xml) {}
/**
* Function is used to destroy the domain identified by it's resource
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return bool result of domain destroy
* @since 0.4.1(-1)
*/
function libvirt_domain_destroy($res): bool {}
/**
* Function is used to detach a virtual device from a domain
* @param resource $res libvirt domain resource
* @param string $xml XML description of one device
* @param int $flags [optional] flags to control how the device is attached. Defaults to VIR_DOMAIN_AFFECT_LIVE
* @return bool TRUE for success, FALSE on error
* @since 0.5.3
*/
function libvirt_domain_detach_device($res, string $xml, int $flags = VIR_DOMAIN_AFFECT_LIVE): bool {}
/**
* Function is used to add the disk to the virtual machine using set of API functions to make it as simple
* as possible for the user
* @param resource $res libvirt domain resource
* @param string $img string for the image file on the host system
* @param string $dev string for the device to be presented to the guest (e.g. hda)
* @param string $typ bus type for the device in the guest, usually 'ide' or 'scsi'
* @param string $driver driver type to be specified, like 'raw' or 'qcow2'
* @param int $flags [optional] flags for getting the XML description
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_disk_add($res, string $img, string $dev, string $typ, string $driver, int $flags = 0) {}
/**
* Function is used to remove the disk from the virtual machine using set of API functions to make it
* as simple as possible
* @param resource $res libvirt domain resource
* @param string $dev string for the device to be removed from the guest (e.g. 'hdb')
* @param int $flags [optional] flags for getting the XML description
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_disk_remove($res, string $dev, int $flags = 0) {}
/**
* Function is getting the autostart value for the domain
* @param resource $res libvirt domain resource
* @return int autostart value or -1
* @since 0.4.1(-1)
*/
function libvirt_domain_get_autostart($res): int {}
/**
* Function is used to get the domain's block device information
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $dev device to get block information about
* @return array domain block device information array of device, file or partition, capacity,
* allocation and physical size
* @since 0.4.1(-1)
*/
function libvirt_domain_get_block_info($res, string $dev): array {}
/**
* Function is used to get the domain's connection resource. This function should *not* be used!
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return resource libvirt connection resource
* @since 0.4.1(-1)
*/
function libvirt_domain_get_connect($res) {}
/**
* Function is getting domain counts for all, active and inactive domains
* @param resource $conn libvirt connection resource from libvirt_connect()
* @return array array of total, active and inactive (but defined) domain counts
* @since 0.4.1(-1)
*/
function libvirt_domain_get_counts($conn): array {}
/**
* Function is used to get disk devices for the domain
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return array|false list of domain disk devices
* @since 0.4.4
*/
function libvirt_domain_get_disk_devices($res): array|false {}
/**
* Function is used to get the domain's ID, applicable to running guests only
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return int running domain ID or -1 if not running
* @since 0.4.1(-1)
*/
function libvirt_domain_get_id($res): int {}
/**
* Function is used to get the domain's information
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return array domain information array
* @since 0.4.4
*/
function libvirt_domain_get_info($res): array {}
/**
* Function is used to get network interface devices for the domain
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return array|false list of domain interface devices
* @since 0.4.4
*/
function libvirt_domain_get_interface_devices($res): array|false {}
/**
* Function is used get job information for the domain
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return array job information array of type, time, data, mem and file fields
* @since 0.4.1(-1)
*/
function libvirt_domain_get_job_info($res): array {}
/**
* Function retrieve appropriate domain element given by $type
* @param resource $res libvirt domain resource
* @param int $type virDomainMetadataType type of description
* @param string $uri XML namespace identifier
* @param int $flags bitwise-OR of virDomainModificationImpact
* @return string|null|false metadata string, NULL on error or FALSE on API not supported
* @since 0.4.9
*/
function libvirt_domain_get_metadata($res, int $type, string $uri, int $flags = 0): string|null|false {}
/**
* Function is used to get domain name from it's resource
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return string domain name string
* @since 0.4.1(-1)
*/
function libvirt_domain_get_name($res): string {}
/**
* Function is used to get the domain's network information
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $mac mac address of the network device
* @return array domain network info array of MAC address, network name and type of NIC card
* @since 0.4.1(-1)
*/
function libvirt_domain_get_network_info($res, string $mac): array {}
/**
* This functions can be used to get the next free slot if you intend to add a new device identified
* by slot to the domain, e.g. NIC device
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return array next free slot number for the domain
* @since 0.4.2
*/
function libvirt_domain_get_next_dev_ids($res): array {}
/**
* Function get screen dimensions of the VNC window
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $server server string of the host machine
* @return array|false array of height and width on success, FALSE otherwise
* @since 0.4.2
*/
function libvirt_domain_get_screen_dimensions($res, string $server): array|false {}
/**
* Function uses gvnccapture (if available) to get the screenshot of the running domain
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $server server string for the host machine
* @param int $scancode [optional] integer value of the scancode to be send to refresh screen, default is 10
* @return string PNG image binary data
* @since 0.4.2
*/
function libvirt_domain_get_screenshot($res, string $server, int $scancode = 10): string {}
/**
* Function is trying to get domain screenshot using libvirt virGetDomainScreenshot() API if available
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_get_by_*()
* @param int $screenID [optional] monitor ID from where to take screenshot
* @return array array of filename and mime type as type is hypervisor specific,
* caller is responsible for temporary file deletion
* @since 0.4.5
*/
function libvirt_domain_get_screenshot_api($res, int $screenID = 0): array {}
/**
* Function is used to get the domain's UUID in binary format
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return string domain UUID in binary format
* @since 0.4.1(-1)
*/
function libvirt_domain_get_uuid($res): string {}
/**
* Function is used to get the domain's UUID in string format
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @return string domain UUID string
* @since 0.4.1(-1)
*/
function libvirt_domain_get_uuid_string($res): string {}
/**
* Function is used to get the domain's XML description
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string|null $xpath xPath expression string to get just this entry, can be NULL
* @param int $flags [optional] flags
* @return string domain XML description string or result of xPath expression
* @since 0.4.2
*/
function libvirt_domain_get_xml_desc($res, ?string $xpath, int $flags = 0): string {}
/**
* Function is used to get network interface addresses for the domain
* @param resource $res libvirt domain resource
* @param int $source one of the VIR_DOMAIN_ADDRESSES_SRC_* flags
* @return array|false interface array of a domain holding information about addresses resembling
* the virDomainInterface structure, false on error
* @since 0.5.5
*/
function libvirt_domain_interface_addresses($res, int $source): array|false {}
/**
* Function is used to get the domain's interface stats
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $path path to interface device
* @return array interface stats array of {tx|rx}_{bytes|packets|errs|drop} fields
* @since 0.4.1(-1)
*/
function libvirt_domain_interface_stats($res, string $path): array {}
/**
* Function is getting information whether domain identified by resource is active or not
* @param resource $res libvirt domain resource
* @return bool virDomainIsActive() result on the domain
* @since 0.4.1(-1)
*/
function libvirt_domain_is_active($res): bool {}
/**
* Function to get information whether domain is persistent or not
* @param resource $res libvirt domain resource
* @return bool TRUE for persistent, FALSE for not persistent, -1 on error
* @since 0.4.9
*/
function libvirt_domain_is_persistent($res): bool {}
/**
* Function is used to get domain by it's ID, applicable only to running guests
* @param resource $conn libvirt connection resource from libvirt_connect()
* @param string $id domain id to look for
* @return resource libvirt domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_lookup_by_id($conn, string $id) {}
/**
* Function is used to lookup for domain by it's name
* @param resource $res libvirt connection resource from libvirt_connect()
* @param string $name domain name to look for
* @return resource libvirt domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_lookup_by_name($res, string $name) {}
/**
* Function is used to lookup for domain by it's UUID in the binary format
* @param resource $res libvirt connection resource from libvirt_connect()
* @param string $uuid binary defined UUID to look for
* @return resource libvirt domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_lookup_by_uuid($res, string $uuid) {}
/**
* Function is used to get the domain by it's UUID that's accepted in string format
* @param resource $res libvirt connection resource from libvirt_connect()
* @param string $uuid domain UUID [in string format] to look for
* @return resource libvirt domain resource
* @since 0.4.1(-1)
*/
function libvirt_domain_lookup_by_uuid_string($res, string $uuid) {}
/**
* Function is used to managed save the domain (domain was unloaded from memory and it state saved to disk)
* identified by it's resource
* @param resource $res TRUE for success, FALSE on error
* @return bool TRUE for success, FALSE on error
* @since 0.4.1(-1)
*/
function libvirt_domain_managedsave($res): bool {}
/**
* Function is used to get the domain's memory peek value
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param int $start start
* @param int $size size
* @param int $flags flags
* @return int domain memory peek
* @since 0.4.1(-1)
*/
function libvirt_domain_memory_peek($res, int $start, int $size, int $flags = 0): int {}
/**
* Function is used to get the domain's memory stats
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param int $flags [optional] flags
* @return array domain memory stats array (same fields as virDomainMemoryStats, please see libvirt documentation)
* @since 0.4.1(-1)
*/
function libvirt_domain_memory_stats($res, int $flags = 0): array {}
/**
* Function is used migrate domain to another domain
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $dest_conn destination host connection object
* @param int $flags migration flags
* @param string $dname [optional] domain name to rename domain to on destination side
* @param int $bandwidth [optional] migration bandwidth in Mbps
* @return resource libvirt domain resource for migrated domain
* @since 0.4.1(-1)
*/
function libvirt_domain_migrate($res, string $dest_conn, int $flags, string $dname, int $bandwidth = 0) {}
/**
* Function is used migrate domain to another libvirt daemon specified by it's URI
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $dest_uri destination URI to migrate to
* @param int $flags migration flags
* @param string $dname [optional] domain name to rename domain to on destination side
* @param int $bandwidth [optional] migration bandwidth in Mbps
* @return bool TRUE for success, FALSE on error
* @since 0.4.1(-1)
*/
function libvirt_domain_migrate_to_uri($res, string $dest_uri, int $flags, string $dname, int $bandwidth = 0): bool {}
/**
* Function is used migrate domain to another libvirt daemon specified by it's URI
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $dconnuri URI for target libvirtd
* @param string $miguri URI for invoking the migration
* @param string $dxml XML config for launching guest on target
* @param int $flags migration flags
* @param string $dname [optional] domain name to rename domain to on destination side
* @param int $bandwidth [optional] migration bandwidth in Mbps
* @return bool TRUE for success, FALSE on error
* @since 0.4.6(-1)
*/
function libvirt_domain_migrate_to_uri2($res, string $dconnuri, string $miguri, string $dxml, int $flags, string $dname, int $bandwidth = 0): bool {}
/**
* Function is used to install a new virtual machine to the machine
* @param resource $conn libvirt connection resource
* @param string $name name of the new domain
* @param string|null|false $arch optional architecture string, can be NULL to get default (or false)
* @param int $memMB number of megabytes of RAM to be allocated for domain
* @param int $maxmemMB maximum number of megabytes of RAM to be allocated for domain
* @param int $vcpus number of VCPUs to be allocated to domain
* @param string $iso_image installation ISO image for domain
* @param array $disks array of disk devices for domain, consist of keys as 'path' (storage location),
* 'driver' (image type, e.g. 'raw' or 'qcow2'), 'bus' (e.g. 'ide', 'scsi'),
* 'dev' (device to be presented to the guest - e.g. 'hda'),
* 'size' (with 'M' or 'G' suffixes, like '10G' for 10 gigabytes image etc.) and
* 'flags' (VIR_DOMAIN_DISK_FILE or VIR_DOMAIN_DISK_BLOCK, optionally VIR_DOMAIN_DISK_ACCESS_ALL
* to allow access to the disk for all users on the host system)
* @param array $networks array of network devices for domain, consists of keys as 'mac' (for MAC address),
* 'network' (for network name) and optional 'model' for model of NIC device
* @param int $flags [optional] bit array of flags
* @return resource a new domain resource
* @since 0.4.5
*/
function libvirt_domain_new($conn, string $name, string|null|false $arch, int $memMB, int $maxmemMB, int $vcpus, string $iso_image, array $disks, array $networks, int $flags = 0) {}
/**
* Function is used to get the VNC server location for the newly created domain (newly started installation)
* @return string|null a VNC server for a newly created domain resource (if any)
* @since 0.4.5
*/
function libvirt_domain_new_get_vnc(): string|null {}
/**
* Function is used to add the NIC card to the virtual machine using set of API functions to make it as simple
* as possible for the user
* @param resource $res libvirt domain resource
* @param string $mac libvirt domain resource
* @param string $network network name where to connect this NIC
* @param string $model string of the NIC model
* @param int $flags [optional] flags for getting the XML description
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_nic_add($res, string $mac, string $network, string $model, int $flags = 0) {}
/**
* Function is used to remove the NIC from the virtual machine using set of API functions to make it
* as simple as possible
* @param resource $res libvirt domain resource
* @param string $dev string representation of the IP address to be removed (e.g. 54:52:00:xx:yy:zz)
* @param int $flags [optional] flags for getting the XML description
* @return resource new domain resource
* @since 0.4.2
*/
function libvirt_domain_nic_remove($res, string $dev, int $flags = 0) {}
/**
* Function is used to send qemu-ga command
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param string $cmd command
* @param int $timeout [optional] timeout
* @param int $flags [optional] unknown
* @return string|false String on success and FALSE on error
* @since 0.5.2(-1)
*/
function libvirt_domain_qemu_agent_command($res, string $cmd, $timeout = -1, int $flags = 0): string|false {}
/**
* Function is used to reboot the domain identified by it's resource
* @param resource $res libvirt domain resource, e.g. from libvirt_domain_lookup_by_*()
* @param int $flags [optional] flags
* @return bool TRUE for success, FALSE on error
* @since 0.4.1(-1)
*/
function libvirt_domain_reboot($res, int $flags = 0): bool {}
/**
* Function is used to reset the domain identified by its resource