aboutsummaryrefslogtreecommitdiff
path: root/qapi/migration.json
blob: ea53b23dca90b886c452eaea01c0ff921f50e80d (plain)
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
# -*- Mode: Python -*-
# vim: filetype=python
#

##
# = Migration
##

{ 'include': 'common.json' }
{ 'include': 'sockets.json' }

##
# @MigrationStats:
#
# Detailed migration status.
#
# @transferred: amount of bytes already transferred to the target VM
#
# @remaining: amount of bytes remaining to be transferred to the target VM
#
# @total: total amount of bytes involved in the migration process
#
# @duplicate: number of duplicate (zero) pages (since 1.2)
#
# @skipped: number of skipped zero pages (since 1.5)
#
# @normal: number of normal pages (since 1.2)
#
# @normal-bytes: number of normal bytes sent (since 1.2)
#
# @dirty-pages-rate: number of pages dirtied by second by the
#                    guest (since 1.3)
#
# @mbps: throughput in megabits/sec. (since 1.6)
#
# @dirty-sync-count: number of times that dirty ram was synchronized (since 2.1)
#
# @postcopy-requests: The number of page requests received from the destination
#                     (since 2.7)
#
# @page-size: The number of bytes per page for the various page-based
#             statistics (since 2.10)
#
# @multifd-bytes: The number of bytes sent through multifd (since 3.0)
#
# @pages-per-second: the number of memory pages transferred per second
#                    (Since 4.0)
#
# Since: 0.14.0
##
{ 'struct': 'MigrationStats',
  'data': {'transferred': 'int', 'remaining': 'int', 'total': 'int' ,
           'duplicate': 'int', 'skipped': 'int', 'normal': 'int',
           'normal-bytes': 'int', 'dirty-pages-rate' : 'int',
           'mbps' : 'number', 'dirty-sync-count' : 'int',
           'postcopy-requests' : 'int', 'page-size' : 'int',
           'multifd-bytes' : 'uint64', 'pages-per-second' : 'uint64' } }

##
# @XBZRLECacheStats:
#
# Detailed XBZRLE migration cache statistics
#
# @cache-size: XBZRLE cache size
#
# @bytes: amount of bytes already transferred to the target VM
#
# @pages: amount of pages transferred to the target VM
#
# @cache-miss: number of cache miss
#
# @cache-miss-rate: rate of cache miss (since 2.1)
#
# @encoding-rate: rate of encoded bytes (since 5.1)
#
# @overflow: number of overflows
#
# Since: 1.2
##
{ 'struct': 'XBZRLECacheStats',
  'data': {'cache-size': 'int', 'bytes': 'int', 'pages': 'int',
           'cache-miss': 'int', 'cache-miss-rate': 'number',
           'encoding-rate': 'number', 'overflow': 'int' } }

##
# @CompressionStats:
#
# Detailed migration compression statistics
#
# @pages: amount of pages compressed and transferred to the target VM
#
# @busy: count of times that no free thread was available to compress data
#
# @busy-rate: rate of thread busy
#
# @compressed-size: amount of bytes after compression
#
# @compression-rate: rate of compressed size
#
# Since: 3.1
##
{ 'struct': 'CompressionStats',
  'data': {'pages': 'int', 'busy': 'int', 'busy-rate': 'number',
           'compressed-size': 'int', 'compression-rate': 'number' } }

##
# @MigrationStatus:
#
# An enumeration of migration status.
#
# @none: no migration has ever happened.
#
# @setup: migration process has been initiated.
#
# @cancelling: in the process of cancelling migration.
#
# @cancelled: cancelling migration is finished.
#
# @active: in the process of doing migration.
#
# @postcopy-active: like active, but now in postcopy mode. (since 2.5)
#
# @postcopy-paused: during postcopy but paused. (since 3.0)
#
# @postcopy-recover: trying to recover from a paused postcopy. (since 3.0)
#
# @completed: migration is finished.
#
# @failed: some error occurred during migration process.
#
# @colo: VM is in the process of fault tolerance, VM can not get into this
#        state unless colo capability is enabled for migration. (since 2.8)
#
# @pre-switchover: Paused before device serialisation. (since 2.11)
#
# @device: During device serialisation when pause-before-switchover is enabled
#          (since 2.11)
#
# @wait-unplug: wait for device unplug request by guest OS to be completed.
#               (since 4.2)
#
# Since: 2.3
#
##
{ 'enum': 'MigrationStatus',
  'data': [ 'none', 'setup', 'cancelling', 'cancelled',
            'active', 'postcopy-active', 'postcopy-paused',
            'postcopy-recover', 'completed', 'failed', 'colo',
            'pre-switchover', 'device', 'wait-unplug' ] }

##
# @MigrationInfo:
#
# Information about current migration process.
#
# @status: @MigrationStatus describing the current migration status.
#          If this field is not returned, no migration process
#          has been initiated
#
# @ram: @MigrationStats containing detailed migration
#       status, only returned if status is 'active' or
#       'completed'(since 1.2)
#
# @disk: @MigrationStats containing detailed disk migration
#        status, only returned if status is 'active' and it is a block
#        migration
#
# @xbzrle-cache: @XBZRLECacheStats containing detailed XBZRLE
#                migration statistics, only returned if XBZRLE feature is on and
#                status is 'active' or 'completed' (since 1.2)
#
# @total-time: total amount of milliseconds since migration started.
#              If migration has ended, it returns the total migration
#              time. (since 1.2)
#
# @downtime: only present when migration finishes correctly
#            total downtime in milliseconds for the guest.
#            (since 1.3)
#
# @expected-downtime: only present while migration is active
#                     expected downtime in milliseconds for the guest in last walk
#                     of the dirty bitmap. (since 1.3)
#
# @setup-time: amount of setup time in milliseconds *before* the
#              iterations begin but *after* the QMP command is issued. This is designed
#              to provide an accounting of any activities (such as RDMA pinning) which
#              may be expensive, but do not actually occur during the iterative
#              migration rounds themselves. (since 1.6)
#
# @cpu-throttle-percentage: percentage of time guest cpus are being
#                           throttled during auto-converge. This is only present when auto-converge
#                           has started throttling guest cpus. (Since 2.7)
#
# @error-desc: the human readable error description string, when
#              @status is 'failed'. Clients should not attempt to parse the
#              error strings. (Since 2.7)
#
# @postcopy-blocktime: total time when all vCPU were blocked during postcopy
#                      live migration. This is only present when the postcopy-blocktime
#                      migration capability is enabled. (Since 3.0)
#
# @postcopy-vcpu-blocktime: list of the postcopy blocktime per vCPU.  This is
#                           only present when the postcopy-blocktime migration capability
#                           is enabled. (Since 3.0)
#
# @compression: migration compression statistics, only returned if compression
#               feature is on and status is 'active' or 'completed' (Since 3.1)
#
# @socket-address: Only used for tcp, to know what the real port is (Since 4.0)
#
# Since: 0.14.0
##
{ 'struct': 'MigrationInfo',
  'data': {'*status': 'MigrationStatus', '*ram': 'MigrationStats',
           '*disk': 'MigrationStats',
           '*xbzrle-cache': 'XBZRLECacheStats',
           '*total-time': 'int',
           '*expected-downtime': 'int',
           '*downtime': 'int',
           '*setup-time': 'int',
           '*cpu-throttle-percentage': 'int',
           '*error-desc': 'str',
           '*postcopy-blocktime' : 'uint32',
           '*postcopy-vcpu-blocktime': ['uint32'],
           '*compression': 'CompressionStats',
           '*socket-address': ['SocketAddress'] } }

##
# @query-migrate:
#
# Returns information about current migration process. If migration
# is active there will be another json-object with RAM migration
# status and if block migration is active another one with block
# migration status.
#
# Returns: @MigrationInfo
#
# Since: 0.14.0
#
# Example:
#
# 1. Before the first migration
#
# -> { "execute": "query-migrate" }
# <- { "return": {} }
#
# 2. Migration is done and has succeeded
#
# -> { "execute": "query-migrate" }
# <- { "return": {
#         "status": "completed",
#         "total-time":12345,
#         "setup-time":12345,
#         "downtime":12345,
#         "ram":{
#           "transferred":123,
#           "remaining":123,
#           "total":246,
#           "duplicate":123,
#           "normal":123,
#           "normal-bytes":123456,
#           "dirty-sync-count":15
#         }
#      }
#    }
#
# 3. Migration is done and has failed
#
# -> { "execute": "query-migrate" }
# <- { "return": { "status": "failed" } }
#
# 4. Migration is being performed and is not a block migration:
#
# -> { "execute": "query-migrate" }
# <- {
#       "return":{
#          "status":"active",
#          "total-time":12345,
#          "setup-time":12345,
#          "expected-downtime":12345,
#          "ram":{
#             "transferred":123,
#             "remaining":123,
#             "total":246,
#             "duplicate":123,
#             "normal":123,
#             "normal-bytes":123456,
#             "dirty-sync-count":15
#          }
#       }
#    }
#
# 5. Migration is being performed and is a block migration:
#
# -> { "execute": "query-migrate" }
# <- {
#       "return":{
#          "status":"active",
#          "total-time":12345,
#          "setup-time":12345,
#          "expected-downtime":12345,
#          "ram":{
#             "total":1057024,
#             "remaining":1053304,
#             "transferred":3720,
#             "duplicate":123,
#             "normal":123,
#             "normal-bytes":123456,
#             "dirty-sync-count":15
#          },
#          "disk":{
#             "total":20971520,
#             "remaining":20880384,
#             "transferred":91136
#          }
#       }
#    }
#
# 6. Migration is being performed and XBZRLE is active:
#
# -> { "execute": "query-migrate" }
# <- {
#       "return":{
#          "status":"active",
#          "total-time":12345,
#          "setup-time":12345,
#          "expected-downtime":12345,
#          "ram":{
#             "total":1057024,
#             "remaining":1053304,
#             "transferred":3720,
#             "duplicate":10,
#             "normal":3333,
#             "normal-bytes":3412992,
#             "dirty-sync-count":15
#          },
#          "xbzrle-cache":{
#             "cache-size":67108864,
#             "bytes":20971520,
#             "pages":2444343,
#             "cache-miss":2244,
#             "cache-miss-rate":0.123,
#             "encoding-rate":80.1,
#             "overflow":34434
#          }
#       }
#    }
#
##
{ 'command': 'query-migrate', 'returns': 'MigrationInfo' }

##
# @MigrationCapability:
#
# Migration capabilities enumeration
#
# @xbzrle: Migration supports xbzrle (Xor Based Zero Run Length Encoding).
#          This feature allows us to minimize migration traffic for certain work
#          loads, by sending compressed difference of the pages
#
# @rdma-pin-all: Controls whether or not the entire VM memory footprint is
#                mlock()'d on demand or all at once. Refer to docs/rdma.txt for usage.
#                Disabled by default. (since 2.0)
#
# @zero-blocks: During storage migration encode blocks of zeroes efficiently. This
#               essentially saves 1MB of zeroes per block on the wire. Enabling requires
#               source and target VM to support this feature. To enable it is sufficient
#               to enable the capability on the source VM. The feature is disabled by
#               default. (since 1.6)
#
# @compress: Use multiple compression threads to accelerate live migration.
#            This feature can help to reduce the migration traffic, by sending
#            compressed pages. Please note that if compress and xbzrle are both
#            on, compress only takes effect in the ram bulk stage, after that,
#            it will be disabled and only xbzrle takes effect, this can help to
#            minimize migration traffic. The feature is disabled by default.
#            (since 2.4 )
#
# @events: generate events for each migration state change
#          (since 2.4 )
#
# @auto-converge: If enabled, QEMU will automatically throttle down the guest
#                 to speed up convergence of RAM migration. (since 1.6)
#
# @postcopy-ram: Start executing on the migration target before all of RAM has
#                been migrated, pulling the remaining pages along as needed. The
#                capacity must have the same setting on both source and target
#                or migration will not even start. NOTE: If the migration fails during
#                postcopy the VM will fail.  (since 2.6)
#
# @x-colo: If enabled, migration will never end, and the state of the VM on the
#          primary side will be migrated continuously to the VM on secondary
#          side, this process is called COarse-Grain LOck Stepping (COLO) for
#          Non-stop Service. (since 2.8)
#
# @release-ram: if enabled, qemu will free the migrated ram pages on the source
#               during postcopy-ram migration. (since 2.9)
#
# @block: If enabled, QEMU will also migrate the contents of all block
#         devices.  Default is disabled.  A possible alternative uses
#         mirror jobs to a builtin NBD server on the destination, which
#         offers more flexibility.
#         (Since 2.10)
#
# @return-path: If enabled, migration will use the return path even
#               for precopy. (since 2.10)
#
# @pause-before-switchover: Pause outgoing migration before serialising device
#                           state and before disabling block IO (since 2.11)
#
# @multifd: Use more than one fd for migration (since 4.0)
#
# @dirty-bitmaps: If enabled, QEMU will migrate named dirty bitmaps.
#                 (since 2.12)
#
# @postcopy-blocktime: Calculate downtime for postcopy live migration
#                      (since 3.0)
#
# @late-block-activate: If enabled, the destination will not activate block
#                       devices (and thus take locks) immediately at the end of migration.
#                       (since 3.0)
#
# @x-ignore-shared: If enabled, QEMU will not migrate shared memory (since 4.0)
#
# @validate-uuid: Send the UUID of the source to allow the destination
#                 to ensure it is the same. (since 4.2)
#
# Since: 1.2
##
{ 'enum': 'MigrationCapability',
  'data': ['xbzrle', 'rdma-pin-all', 'auto-converge', 'zero-blocks',
           'compress', 'events', 'postcopy-ram', 'x-colo', 'release-ram',
           'block', 'return-path', 'pause-before-switchover', 'multifd',
           'dirty-bitmaps', 'postcopy-blocktime', 'late-block-activate',
           'x-ignore-shared', 'validate-uuid' ] }

##
# @MigrationCapabilityStatus:
#
# Migration capability information
#
# @capability: capability enum
#
# @state: capability state bool
#
# Since: 1.2
##
{ 'struct': 'MigrationCapabilityStatus',
  'data': { 'capability' : 'MigrationCapability', 'state' : 'bool' } }

##
# @migrate-set-capabilities:
#
# Enable/Disable the following migration capabilities (like xbzrle)
#
# @capabilities: json array of capability modifications to make
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "migrate-set-capabilities" , "arguments":
#      { "capabilities": [ { "capability": "xbzrle", "state": true } ] } }
#
##
{ 'command': 'migrate-set-capabilities',
  'data': { 'capabilities': ['MigrationCapabilityStatus'] } }

##
# @query-migrate-capabilities:
#
# Returns information about the current migration capabilities status
#
# Returns: @MigrationCapabilitiesStatus
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "query-migrate-capabilities" }
# <- { "return": [
#       {"state": false, "capability": "xbzrle"},
#       {"state": false, "capability": "rdma-pin-all"},
#       {"state": false, "capability": "auto-converge"},
#       {"state": false, "capability": "zero-blocks"},
#       {"state": false, "capability": "compress"},
#       {"state": true, "capability": "events"},
#       {"state": false, "capability": "postcopy-ram"},
#       {"state": false, "capability": "x-colo"}
#    ]}
#
##
{ 'command': 'query-migrate-capabilities', 'returns':   ['MigrationCapabilityStatus']}

##
# @MultiFDCompression:
#
# An enumeration of multifd compression methods.
#
# @none: no compression.
# @zlib: use zlib compression method.
# @zstd: use zstd compression method.
#
# Since: 5.0
#
##
{ 'enum': 'MultiFDCompression',
  'data': [ 'none', 'zlib',
            { 'name': 'zstd', 'if': 'defined(CONFIG_ZSTD)' } ] }

##
# @MigrationParameter:
#
# Migration parameters enumeration
#
# @announce-initial: Initial delay (in milliseconds) before sending the first
#                    announce (Since 4.0)
#
# @announce-max: Maximum delay (in milliseconds) between packets in the
#                announcement (Since 4.0)
#
# @announce-rounds: Number of self-announce packets sent after migration
#                   (Since 4.0)
#
# @announce-step: Increase in delay (in milliseconds) between subsequent
#                 packets in the announcement (Since 4.0)
#
# @compress-level: Set the compression level to be used in live migration,
#                  the compression level is an integer between 0 and 9, where 0 means
#                  no compression, 1 means the best compression speed, and 9 means best
#                  compression ratio which will consume more CPU.
#
# @compress-threads: Set compression thread count to be used in live migration,
#                    the compression thread count is an integer between 1 and 255.
#
# @compress-wait-thread: Controls behavior when all compression threads are
#                        currently busy. If true (default), wait for a free
#                        compression thread to become available; otherwise,
#                        send the page uncompressed. (Since 3.1)
#
# @decompress-threads: Set decompression thread count to be used in live
#                      migration, the decompression thread count is an integer between 1
#                      and 255. Usually, decompression is at least 4 times as fast as
#                      compression, so set the decompress-threads to the number about 1/4
#                      of compress-threads is adequate.
#
# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
#                              to trigger throttling. It is expressed as percentage.
#                              The default value is 50. (Since 5.0)
#
# @cpu-throttle-initial: Initial percentage of time guest cpus are throttled
#                        when migration auto-converge is activated. The
#                        default value is 20. (Since 2.7)
#
# @cpu-throttle-increment: throttle percentage increase each time
#                          auto-converge detects that migration is not making
#                          progress. The default value is 10. (Since 2.7)
#
# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
#                         At the tail stage of throttling, the Guest is very
#                         sensitive to CPU percentage while the @cpu-throttle
#                         -increment is excessive usually at tail stage.
#                         If this parameter is true, we will compute the ideal
#                         CPU percentage used by the Guest, which may exactly make
#                         the dirty rate match the dirty rate threshold. Then we
#                         will choose a smaller throttle increment between the
#                         one specified by @cpu-throttle-increment and the one
#                         generated by ideal CPU percentage.
#                         Therefore, it is compatible to traditional throttling,
#                         meanwhile the throttle increment won't be excessive
#                         at tail stage.
#                         The default value is false. (Since 5.1)
#
# @tls-creds: ID of the 'tls-creds' object that provides credentials for
#             establishing a TLS connection over the migration data channel.
#             On the outgoing side of the migration, the credentials must
#             be for a 'client' endpoint, while for the incoming side the
#             credentials must be for a 'server' endpoint. Setting this
#             will enable TLS for all migrations. The default is unset,
#             resulting in unsecured migration at the QEMU level. (Since 2.7)
#
# @tls-hostname: hostname of the target host for the migration. This is
#                required when using x509 based TLS credentials and the
#                migration URI does not already include a hostname. For
#                example if using fd: or exec: based migration, the
#                hostname must be provided so that the server's x509
#                certificate identity can be validated. (Since 2.7)
#
# @tls-authz: ID of the 'authz' object subclass that provides access control
#             checking of the TLS x509 certificate distinguished name.
#             This object is only resolved at time of use, so can be deleted
#             and recreated on the fly while the migration server is active.
#             If missing, it will default to denying access (Since 4.0)
#
# @max-bandwidth: to set maximum speed for migration. maximum speed in
#                 bytes per second. (Since 2.8)
#
# @downtime-limit: set maximum tolerated downtime for migration. maximum
#                  downtime in milliseconds (Since 2.8)
#
# @x-checkpoint-delay: The delay time (in ms) between two COLO checkpoints in
#                      periodic mode. (Since 2.8)
#
# @block-incremental: Affects how much storage is migrated when the
#                     block migration capability is enabled.  When false, the entire
#                     storage backing chain is migrated into a flattened image at
#                     the destination; when true, only the active qcow2 layer is
#                     migrated and the destination must already have access to the
#                     same backing chain as was used on the source.  (since 2.10)
#
# @multifd-channels: Number of channels used to migrate data in
#                    parallel. This is the same number that the
#                    number of sockets used for migration.  The
#                    default value is 2 (since 4.0)
#
# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
#                     needs to be a multiple of the target page size
#                     and a power of 2
#                     (Since 2.11)
#
# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
#                          Defaults to 0 (unlimited).  In bytes per second.
#                          (Since 3.0)
#
# @max-cpu-throttle: maximum cpu throttle percentage.
#                    Defaults to 99. (Since 3.1)
#
# @multifd-compression: Which compression method to use.
#                       Defaults to none. (Since 5.0)
#
# @multifd-zlib-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 9, where 0 means no compression, 1 means the best
#          compression speed, and 9 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# @multifd-zstd-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 20, where 0 means no compression, 1 means the best
#          compression speed, and 20 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# Since: 2.4
##
{ 'enum': 'MigrationParameter',
  'data': ['announce-initial', 'announce-max',
           'announce-rounds', 'announce-step',
           'compress-level', 'compress-threads', 'decompress-threads',
           'compress-wait-thread', 'throttle-trigger-threshold',
           'cpu-throttle-initial', 'cpu-throttle-increment',
           'cpu-throttle-tailslow',
           'tls-creds', 'tls-hostname', 'tls-authz', 'max-bandwidth',
           'downtime-limit', 'x-checkpoint-delay', 'block-incremental',
           'multifd-channels',
           'xbzrle-cache-size', 'max-postcopy-bandwidth',
           'max-cpu-throttle', 'multifd-compression',
           'multifd-zlib-level' ,'multifd-zstd-level' ] }

##
# @MigrateSetParameters:
#
# @announce-initial: Initial delay (in milliseconds) before sending the first
#                    announce (Since 4.0)
#
# @announce-max: Maximum delay (in milliseconds) between packets in the
#                announcement (Since 4.0)
#
# @announce-rounds: Number of self-announce packets sent after migration
#                   (Since 4.0)
#
# @announce-step: Increase in delay (in milliseconds) between subsequent
#                 packets in the announcement (Since 4.0)
#
# @compress-level: compression level
#
# @compress-threads: compression thread count
#
# @compress-wait-thread: Controls behavior when all compression threads are
#                        currently busy. If true (default), wait for a free
#                        compression thread to become available; otherwise,
#                        send the page uncompressed. (Since 3.1)
#
# @decompress-threads: decompression thread count
#
# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
#                              to trigger throttling. It is expressed as percentage.
#                              The default value is 50. (Since 5.0)
#
# @cpu-throttle-initial: Initial percentage of time guest cpus are
#                        throttled when migration auto-converge is activated.
#                        The default value is 20. (Since 2.7)
#
# @cpu-throttle-increment: throttle percentage increase each time
#                          auto-converge detects that migration is not making
#                          progress. The default value is 10. (Since 2.7)
#
# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
#                         At the tail stage of throttling, the Guest is very
#                         sensitive to CPU percentage while the @cpu-throttle
#                         -increment is excessive usually at tail stage.
#                         If this parameter is true, we will compute the ideal
#                         CPU percentage used by the Guest, which may exactly make
#                         the dirty rate match the dirty rate threshold. Then we
#                         will choose a smaller throttle increment between the
#                         one specified by @cpu-throttle-increment and the one
#                         generated by ideal CPU percentage.
#                         Therefore, it is compatible to traditional throttling,
#                         meanwhile the throttle increment won't be excessive
#                         at tail stage.
#                         The default value is false. (Since 5.1)
#
# @tls-creds: ID of the 'tls-creds' object that provides credentials
#             for establishing a TLS connection over the migration data
#             channel. On the outgoing side of the migration, the credentials
#             must be for a 'client' endpoint, while for the incoming side the
#             credentials must be for a 'server' endpoint. Setting this
#             to a non-empty string enables TLS for all migrations.
#             An empty string means that QEMU will use plain text mode for
#             migration, rather than TLS (Since 2.9)
#             Previously (since 2.7), this was reported by omitting
#             tls-creds instead.
#
# @tls-hostname: hostname of the target host for the migration. This
#                is required when using x509 based TLS credentials and the
#                migration URI does not already include a hostname. For
#                example if using fd: or exec: based migration, the
#                hostname must be provided so that the server's x509
#                certificate identity can be validated. (Since 2.7)
#                An empty string means that QEMU will use the hostname
#                associated with the migration URI, if any. (Since 2.9)
#                Previously (since 2.7), this was reported by omitting
#                tls-hostname instead.
#
# @max-bandwidth: to set maximum speed for migration. maximum speed in
#                 bytes per second. (Since 2.8)
#
# @downtime-limit: set maximum tolerated downtime for migration. maximum
#                  downtime in milliseconds (Since 2.8)
#
# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
#
# @block-incremental: Affects how much storage is migrated when the
#                     block migration capability is enabled.  When false, the entire
#                     storage backing chain is migrated into a flattened image at
#                     the destination; when true, only the active qcow2 layer is
#                     migrated and the destination must already have access to the
#                     same backing chain as was used on the source.  (since 2.10)
#
# @multifd-channels: Number of channels used to migrate data in
#                    parallel. This is the same number that the
#                    number of sockets used for migration.  The
#                    default value is 2 (since 4.0)
#
# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
#                     needs to be a multiple of the target page size
#                     and a power of 2
#                     (Since 2.11)
#
# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
#                          Defaults to 0 (unlimited).  In bytes per second.
#                          (Since 3.0)
#
# @max-cpu-throttle: maximum cpu throttle percentage.
#                    The default value is 99. (Since 3.1)
#
# @multifd-compression: Which compression method to use.
#                       Defaults to none. (Since 5.0)
#
# @multifd-zlib-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 9, where 0 means no compression, 1 means the best
#          compression speed, and 9 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# @multifd-zstd-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 20, where 0 means no compression, 1 means the best
#          compression speed, and 20 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# Since: 2.4
##
# TODO either fuse back into MigrationParameters, or make
# MigrationParameters members mandatory
{ 'struct': 'MigrateSetParameters',
  'data': { '*announce-initial': 'size',
            '*announce-max': 'size',
            '*announce-rounds': 'size',
            '*announce-step': 'size',
            '*compress-level': 'int',
            '*compress-threads': 'int',
            '*compress-wait-thread': 'bool',
            '*decompress-threads': 'int',
            '*throttle-trigger-threshold': 'int',
            '*cpu-throttle-initial': 'int',
            '*cpu-throttle-increment': 'int',
            '*cpu-throttle-tailslow': 'bool',
            '*tls-creds': 'StrOrNull',
            '*tls-hostname': 'StrOrNull',
            '*tls-authz': 'StrOrNull',
            '*max-bandwidth': 'int',
            '*downtime-limit': 'int',
            '*x-checkpoint-delay': 'int',
            '*block-incremental': 'bool',
            '*multifd-channels': 'int',
            '*xbzrle-cache-size': 'size',
            '*max-postcopy-bandwidth': 'size',
            '*max-cpu-throttle': 'int',
            '*multifd-compression': 'MultiFDCompression',
            '*multifd-zlib-level': 'int',
            '*multifd-zstd-level': 'int' } }

##
# @migrate-set-parameters:
#
# Set various migration parameters.
#
# Since: 2.4
#
# Example:
#
# -> { "execute": "migrate-set-parameters" ,
#      "arguments": { "compress-level": 1 } }
#
##
{ 'command': 'migrate-set-parameters', 'boxed': true,
  'data': 'MigrateSetParameters' }

##
# @MigrationParameters:
#
# The optional members aren't actually optional.
#
# @announce-initial: Initial delay (in milliseconds) before sending the
#                    first announce (Since 4.0)
#
# @announce-max: Maximum delay (in milliseconds) between packets in the
#                announcement (Since 4.0)
#
# @announce-rounds: Number of self-announce packets sent after migration
#                   (Since 4.0)
#
# @announce-step: Increase in delay (in milliseconds) between subsequent
#                 packets in the announcement (Since 4.0)
#
# @compress-level: compression level
#
# @compress-threads: compression thread count
#
# @compress-wait-thread: Controls behavior when all compression threads are
#                        currently busy. If true (default), wait for a free
#                        compression thread to become available; otherwise,
#                        send the page uncompressed. (Since 3.1)
#
# @decompress-threads: decompression thread count
#
# @throttle-trigger-threshold: The ratio of bytes_dirty_period and bytes_xfer_period
#                              to trigger throttling. It is expressed as percentage.
#                              The default value is 50. (Since 5.0)
#
# @cpu-throttle-initial: Initial percentage of time guest cpus are
#                        throttled when migration auto-converge is activated.
#                        (Since 2.7)
#
# @cpu-throttle-increment: throttle percentage increase each time
#                          auto-converge detects that migration is not making
#                          progress. (Since 2.7)
#
# @cpu-throttle-tailslow: Make CPU throttling slower at tail stage
#                         At the tail stage of throttling, the Guest is very
#                         sensitive to CPU percentage while the @cpu-throttle
#                         -increment is excessive usually at tail stage.
#                         If this parameter is true, we will compute the ideal
#                         CPU percentage used by the Guest, which may exactly make
#                         the dirty rate match the dirty rate threshold. Then we
#                         will choose a smaller throttle increment between the
#                         one specified by @cpu-throttle-increment and the one
#                         generated by ideal CPU percentage.
#                         Therefore, it is compatible to traditional throttling,
#                         meanwhile the throttle increment won't be excessive
#                         at tail stage.
#                         The default value is false. (Since 5.1)
#
# @tls-creds: ID of the 'tls-creds' object that provides credentials
#             for establishing a TLS connection over the migration data
#             channel. On the outgoing side of the migration, the credentials
#             must be for a 'client' endpoint, while for the incoming side the
#             credentials must be for a 'server' endpoint.
#             An empty string means that QEMU will use plain text mode for
#             migration, rather than TLS (Since 2.7)
#             Note: 2.8 reports this by omitting tls-creds instead.
#
# @tls-hostname: hostname of the target host for the migration. This
#                is required when using x509 based TLS credentials and the
#                migration URI does not already include a hostname. For
#                example if using fd: or exec: based migration, the
#                hostname must be provided so that the server's x509
#                certificate identity can be validated. (Since 2.7)
#                An empty string means that QEMU will use the hostname
#                associated with the migration URI, if any. (Since 2.9)
#                Note: 2.8 reports this by omitting tls-hostname instead.
#
# @tls-authz: ID of the 'authz' object subclass that provides access control
#             checking of the TLS x509 certificate distinguished name. (Since
#             4.0)
#
# @max-bandwidth: to set maximum speed for migration. maximum speed in
#                 bytes per second. (Since 2.8)
#
# @downtime-limit: set maximum tolerated downtime for migration. maximum
#                  downtime in milliseconds (Since 2.8)
#
# @x-checkpoint-delay: the delay time between two COLO checkpoints. (Since 2.8)
#
# @block-incremental: Affects how much storage is migrated when the
#                     block migration capability is enabled.  When false, the entire
#                     storage backing chain is migrated into a flattened image at
#                     the destination; when true, only the active qcow2 layer is
#                     migrated and the destination must already have access to the
#                     same backing chain as was used on the source.  (since 2.10)
#
# @multifd-channels: Number of channels used to migrate data in
#                    parallel. This is the same number that the
#                    number of sockets used for migration.
#                    The default value is 2 (since 4.0)
#
# @xbzrle-cache-size: cache size to be used by XBZRLE migration.  It
#                     needs to be a multiple of the target page size
#                     and a power of 2
#                     (Since 2.11)
#
# @max-postcopy-bandwidth: Background transfer bandwidth during postcopy.
#                          Defaults to 0 (unlimited).  In bytes per second.
#                          (Since 3.0)
#
# @max-cpu-throttle: maximum cpu throttle percentage.
#                    Defaults to 99.
#                    (Since 3.1)
#
# @multifd-compression: Which compression method to use.
#                       Defaults to none. (Since 5.0)
#
# @multifd-zlib-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 9, where 0 means no compression, 1 means the best
#          compression speed, and 9 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# @multifd-zstd-level: Set the compression level to be used in live
#          migration, the compression level is an integer between 0
#          and 20, where 0 means no compression, 1 means the best
#          compression speed, and 20 means best compression ratio which
#          will consume more CPU.
#          Defaults to 1. (Since 5.0)
#
# Since: 2.4
##
{ 'struct': 'MigrationParameters',
  'data': { '*announce-initial': 'size',
            '*announce-max': 'size',
            '*announce-rounds': 'size',
            '*announce-step': 'size',
            '*compress-level': 'uint8',
            '*compress-threads': 'uint8',
            '*compress-wait-thread': 'bool',
            '*decompress-threads': 'uint8',
            '*throttle-trigger-threshold': 'uint8',
            '*cpu-throttle-initial': 'uint8',
            '*cpu-throttle-increment': 'uint8',
            '*cpu-throttle-tailslow': 'bool',
            '*tls-creds': 'str',
            '*tls-hostname': 'str',
            '*tls-authz': 'str',
            '*max-bandwidth': 'size',
            '*downtime-limit': 'uint64',
            '*x-checkpoint-delay': 'uint32',
            '*block-incremental': 'bool' ,
            '*multifd-channels': 'uint8',
            '*xbzrle-cache-size': 'size',
            '*max-postcopy-bandwidth': 'size',
            '*max-cpu-throttle': 'uint8',
            '*multifd-compression': 'MultiFDCompression',
            '*multifd-zlib-level': 'uint8',
            '*multifd-zstd-level': 'uint8' } }

##
# @query-migrate-parameters:
#
# Returns information about the current migration parameters
#
# Returns: @MigrationParameters
#
# Since: 2.4
#
# Example:
#
# -> { "execute": "query-migrate-parameters" }
# <- { "return": {
#          "decompress-threads": 2,
#          "cpu-throttle-increment": 10,
#          "compress-threads": 8,
#          "compress-level": 1,
#          "cpu-throttle-initial": 20,
#          "max-bandwidth": 33554432,
#          "downtime-limit": 300
#       }
#    }
#
##
{ 'command': 'query-migrate-parameters',
  'returns': 'MigrationParameters' }

##
# @client_migrate_info:
#
# Set migration information for remote display.  This makes the server
# ask the client to automatically reconnect using the new parameters
# once migration finished successfully.  Only implemented for SPICE.
#
# @protocol:     must be "spice"
# @hostname:     migration target hostname
# @port:         spice tcp port for plaintext channels
# @tls-port:     spice tcp port for tls-secured channels
# @cert-subject: server certificate subject
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "client_migrate_info",
#      "arguments": { "protocol": "spice",
#                     "hostname": "virt42.lab.kraxel.org",
#                     "port": 1234 } }
# <- { "return": {} }
#
##
{ 'command': 'client_migrate_info',
  'data': { 'protocol': 'str', 'hostname': 'str', '*port': 'int',
            '*tls-port': 'int', '*cert-subject': 'str' } }

##
# @migrate-start-postcopy:
#
# Followup to a migration command to switch the migration to postcopy mode.
# The postcopy-ram capability must be set on both source and destination
# before the original migration command.
#
# Since: 2.5
#
# Example:
#
# -> { "execute": "migrate-start-postcopy" }
# <- { "return": {} }
#
##
{ 'command': 'migrate-start-postcopy' }

##
# @MIGRATION:
#
# Emitted when a migration event happens
#
# @status: @MigrationStatus describing the current migration status.
#
# Since: 2.4
#
# Example:
#
# <- {"timestamp": {"seconds": 1432121972, "microseconds": 744001},
#     "event": "MIGRATION",
#     "data": {"status": "completed"} }
#
##
{ 'event': 'MIGRATION',
  'data': {'status': 'MigrationStatus'}}

##
# @MIGRATION_PASS:
#
# Emitted from the source side of a migration at the start of each pass
# (when it syncs the dirty bitmap)
#
# @pass: An incrementing count (starting at 1 on the first pass)
#
# Since: 2.6
#
# Example:
#
# { "timestamp": {"seconds": 1449669631, "microseconds": 239225},
#   "event": "MIGRATION_PASS", "data": {"pass": 2} }
#
##
{ 'event': 'MIGRATION_PASS',
  'data': { 'pass': 'int' } }

##
# @COLOMessage:
#
# The message transmission between Primary side and Secondary side.
#
# @checkpoint-ready: Secondary VM (SVM) is ready for checkpointing
#
# @checkpoint-request: Primary VM (PVM) tells SVM to prepare for checkpointing
#
# @checkpoint-reply: SVM gets PVM's checkpoint request
#
# @vmstate-send: VM's state will be sent by PVM.
#
# @vmstate-size: The total size of VMstate.
#
# @vmstate-received: VM's state has been received by SVM.
#
# @vmstate-loaded: VM's state has been loaded by SVM.
#
# Since: 2.8
##
{ 'enum': 'COLOMessage',
  'data': [ 'checkpoint-ready', 'checkpoint-request', 'checkpoint-reply',
            'vmstate-send', 'vmstate-size', 'vmstate-received',
            'vmstate-loaded' ] }

##
# @COLOMode:
#
# The COLO current mode.
#
# @none: COLO is disabled.
#
# @primary: COLO node in primary side.
#
# @secondary: COLO node in slave side.
#
# Since: 2.8
##
{ 'enum': 'COLOMode',
  'data': [ 'none', 'primary', 'secondary'] }

##
# @FailoverStatus:
#
# An enumeration of COLO failover status
#
# @none: no failover has ever happened
#
# @require: got failover requirement but not handled
#
# @active: in the process of doing failover
#
# @completed: finish the process of failover
#
# @relaunch: restart the failover process, from 'none' -> 'completed' (Since 2.9)
#
# Since: 2.8
##
{ 'enum': 'FailoverStatus',
  'data': [ 'none', 'require', 'active', 'completed', 'relaunch' ] }

##
# @COLO_EXIT:
#
# Emitted when VM finishes COLO mode due to some errors happening or
# at the request of users.
#
# @mode: report COLO mode when COLO exited.
#
# @reason: describes the reason for the COLO exit.
#
# Since: 3.1
#
# Example:
#
# <- { "timestamp": {"seconds": 2032141960, "microseconds": 417172},
#      "event": "COLO_EXIT", "data": {"mode": "primary", "reason": "request" } }
#
##
{ 'event': 'COLO_EXIT',
  'data': {'mode': 'COLOMode', 'reason': 'COLOExitReason' } }

##
# @COLOExitReason:
#
# The reason for a COLO exit.
#
# @none: failover has never happened. This state does not occur
#        in the COLO_EXIT event, and is only visible in the result of
#        query-colo-status.
#
# @request: COLO exit is due to an external request.
#
# @error: COLO exit is due to an internal error.
#
# @processing: COLO is currently handling a failover (since 4.0).
#
# Since: 3.1
##
{ 'enum': 'COLOExitReason',
  'data': [ 'none', 'request', 'error' , 'processing' ] }

##
# @x-colo-lost-heartbeat:
#
# Tell qemu that heartbeat is lost, request it to do takeover procedures.
# If this command is sent to the PVM, the Primary side will exit COLO mode.
# If sent to the Secondary, the Secondary side will run failover work,
# then takes over server operation to become the service VM.
#
# Since: 2.8
#
# Example:
#
# -> { "execute": "x-colo-lost-heartbeat" }
# <- { "return": {} }
#
##
{ 'command': 'x-colo-lost-heartbeat' }

##
# @migrate_cancel:
#
# Cancel the current executing migration process.
#
# Returns: nothing on success
#
# Notes: This command succeeds even if there is no migration process running.
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "migrate_cancel" }
# <- { "return": {} }
#
##
{ 'command': 'migrate_cancel' }

##
# @migrate-continue:
#
# Continue migration when it's in a paused state.
#
# @state: The state the migration is currently expected to be in
#
# Returns: nothing on success
# Since: 2.11
# Example:
#
# -> { "execute": "migrate-continue" , "arguments":
#      { "state": "pre-switchover" } }
# <- { "return": {} }
##
{ 'command': 'migrate-continue', 'data': {'state': 'MigrationStatus'} }

##
# @migrate_set_downtime:
#
# Set maximum tolerated downtime for migration.
#
# @value: maximum downtime in seconds
#
# Features:
# @deprecated: This command is deprecated.  Use
#     'migrate-set-parameters' instead.
#
# Returns: nothing on success
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "migrate_set_downtime", "arguments": { "value": 0.1 } }
# <- { "return": {} }
#
##
{ 'command': 'migrate_set_downtime', 'data': {'value': 'number'},
  'features': [ 'deprecated' ] }

##
# @migrate_set_speed:
#
# Set maximum speed for migration.
#
# @value: maximum speed in bytes per second.
#
# Features:
# @deprecated: This command is deprecated.  Use
#     'migrate-set-parameters' instead.
#
# Returns: nothing on success
#
# Since: 0.14.0
#
# Example:
#
# -> { "execute": "migrate_set_speed", "arguments": { "value": 1024 } }
# <- { "return": {} }
#
##
{ 'command': 'migrate_set_speed', 'data': {'value': 'int'},
  'features': [ 'deprecated' ] }

##
# @migrate-set-cache-size:
#
# Set cache size to be used by XBZRLE migration
#
# @value: cache size in bytes
#
# Features:
# @deprecated: This command is deprecated.  Use
#     'migrate-set-parameters' instead.
#
# The size will be rounded down to the nearest power of 2.
# The cache size can be modified before and during ongoing migration
#
# Returns: nothing on success
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "migrate-set-cache-size",
#      "arguments": { "value": 536870912 } }
# <- { "return": {} }
#
##
{ 'command': 'migrate-set-cache-size', 'data': {'value': 'int'},
  'features': [ 'deprecated' ] }

##
# @query-migrate-cache-size:
#
# Query migration XBZRLE cache size
#
# Features:
# @deprecated: This command is deprecated.  Use
#     'query-migrate-parameters' instead.
#
# Returns: XBZRLE cache size in bytes
#
# Since: 1.2
#
# Example:
#
# -> { "execute": "query-migrate-cache-size" }
# <- { "return": 67108864 }
#
##
{ 'command': 'query-migrate-cache-size', 'returns': 'int',
  'features': [ 'deprecated' ] }

##
# @migrate:
#
# Migrates the current running guest to another Virtual Machine.
#
# @uri: the Uniform Resource Identifier of the destination VM
#
# @blk: do block migration (full disk copy)
#
# @inc: incremental disk copy migration
#
# @detach: this argument exists only for compatibility reasons and
#          is ignored by QEMU
#
# @resume: resume one paused migration, default "off". (since 3.0)
#
# Returns: nothing on success
#
# Since: 0.14.0
#
# Notes:
#
# 1. The 'query-migrate' command should be used to check migration's progress
#    and final result (this information is provided by the 'status' member)
#
# 2. All boolean arguments default to false
#
# 3. The user Monitor's "detach" argument is invalid in QMP and should not
#    be used
#
# Example:
#
# -> { "execute": "migrate", "arguments": { "uri": "tcp:0:4446" } }
# <- { "return": {} }
#
##
{ 'command': 'migrate',
  'data': {'uri': 'str', '*blk': 'bool', '*inc': 'bool',
           '*detach': 'bool', '*resume': 'bool' } }

##
# @migrate-incoming:
#
# Start an incoming migration, the qemu must have been started
# with -incoming defer
#
# @uri: The Uniform Resource Identifier identifying the source or
#       address to listen on
#
# Returns: nothing on success
#
# Since: 2.3
#
# Notes:
#
# 1. It's a bad idea to use a string for the uri, but it needs to stay
#    compatible with -incoming and the format of the uri is already exposed
#    above libvirt.
#
# 2. QEMU must be started with -incoming defer to allow migrate-incoming to
#    be used.
#
# 3. The uri format is the same as for -incoming
#
# Example:
#
# -> { "execute": "migrate-incoming",
#      "arguments": { "uri": "tcp::4446" } }
# <- { "return": {} }
#
##
{ 'command': 'migrate-incoming', 'data': {'uri': 'str' } }

##
# @xen-save-devices-state:
#
# Save the state of all devices to file. The RAM and the block devices
# of the VM are not saved by this command.
#
# @filename: the file to save the state of the devices to as binary
#            data. See xen-save-devices-state.txt for a description of the binary
#            format.
#
# @live: Optional argument to ask QEMU to treat this command as part of a live
#        migration. Default to true. (since 2.11)
#
# Returns: Nothing on success
#
# Since: 1.1
#
# Example:
#
# -> { "execute": "xen-save-devices-state",
#      "arguments": { "filename": "/tmp/save" } }
# <- { "return": {} }
#
##
{ 'command': 'xen-save-devices-state',
  'data': {'filename': 'str', '*live':'bool' } }

##
# @xen-set-replication:
#
# Enable or disable replication.
#
# @enable: true to enable, false to disable.
#
# @primary: true for primary or false for secondary.
#
# @failover: true to do failover, false to stop. but cannot be
#            specified if 'enable' is true. default value is false.
#
# Returns: nothing.
#
# Example:
#
# -> { "execute": "xen-set-replication",
#      "arguments": {"enable": true, "primary": false} }
# <- { "return": {} }
#
# Since: 2.9
##
{ 'command': 'xen-set-replication',
  'data': { 'enable': 'bool', 'primary': 'bool', '*failover' : 'bool' },
  'if': 'defined(CONFIG_REPLICATION)' }

##
# @ReplicationStatus:
#
# The result format for 'query-xen-replication-status'.
#
# @error: true if an error happened, false if replication is normal.
#
# @desc: the human readable error description string, when
#        @error is 'true'.
#
# Since: 2.9
##
{ 'struct': 'ReplicationStatus',
  'data': { 'error': 'bool', '*desc': 'str' },
  'if': 'defined(CONFIG_REPLICATION)' }

##
# @query-xen-replication-status:
#
# Query replication status while the vm is running.
#
# Returns: A @ReplicationResult object showing the status.
#
# Example:
#
# -> { "execute": "query-xen-replication-status" }
# <- { "return": { "error": false } }
#
# Since: 2.9
##
{ 'command': 'query-xen-replication-status',
  'returns': 'ReplicationStatus',
  'if': 'defined(CONFIG_REPLICATION)' }

##
# @xen-colo-do-checkpoint:
#
# Xen uses this command to notify replication to trigger a checkpoint.
#
# Returns: nothing.
#
# Example:
#
# -> { "execute": "xen-colo-do-checkpoint" }
# <- { "return": {} }
#
# Since: 2.9
##
{ 'command': 'xen-colo-do-checkpoint',
  'if': 'defined(CONFIG_REPLICATION)' }

##
# @COLOStatus:
#
# The result format for 'query-colo-status'.
#
# @mode: COLO running mode. If COLO is running, this field will return
#        'primary' or 'secondary'.
#
# @last-mode: COLO last running mode. If COLO is running, this field
#             will return same like mode field, after failover we can
#             use this field to get last colo mode. (since 4.0)
#
# @reason: describes the reason for the COLO exit.
#
# Since: 3.1
##
{ 'struct': 'COLOStatus',
  'data': { 'mode': 'COLOMode', 'last-mode': 'COLOMode',
            'reason': 'COLOExitReason' } }

##
# @query-colo-status:
#
# Query COLO status while the vm is running.
#
# Returns: A @COLOStatus object showing the status.
#
# Example:
#
# -> { "execute": "query-colo-status" }
# <- { "return": { "mode": "primary", "reason": "request" } }
#
# Since: 3.1
##
{ 'command': 'query-colo-status',
  'returns': 'COLOStatus' }

##
# @migrate-recover:
#
# Provide a recovery migration stream URI.
#
# @uri: the URI to be used for the recovery of migration stream.
#
# Returns: nothing.
#
# Example:
#
# -> { "execute": "migrate-recover",
#      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
# <- { "return": {} }
#
# Since: 3.0
##
{ 'command': 'migrate-recover',
  'data': { 'uri': 'str' },
  'allow-oob': true }

##
# @migrate-pause:
#
# Pause a migration.  Currently it only supports postcopy.
#
# Returns: nothing.
#
# Example:
#
# -> { "execute": "migrate-pause" }
# <- { "return": {} }
#
# Since: 3.0
##
{ 'command': 'migrate-pause', 'allow-oob': true }

##
# @UNPLUG_PRIMARY:
#
# Emitted from source side of a migration when migration state is
# WAIT_UNPLUG. Device was unplugged by guest operating system.
# Device resources in QEMU are kept on standby to be able to re-plug it in case
# of migration failure.
#
# @device-id: QEMU device id of the unplugged device
#
# Since: 4.2
#
# Example:
#   {"event": "UNPLUG_PRIMARY", "data": {"device-id": "hostdev0"} }
#
##
{ 'event': 'UNPLUG_PRIMARY',
  'data': { 'device-id': 'str' } }