-
Notifications
You must be signed in to change notification settings - Fork 1
/
cloud-hypervisor.yaml
1145 lines (1079 loc) · 28.6 KB
/
cloud-hypervisor.yaml
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
openapi: 3.0.1
info:
title: Cloud Hypervisor API
description: Local HTTP based API for managing and inspecting a cloud-hypervisor virtual machine.
license:
name: Apache 2.0
url: http://www.apache.org/licenses/LICENSE-2.0.html
version: 0.3.0
servers:
- url: http://localhost/api/v1
paths:
/vmm.ping:
get:
summary: Ping the VMM to check for API server availability
responses:
200:
description: The VMM information
content:
application/json:
schema:
$ref: "#/components/schemas/VmmPingResponse"
/vmm.shutdown:
put:
summary: Shuts the cloud-hypervisor VMM.
operationId: shutdownVMM
responses:
204:
description: The VMM successfully shutdown.
/vm.info:
get:
summary: Returns general information about the cloud-hypervisor Virtual Machine (VM) instance.
responses:
200:
description: The VM information
content:
application/json:
schema:
$ref: "#/components/schemas/VmInfo"
/vm.counters:
get:
summary: Get counters from the VM
responses:
200:
description: The VM counters
content:
application/json:
schema:
$ref: "#/components/schemas/VmCounters"
/vm.create:
put:
summary: Create the cloud-hypervisor Virtual Machine (VM) instance. The instance is not booted, only created.
operationId: createVM
requestBody:
description: The VM configuration
content:
application/json:
schema:
$ref: "#/components/schemas/VmConfig"
required: true
responses:
204:
description: The VM instance was successfully created.
/vm.delete:
put:
summary: Delete the cloud-hypervisor Virtual Machine (VM) instance.
operationId: deleteVM
responses:
204:
description: The VM instance was successfully deleted.
/vm.boot:
put:
summary: Boot the previously created VM instance.
operationId: bootVM
responses:
204:
description: The VM instance successfully booted.
404:
description: The VM instance could not boot because it is not created yet
/vm.pause:
put:
summary: Pause a previously booted VM instance.
operationId: pauseVM
responses:
204:
description: The VM instance successfully paused.
404:
description: The VM instance could not pause because it is not created yet
405:
description: The VM instance could not pause because it is not booted.
/vm.resume:
put:
summary: Resume a previously paused VM instance.
operationId: resumeVM
responses:
204:
description: The VM instance successfully paused.
404:
description: The VM instance could not resume because it is not booted yet
405:
description: The VM instance could not resume because it is not paused.
/vm.shutdown:
put:
summary: Shut the VM instance down.
operationId: shutdownVM
responses:
204:
description: The VM instance successfully shut down.
404:
description: The VM instance could not shut down because is not created.
405:
description: The VM instance could not shut down because it is not started.
/vm.reboot:
put:
summary: Reboot the VM instance.
operationId: rebootVM
responses:
204:
description: The VM instance successfully rebooted.
404:
description: The VM instance could not reboot because it is not created.
405:
description: The VM instance could not reboot because it is not booted.
/vm.power-button:
put:
summary: Trigger a power button in the VM
operationId: power-buttonVM
responses:
204:
description: Power button successfully triggered in the VM
404:
description: The button could not be triggered because it is not created yet
405:
description: The button could not be triggered because it is not booted.
/vm.resize:
put:
summary: Resize the VM
requestBody:
description: The target size for the VM
content:
application/json:
schema:
$ref: "#/components/schemas/VmResize"
required: true
responses:
204:
description: The VM instance was successfully resized.
404:
description: The VM instance could not be resized because it is not created.
/vm.resize-zone:
put:
summary: Resize a memory zone
requestBody:
description: The target size for the memory zone
content:
application/json:
schema:
$ref: "#/components/schemas/VmResizeZone"
required: true
responses:
204:
description: The memory zone was successfully resized.
500:
description: The memory zone could not be resized.
/vm.add-device:
put:
summary: Add a new device to the VM
requestBody:
description: The path of the new device
content:
application/json:
schema:
$ref: "#/components/schemas/DeviceConfig"
required: true
responses:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new device was successfully (cold) added to the VM instance.
404:
description: The new device could not be added to the VM instance.
/vm.remove-device:
put:
summary: Remove a device from the VM
requestBody:
description: The identifier of the device
content:
application/json:
schema:
$ref: "#/components/schemas/VmRemoveDevice"
required: true
responses:
204:
description: The device was successfully removed from the VM instance.
404:
description: The device could not be removed from the VM instance.
/vm.add-disk:
put:
summary: Add a new disk to the VM
requestBody:
description: The details of the new disk
content:
application/json:
schema:
$ref: "#/components/schemas/DiskConfig"
required: true
responses:
200:
description: The new disk was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new disk was successfully (cold) added to the VM instance.
500:
description: The new disk could not be added to the VM instance.
/vm.add-fs:
put:
summary: Add a new virtio-fs device to the VM
requestBody:
description: The details of the new virtio-fs
content:
application/json:
schema:
$ref: "#/components/schemas/FsConfig"
required: true
responses:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new device was successfully (cold) added to the VM instance.
500:
description: The new device could not be added to the VM instance.
/vm.add-pmem:
put:
summary: Add a new pmem device to the VM
requestBody:
description: The details of the new pmem device
content:
application/json:
schema:
$ref: "#/components/schemas/PmemConfig"
required: true
responses:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new device was successfully (cold) added to the VM instance.
500:
description: The new device could not be added to the VM instance.
/vm.add-net:
put:
summary: Add a new network device to the VM
requestBody:
description: The details of the new network device
content:
application/json:
schema:
$ref: "#/components/schemas/NetConfig"
required: true
responses:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new device was successfully (cold) added to the VM instance.
500:
description: The new device could not be added to the VM instance.
/vm.add-vsock:
put:
summary: Add a new vsock device to the VM
requestBody:
description: The details of the new vsock device
content:
application/json:
schema:
$ref: "#/components/schemas/VsockConfig"
required: true
responses:
200:
description: The new device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new device was successfully (cold) added to the VM instance.
500:
description: The new device could not be added to the VM instance.
/vm.add-vdpa:
put:
summary: Add a new vDPA device to the VM
requestBody:
description: The details of the new vDPA device
content:
application/json:
schema:
$ref: "#/components/schemas/VdpaConfig"
required: true
responses:
200:
description: The new vDPA device was successfully added to the VM instance.
content:
application/json:
schema:
$ref: "#/components/schemas/PciDeviceInfo"
204:
description: The new vDPA device was successfully (cold) added to the VM instance.
500:
description: The new vDPA device could not be added to the VM instance.
/vm.snapshot:
put:
summary: Returns a VM snapshot.
requestBody:
description: The snapshot configuration
content:
application/json:
schema:
$ref: "#/components/schemas/VmSnapshotConfig"
required: true
responses:
204:
description: The VM instance was successfully snapshotted.
404:
description: The VM instance could not be snapshotted because it is not created.
405:
description: The VM instance could not be snapshotted because it is not booted.
/vm.coredump:
put:
summary: Takes a VM coredump.
requestBody:
description: The coredump configuration
content:
application/json:
schema:
$ref: "#/components/schemas/VmCoredumpData"
required: true
responses:
204:
description: The VM instance was successfully coredumped.
404:
description: The VM instance could not be coredumped because it is not created.
405:
description: The VM instance could not be coredumped because it is not booted.
/vm.restore:
put:
summary: Restore a VM from a snapshot.
requestBody:
description: The restore configuration
content:
application/json:
schema:
$ref: "#/components/schemas/RestoreConfig"
required: true
responses:
204:
description: The VM instance was successfully restored.
404:
description: The VM instance could not be restored because it is already created.
/vm.receive-migration:
put:
summary: Receive a VM migration from URL
requestBody:
description: The URL for the reception of migration state
content:
application/json:
schema:
$ref: "#/components/schemas/ReceiveMigrationData"
required: true
responses:
204:
description: The VM migration was successfully received.
500:
description: The VM migration could not be received.
/vm.send-migration:
put:
summary: Send a VM migration to URL
requestBody:
description: The URL for sending the migration state
content:
application/json:
schema:
$ref: "#/components/schemas/SendMigrationData"
required: true
responses:
204:
description: The VM migration was successfully sent.
500:
description: The VM migration could not be sent.
components:
schemas:
VmmPingResponse:
required:
- version
type: object
properties:
build_version:
type: string
version:
type: string
pid:
type: integer
format: int64
description: Virtual Machine Monitor information
VmInfo:
required:
- config
- state
type: object
properties:
config:
$ref: "#/components/schemas/VmConfig"
state:
type: string
enum: [Created, Running, Shutdown, Paused]
memory_actual_size:
type: integer
format: int64
device_tree:
type: object
additionalProperties:
$ref: "#/components/schemas/DeviceNode"
description: Virtual Machine information
DeviceNode:
type: object
properties:
id:
type: string
resources:
type: array
items:
# Rust enum type (with data) which can't be better represented here
type: object
children:
type: array
items:
type: string
pci_bdf:
type: string
VmCounters:
type: object
additionalProperties:
type: object
additionalProperties:
type: integer
format: int64
PciDeviceInfo:
required:
- id
- bdf
type: object
properties:
id:
type: string
bdf:
type: string
description: Information about a PCI device
PayloadConfig:
type: object
properties:
firmware:
type: string
kernel:
type: string
cmdline:
type: string
initramfs:
type: string
description: Payloads to boot in guest
VmConfig:
required:
- payload
type: object
properties:
cpus:
$ref: "#/components/schemas/CpusConfig"
memory:
$ref: "#/components/schemas/MemoryConfig"
payload:
$ref: "#/components/schemas/PayloadConfig"
disks:
type: array
items:
$ref: "#/components/schemas/DiskConfig"
net:
type: array
items:
$ref: "#/components/schemas/NetConfig"
rng:
$ref: "#/components/schemas/RngConfig"
balloon:
$ref: "#/components/schemas/BalloonConfig"
fs:
type: array
items:
$ref: "#/components/schemas/FsConfig"
pmem:
type: array
items:
$ref: "#/components/schemas/PmemConfig"
serial:
$ref: "#/components/schemas/ConsoleConfig"
console:
$ref: "#/components/schemas/ConsoleConfig"
devices:
type: array
items:
$ref: "#/components/schemas/DeviceConfig"
vdpa:
type: array
items:
$ref: "#/components/schemas/VdpaConfig"
vsock:
$ref: "#/components/schemas/VsockConfig"
sgx_epc:
type: array
items:
$ref: "#/components/schemas/SgxEpcConfig"
numa:
type: array
items:
$ref: "#/components/schemas/NumaConfig"
iommu:
type: boolean
default: false
watchdog:
type: boolean
default: false
platform:
$ref: "#/components/schemas/PlatformConfig"
tpm:
$ref: "#/components/schemas/TpmConfig"
description: Virtual machine configuration
CpuAffinity:
required:
- vcpu
- host_cpus
type: object
properties:
vcpu:
type: integer
host_cpus:
type: array
items:
type: integer
CpuFeatures:
type: object
properties:
amx:
type: boolean
CpuTopology:
type: object
properties:
threads_per_core:
type: integer
cores_per_die:
type: integer
dies_per_package:
type: integer
packages:
type: integer
CpusConfig:
required:
- boot_vcpus
- max_vcpus
type: object
properties:
boot_vcpus:
minimum: 1
default: 1
type: integer
max_vcpus:
minimum: 1
default: 1
type: integer
topology:
$ref: "#/components/schemas/CpuTopology"
kvm_hyperv:
type: boolean
default: false
max_phys_bits:
type: integer
affinity:
type: array
items:
$ref: "#/components/schemas/CpuAffinity"
features:
$ref: "#/components/schemas/CpuFeatures"
PlatformConfig:
type: object
properties:
num_pci_segments:
type: integer
format: int16
iommu_segments:
type: array
items:
type: integer
format: int16
serial_number:
type: string
uuid:
type: string
oem_strings:
type: array
items:
type: string
tdx:
type: boolean
default: false
MemoryZoneConfig:
required:
- id
- size
type: object
properties:
id:
type: string
size:
type: integer
format: int64
default: 512 MB
file:
type: string
mergeable:
type: boolean
default: false
shared:
type: boolean
default: false
hugepages:
type: boolean
default: false
hugepage_size:
type: integer
format: int64
host_numa_node:
type: integer
format: int32
hotplug_size:
type: integer
format: int64
hotplugged_size:
type: integer
format: int64
prefault:
type: boolean
default: false
MemoryConfig:
required:
- size
type: object
properties:
size:
type: integer
format: int64
default: 512 MB
hotplug_size:
type: integer
format: int64
hotplugged_size:
type: integer
format: int64
mergeable:
type: boolean
default: false
hotplug_method:
type: string
default: "Acpi"
shared:
type: boolean
default: false
hugepages:
type: boolean
default: false
hugepage_size:
type: integer
format: int64
prefault:
type: boolean
default: false
thp:
type: boolean
default: true
zones:
type: array
items:
$ref: "#/components/schemas/MemoryZoneConfig"
TokenBucket:
required:
- size
- refill_time
type: object
properties:
size:
type: integer
format: int64
minimum: 0
description: The total number of tokens this bucket can hold.
one_time_burst:
type: integer
format: int64
minimum: 0
description: The initial size of a token bucket.
refill_time:
type: integer
format: int64
minimum: 0
description: The amount of milliseconds it takes for the bucket to refill.
description:
Defines a token bucket with a maximum capacity (_size_), an initial burst size
(_one_time_burst_) and an interval for refilling purposes (_refill_time_).
The refill-rate is derived from _size_ and _refill_time_, and it is the constant
rate at which the tokens replenish. The refill process only starts happening after
the initial burst budget is consumed.
Consumption from the token bucket is unbounded in speed which allows for bursts
bound in size by the amount of tokens available.
Once the token bucket is empty, consumption speed is bound by the refill-rate.
RateLimiterConfig:
type: object
properties:
bandwidth:
$ref: "#/components/schemas/TokenBucket"
ops:
$ref: "#/components/schemas/TokenBucket"
description:
Defines an IO rate limiter with independent bytes/s and ops/s limits.
Limits are defined by configuring each of the _bandwidth_ and _ops_ token buckets.
DiskConfig:
required:
- path
type: object
properties:
path:
type: string
readonly:
type: boolean
default: false
direct:
type: boolean
default: false
iommu:
type: boolean
default: false
num_queues:
type: integer
default: 1
queue_size:
type: integer
default: 128
vhost_user:
type: boolean
default: false
vhost_socket:
type: string
rate_limiter_config:
$ref: "#/components/schemas/RateLimiterConfig"
pci_segment:
type: integer
format: int16
id:
type: string
NetConfig:
type: object
properties:
tap:
type: string
ip:
type: string
default: "192.168.249.1"
mask:
type: string
default: "255.255.255.0"
mac:
type: string
host_mac:
type: string
mtu:
type: integer
iommu:
type: boolean
default: false
num_queues:
type: integer
default: 2
queue_size:
type: integer
default: 256
vhost_user:
type: boolean
default: false
vhost_socket:
type: string
vhost_mode:
type: string
default: "Client"
id:
type: string
pci_segment:
type: integer
format: int16
rate_limiter_config:
$ref: "#/components/schemas/RateLimiterConfig"
RngConfig:
required:
- src
type: object
properties:
src:
type: string
default: "/dev/urandom"
iommu:
type: boolean
default: false
BalloonConfig:
required:
- size
type: object
properties:
size:
type: integer
format: int64
deflate_on_oom:
type: boolean
default: false
description: Deflate balloon when the guest is under memory pressure.
free_page_reporting:
type: boolean
default: false
description: Enable guest to report free pages.
FsConfig:
required:
- num_queues
- queue_size
- socket
- tag
type: object
properties:
tag:
type: string
socket:
type: string
num_queues:
type: integer
default: 1
queue_size:
type: integer
default: 1024
pci_segment:
type: integer
format: int16
id:
type: string
PmemConfig:
required:
- file
type: object
properties:
file:
type: string
size:
type: integer
format: int64
iommu:
type: boolean
default: false
discard_writes:
type: boolean
default: false
pci_segment:
type: integer
format: int16
id:
type: string
ConsoleConfig:
required:
- mode
type: object
properties:
file:
type: string
mode:
type: string
enum: [Off, Pty, Tty, File, Null]
iommu:
type: boolean
default: false
DeviceConfig:
required:
- path
type: object
properties:
path:
type: string
iommu:
type: boolean
default: false
pci_segment:
type: integer
format: int16
id:
type: string
TpmConfig:
required:
- socket
type: object
properties:
socket:
type: string
VdpaConfig:
required:
- path
- num_queues
type: object
properties:
path:
type: string
num_queues:
type: integer
default: 1
iommu:
type: boolean
default: false
pci_segment:
type: integer
format: int16
id:
type: string
VsockConfig:
required: