1# -*- Mode: Python -*- 2 3## 4# == QAPI block core definitions (vm unrelated) 5## 6 7# QAPI common definitions 8{ 'include': 'common.json' } 9 10## 11# @SnapshotInfo: 12# 13# @id: unique snapshot id 14# 15# @name: user chosen name 16# 17# @vm-state-size: size of the VM state 18# 19# @date-sec: UTC date of the snapshot in seconds 20# 21# @date-nsec: fractional part in nano seconds to be used with date-sec 22# 23# @vm-clock-sec: VM clock relative to boot in seconds 24# 25# @vm-clock-nsec: fractional part in nano seconds to be used with vm-clock-sec 26# 27# Since: 1.3 28# 29## 30{ 'struct': 'SnapshotInfo', 31 'data': { 'id': 'str', 'name': 'str', 'vm-state-size': 'int', 32 'date-sec': 'int', 'date-nsec': 'int', 33 'vm-clock-sec': 'int', 'vm-clock-nsec': 'int' } } 34 35## 36# @ImageInfoSpecificQCow2: 37# 38# @compat: compatibility level 39# 40# @lazy-refcounts: #optional on or off; only valid for compat >= 1.1 41# 42# @corrupt: #optional true if the image has been marked corrupt; only valid for 43# compat >= 1.1 (since 2.2) 44# 45# @refcount-bits: width of a refcount entry in bits (since 2.3) 46# 47# Since: 1.7 48## 49{ 'struct': 'ImageInfoSpecificQCow2', 50 'data': { 51 'compat': 'str', 52 '*lazy-refcounts': 'bool', 53 '*corrupt': 'bool', 54 'refcount-bits': 'int' 55 } } 56 57## 58# @ImageInfoSpecificVmdk: 59# 60# @create-type: The create type of VMDK image 61# 62# @cid: Content id of image 63# 64# @parent-cid: Parent VMDK image's cid 65# 66# @extents: List of extent files 67# 68# Since: 1.7 69## 70{ 'struct': 'ImageInfoSpecificVmdk', 71 'data': { 72 'create-type': 'str', 73 'cid': 'int', 74 'parent-cid': 'int', 75 'extents': ['ImageInfo'] 76 } } 77 78## 79# @ImageInfoSpecific: 80# 81# A discriminated record of image format specific information structures. 82# 83# Since: 1.7 84## 85{ 'union': 'ImageInfoSpecific', 86 'data': { 87 'qcow2': 'ImageInfoSpecificQCow2', 88 'vmdk': 'ImageInfoSpecificVmdk', 89 # If we need to add block driver specific parameters for 90 # LUKS in future, then we'll subclass QCryptoBlockInfoLUKS 91 # to define a ImageInfoSpecificLUKS 92 'luks': 'QCryptoBlockInfoLUKS' 93 } } 94 95## 96# @ImageInfo: 97# 98# Information about a QEMU image file 99# 100# @filename: name of the image file 101# 102# @format: format of the image file 103# 104# @virtual-size: maximum capacity in bytes of the image 105# 106# @actual-size: #optional actual size on disk in bytes of the image 107# 108# @dirty-flag: #optional true if image is not cleanly closed 109# 110# @cluster-size: #optional size of a cluster in bytes 111# 112# @encrypted: #optional true if the image is encrypted 113# 114# @compressed: #optional true if the image is compressed (Since 1.7) 115# 116# @backing-filename: #optional name of the backing file 117# 118# @full-backing-filename: #optional full path of the backing file 119# 120# @backing-filename-format: #optional the format of the backing file 121# 122# @snapshots: #optional list of VM snapshots 123# 124# @backing-image: #optional info of the backing image (since 1.6) 125# 126# @format-specific: #optional structure supplying additional format-specific 127# information (since 1.7) 128# 129# Since: 1.3 130# 131## 132{ 'struct': 'ImageInfo', 133 'data': {'filename': 'str', 'format': 'str', '*dirty-flag': 'bool', 134 '*actual-size': 'int', 'virtual-size': 'int', 135 '*cluster-size': 'int', '*encrypted': 'bool', '*compressed': 'bool', 136 '*backing-filename': 'str', '*full-backing-filename': 'str', 137 '*backing-filename-format': 'str', '*snapshots': ['SnapshotInfo'], 138 '*backing-image': 'ImageInfo', 139 '*format-specific': 'ImageInfoSpecific' } } 140 141## 142# @ImageCheck: 143# 144# Information about a QEMU image file check 145# 146# @filename: name of the image file checked 147# 148# @format: format of the image file checked 149# 150# @check-errors: number of unexpected errors occurred during check 151# 152# @image-end-offset: #optional offset (in bytes) where the image ends, this 153# field is present if the driver for the image format 154# supports it 155# 156# @corruptions: #optional number of corruptions found during the check if any 157# 158# @leaks: #optional number of leaks found during the check if any 159# 160# @corruptions-fixed: #optional number of corruptions fixed during the check 161# if any 162# 163# @leaks-fixed: #optional number of leaks fixed during the check if any 164# 165# @total-clusters: #optional total number of clusters, this field is present 166# if the driver for the image format supports it 167# 168# @allocated-clusters: #optional total number of allocated clusters, this 169# field is present if the driver for the image format 170# supports it 171# 172# @fragmented-clusters: #optional total number of fragmented clusters, this 173# field is present if the driver for the image format 174# supports it 175# 176# @compressed-clusters: #optional total number of compressed clusters, this 177# field is present if the driver for the image format 178# supports it 179# 180# Since: 1.4 181# 182## 183{ 'struct': 'ImageCheck', 184 'data': {'filename': 'str', 'format': 'str', 'check-errors': 'int', 185 '*image-end-offset': 'int', '*corruptions': 'int', '*leaks': 'int', 186 '*corruptions-fixed': 'int', '*leaks-fixed': 'int', 187 '*total-clusters': 'int', '*allocated-clusters': 'int', 188 '*fragmented-clusters': 'int', '*compressed-clusters': 'int' } } 189 190## 191# @MapEntry: 192# 193# Mapping information from a virtual block range to a host file range 194# 195# @start: the start byte of the mapped virtual range 196# 197# @length: the number of bytes of the mapped virtual range 198# 199# @data: whether the mapped range has data 200# 201# @zero: whether the virtual blocks are zeroed 202# 203# @depth: the depth of the mapping 204# 205# @offset: #optional the offset in file that the virtual sectors are mapped to 206# 207# @filename: #optional filename that is referred to by @offset 208# 209# Since: 2.6 210# 211## 212{ 'struct': 'MapEntry', 213 'data': {'start': 'int', 'length': 'int', 'data': 'bool', 214 'zero': 'bool', 'depth': 'int', '*offset': 'int', 215 '*filename': 'str' } } 216 217## 218# @BlockdevCacheInfo: 219# 220# Cache mode information for a block device 221# 222# @writeback: true if writeback mode is enabled 223# @direct: true if the host page cache is bypassed (O_DIRECT) 224# @no-flush: true if flush requests are ignored for the device 225# 226# Since: 2.3 227## 228{ 'struct': 'BlockdevCacheInfo', 229 'data': { 'writeback': 'bool', 230 'direct': 'bool', 231 'no-flush': 'bool' } } 232 233## 234# @BlockDeviceInfo: 235# 236# Information about the backing device for a block device. 237# 238# @file: the filename of the backing device 239# 240# @node-name: #optional the name of the block driver node (Since 2.0) 241# 242# @ro: true if the backing device was open read-only 243# 244# @drv: the name of the block format used to open the backing device. As of 245# 0.14.0 this can be: 'blkdebug', 'bochs', 'cloop', 'cow', 'dmg', 246# 'file', 'file', 'ftp', 'ftps', 'host_cdrom', 'host_device', 247# 'http', 'https', 'luks', 'nbd', 'parallels', 'qcow', 248# 'qcow2', 'raw', 'vdi', 'vmdk', 'vpc', 'vvfat' 249# 2.2: 'archipelago' added, 'cow' dropped 250# 2.3: 'host_floppy' deprecated 251# 2.5: 'host_floppy' dropped 252# 2.6: 'luks' added 253# 2.8: 'replication' added, 'tftp' dropped 254# 2.9: 'archipelago' dropped 255# 256# @backing_file: #optional the name of the backing file (for copy-on-write) 257# 258# @backing_file_depth: number of files in the backing file chain (since: 1.2) 259# 260# @encrypted: true if the backing device is encrypted 261# 262# @encryption_key_missing: true if the backing device is encrypted but an 263# valid encryption key is missing 264# 265# @detect_zeroes: detect and optimize zero writes (Since 2.1) 266# 267# @bps: total throughput limit in bytes per second is specified 268# 269# @bps_rd: read throughput limit in bytes per second is specified 270# 271# @bps_wr: write throughput limit in bytes per second is specified 272# 273# @iops: total I/O operations per second is specified 274# 275# @iops_rd: read I/O operations per second is specified 276# 277# @iops_wr: write I/O operations per second is specified 278# 279# @image: the info of image used (since: 1.6) 280# 281# @bps_max: #optional total throughput limit during bursts, 282# in bytes (Since 1.7) 283# 284# @bps_rd_max: #optional read throughput limit during bursts, 285# in bytes (Since 1.7) 286# 287# @bps_wr_max: #optional write throughput limit during bursts, 288# in bytes (Since 1.7) 289# 290# @iops_max: #optional total I/O operations per second during bursts, 291# in bytes (Since 1.7) 292# 293# @iops_rd_max: #optional read I/O operations per second during bursts, 294# in bytes (Since 1.7) 295# 296# @iops_wr_max: #optional write I/O operations per second during bursts, 297# in bytes (Since 1.7) 298# 299# @bps_max_length: #optional maximum length of the @bps_max burst 300# period, in seconds. (Since 2.6) 301# 302# @bps_rd_max_length: #optional maximum length of the @bps_rd_max 303# burst period, in seconds. (Since 2.6) 304# 305# @bps_wr_max_length: #optional maximum length of the @bps_wr_max 306# burst period, in seconds. (Since 2.6) 307# 308# @iops_max_length: #optional maximum length of the @iops burst 309# period, in seconds. (Since 2.6) 310# 311# @iops_rd_max_length: #optional maximum length of the @iops_rd_max 312# burst period, in seconds. (Since 2.6) 313# 314# @iops_wr_max_length: #optional maximum length of the @iops_wr_max 315# burst period, in seconds. (Since 2.6) 316# 317# @iops_size: #optional an I/O size in bytes (Since 1.7) 318# 319# @group: #optional throttle group name (Since 2.4) 320# 321# @cache: the cache mode used for the block device (since: 2.3) 322# 323# @write_threshold: configured write threshold for the device. 324# 0 if disabled. (Since 2.3) 325# 326# Since: 0.14.0 327# 328## 329{ 'struct': 'BlockDeviceInfo', 330 'data': { 'file': 'str', '*node-name': 'str', 'ro': 'bool', 'drv': 'str', 331 '*backing_file': 'str', 'backing_file_depth': 'int', 332 'encrypted': 'bool', 'encryption_key_missing': 'bool', 333 'detect_zeroes': 'BlockdevDetectZeroesOptions', 334 'bps': 'int', 'bps_rd': 'int', 'bps_wr': 'int', 335 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', 336 'image': 'ImageInfo', 337 '*bps_max': 'int', '*bps_rd_max': 'int', 338 '*bps_wr_max': 'int', '*iops_max': 'int', 339 '*iops_rd_max': 'int', '*iops_wr_max': 'int', 340 '*bps_max_length': 'int', '*bps_rd_max_length': 'int', 341 '*bps_wr_max_length': 'int', '*iops_max_length': 'int', 342 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', 343 '*iops_size': 'int', '*group': 'str', 'cache': 'BlockdevCacheInfo', 344 'write_threshold': 'int' } } 345 346## 347# @BlockDeviceIoStatus: 348# 349# An enumeration of block device I/O status. 350# 351# @ok: The last I/O operation has succeeded 352# 353# @failed: The last I/O operation has failed 354# 355# @nospace: The last I/O operation has failed due to a no-space condition 356# 357# Since: 1.0 358## 359{ 'enum': 'BlockDeviceIoStatus', 'data': [ 'ok', 'failed', 'nospace' ] } 360 361## 362# @BlockDeviceMapEntry: 363# 364# Entry in the metadata map of the device (returned by "qemu-img map") 365# 366# @start: Offset in the image of the first byte described by this entry 367# (in bytes) 368# 369# @length: Length of the range described by this entry (in bytes) 370# 371# @depth: Number of layers (0 = top image, 1 = top image's backing file, etc.) 372# before reaching one for which the range is allocated. The value is 373# in the range 0 to the depth of the image chain - 1. 374# 375# @zero: the sectors in this range read as zeros 376# 377# @data: reading the image will actually read data from a file (in particular, 378# if @offset is present this means that the sectors are not simply 379# preallocated, but contain actual data in raw format) 380# 381# @offset: if present, the image file stores the data for this range in 382# raw format at the given offset. 383# 384# Since: 1.7 385## 386{ 'struct': 'BlockDeviceMapEntry', 387 'data': { 'start': 'int', 'length': 'int', 'depth': 'int', 'zero': 'bool', 388 'data': 'bool', '*offset': 'int' } } 389 390## 391# @DirtyBitmapStatus: 392# 393# An enumeration of possible states that a dirty bitmap can report to the user. 394# 395# @frozen: The bitmap is currently in-use by a backup operation or block job, 396# and is immutable. 397# 398# @disabled: The bitmap is currently in-use by an internal operation and is 399# read-only. It can still be deleted. 400# 401# @active: The bitmap is actively monitoring for new writes, and can be cleared, 402# deleted, or used for backup operations. 403# 404# Since: 2.4 405## 406{ 'enum': 'DirtyBitmapStatus', 407 'data': ['active', 'disabled', 'frozen'] } 408 409## 410# @BlockDirtyInfo: 411# 412# Block dirty bitmap information. 413# 414# @name: #optional the name of the dirty bitmap (Since 2.4) 415# 416# @count: number of dirty bytes according to the dirty bitmap 417# 418# @granularity: granularity of the dirty bitmap in bytes (since 1.4) 419# 420# @status: current status of the dirty bitmap (since 2.4) 421# 422# Since: 1.3 423## 424{ 'struct': 'BlockDirtyInfo', 425 'data': {'*name': 'str', 'count': 'int', 'granularity': 'uint32', 426 'status': 'DirtyBitmapStatus'} } 427 428## 429# @BlockInfo: 430# 431# Block device information. This structure describes a virtual device and 432# the backing device associated with it. 433# 434# @device: The device name associated with the virtual device. 435# 436# @type: This field is returned only for compatibility reasons, it should 437# not be used (always returns 'unknown') 438# 439# @removable: True if the device supports removable media. 440# 441# @locked: True if the guest has locked this device from having its media 442# removed 443# 444# @tray_open: #optional True if the device's tray is open 445# (only present if it has a tray) 446# 447# @dirty-bitmaps: #optional dirty bitmaps information (only present if the 448# driver has one or more dirty bitmaps) (Since 2.0) 449# 450# @io-status: #optional @BlockDeviceIoStatus. Only present if the device 451# supports it and the VM is configured to stop on errors 452# (supported device models: virtio-blk, ide, scsi-disk) 453# 454# @inserted: #optional @BlockDeviceInfo describing the device if media is 455# present 456# 457# Since: 0.14.0 458## 459{ 'struct': 'BlockInfo', 460 'data': {'device': 'str', 'type': 'str', 'removable': 'bool', 461 'locked': 'bool', '*inserted': 'BlockDeviceInfo', 462 '*tray_open': 'bool', '*io-status': 'BlockDeviceIoStatus', 463 '*dirty-bitmaps': ['BlockDirtyInfo'] } } 464 465## 466# @query-block: 467# 468# Get a list of BlockInfo for all virtual block devices. 469# 470# Returns: a list of @BlockInfo describing each virtual block device 471# 472# Since: 0.14.0 473# 474# Example: 475# 476# -> { "execute": "query-block" } 477# <- { 478# "return":[ 479# { 480# "io-status": "ok", 481# "device":"ide0-hd0", 482# "locked":false, 483# "removable":false, 484# "inserted":{ 485# "ro":false, 486# "drv":"qcow2", 487# "encrypted":false, 488# "file":"disks/test.qcow2", 489# "backing_file_depth":1, 490# "bps":1000000, 491# "bps_rd":0, 492# "bps_wr":0, 493# "iops":1000000, 494# "iops_rd":0, 495# "iops_wr":0, 496# "bps_max": 8000000, 497# "bps_rd_max": 0, 498# "bps_wr_max": 0, 499# "iops_max": 0, 500# "iops_rd_max": 0, 501# "iops_wr_max": 0, 502# "iops_size": 0, 503# "detect_zeroes": "on", 504# "write_threshold": 0, 505# "image":{ 506# "filename":"disks/test.qcow2", 507# "format":"qcow2", 508# "virtual-size":2048000, 509# "backing_file":"base.qcow2", 510# "full-backing-filename":"disks/base.qcow2", 511# "backing-filename-format":"qcow2", 512# "snapshots":[ 513# { 514# "id": "1", 515# "name": "snapshot1", 516# "vm-state-size": 0, 517# "date-sec": 10000200, 518# "date-nsec": 12, 519# "vm-clock-sec": 206, 520# "vm-clock-nsec": 30 521# } 522# ], 523# "backing-image":{ 524# "filename":"disks/base.qcow2", 525# "format":"qcow2", 526# "virtual-size":2048000 527# } 528# } 529# }, 530# "type":"unknown" 531# }, 532# { 533# "io-status": "ok", 534# "device":"ide1-cd0", 535# "locked":false, 536# "removable":true, 537# "type":"unknown" 538# }, 539# { 540# "device":"floppy0", 541# "locked":false, 542# "removable":true, 543# "type":"unknown" 544# }, 545# { 546# "device":"sd0", 547# "locked":false, 548# "removable":true, 549# "type":"unknown" 550# } 551# ] 552# } 553# 554## 555{ 'command': 'query-block', 'returns': ['BlockInfo'] } 556 557 558## 559# @BlockDeviceTimedStats: 560# 561# Statistics of a block device during a given interval of time. 562# 563# @interval_length: Interval used for calculating the statistics, 564# in seconds. 565# 566# @min_rd_latency_ns: Minimum latency of read operations in the 567# defined interval, in nanoseconds. 568# 569# @min_wr_latency_ns: Minimum latency of write operations in the 570# defined interval, in nanoseconds. 571# 572# @min_flush_latency_ns: Minimum latency of flush operations in the 573# defined interval, in nanoseconds. 574# 575# @max_rd_latency_ns: Maximum latency of read operations in the 576# defined interval, in nanoseconds. 577# 578# @max_wr_latency_ns: Maximum latency of write operations in the 579# defined interval, in nanoseconds. 580# 581# @max_flush_latency_ns: Maximum latency of flush operations in the 582# defined interval, in nanoseconds. 583# 584# @avg_rd_latency_ns: Average latency of read operations in the 585# defined interval, in nanoseconds. 586# 587# @avg_wr_latency_ns: Average latency of write operations in the 588# defined interval, in nanoseconds. 589# 590# @avg_flush_latency_ns: Average latency of flush operations in the 591# defined interval, in nanoseconds. 592# 593# @avg_rd_queue_depth: Average number of pending read operations 594# in the defined interval. 595# 596# @avg_wr_queue_depth: Average number of pending write operations 597# in the defined interval. 598# 599# Since: 2.5 600## 601{ 'struct': 'BlockDeviceTimedStats', 602 'data': { 'interval_length': 'int', 'min_rd_latency_ns': 'int', 603 'max_rd_latency_ns': 'int', 'avg_rd_latency_ns': 'int', 604 'min_wr_latency_ns': 'int', 'max_wr_latency_ns': 'int', 605 'avg_wr_latency_ns': 'int', 'min_flush_latency_ns': 'int', 606 'max_flush_latency_ns': 'int', 'avg_flush_latency_ns': 'int', 607 'avg_rd_queue_depth': 'number', 'avg_wr_queue_depth': 'number' } } 608 609## 610# @BlockDeviceStats: 611# 612# Statistics of a virtual block device or a block backing device. 613# 614# @rd_bytes: The number of bytes read by the device. 615# 616# @wr_bytes: The number of bytes written by the device. 617# 618# @rd_operations: The number of read operations performed by the device. 619# 620# @wr_operations: The number of write operations performed by the device. 621# 622# @flush_operations: The number of cache flush operations performed by the 623# device (since 0.15.0) 624# 625# @flush_total_time_ns: Total time spend on cache flushes in nano-seconds 626# (since 0.15.0). 627# 628# @wr_total_time_ns: Total time spend on writes in nano-seconds (since 0.15.0). 629# 630# @rd_total_time_ns: Total_time_spend on reads in nano-seconds (since 0.15.0). 631# 632# @wr_highest_offset: The offset after the greatest byte written to the 633# device. The intended use of this information is for 634# growable sparse files (like qcow2) that are used on top 635# of a physical device. 636# 637# @rd_merged: Number of read requests that have been merged into another 638# request (Since 2.3). 639# 640# @wr_merged: Number of write requests that have been merged into another 641# request (Since 2.3). 642# 643# @idle_time_ns: #optional Time since the last I/O operation, in 644# nanoseconds. If the field is absent it means that 645# there haven't been any operations yet (Since 2.5). 646# 647# @failed_rd_operations: The number of failed read operations 648# performed by the device (Since 2.5) 649# 650# @failed_wr_operations: The number of failed write operations 651# performed by the device (Since 2.5) 652# 653# @failed_flush_operations: The number of failed flush operations 654# performed by the device (Since 2.5) 655# 656# @invalid_rd_operations: The number of invalid read operations 657# performed by the device (Since 2.5) 658# 659# @invalid_wr_operations: The number of invalid write operations 660# performed by the device (Since 2.5) 661# 662# @invalid_flush_operations: The number of invalid flush operations 663# performed by the device (Since 2.5) 664# 665# @account_invalid: Whether invalid operations are included in the 666# last access statistics (Since 2.5) 667# 668# @account_failed: Whether failed operations are included in the 669# latency and last access statistics (Since 2.5) 670# 671# @timed_stats: Statistics specific to the set of previously defined 672# intervals of time (Since 2.5) 673# 674# Since: 0.14.0 675## 676{ 'struct': 'BlockDeviceStats', 677 'data': {'rd_bytes': 'int', 'wr_bytes': 'int', 'rd_operations': 'int', 678 'wr_operations': 'int', 'flush_operations': 'int', 679 'flush_total_time_ns': 'int', 'wr_total_time_ns': 'int', 680 'rd_total_time_ns': 'int', 'wr_highest_offset': 'int', 681 'rd_merged': 'int', 'wr_merged': 'int', '*idle_time_ns': 'int', 682 'failed_rd_operations': 'int', 'failed_wr_operations': 'int', 683 'failed_flush_operations': 'int', 'invalid_rd_operations': 'int', 684 'invalid_wr_operations': 'int', 'invalid_flush_operations': 'int', 685 'account_invalid': 'bool', 'account_failed': 'bool', 686 'timed_stats': ['BlockDeviceTimedStats'] } } 687 688## 689# @BlockStats: 690# 691# Statistics of a virtual block device or a block backing device. 692# 693# @device: #optional If the stats are for a virtual block device, the name 694# corresponding to the virtual block device. 695# 696# @node-name: #optional The node name of the device. (Since 2.3) 697# 698# @stats: A @BlockDeviceStats for the device. 699# 700# @parent: #optional This describes the file block device if it has one. 701# Contains recursively the statistics of the underlying 702# protocol (e.g. the host file for a qcow2 image). If there is 703# no underlying protocol, this field is omitted 704# 705# @backing: #optional This describes the backing block device if it has one. 706# (Since 2.0) 707# 708# Since: 0.14.0 709## 710{ 'struct': 'BlockStats', 711 'data': {'*device': 'str', '*node-name': 'str', 712 'stats': 'BlockDeviceStats', 713 '*parent': 'BlockStats', 714 '*backing': 'BlockStats'} } 715 716## 717# @query-blockstats: 718# 719# Query the @BlockStats for all virtual block devices. 720# 721# @query-nodes: #optional If true, the command will query all the block nodes 722# that have a node name, in a list which will include "parent" 723# information, but not "backing". 724# If false or omitted, the behavior is as before - query all the 725# device backends, recursively including their "parent" and 726# "backing". (Since 2.3) 727# 728# Returns: A list of @BlockStats for each virtual block devices. 729# 730# Since: 0.14.0 731# 732# Example: 733# 734# -> { "execute": "query-blockstats" } 735# <- { 736# "return":[ 737# { 738# "device":"ide0-hd0", 739# "parent":{ 740# "stats":{ 741# "wr_highest_offset":3686448128, 742# "wr_bytes":9786368, 743# "wr_operations":751, 744# "rd_bytes":122567168, 745# "rd_operations":36772 746# "wr_total_times_ns":313253456 747# "rd_total_times_ns":3465673657 748# "flush_total_times_ns":49653 749# "flush_operations":61, 750# "rd_merged":0, 751# "wr_merged":0, 752# "idle_time_ns":2953431879, 753# "account_invalid":true, 754# "account_failed":false 755# } 756# }, 757# "stats":{ 758# "wr_highest_offset":2821110784, 759# "wr_bytes":9786368, 760# "wr_operations":692, 761# "rd_bytes":122739200, 762# "rd_operations":36604 763# "flush_operations":51, 764# "wr_total_times_ns":313253456 765# "rd_total_times_ns":3465673657 766# "flush_total_times_ns":49653, 767# "rd_merged":0, 768# "wr_merged":0, 769# "idle_time_ns":2953431879, 770# "account_invalid":true, 771# "account_failed":false 772# } 773# }, 774# { 775# "device":"ide1-cd0", 776# "stats":{ 777# "wr_highest_offset":0, 778# "wr_bytes":0, 779# "wr_operations":0, 780# "rd_bytes":0, 781# "rd_operations":0 782# "flush_operations":0, 783# "wr_total_times_ns":0 784# "rd_total_times_ns":0 785# "flush_total_times_ns":0, 786# "rd_merged":0, 787# "wr_merged":0, 788# "account_invalid":false, 789# "account_failed":false 790# } 791# }, 792# { 793# "device":"floppy0", 794# "stats":{ 795# "wr_highest_offset":0, 796# "wr_bytes":0, 797# "wr_operations":0, 798# "rd_bytes":0, 799# "rd_operations":0 800# "flush_operations":0, 801# "wr_total_times_ns":0 802# "rd_total_times_ns":0 803# "flush_total_times_ns":0, 804# "rd_merged":0, 805# "wr_merged":0, 806# "account_invalid":false, 807# "account_failed":false 808# } 809# }, 810# { 811# "device":"sd0", 812# "stats":{ 813# "wr_highest_offset":0, 814# "wr_bytes":0, 815# "wr_operations":0, 816# "rd_bytes":0, 817# "rd_operations":0 818# "flush_operations":0, 819# "wr_total_times_ns":0 820# "rd_total_times_ns":0 821# "flush_total_times_ns":0, 822# "rd_merged":0, 823# "wr_merged":0, 824# "account_invalid":false, 825# "account_failed":false 826# } 827# } 828# ] 829# } 830# 831## 832{ 'command': 'query-blockstats', 833 'data': { '*query-nodes': 'bool' }, 834 'returns': ['BlockStats'] } 835 836## 837# @BlockdevOnError: 838# 839# An enumeration of possible behaviors for errors on I/O operations. 840# The exact meaning depends on whether the I/O was initiated by a guest 841# or by a block job 842# 843# @report: for guest operations, report the error to the guest; 844# for jobs, cancel the job 845# 846# @ignore: ignore the error, only report a QMP event (BLOCK_IO_ERROR 847# or BLOCK_JOB_ERROR) 848# 849# @enospc: same as @stop on ENOSPC, same as @report otherwise. 850# 851# @stop: for guest operations, stop the virtual machine; 852# for jobs, pause the job 853# 854# @auto: inherit the error handling policy of the backend (since: 2.7) 855# 856# Since: 1.3 857## 858{ 'enum': 'BlockdevOnError', 859 'data': ['report', 'ignore', 'enospc', 'stop', 'auto'] } 860 861## 862# @MirrorSyncMode: 863# 864# An enumeration of possible behaviors for the initial synchronization 865# phase of storage mirroring. 866# 867# @top: copies data in the topmost image to the destination 868# 869# @full: copies data from all images to the destination 870# 871# @none: only copy data written from now on 872# 873# @incremental: only copy data described by the dirty bitmap. Since: 2.4 874# 875# Since: 1.3 876## 877{ 'enum': 'MirrorSyncMode', 878 'data': ['top', 'full', 'none', 'incremental'] } 879 880## 881# @BlockJobType: 882# 883# Type of a block job. 884# 885# @commit: block commit job type, see "block-commit" 886# 887# @stream: block stream job type, see "block-stream" 888# 889# @mirror: drive mirror job type, see "drive-mirror" 890# 891# @backup: drive backup job type, see "drive-backup" 892# 893# Since: 1.7 894## 895{ 'enum': 'BlockJobType', 896 'data': ['commit', 'stream', 'mirror', 'backup'] } 897 898## 899# @BlockJobInfo: 900# 901# Information about a long-running block device operation. 902# 903# @type: the job type ('stream' for image streaming) 904# 905# @device: The job identifier. Originally the device name but other 906# values are allowed since QEMU 2.7 907# 908# @len: the maximum progress value 909# 910# @busy: false if the job is known to be in a quiescent state, with 911# no pending I/O. Since 1.3. 912# 913# @paused: whether the job is paused or, if @busy is true, will 914# pause itself as soon as possible. Since 1.3. 915# 916# @offset: the current progress value 917# 918# @speed: the rate limit, bytes per second 919# 920# @io-status: the status of the job (since 1.3) 921# 922# @ready: true if the job may be completed (since 2.2) 923# 924# Since: 1.1 925## 926{ 'struct': 'BlockJobInfo', 927 'data': {'type': 'str', 'device': 'str', 'len': 'int', 928 'offset': 'int', 'busy': 'bool', 'paused': 'bool', 'speed': 'int', 929 'io-status': 'BlockDeviceIoStatus', 'ready': 'bool'} } 930 931## 932# @query-block-jobs: 933# 934# Return information about long-running block device operations. 935# 936# Returns: a list of @BlockJobInfo for each active block job 937# 938# Since: 1.1 939## 940{ 'command': 'query-block-jobs', 'returns': ['BlockJobInfo'] } 941 942## 943# @block_passwd: 944# 945# This command sets the password of a block device that has not been open 946# with a password and requires one. 947# 948# The two cases where this can happen are a block device is created through 949# QEMU's initial command line or a block device is changed through the legacy 950# @change interface. 951# 952# In the event that the block device is created through the initial command 953# line, the VM will start in the stopped state regardless of whether '-S' is 954# used. The intention is for a management tool to query the block devices to 955# determine which ones are encrypted, set the passwords with this command, and 956# then start the guest with the @cont command. 957# 958# Either @device or @node-name must be set but not both. 959# 960# @device: #optional the name of the block backend device to set the password on 961# 962# @node-name: #optional graph node name to set the password on (Since 2.0) 963# 964# @password: the password to use for the device 965# 966# Returns: nothing on success 967# If @device is not a valid block device, DeviceNotFound 968# If @device is not encrypted, DeviceNotEncrypted 969# 970# Notes: Not all block formats support encryption and some that do are not 971# able to validate that a password is correct. Disk corruption may 972# occur if an invalid password is specified. 973# 974# Since: 0.14.0 975# 976# Example: 977# 978# -> { "execute": "block_passwd", "arguments": { "device": "ide0-hd0", 979# "password": "12345" } } 980# <- { "return": {} } 981# 982## 983{ 'command': 'block_passwd', 'data': {'*device': 'str', 984 '*node-name': 'str', 'password': 'str'} } 985 986## 987# @block_resize: 988# 989# Resize a block image while a guest is running. 990# 991# Either @device or @node-name must be set but not both. 992# 993# @device: #optional the name of the device to get the image resized 994# 995# @node-name: #optional graph node name to get the image resized (Since 2.0) 996# 997# @size: new image size in bytes 998# 999# Returns: nothing on success 1000# If @device is not a valid block device, DeviceNotFound 1001# 1002# Since: 0.14.0 1003# 1004# Example: 1005# 1006# -> { "execute": "block_resize", 1007# "arguments": { "device": "scratch", "size": 1073741824 } } 1008# <- { "return": {} } 1009# 1010## 1011{ 'command': 'block_resize', 'data': { '*device': 'str', 1012 '*node-name': 'str', 1013 'size': 'int' }} 1014 1015## 1016# @NewImageMode: 1017# 1018# An enumeration that tells QEMU how to set the backing file path in 1019# a new image file. 1020# 1021# @existing: QEMU should look for an existing image file. 1022# 1023# @absolute-paths: QEMU should create a new image with absolute paths 1024# for the backing file. If there is no backing file available, the new 1025# image will not be backed either. 1026# 1027# Since: 1.1 1028## 1029{ 'enum': 'NewImageMode', 1030 'data': [ 'existing', 'absolute-paths' ] } 1031 1032## 1033# @BlockdevSnapshotSync: 1034# 1035# Either @device or @node-name must be set but not both. 1036# 1037# @device: #optional the name of the device to generate the snapshot from. 1038# 1039# @node-name: #optional graph node name to generate the snapshot from (Since 2.0) 1040# 1041# @snapshot-file: the target of the new image. If the file exists, or 1042# if it is a device, the snapshot will be created in the existing 1043# file/device. Otherwise, a new file will be created. 1044# 1045# @snapshot-node-name: #optional the graph node name of the new image (Since 2.0) 1046# 1047# @format: #optional the format of the snapshot image, default is 'qcow2'. 1048# 1049# @mode: #optional whether and how QEMU should create a new image, default is 1050# 'absolute-paths'. 1051## 1052{ 'struct': 'BlockdevSnapshotSync', 1053 'data': { '*device': 'str', '*node-name': 'str', 1054 'snapshot-file': 'str', '*snapshot-node-name': 'str', 1055 '*format': 'str', '*mode': 'NewImageMode' } } 1056 1057## 1058# @BlockdevSnapshot: 1059# 1060# @node: device or node name that will have a snapshot created. 1061# 1062# @overlay: reference to the existing block device that will become 1063# the overlay of @node, as part of creating the snapshot. 1064# It must not have a current backing file (this can be 1065# achieved by passing "backing": "" to blockdev-add). 1066# 1067# Since: 2.5 1068## 1069{ 'struct': 'BlockdevSnapshot', 1070 'data': { 'node': 'str', 'overlay': 'str' } } 1071 1072## 1073# @DriveBackup: 1074# 1075# @job-id: #optional identifier for the newly-created block job. If 1076# omitted, the device name will be used. (Since 2.7) 1077# 1078# @device: the device name or node-name of a root node which should be copied. 1079# 1080# @target: the target of the new image. If the file exists, or if it 1081# is a device, the existing file/device will be used as the new 1082# destination. If it does not exist, a new file will be created. 1083# 1084# @format: #optional the format of the new destination, default is to 1085# probe if @mode is 'existing', else the format of the source 1086# 1087# @sync: what parts of the disk image should be copied to the destination 1088# (all the disk, only the sectors allocated in the topmost image, from a 1089# dirty bitmap, or only new I/O). 1090# 1091# @mode: #optional whether and how QEMU should create a new image, default is 1092# 'absolute-paths'. 1093# 1094# @speed: #optional the maximum speed, in bytes per second 1095# 1096# @bitmap: #optional the name of dirty bitmap if sync is "incremental". 1097# Must be present if sync is "incremental", must NOT be present 1098# otherwise. (Since 2.4) 1099# 1100# @compress: #optional true to compress data, if the target format supports it. 1101# (default: false) (since 2.8) 1102# 1103# @on-source-error: #optional the action to take on an error on the source, 1104# default 'report'. 'stop' and 'enospc' can only be used 1105# if the block device supports io-status (see BlockInfo). 1106# 1107# @on-target-error: #optional the action to take on an error on the target, 1108# default 'report' (no limitations, since this applies to 1109# a different block device than @device). 1110# 1111# Note: @on-source-error and @on-target-error only affect background 1112# I/O. If an error occurs during a guest write request, the device's 1113# rerror/werror actions will be used. 1114# 1115# Since: 1.6 1116## 1117{ 'struct': 'DriveBackup', 1118 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', 1119 '*format': 'str', 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode', 1120 '*speed': 'int', '*bitmap': 'str', '*compress': 'bool', 1121 '*on-source-error': 'BlockdevOnError', 1122 '*on-target-error': 'BlockdevOnError' } } 1123 1124## 1125# @BlockdevBackup: 1126# 1127# @job-id: #optional identifier for the newly-created block job. If 1128# omitted, the device name will be used. (Since 2.7) 1129# 1130# @device: the device name or node-name of a root node which should be copied. 1131# 1132# @target: the device name or node-name of the backup target node. 1133# 1134# @sync: what parts of the disk image should be copied to the destination 1135# (all the disk, only the sectors allocated in the topmost image, or 1136# only new I/O). 1137# 1138# @speed: #optional the maximum speed, in bytes per second. The default is 0, 1139# for unlimited. 1140# 1141# @compress: #optional true to compress data, if the target format supports it. 1142# (default: false) (since 2.8) 1143# 1144# @on-source-error: #optional the action to take on an error on the source, 1145# default 'report'. 'stop' and 'enospc' can only be used 1146# if the block device supports io-status (see BlockInfo). 1147# 1148# @on-target-error: #optional the action to take on an error on the target, 1149# default 'report' (no limitations, since this applies to 1150# a different block device than @device). 1151# 1152# Note: @on-source-error and @on-target-error only affect background 1153# I/O. If an error occurs during a guest write request, the device's 1154# rerror/werror actions will be used. 1155# 1156# Since: 2.3 1157## 1158{ 'struct': 'BlockdevBackup', 1159 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', 1160 'sync': 'MirrorSyncMode', 1161 '*speed': 'int', 1162 '*compress': 'bool', 1163 '*on-source-error': 'BlockdevOnError', 1164 '*on-target-error': 'BlockdevOnError' } } 1165 1166## 1167# @blockdev-snapshot-sync: 1168# 1169# Generates a synchronous snapshot of a block device. 1170# 1171# For the arguments, see the documentation of BlockdevSnapshotSync. 1172# 1173# Returns: nothing on success 1174# If @device is not a valid block device, DeviceNotFound 1175# 1176# Since: 0.14.0 1177# 1178# Example: 1179# 1180# -> { "execute": "blockdev-snapshot-sync", 1181# "arguments": { "device": "ide-hd0", 1182# "snapshot-file": 1183# "/some/place/my-image", 1184# "format": "qcow2" } } 1185# <- { "return": {} } 1186# 1187## 1188{ 'command': 'blockdev-snapshot-sync', 1189 'data': 'BlockdevSnapshotSync' } 1190 1191 1192## 1193# @blockdev-snapshot: 1194# 1195# Generates a snapshot of a block device. 1196# 1197# Create a snapshot, by installing 'node' as the backing image of 1198# 'overlay'. Additionally, if 'node' is associated with a block 1199# device, the block device changes to using 'overlay' as its new active 1200# image. 1201# 1202# For the arguments, see the documentation of BlockdevSnapshot. 1203# 1204# Since: 2.5 1205# 1206# Example: 1207# 1208# -> { "execute": "blockdev-add", 1209# "arguments": { "options": { "driver": "qcow2", 1210# "node-name": "node1534", 1211# "file": { "driver": "file", 1212# "filename": "hd1.qcow2" }, 1213# "backing": "" } } } 1214# 1215# <- { "return": {} } 1216# 1217# -> { "execute": "blockdev-snapshot", 1218# "arguments": { "node": "ide-hd0", 1219# "overlay": "node1534" } } 1220# <- { "return": {} } 1221# 1222## 1223{ 'command': 'blockdev-snapshot', 1224 'data': 'BlockdevSnapshot' } 1225 1226## 1227# @change-backing-file: 1228# 1229# Change the backing file in the image file metadata. This does not 1230# cause QEMU to reopen the image file to reparse the backing filename 1231# (it may, however, perform a reopen to change permissions from 1232# r/o -> r/w -> r/o, if needed). The new backing file string is written 1233# into the image file metadata, and the QEMU internal strings are 1234# updated. 1235# 1236# @image-node-name: The name of the block driver state node of the 1237# image to modify. The "device" argument is used 1238# to verify "image-node-name" is in the chain 1239# described by "device". 1240# 1241# @device: The device name or node-name of the root node that owns 1242# image-node-name. 1243# 1244# @backing-file: The string to write as the backing file. This 1245# string is not validated, so care should be taken 1246# when specifying the string or the image chain may 1247# not be able to be reopened again. 1248# 1249# Returns: Nothing on success 1250# 1251# If "device" does not exist or cannot be determined, DeviceNotFound 1252# 1253# Since: 2.1 1254## 1255{ 'command': 'change-backing-file', 1256 'data': { 'device': 'str', 'image-node-name': 'str', 1257 'backing-file': 'str' } } 1258 1259## 1260# @block-commit: 1261# 1262# Live commit of data from overlay image nodes into backing nodes - i.e., 1263# writes data between 'top' and 'base' into 'base'. 1264# 1265# @job-id: #optional identifier for the newly-created block job. If 1266# omitted, the device name will be used. (Since 2.7) 1267# 1268# @device: the device name or node-name of a root node 1269# 1270# @base: #optional The file name of the backing image to write data into. 1271# If not specified, this is the deepest backing image. 1272# 1273# @top: #optional The file name of the backing image within the image chain, 1274# which contains the topmost data to be committed down. If 1275# not specified, this is the active layer. 1276# 1277# @backing-file: #optional The backing file string to write into the overlay 1278# image of 'top'. If 'top' is the active layer, 1279# specifying a backing file string is an error. This 1280# filename is not validated. 1281# 1282# If a pathname string is such that it cannot be 1283# resolved by QEMU, that means that subsequent QMP or 1284# HMP commands must use node-names for the image in 1285# question, as filename lookup methods will fail. 1286# 1287# If not specified, QEMU will automatically determine 1288# the backing file string to use, or error out if 1289# there is no obvious choice. Care should be taken 1290# when specifying the string, to specify a valid 1291# filename or protocol. 1292# (Since 2.1) 1293# 1294# If top == base, that is an error. 1295# If top == active, the job will not be completed by itself, 1296# user needs to complete the job with the block-job-complete 1297# command after getting the ready event. (Since 2.0) 1298# 1299# If the base image is smaller than top, then the base image 1300# will be resized to be the same size as top. If top is 1301# smaller than the base image, the base will not be 1302# truncated. If you want the base image size to match the 1303# size of the smaller top, you can safely truncate it 1304# yourself once the commit operation successfully completes. 1305# 1306# @speed: #optional the maximum speed, in bytes per second 1307# 1308# @filter-node-name: #optional the node name that should be assigned to the 1309# filter driver that the commit job inserts into the graph 1310# above @top. If this option is not given, a node name is 1311# autogenerated. (Since: 2.9) 1312# 1313# Returns: Nothing on success 1314# If commit or stream is already active on this device, DeviceInUse 1315# If @device does not exist, DeviceNotFound 1316# If image commit is not supported by this device, NotSupported 1317# If @base or @top is invalid, a generic error is returned 1318# If @speed is invalid, InvalidParameter 1319# 1320# Since: 1.3 1321# 1322# Example: 1323# 1324# -> { "execute": "block-commit", 1325# "arguments": { "device": "virtio0", 1326# "top": "/tmp/snap1.qcow2" } } 1327# <- { "return": {} } 1328# 1329## 1330{ 'command': 'block-commit', 1331 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', '*top': 'str', 1332 '*backing-file': 'str', '*speed': 'int', 1333 '*filter-node-name': 'str' } } 1334 1335## 1336# @drive-backup: 1337# 1338# Start a point-in-time copy of a block device to a new destination. The 1339# status of ongoing drive-backup operations can be checked with 1340# query-block-jobs where the BlockJobInfo.type field has the value 'backup'. 1341# The operation can be stopped before it has completed using the 1342# block-job-cancel command. 1343# 1344# For the arguments, see the documentation of DriveBackup. 1345# 1346# Returns: nothing on success 1347# If @device is not a valid block device, GenericError 1348# 1349# Since: 1.6 1350# 1351# Example: 1352# 1353# -> { "execute": "drive-backup", 1354# "arguments": { "device": "drive0", 1355# "sync": "full", 1356# "target": "backup.img" } } 1357# <- { "return": {} } 1358# 1359## 1360{ 'command': 'drive-backup', 'boxed': true, 1361 'data': 'DriveBackup' } 1362 1363## 1364# @blockdev-backup: 1365# 1366# Start a point-in-time copy of a block device to a new destination. The 1367# status of ongoing blockdev-backup operations can be checked with 1368# query-block-jobs where the BlockJobInfo.type field has the value 'backup'. 1369# The operation can be stopped before it has completed using the 1370# block-job-cancel command. 1371# 1372# For the arguments, see the documentation of BlockdevBackup. 1373# 1374# Returns: nothing on success 1375# If @device is not a valid block device, DeviceNotFound 1376# 1377# Since: 2.3 1378# 1379# Example: 1380# -> { "execute": "blockdev-backup", 1381# "arguments": { "device": "src-id", 1382# "sync": "full", 1383# "target": "tgt-id" } } 1384# <- { "return": {} } 1385# 1386## 1387{ 'command': 'blockdev-backup', 'boxed': true, 1388 'data': 'BlockdevBackup' } 1389 1390 1391## 1392# @query-named-block-nodes: 1393# 1394# Get the named block driver list 1395# 1396# Returns: the list of BlockDeviceInfo 1397# 1398# Since: 2.0 1399# 1400# Example: 1401# 1402# -> { "execute": "query-named-block-nodes" } 1403# <- { "return": [ { "ro":false, 1404# "drv":"qcow2", 1405# "encrypted":false, 1406# "file":"disks/test.qcow2", 1407# "node-name": "my-node", 1408# "backing_file_depth":1, 1409# "bps":1000000, 1410# "bps_rd":0, 1411# "bps_wr":0, 1412# "iops":1000000, 1413# "iops_rd":0, 1414# "iops_wr":0, 1415# "bps_max": 8000000, 1416# "bps_rd_max": 0, 1417# "bps_wr_max": 0, 1418# "iops_max": 0, 1419# "iops_rd_max": 0, 1420# "iops_wr_max": 0, 1421# "iops_size": 0, 1422# "write_threshold": 0, 1423# "image":{ 1424# "filename":"disks/test.qcow2", 1425# "format":"qcow2", 1426# "virtual-size":2048000, 1427# "backing_file":"base.qcow2", 1428# "full-backing-filename":"disks/base.qcow2", 1429# "backing-filename-format":"qcow2", 1430# "snapshots":[ 1431# { 1432# "id": "1", 1433# "name": "snapshot1", 1434# "vm-state-size": 0, 1435# "date-sec": 10000200, 1436# "date-nsec": 12, 1437# "vm-clock-sec": 206, 1438# "vm-clock-nsec": 30 1439# } 1440# ], 1441# "backing-image":{ 1442# "filename":"disks/base.qcow2", 1443# "format":"qcow2", 1444# "virtual-size":2048000 1445# } 1446# } } ] } 1447# 1448## 1449{ 'command': 'query-named-block-nodes', 'returns': [ 'BlockDeviceInfo' ] } 1450 1451## 1452# @drive-mirror: 1453# 1454# Start mirroring a block device's writes to a new destination. target 1455# specifies the target of the new image. If the file exists, or if it 1456# is a device, it will be used as the new destination for writes. If 1457# it does not exist, a new file will be created. format specifies the 1458# format of the mirror image, default is to probe if mode='existing', 1459# else the format of the source. 1460# 1461# See DriveMirror for parameter descriptions 1462# 1463# Returns: nothing on success 1464# If @device is not a valid block device, GenericError 1465# 1466# Since: 1.3 1467# 1468# Example: 1469# 1470# -> { "execute": "drive-mirror", 1471# "arguments": { "device": "ide-hd0", 1472# "target": "/some/place/my-image", 1473# "sync": "full", 1474# "format": "qcow2" } } 1475# <- { "return": {} } 1476# 1477## 1478{ 'command': 'drive-mirror', 'boxed': true, 1479 'data': 'DriveMirror' } 1480 1481## 1482# @DriveMirror: 1483# 1484# A set of parameters describing drive mirror setup. 1485# 1486# @job-id: #optional identifier for the newly-created block job. If 1487# omitted, the device name will be used. (Since 2.7) 1488# 1489# @device: the device name or node-name of a root node whose writes should be 1490# mirrored. 1491# 1492# @target: the target of the new image. If the file exists, or if it 1493# is a device, the existing file/device will be used as the new 1494# destination. If it does not exist, a new file will be created. 1495# 1496# @format: #optional the format of the new destination, default is to 1497# probe if @mode is 'existing', else the format of the source 1498# 1499# @node-name: #optional the new block driver state node name in the graph 1500# (Since 2.1) 1501# 1502# @replaces: #optional with sync=full graph node name to be replaced by the new 1503# image when a whole image copy is done. This can be used to repair 1504# broken Quorum files. (Since 2.1) 1505# 1506# @mode: #optional whether and how QEMU should create a new image, default is 1507# 'absolute-paths'. 1508# 1509# @speed: #optional the maximum speed, in bytes per second 1510# 1511# @sync: what parts of the disk image should be copied to the destination 1512# (all the disk, only the sectors allocated in the topmost image, or 1513# only new I/O). 1514# 1515# @granularity: #optional granularity of the dirty bitmap, default is 64K 1516# if the image format doesn't have clusters, 4K if the clusters 1517# are smaller than that, else the cluster size. Must be a 1518# power of 2 between 512 and 64M (since 1.4). 1519# 1520# @buf-size: #optional maximum amount of data in flight from source to 1521# target (since 1.4). 1522# 1523# @on-source-error: #optional the action to take on an error on the source, 1524# default 'report'. 'stop' and 'enospc' can only be used 1525# if the block device supports io-status (see BlockInfo). 1526# 1527# @on-target-error: #optional the action to take on an error on the target, 1528# default 'report' (no limitations, since this applies to 1529# a different block device than @device). 1530# @unmap: #optional Whether to try to unmap target sectors where source has 1531# only zero. If true, and target unallocated sectors will read as zero, 1532# target image sectors will be unmapped; otherwise, zeroes will be 1533# written. Both will result in identical contents. 1534# Default is true. (Since 2.4) 1535# 1536# Since: 1.3 1537## 1538{ 'struct': 'DriveMirror', 1539 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', 1540 '*format': 'str', '*node-name': 'str', '*replaces': 'str', 1541 'sync': 'MirrorSyncMode', '*mode': 'NewImageMode', 1542 '*speed': 'int', '*granularity': 'uint32', 1543 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', 1544 '*on-target-error': 'BlockdevOnError', 1545 '*unmap': 'bool' } } 1546 1547## 1548# @BlockDirtyBitmap: 1549# 1550# @node: name of device/node which the bitmap is tracking 1551# 1552# @name: name of the dirty bitmap 1553# 1554# Since: 2.4 1555## 1556{ 'struct': 'BlockDirtyBitmap', 1557 'data': { 'node': 'str', 'name': 'str' } } 1558 1559## 1560# @BlockDirtyBitmapAdd: 1561# 1562# @node: name of device/node which the bitmap is tracking 1563# 1564# @name: name of the dirty bitmap 1565# 1566# @granularity: #optional the bitmap granularity, default is 64k for 1567# block-dirty-bitmap-add 1568# 1569# Since: 2.4 1570## 1571{ 'struct': 'BlockDirtyBitmapAdd', 1572 'data': { 'node': 'str', 'name': 'str', '*granularity': 'uint32' } } 1573 1574## 1575# @block-dirty-bitmap-add: 1576# 1577# Create a dirty bitmap with a name on the node, and start tracking the writes. 1578# 1579# Returns: nothing on success 1580# If @node is not a valid block device or node, DeviceNotFound 1581# If @name is already taken, GenericError with an explanation 1582# 1583# Since: 2.4 1584# 1585# Example: 1586# 1587# -> { "execute": "block-dirty-bitmap-add", 1588# "arguments": { "node": "drive0", "name": "bitmap0" } } 1589# <- { "return": {} } 1590# 1591## 1592{ 'command': 'block-dirty-bitmap-add', 1593 'data': 'BlockDirtyBitmapAdd' } 1594 1595## 1596# @block-dirty-bitmap-remove: 1597# 1598# Stop write tracking and remove the dirty bitmap that was created 1599# with block-dirty-bitmap-add. 1600# 1601# Returns: nothing on success 1602# If @node is not a valid block device or node, DeviceNotFound 1603# If @name is not found, GenericError with an explanation 1604# if @name is frozen by an operation, GenericError 1605# 1606# Since: 2.4 1607# 1608# Example: 1609# 1610# -> { "execute": "block-dirty-bitmap-remove", 1611# "arguments": { "node": "drive0", "name": "bitmap0" } } 1612# <- { "return": {} } 1613# 1614## 1615{ 'command': 'block-dirty-bitmap-remove', 1616 'data': 'BlockDirtyBitmap' } 1617 1618## 1619# @block-dirty-bitmap-clear: 1620# 1621# Clear (reset) a dirty bitmap on the device, so that an incremental 1622# backup from this point in time forward will only backup clusters 1623# modified after this clear operation. 1624# 1625# Returns: nothing on success 1626# If @node is not a valid block device, DeviceNotFound 1627# If @name is not found, GenericError with an explanation 1628# 1629# Since: 2.4 1630# 1631# Example: 1632# 1633# -> { "execute": "block-dirty-bitmap-clear", 1634# "arguments": { "node": "drive0", "name": "bitmap0" } } 1635# <- { "return": {} } 1636# 1637## 1638{ 'command': 'block-dirty-bitmap-clear', 1639 'data': 'BlockDirtyBitmap' } 1640 1641## 1642# @blockdev-mirror: 1643# 1644# Start mirroring a block device's writes to a new destination. 1645# 1646# @job-id: #optional identifier for the newly-created block job. If 1647# omitted, the device name will be used. (Since 2.7) 1648# 1649# @device: The device name or node-name of a root node whose writes should be 1650# mirrored. 1651# 1652# @target: the id or node-name of the block device to mirror to. This mustn't be 1653# attached to guest. 1654# 1655# @replaces: #optional with sync=full graph node name to be replaced by the new 1656# image when a whole image copy is done. This can be used to repair 1657# broken Quorum files. 1658# 1659# @speed: #optional the maximum speed, in bytes per second 1660# 1661# @sync: what parts of the disk image should be copied to the destination 1662# (all the disk, only the sectors allocated in the topmost image, or 1663# only new I/O). 1664# 1665# @granularity: #optional granularity of the dirty bitmap, default is 64K 1666# if the image format doesn't have clusters, 4K if the clusters 1667# are smaller than that, else the cluster size. Must be a 1668# power of 2 between 512 and 64M 1669# 1670# @buf-size: #optional maximum amount of data in flight from source to 1671# target 1672# 1673# @on-source-error: #optional the action to take on an error on the source, 1674# default 'report'. 'stop' and 'enospc' can only be used 1675# if the block device supports io-status (see BlockInfo). 1676# 1677# @on-target-error: #optional the action to take on an error on the target, 1678# default 'report' (no limitations, since this applies to 1679# a different block device than @device). 1680# 1681# @filter-node-name: #optional the node name that should be assigned to the 1682# filter driver that the mirror job inserts into the graph 1683# above @device. If this option is not given, a node name is 1684# autogenerated. (Since: 2.9) 1685# 1686# Returns: nothing on success. 1687# 1688# Since: 2.6 1689# 1690# Example: 1691# 1692# -> { "execute": "blockdev-mirror", 1693# "arguments": { "device": "ide-hd0", 1694# "target": "target0", 1695# "sync": "full" } } 1696# <- { "return": {} } 1697# 1698## 1699{ 'command': 'blockdev-mirror', 1700 'data': { '*job-id': 'str', 'device': 'str', 'target': 'str', 1701 '*replaces': 'str', 1702 'sync': 'MirrorSyncMode', 1703 '*speed': 'int', '*granularity': 'uint32', 1704 '*buf-size': 'int', '*on-source-error': 'BlockdevOnError', 1705 '*on-target-error': 'BlockdevOnError', 1706 '*filter-node-name': 'str' } } 1707 1708## 1709# @block_set_io_throttle: 1710# 1711# Change I/O throttle limits for a block drive. 1712# 1713# Since QEMU 2.4, each device with I/O limits is member of a throttle 1714# group. 1715# 1716# If two or more devices are members of the same group, the limits 1717# will apply to the combined I/O of the whole group in a round-robin 1718# fashion. Therefore, setting new I/O limits to a device will affect 1719# the whole group. 1720# 1721# The name of the group can be specified using the 'group' parameter. 1722# If the parameter is unset, it is assumed to be the current group of 1723# that device. If it's not in any group yet, the name of the device 1724# will be used as the name for its group. 1725# 1726# The 'group' parameter can also be used to move a device to a 1727# different group. In this case the limits specified in the parameters 1728# will be applied to the new group only. 1729# 1730# I/O limits can be disabled by setting all of them to 0. In this case 1731# the device will be removed from its group and the rest of its 1732# members will not be affected. The 'group' parameter is ignored. 1733# 1734# See BlockIOThrottle for parameter descriptions. 1735# 1736# Returns: Nothing on success 1737# If @device is not a valid block device, DeviceNotFound 1738# 1739# Since: 1.1 1740# 1741# Example: 1742# 1743# -> { "execute": "block_set_io_throttle", 1744# "arguments": { "id": "ide0-1-0", 1745# "bps": 1000000, 1746# "bps_rd": 0, 1747# "bps_wr": 0, 1748# "iops": 0, 1749# "iops_rd": 0, 1750# "iops_wr": 0, 1751# "bps_max": 8000000, 1752# "bps_rd_max": 0, 1753# "bps_wr_max": 0, 1754# "iops_max": 0, 1755# "iops_rd_max": 0, 1756# "iops_wr_max": 0, 1757# "bps_max_length": 60, 1758# "iops_size": 0 } } 1759# <- { "return": {} } 1760## 1761{ 'command': 'block_set_io_throttle', 'boxed': true, 1762 'data': 'BlockIOThrottle' } 1763 1764## 1765# @BlockIOThrottle: 1766# 1767# A set of parameters describing block throttling. 1768# 1769# @device: #optional Block device name (deprecated, use @id instead) 1770# 1771# @id: #optional The name or QOM path of the guest device (since: 2.8) 1772# 1773# @bps: total throughput limit in bytes per second 1774# 1775# @bps_rd: read throughput limit in bytes per second 1776# 1777# @bps_wr: write throughput limit in bytes per second 1778# 1779# @iops: total I/O operations per second 1780# 1781# @iops_rd: read I/O operations per second 1782# 1783# @iops_wr: write I/O operations per second 1784# 1785# @bps_max: #optional total throughput limit during bursts, 1786# in bytes (Since 1.7) 1787# 1788# @bps_rd_max: #optional read throughput limit during bursts, 1789# in bytes (Since 1.7) 1790# 1791# @bps_wr_max: #optional write throughput limit during bursts, 1792# in bytes (Since 1.7) 1793# 1794# @iops_max: #optional total I/O operations per second during bursts, 1795# in bytes (Since 1.7) 1796# 1797# @iops_rd_max: #optional read I/O operations per second during bursts, 1798# in bytes (Since 1.7) 1799# 1800# @iops_wr_max: #optional write I/O operations per second during bursts, 1801# in bytes (Since 1.7) 1802# 1803# @bps_max_length: #optional maximum length of the @bps_max burst 1804# period, in seconds. It must only 1805# be set if @bps_max is set as well. 1806# Defaults to 1. (Since 2.6) 1807# 1808# @bps_rd_max_length: #optional maximum length of the @bps_rd_max 1809# burst period, in seconds. It must only 1810# be set if @bps_rd_max is set as well. 1811# Defaults to 1. (Since 2.6) 1812# 1813# @bps_wr_max_length: #optional maximum length of the @bps_wr_max 1814# burst period, in seconds. It must only 1815# be set if @bps_wr_max is set as well. 1816# Defaults to 1. (Since 2.6) 1817# 1818# @iops_max_length: #optional maximum length of the @iops burst 1819# period, in seconds. It must only 1820# be set if @iops_max is set as well. 1821# Defaults to 1. (Since 2.6) 1822# 1823# @iops_rd_max_length: #optional maximum length of the @iops_rd_max 1824# burst period, in seconds. It must only 1825# be set if @iops_rd_max is set as well. 1826# Defaults to 1. (Since 2.6) 1827# 1828# @iops_wr_max_length: #optional maximum length of the @iops_wr_max 1829# burst period, in seconds. It must only 1830# be set if @iops_wr_max is set as well. 1831# Defaults to 1. (Since 2.6) 1832# 1833# @iops_size: #optional an I/O size in bytes (Since 1.7) 1834# 1835# @group: #optional throttle group name (Since 2.4) 1836# 1837# Since: 1.1 1838## 1839{ 'struct': 'BlockIOThrottle', 1840 'data': { '*device': 'str', '*id': 'str', 'bps': 'int', 'bps_rd': 'int', 1841 'bps_wr': 'int', 'iops': 'int', 'iops_rd': 'int', 'iops_wr': 'int', 1842 '*bps_max': 'int', '*bps_rd_max': 'int', 1843 '*bps_wr_max': 'int', '*iops_max': 'int', 1844 '*iops_rd_max': 'int', '*iops_wr_max': 'int', 1845 '*bps_max_length': 'int', '*bps_rd_max_length': 'int', 1846 '*bps_wr_max_length': 'int', '*iops_max_length': 'int', 1847 '*iops_rd_max_length': 'int', '*iops_wr_max_length': 'int', 1848 '*iops_size': 'int', '*group': 'str' } } 1849 1850## 1851# @block-stream: 1852# 1853# Copy data from a backing file into a block device. 1854# 1855# The block streaming operation is performed in the background until the entire 1856# backing file has been copied. This command returns immediately once streaming 1857# has started. The status of ongoing block streaming operations can be checked 1858# with query-block-jobs. The operation can be stopped before it has completed 1859# using the block-job-cancel command. 1860# 1861# The node that receives the data is called the top image, can be located in 1862# any part of the chain (but always above the base image; see below) and can be 1863# specified using its device or node name. Earlier qemu versions only allowed 1864# 'device' to name the top level node; presence of the 'base-node' parameter 1865# during introspection can be used as a witness of the enhanced semantics 1866# of 'device'. 1867# 1868# If a base file is specified then sectors are not copied from that base file and 1869# its backing chain. When streaming completes the image file will have the base 1870# file as its backing file. This can be used to stream a subset of the backing 1871# file chain instead of flattening the entire image. 1872# 1873# On successful completion the image file is updated to drop the backing file 1874# and the BLOCK_JOB_COMPLETED event is emitted. 1875# 1876# @job-id: #optional identifier for the newly-created block job. If 1877# omitted, the device name will be used. (Since 2.7) 1878# 1879# @device: the device or node name of the top image 1880# 1881# @base: #optional the common backing file name. 1882# It cannot be set if @base-node is also set. 1883# 1884# @base-node: #optional the node name of the backing file. 1885# It cannot be set if @base is also set. (Since 2.8) 1886# 1887# @backing-file: #optional The backing file string to write into the top 1888# image. This filename is not validated. 1889# 1890# If a pathname string is such that it cannot be 1891# resolved by QEMU, that means that subsequent QMP or 1892# HMP commands must use node-names for the image in 1893# question, as filename lookup methods will fail. 1894# 1895# If not specified, QEMU will automatically determine 1896# the backing file string to use, or error out if there 1897# is no obvious choice. Care should be taken when 1898# specifying the string, to specify a valid filename or 1899# protocol. 1900# (Since 2.1) 1901# 1902# @speed: #optional the maximum speed, in bytes per second 1903# 1904# @on-error: #optional the action to take on an error (default report). 1905# 'stop' and 'enospc' can only be used if the block device 1906# supports io-status (see BlockInfo). Since 1.3. 1907# 1908# Returns: Nothing on success. If @device does not exist, DeviceNotFound. 1909# 1910# Since: 1.1 1911# 1912# Example: 1913# 1914# -> { "execute": "block-stream", 1915# "arguments": { "device": "virtio0", 1916# "base": "/tmp/master.qcow2" } } 1917# <- { "return": {} } 1918# 1919## 1920{ 'command': 'block-stream', 1921 'data': { '*job-id': 'str', 'device': 'str', '*base': 'str', 1922 '*base-node': 'str', '*backing-file': 'str', '*speed': 'int', 1923 '*on-error': 'BlockdevOnError' } } 1924 1925## 1926# @block-job-set-speed: 1927# 1928# Set maximum speed for a background block operation. 1929# 1930# This command can only be issued when there is an active block job. 1931# 1932# Throttling can be disabled by setting the speed to 0. 1933# 1934# @device: The job identifier. This used to be a device name (hence 1935# the name of the parameter), but since QEMU 2.7 it can have 1936# other values. 1937# 1938# @speed: the maximum speed, in bytes per second, or 0 for unlimited. 1939# Defaults to 0. 1940# 1941# Returns: Nothing on success 1942# If no background operation is active on this device, DeviceNotActive 1943# 1944# Since: 1.1 1945## 1946{ 'command': 'block-job-set-speed', 1947 'data': { 'device': 'str', 'speed': 'int' } } 1948 1949## 1950# @block-job-cancel: 1951# 1952# Stop an active background block operation. 1953# 1954# This command returns immediately after marking the active background block 1955# operation for cancellation. It is an error to call this command if no 1956# operation is in progress. 1957# 1958# The operation will cancel as soon as possible and then emit the 1959# BLOCK_JOB_CANCELLED event. Before that happens the job is still visible when 1960# enumerated using query-block-jobs. 1961# 1962# For streaming, the image file retains its backing file unless the streaming 1963# operation happens to complete just as it is being cancelled. A new streaming 1964# operation can be started at a later time to finish copying all data from the 1965# backing file. 1966# 1967# @device: The job identifier. This used to be a device name (hence 1968# the name of the parameter), but since QEMU 2.7 it can have 1969# other values. 1970# 1971# @force: #optional whether to allow cancellation of a paused job (default 1972# false). Since 1.3. 1973# 1974# Returns: Nothing on success 1975# If no background operation is active on this device, DeviceNotActive 1976# 1977# Since: 1.1 1978## 1979{ 'command': 'block-job-cancel', 'data': { 'device': 'str', '*force': 'bool' } } 1980 1981## 1982# @block-job-pause: 1983# 1984# Pause an active background block operation. 1985# 1986# This command returns immediately after marking the active background block 1987# operation for pausing. It is an error to call this command if no 1988# operation is in progress. Pausing an already paused job has no cumulative 1989# effect; a single block-job-resume command will resume the job. 1990# 1991# The operation will pause as soon as possible. No event is emitted when 1992# the operation is actually paused. Cancelling a paused job automatically 1993# resumes it. 1994# 1995# @device: The job identifier. This used to be a device name (hence 1996# the name of the parameter), but since QEMU 2.7 it can have 1997# other values. 1998# 1999# Returns: Nothing on success 2000# If no background operation is active on this device, DeviceNotActive 2001# 2002# Since: 1.3 2003## 2004{ 'command': 'block-job-pause', 'data': { 'device': 'str' } } 2005 2006## 2007# @block-job-resume: 2008# 2009# Resume an active background block operation. 2010# 2011# This command returns immediately after resuming a paused background block 2012# operation. It is an error to call this command if no operation is in 2013# progress. Resuming an already running job is not an error. 2014# 2015# This command also clears the error status of the job. 2016# 2017# @device: The job identifier. This used to be a device name (hence 2018# the name of the parameter), but since QEMU 2.7 it can have 2019# other values. 2020# 2021# Returns: Nothing on success 2022# If no background operation is active on this device, DeviceNotActive 2023# 2024# Since: 1.3 2025## 2026{ 'command': 'block-job-resume', 'data': { 'device': 'str' } } 2027 2028## 2029# @block-job-complete: 2030# 2031# Manually trigger completion of an active background block operation. This 2032# is supported for drive mirroring, where it also switches the device to 2033# write to the target path only. The ability to complete is signaled with 2034# a BLOCK_JOB_READY event. 2035# 2036# This command completes an active background block operation synchronously. 2037# The ordering of this command's return with the BLOCK_JOB_COMPLETED event 2038# is not defined. Note that if an I/O error occurs during the processing of 2039# this command: 1) the command itself will fail; 2) the error will be processed 2040# according to the rerror/werror arguments that were specified when starting 2041# the operation. 2042# 2043# A cancelled or paused job cannot be completed. 2044# 2045# @device: The job identifier. This used to be a device name (hence 2046# the name of the parameter), but since QEMU 2.7 it can have 2047# other values. 2048# 2049# Returns: Nothing on success 2050# If no background operation is active on this device, DeviceNotActive 2051# 2052# Since: 1.3 2053## 2054{ 'command': 'block-job-complete', 'data': { 'device': 'str' } } 2055 2056## 2057# @BlockdevDiscardOptions: 2058# 2059# Determines how to handle discard requests. 2060# 2061# @ignore: Ignore the request 2062# @unmap: Forward as an unmap request 2063# 2064# Since: 1.7 2065## 2066{ 'enum': 'BlockdevDiscardOptions', 2067 'data': [ 'ignore', 'unmap' ] } 2068 2069## 2070# @BlockdevDetectZeroesOptions: 2071# 2072# Describes the operation mode for the automatic conversion of plain 2073# zero writes by the OS to driver specific optimized zero write commands. 2074# 2075# @off: Disabled (default) 2076# @on: Enabled 2077# @unmap: Enabled and even try to unmap blocks if possible. This requires 2078# also that @BlockdevDiscardOptions is set to unmap for this device. 2079# 2080# Since: 2.1 2081## 2082{ 'enum': 'BlockdevDetectZeroesOptions', 2083 'data': [ 'off', 'on', 'unmap' ] } 2084 2085## 2086# @BlockdevAioOptions: 2087# 2088# Selects the AIO backend to handle I/O requests 2089# 2090# @threads: Use qemu's thread pool 2091# @native: Use native AIO backend (only Linux and Windows) 2092# 2093# Since: 1.7 2094## 2095{ 'enum': 'BlockdevAioOptions', 2096 'data': [ 'threads', 'native' ] } 2097 2098## 2099# @BlockdevCacheOptions: 2100# 2101# Includes cache-related options for block devices 2102# 2103# @direct: #optional enables use of O_DIRECT (bypass the host page cache; 2104# default: false) 2105# @no-flush: #optional ignore any flush requests for the device (default: 2106# false) 2107# 2108# Since: 1.7 2109## 2110{ 'struct': 'BlockdevCacheOptions', 2111 'data': { '*direct': 'bool', 2112 '*no-flush': 'bool' } } 2113 2114## 2115# @BlockdevDriver: 2116# 2117# Drivers that are supported in block device operations. 2118# 2119# @host_device: Since 2.1 2120# @host_cdrom: Since 2.1 2121# @gluster: Since 2.7 2122# @nbd: Since 2.8 2123# @nfs: Since 2.8 2124# @replication: Since 2.8 2125# @ssh: Since 2.8 2126# @iscsi: Since 2.9 2127# @rbd: Since 2.9 2128# @sheepdog: Since 2.9 2129# 2130# Since: 2.0 2131## 2132{ 'enum': 'BlockdevDriver', 2133 'data': [ 'blkdebug', 'blkverify', 'bochs', 'cloop', 2134 'dmg', 'file', 'ftp', 'ftps', 'gluster', 'host_cdrom', 2135 'host_device', 'http', 'https', 'iscsi', 'luks', 'nbd', 'nfs', 2136 'null-aio', 'null-co', 'parallels', 'qcow', 'qcow2', 'qed', 2137 'quorum', 'raw', 'rbd', 'replication', 'sheepdog', 'ssh', 2138 'vdi', 'vhdx', 'vmdk', 'vpc', 'vvfat' ] } 2139 2140## 2141# @BlockdevOptionsFile: 2142# 2143# Driver specific block device options for the file backend. 2144# 2145# @filename: path to the image file 2146# @aio: #optional AIO backend (default: threads) (since: 2.8) 2147# 2148# Since: 1.7 2149## 2150{ 'struct': 'BlockdevOptionsFile', 2151 'data': { 'filename': 'str', 2152 '*aio': 'BlockdevAioOptions' } } 2153 2154## 2155# @BlockdevOptionsNull: 2156# 2157# Driver specific block device options for the null backend. 2158# 2159# @size: #optional size of the device in bytes. 2160# @latency-ns: #optional emulated latency (in nanoseconds) in processing 2161# requests. Default to zero which completes requests immediately. 2162# (Since 2.4) 2163# 2164# Since: 2.2 2165## 2166{ 'struct': 'BlockdevOptionsNull', 2167 'data': { '*size': 'int', '*latency-ns': 'uint64' } } 2168 2169## 2170# @BlockdevOptionsVVFAT: 2171# 2172# Driver specific block device options for the vvfat protocol. 2173# 2174# @dir: directory to be exported as FAT image 2175# @fat-type: #optional FAT type: 12, 16 or 32 2176# @floppy: #optional whether to export a floppy image (true) or 2177# partitioned hard disk (false; default) 2178# @label: #optional set the volume label, limited to 11 bytes. FAT16 and 2179# FAT32 traditionally have some restrictions on labels, which are 2180# ignored by most operating systems. Defaults to "QEMU VVFAT". 2181# (since 2.4) 2182# @rw: #optional whether to allow write operations (default: false) 2183# 2184# Since: 1.7 2185## 2186{ 'struct': 'BlockdevOptionsVVFAT', 2187 'data': { 'dir': 'str', '*fat-type': 'int', '*floppy': 'bool', 2188 '*label': 'str', '*rw': 'bool' } } 2189 2190## 2191# @BlockdevOptionsGenericFormat: 2192# 2193# Driver specific block device options for image format that have no option 2194# besides their data source. 2195# 2196# @file: reference to or definition of the data source block device 2197# 2198# Since: 1.7 2199## 2200{ 'struct': 'BlockdevOptionsGenericFormat', 2201 'data': { 'file': 'BlockdevRef' } } 2202 2203## 2204# @BlockdevOptionsLUKS: 2205# 2206# Driver specific block device options for LUKS. 2207# 2208# @key-secret: #optional the ID of a QCryptoSecret object providing 2209# the decryption key (since 2.6). Mandatory except when 2210# doing a metadata-only probe of the image. 2211# 2212# Since: 2.6 2213## 2214{ 'struct': 'BlockdevOptionsLUKS', 2215 'base': 'BlockdevOptionsGenericFormat', 2216 'data': { '*key-secret': 'str' } } 2217 2218 2219## 2220# @BlockdevOptionsGenericCOWFormat: 2221# 2222# Driver specific block device options for image format that have no option 2223# besides their data source and an optional backing file. 2224# 2225# @backing: #optional reference to or definition of the backing file block 2226# device (if missing, taken from the image file content). It is 2227# allowed to pass an empty string here in order to disable the 2228# default backing file. 2229# 2230# Since: 1.7 2231## 2232{ 'struct': 'BlockdevOptionsGenericCOWFormat', 2233 'base': 'BlockdevOptionsGenericFormat', 2234 'data': { '*backing': 'BlockdevRef' } } 2235 2236## 2237# @Qcow2OverlapCheckMode: 2238# 2239# General overlap check modes. 2240# 2241# @none: Do not perform any checks 2242# 2243# @constant: Perform only checks which can be done in constant time and 2244# without reading anything from disk 2245# 2246# @cached: Perform only checks which can be done without reading anything 2247# from disk 2248# 2249# @all: Perform all available overlap checks 2250# 2251# Since: 2.2 2252## 2253{ 'enum': 'Qcow2OverlapCheckMode', 2254 'data': [ 'none', 'constant', 'cached', 'all' ] } 2255 2256## 2257# @Qcow2OverlapCheckFlags: 2258# 2259# Structure of flags for each metadata structure. Setting a field to 'true' 2260# makes qemu guard that structure against unintended overwriting. The default 2261# value is chosen according to the template given. 2262# 2263# @template: Specifies a template mode which can be adjusted using the other 2264# flags, defaults to 'cached' 2265# 2266# Since: 2.2 2267## 2268{ 'struct': 'Qcow2OverlapCheckFlags', 2269 'data': { '*template': 'Qcow2OverlapCheckMode', 2270 '*main-header': 'bool', 2271 '*active-l1': 'bool', 2272 '*active-l2': 'bool', 2273 '*refcount-table': 'bool', 2274 '*refcount-block': 'bool', 2275 '*snapshot-table': 'bool', 2276 '*inactive-l1': 'bool', 2277 '*inactive-l2': 'bool' } } 2278 2279## 2280# @Qcow2OverlapChecks: 2281# 2282# Specifies which metadata structures should be guarded against unintended 2283# overwriting. 2284# 2285# @flags: set of flags for separate specification of each metadata structure 2286# type 2287# 2288# @mode: named mode which chooses a specific set of flags 2289# 2290# Since: 2.2 2291## 2292{ 'alternate': 'Qcow2OverlapChecks', 2293 'data': { 'flags': 'Qcow2OverlapCheckFlags', 2294 'mode': 'Qcow2OverlapCheckMode' } } 2295 2296## 2297# @BlockdevOptionsQcow2: 2298# 2299# Driver specific block device options for qcow2. 2300# 2301# @lazy-refcounts: #optional whether to enable the lazy refcounts 2302# feature (default is taken from the image file) 2303# 2304# @pass-discard-request: #optional whether discard requests to the qcow2 2305# device should be forwarded to the data source 2306# 2307# @pass-discard-snapshot: #optional whether discard requests for the data source 2308# should be issued when a snapshot operation (e.g. 2309# deleting a snapshot) frees clusters in the qcow2 file 2310# 2311# @pass-discard-other: #optional whether discard requests for the data source 2312# should be issued on other occasions where a cluster 2313# gets freed 2314# 2315# @overlap-check: #optional which overlap checks to perform for writes 2316# to the image, defaults to 'cached' (since 2.2) 2317# 2318# @cache-size: #optional the maximum total size of the L2 table and 2319# refcount block caches in bytes (since 2.2) 2320# 2321# @l2-cache-size: #optional the maximum size of the L2 table cache in 2322# bytes (since 2.2) 2323# 2324# @refcount-cache-size: #optional the maximum size of the refcount block cache 2325# in bytes (since 2.2) 2326# 2327# @cache-clean-interval: #optional clean unused entries in the L2 and refcount 2328# caches. The interval is in seconds. The default value 2329# is 0 and it disables this feature (since 2.5) 2330# 2331# Since: 1.7 2332## 2333{ 'struct': 'BlockdevOptionsQcow2', 2334 'base': 'BlockdevOptionsGenericCOWFormat', 2335 'data': { '*lazy-refcounts': 'bool', 2336 '*pass-discard-request': 'bool', 2337 '*pass-discard-snapshot': 'bool', 2338 '*pass-discard-other': 'bool', 2339 '*overlap-check': 'Qcow2OverlapChecks', 2340 '*cache-size': 'int', 2341 '*l2-cache-size': 'int', 2342 '*refcount-cache-size': 'int', 2343 '*cache-clean-interval': 'int' } } 2344 2345 2346## 2347# @BlockdevOptionsSsh: 2348# 2349# @server: host address 2350# 2351# @path: path to the image on the host 2352# 2353# @user: #optional user as which to connect, defaults to current 2354# local user name 2355# 2356# TODO: Expose the host_key_check option in QMP 2357# 2358# Since: 2.8 2359## 2360{ 'struct': 'BlockdevOptionsSsh', 2361 'data': { 'server': 'InetSocketAddress', 2362 'path': 'str', 2363 '*user': 'str' } } 2364 2365 2366## 2367# @BlkdebugEvent: 2368# 2369# Trigger events supported by blkdebug. 2370# 2371# Since: 2.0 2372## 2373{ 'enum': 'BlkdebugEvent', 'prefix': 'BLKDBG', 2374 'data': [ 'l1_update', 'l1_grow_alloc_table', 'l1_grow_write_table', 2375 'l1_grow_activate_table', 'l2_load', 'l2_update', 2376 'l2_update_compressed', 'l2_alloc_cow_read', 'l2_alloc_write', 2377 'read_aio', 'read_backing_aio', 'read_compressed', 'write_aio', 2378 'write_compressed', 'vmstate_load', 'vmstate_save', 'cow_read', 2379 'cow_write', 'reftable_load', 'reftable_grow', 'reftable_update', 2380 'refblock_load', 'refblock_update', 'refblock_update_part', 2381 'refblock_alloc', 'refblock_alloc_hookup', 'refblock_alloc_write', 2382 'refblock_alloc_write_blocks', 'refblock_alloc_write_table', 2383 'refblock_alloc_switch_table', 'cluster_alloc', 2384 'cluster_alloc_bytes', 'cluster_free', 'flush_to_os', 2385 'flush_to_disk', 'pwritev_rmw_head', 'pwritev_rmw_after_head', 2386 'pwritev_rmw_tail', 'pwritev_rmw_after_tail', 'pwritev', 2387 'pwritev_zero', 'pwritev_done', 'empty_image_prepare' ] } 2388 2389## 2390# @BlkdebugInjectErrorOptions: 2391# 2392# Describes a single error injection for blkdebug. 2393# 2394# @event: trigger event 2395# 2396# @state: #optional the state identifier blkdebug needs to be in to 2397# actually trigger the event; defaults to "any" 2398# 2399# @errno: #optional error identifier (errno) to be returned; defaults to 2400# EIO 2401# 2402# @sector: #optional specifies the sector index which has to be affected 2403# in order to actually trigger the event; defaults to "any 2404# sector" 2405# 2406# @once: #optional disables further events after this one has been 2407# triggered; defaults to false 2408# 2409# @immediately: #optional fail immediately; defaults to false 2410# 2411# Since: 2.0 2412## 2413{ 'struct': 'BlkdebugInjectErrorOptions', 2414 'data': { 'event': 'BlkdebugEvent', 2415 '*state': 'int', 2416 '*errno': 'int', 2417 '*sector': 'int', 2418 '*once': 'bool', 2419 '*immediately': 'bool' } } 2420 2421## 2422# @BlkdebugSetStateOptions: 2423# 2424# Describes a single state-change event for blkdebug. 2425# 2426# @event: trigger event 2427# 2428# @state: #optional the current state identifier blkdebug needs to be in; 2429# defaults to "any" 2430# 2431# @new_state: the state identifier blkdebug is supposed to assume if 2432# this event is triggered 2433# 2434# Since: 2.0 2435## 2436{ 'struct': 'BlkdebugSetStateOptions', 2437 'data': { 'event': 'BlkdebugEvent', 2438 '*state': 'int', 2439 'new_state': 'int' } } 2440 2441## 2442# @BlockdevOptionsBlkdebug: 2443# 2444# Driver specific block device options for blkdebug. 2445# 2446# @image: underlying raw block device (or image file) 2447# 2448# @config: #optional filename of the configuration file 2449# 2450# @align: #optional required alignment for requests in bytes, 2451# must be power of 2, or 0 for default 2452# 2453# @inject-error: #optional array of error injection descriptions 2454# 2455# @set-state: #optional array of state-change descriptions 2456# 2457# Since: 2.0 2458## 2459{ 'struct': 'BlockdevOptionsBlkdebug', 2460 'data': { 'image': 'BlockdevRef', 2461 '*config': 'str', 2462 '*align': 'int', 2463 '*inject-error': ['BlkdebugInjectErrorOptions'], 2464 '*set-state': ['BlkdebugSetStateOptions'] } } 2465 2466## 2467# @BlockdevOptionsBlkverify: 2468# 2469# Driver specific block device options for blkverify. 2470# 2471# @test: block device to be tested 2472# 2473# @raw: raw image used for verification 2474# 2475# Since: 2.0 2476## 2477{ 'struct': 'BlockdevOptionsBlkverify', 2478 'data': { 'test': 'BlockdevRef', 2479 'raw': 'BlockdevRef' } } 2480 2481## 2482# @QuorumReadPattern: 2483# 2484# An enumeration of quorum read patterns. 2485# 2486# @quorum: read all the children and do a quorum vote on reads 2487# 2488# @fifo: read only from the first child that has not failed 2489# 2490# Since: 2.2 2491## 2492{ 'enum': 'QuorumReadPattern', 'data': [ 'quorum', 'fifo' ] } 2493 2494## 2495# @BlockdevOptionsQuorum: 2496# 2497# Driver specific block device options for Quorum 2498# 2499# @blkverify: #optional true if the driver must print content mismatch 2500# set to false by default 2501# 2502# @children: the children block devices to use 2503# 2504# @vote-threshold: the vote limit under which a read will fail 2505# 2506# @rewrite-corrupted: #optional rewrite corrupted data when quorum is reached 2507# (Since 2.1) 2508# 2509# @read-pattern: #optional choose read pattern and set to quorum by default 2510# (Since 2.2) 2511# 2512# Since: 2.0 2513## 2514{ 'struct': 'BlockdevOptionsQuorum', 2515 'data': { '*blkverify': 'bool', 2516 'children': [ 'BlockdevRef' ], 2517 'vote-threshold': 'int', 2518 '*rewrite-corrupted': 'bool', 2519 '*read-pattern': 'QuorumReadPattern' } } 2520 2521## 2522# @BlockdevOptionsGluster: 2523# 2524# Driver specific block device options for Gluster 2525# 2526# @volume: name of gluster volume where VM image resides 2527# 2528# @path: absolute path to image file in gluster volume 2529# 2530# @server: gluster servers description 2531# 2532# @debug: #optional libgfapi log level (default '4' which is Error) 2533# (Since 2.8) 2534# 2535# @logfile: #optional libgfapi log file (default /dev/stderr) (Since 2.8) 2536# 2537# Since: 2.7 2538## 2539{ 'struct': 'BlockdevOptionsGluster', 2540 'data': { 'volume': 'str', 2541 'path': 'str', 2542 'server': ['SocketAddressFlat'], 2543 '*debug': 'int', 2544 '*logfile': 'str' } } 2545 2546## 2547# @IscsiTransport: 2548# 2549# An enumeration of libiscsi transport types 2550# 2551# Since: 2.9 2552## 2553{ 'enum': 'IscsiTransport', 2554 'data': [ 'tcp', 'iser' ] } 2555 2556## 2557# @IscsiHeaderDigest: 2558# 2559# An enumeration of header digests supported by libiscsi 2560# 2561# Since: 2.9 2562## 2563{ 'enum': 'IscsiHeaderDigest', 2564 'prefix': 'QAPI_ISCSI_HEADER_DIGEST', 2565 'data': [ 'crc32c', 'none', 'crc32c-none', 'none-crc32c' ] } 2566 2567## 2568# @BlockdevOptionsIscsi: 2569# 2570# @transport: The iscsi transport type 2571# 2572# @portal: The address of the iscsi portal 2573# 2574# @target: The target iqn name 2575# 2576# @lun: #optional LUN to connect to. Defaults to 0. 2577# 2578# @user: #optional User name to log in with. If omitted, no CHAP 2579# authentication is performed. 2580# 2581# @password-secret: #optional The ID of a QCryptoSecret object providing 2582# the password for the login. This option is required if 2583# @user is specified. 2584# 2585# @initiator-name: #optional The iqn name we want to identify to the target 2586# as. If this option is not specified, an initiator name is 2587# generated automatically. 2588# 2589# @header-digest: #optional The desired header digest. Defaults to 2590# none-crc32c. 2591# 2592# @timeout: #optional Timeout in seconds after which a request will 2593# timeout. 0 means no timeout and is the default. 2594# 2595# Driver specific block device options for iscsi 2596# 2597# Since: 2.9 2598## 2599{ 'struct': 'BlockdevOptionsIscsi', 2600 'data': { 'transport': 'IscsiTransport', 2601 'portal': 'str', 2602 'target': 'str', 2603 '*lun': 'int', 2604 '*user': 'str', 2605 '*password-secret': 'str', 2606 '*initiator-name': 'str', 2607 '*header-digest': 'IscsiHeaderDigest', 2608 '*timeout': 'int' } } 2609 2610 2611## 2612# @RbdAuthSupport: 2613# 2614# An enumeration of RBD auth support 2615# 2616# Since: 2.9 2617## 2618{ 'enum': 'RbdAuthSupport', 2619 'data': [ 'cephx', 'none' ] } 2620 2621 2622## 2623# @RbdAuthMethod: 2624# 2625# An enumeration of rados auth_supported types 2626# 2627# Since: 2.9 2628## 2629{ 'struct': 'RbdAuthMethod', 2630 'data': { 'auth': 'RbdAuthSupport' } } 2631 2632## 2633# @BlockdevOptionsRbd: 2634# 2635# @pool: Ceph pool name. 2636# 2637# @image: Image name in the Ceph pool. 2638# 2639# @conf: #optional path to Ceph configuration file. Values 2640# in the configuration file will be overridden by 2641# options specified via QAPI. 2642# 2643# @snapshot: #optional Ceph snapshot name. 2644# 2645# @user: #optional Ceph id name. 2646# 2647# @server: #optional Monitor host address and port. This maps 2648# to the "mon_host" Ceph option. 2649# 2650# @auth-supported: #optional Authentication supported. 2651# 2652# @password-secret: #optional The ID of a QCryptoSecret object providing 2653# the password for the login. 2654# 2655# Since: 2.9 2656## 2657{ 'struct': 'BlockdevOptionsRbd', 2658 'data': { 'pool': 'str', 2659 'image': 'str', 2660 '*conf': 'str', 2661 '*snapshot': 'str', 2662 '*user': 'str', 2663 '*server': ['InetSocketAddress'], 2664 '*auth-supported': ['RbdAuthMethod'], 2665 '*password-secret': 'str' } } 2666 2667## 2668# @BlockdevOptionsSheepdog: 2669# 2670# Driver specific block device options for sheepdog 2671# 2672# @vdi: Virtual disk image name 2673# @addr: The Sheepdog server to connect to 2674# @snap-id: Snapshot ID 2675# @tag: Snapshot tag name 2676# 2677# Only one of @snap-id and @tag may be present. 2678# 2679# Since: 2.9 2680## 2681{ 'struct': 'BlockdevOptionsSheepdog', 2682 'data': { 'addr': 'SocketAddressFlat', 2683 'vdi': 'str', 2684 '*snap-id': 'uint32', 2685 '*tag': 'str' } } 2686 2687## 2688# @ReplicationMode: 2689# 2690# An enumeration of replication modes. 2691# 2692# @primary: Primary mode, the vm's state will be sent to secondary QEMU. 2693# 2694# @secondary: Secondary mode, receive the vm's state from primary QEMU. 2695# 2696# Since: 2.8 2697## 2698{ 'enum' : 'ReplicationMode', 'data' : [ 'primary', 'secondary' ] } 2699 2700## 2701# @BlockdevOptionsReplication: 2702# 2703# Driver specific block device options for replication 2704# 2705# @mode: the replication mode 2706# 2707# @top-id: #optional In secondary mode, node name or device ID of the root 2708# node who owns the replication node chain. Must not be given in 2709# primary mode. 2710# 2711# Since: 2.8 2712## 2713{ 'struct': 'BlockdevOptionsReplication', 2714 'base': 'BlockdevOptionsGenericFormat', 2715 'data': { 'mode': 'ReplicationMode', 2716 '*top-id': 'str' } } 2717 2718## 2719# @NFSTransport: 2720# 2721# An enumeration of NFS transport types 2722# 2723# @inet: TCP transport 2724# 2725# Since: 2.8 2726## 2727{ 'enum': 'NFSTransport', 2728 'data': [ 'inet' ] } 2729 2730## 2731# @NFSServer: 2732# 2733# Captures the address of the socket 2734# 2735# @type: transport type used for NFS (only TCP supported) 2736# 2737# @host: host address for NFS server 2738# 2739# Since: 2.8 2740## 2741{ 'struct': 'NFSServer', 2742 'data': { 'type': 'NFSTransport', 2743 'host': 'str' } } 2744 2745## 2746# @BlockdevOptionsNfs: 2747# 2748# Driver specific block device option for NFS 2749# 2750# @server: host address 2751# 2752# @path: path of the image on the host 2753# 2754# @user: #optional UID value to use when talking to the 2755# server (defaults to 65534 on Windows and getuid() 2756# on unix) 2757# 2758# @group: #optional GID value to use when talking to the 2759# server (defaults to 65534 on Windows and getgid() 2760# in unix) 2761# 2762# @tcp-syn-count: #optional number of SYNs during the session 2763# establishment (defaults to libnfs default) 2764# 2765# @readahead-size: #optional set the readahead size in bytes (defaults 2766# to libnfs default) 2767# 2768# @page-cache-size: #optional set the pagecache size in bytes (defaults 2769# to libnfs default) 2770# 2771# @debug: #optional set the NFS debug level (max 2) (defaults 2772# to libnfs default) 2773# 2774# Since: 2.8 2775## 2776{ 'struct': 'BlockdevOptionsNfs', 2777 'data': { 'server': 'NFSServer', 2778 'path': 'str', 2779 '*user': 'int', 2780 '*group': 'int', 2781 '*tcp-syn-count': 'int', 2782 '*readahead-size': 'int', 2783 '*page-cache-size': 'int', 2784 '*debug': 'int' } } 2785 2786## 2787# @BlockdevOptionsCurl: 2788# 2789# Driver specific block device options for the curl backend. 2790# 2791# @filename: path to the image file 2792# 2793# Since: 1.7 2794## 2795{ 'struct': 'BlockdevOptionsCurl', 2796 'data': { 'filename': 'str' } } 2797 2798## 2799# @BlockdevOptionsNbd: 2800# 2801# Driver specific block device options for NBD. 2802# 2803# @server: NBD server address 2804# 2805# @export: #optional export name 2806# 2807# @tls-creds: #optional TLS credentials ID 2808# 2809# Since: 2.8 2810## 2811{ 'struct': 'BlockdevOptionsNbd', 2812 'data': { 'server': 'SocketAddress', 2813 '*export': 'str', 2814 '*tls-creds': 'str' } } 2815 2816## 2817# @BlockdevOptionsRaw: 2818# 2819# Driver specific block device options for the raw driver. 2820# 2821# @offset: #optional position where the block device starts 2822# @size: #optional the assumed size of the device 2823# 2824# Since: 2.8 2825## 2826{ 'struct': 'BlockdevOptionsRaw', 2827 'base': 'BlockdevOptionsGenericFormat', 2828 'data': { '*offset': 'int', '*size': 'int' } } 2829 2830## 2831# @BlockdevOptions: 2832# 2833# Options for creating a block device. Many options are available for all 2834# block devices, independent of the block driver: 2835# 2836# @driver: block driver name 2837# @node-name: #optional the node name of the new node (Since 2.0). 2838# This option is required on the top level of blockdev-add. 2839# @discard: #optional discard-related options (default: ignore) 2840# @cache: #optional cache-related options 2841# @read-only: #optional whether the block device should be read-only 2842# (default: false) 2843# @detect-zeroes: #optional detect and optimize zero writes (Since 2.1) 2844# (default: off) 2845# 2846# Remaining options are determined by the block driver. 2847# 2848# Since: 1.7 2849## 2850{ 'union': 'BlockdevOptions', 2851 'base': { 'driver': 'BlockdevDriver', 2852 '*node-name': 'str', 2853 '*discard': 'BlockdevDiscardOptions', 2854 '*cache': 'BlockdevCacheOptions', 2855 '*read-only': 'bool', 2856 '*detect-zeroes': 'BlockdevDetectZeroesOptions' }, 2857 'discriminator': 'driver', 2858 'data': { 2859 'blkdebug': 'BlockdevOptionsBlkdebug', 2860 'blkverify': 'BlockdevOptionsBlkverify', 2861 'bochs': 'BlockdevOptionsGenericFormat', 2862 'cloop': 'BlockdevOptionsGenericFormat', 2863 'dmg': 'BlockdevOptionsGenericFormat', 2864 'file': 'BlockdevOptionsFile', 2865 'ftp': 'BlockdevOptionsCurl', 2866 'ftps': 'BlockdevOptionsCurl', 2867 'gluster': 'BlockdevOptionsGluster', 2868 'host_cdrom': 'BlockdevOptionsFile', 2869 'host_device':'BlockdevOptionsFile', 2870 'http': 'BlockdevOptionsCurl', 2871 'https': 'BlockdevOptionsCurl', 2872 'iscsi': 'BlockdevOptionsIscsi', 2873 'luks': 'BlockdevOptionsLUKS', 2874 'nbd': 'BlockdevOptionsNbd', 2875 'nfs': 'BlockdevOptionsNfs', 2876 'null-aio': 'BlockdevOptionsNull', 2877 'null-co': 'BlockdevOptionsNull', 2878 'parallels': 'BlockdevOptionsGenericFormat', 2879 'qcow2': 'BlockdevOptionsQcow2', 2880 'qcow': 'BlockdevOptionsGenericCOWFormat', 2881 'qed': 'BlockdevOptionsGenericCOWFormat', 2882 'quorum': 'BlockdevOptionsQuorum', 2883 'raw': 'BlockdevOptionsRaw', 2884 'rbd': 'BlockdevOptionsRbd', 2885 'replication':'BlockdevOptionsReplication', 2886 'sheepdog': 'BlockdevOptionsSheepdog', 2887 'ssh': 'BlockdevOptionsSsh', 2888 'vdi': 'BlockdevOptionsGenericFormat', 2889 'vhdx': 'BlockdevOptionsGenericFormat', 2890 'vmdk': 'BlockdevOptionsGenericCOWFormat', 2891 'vpc': 'BlockdevOptionsGenericFormat', 2892 'vvfat': 'BlockdevOptionsVVFAT' 2893 } } 2894 2895## 2896# @BlockdevRef: 2897# 2898# Reference to a block device. 2899# 2900# @definition: defines a new block device inline 2901# @reference: references the ID of an existing block device. An 2902# empty string means that no block device should be 2903# referenced. 2904# 2905# Since: 1.7 2906## 2907{ 'alternate': 'BlockdevRef', 2908 'data': { 'definition': 'BlockdevOptions', 2909 'reference': 'str' } } 2910 2911## 2912# @blockdev-add: 2913# 2914# Creates a new block device. If the @id option is given at the top level, a 2915# BlockBackend will be created; otherwise, @node-name is mandatory at the top 2916# level and no BlockBackend will be created. 2917# 2918# For the arguments, see the documentation of BlockdevOptions. 2919# 2920# Note: This command is still a work in progress. It doesn't support all 2921# block drivers among other things. Stay away from it unless you want 2922# to help with its development. 2923# 2924# Since: 1.7 2925# 2926# Example: 2927# 2928# 1. 2929# -> { "execute": "blockdev-add", 2930# "arguments": { 2931# "driver": "qcow2", 2932# "node-name": "test1", 2933# "file": { 2934# "driver": "file", 2935# "filename": "test.qcow2" 2936# } 2937# } 2938# } 2939# <- { "return": {} } 2940# 2941# 2. 2942# -> { "execute": "blockdev-add", 2943# "arguments": { 2944# "driver": "qcow2", 2945# "node-name": "node0", 2946# "discard": "unmap", 2947# "cache": { 2948# "direct": true 2949# }, 2950# "file": { 2951# "driver": "file", 2952# "filename": "/tmp/test.qcow2" 2953# }, 2954# "backing": { 2955# "driver": "raw", 2956# "file": { 2957# "driver": "file", 2958# "filename": "/dev/fdset/4" 2959# } 2960# } 2961# } 2962# } 2963# 2964# <- { "return": {} } 2965# 2966## 2967{ 'command': 'blockdev-add', 'data': 'BlockdevOptions', 'boxed': true } 2968 2969## 2970# @x-blockdev-del: 2971# 2972# Deletes a block device that has been added using blockdev-add. 2973# The command will fail if the node is attached to a device or is 2974# otherwise being used. 2975# 2976# @node-name: Name of the graph node to delete. 2977# 2978# Note: This command is still a work in progress and is considered 2979# experimental. Stay away from it unless you want to help with its 2980# development. 2981# 2982# Since: 2.5 2983# 2984# Example: 2985# 2986# -> { "execute": "blockdev-add", 2987# "arguments": { 2988# "driver": "qcow2", 2989# "node-name": "node0", 2990# "file": { 2991# "driver": "file", 2992# "filename": "test.qcow2" 2993# } 2994# } 2995# } 2996# <- { "return": {} } 2997# 2998# -> { "execute": "x-blockdev-del", 2999# "arguments": { "node-name": "node0" } 3000# } 3001# <- { "return": {} } 3002# 3003## 3004{ 'command': 'x-blockdev-del', 'data': { 'node-name': 'str' } } 3005 3006## 3007# @blockdev-open-tray: 3008# 3009# Opens a block device's tray. If there is a block driver state tree inserted as 3010# a medium, it will become inaccessible to the guest (but it will remain 3011# associated to the block device, so closing the tray will make it accessible 3012# again). 3013# 3014# If the tray was already open before, this will be a no-op. 3015# 3016# Once the tray opens, a DEVICE_TRAY_MOVED event is emitted. There are cases in 3017# which no such event will be generated, these include: 3018# - if the guest has locked the tray, @force is false and the guest does not 3019# respond to the eject request 3020# - if the BlockBackend denoted by @device does not have a guest device attached 3021# to it 3022# - if the guest device does not have an actual tray 3023# 3024# @device: #optional Block device name (deprecated, use @id instead) 3025# 3026# @id: #optional The name or QOM path of the guest device (since: 2.8) 3027# 3028# @force: #optional if false (the default), an eject request will be sent to 3029# the guest if it has locked the tray (and the tray will not be opened 3030# immediately); if true, the tray will be opened regardless of whether 3031# it is locked 3032# 3033# Since: 2.5 3034# 3035# Example: 3036# 3037# -> { "execute": "blockdev-open-tray", 3038# "arguments": { "id": "ide0-1-0" } } 3039# 3040# <- { "timestamp": { "seconds": 1418751016, 3041# "microseconds": 716996 }, 3042# "event": "DEVICE_TRAY_MOVED", 3043# "data": { "device": "ide1-cd0", 3044# "id": "ide0-1-0", 3045# "tray-open": true } } 3046# 3047# <- { "return": {} } 3048# 3049## 3050{ 'command': 'blockdev-open-tray', 3051 'data': { '*device': 'str', 3052 '*id': 'str', 3053 '*force': 'bool' } } 3054 3055## 3056# @blockdev-close-tray: 3057# 3058# Closes a block device's tray. If there is a block driver state tree associated 3059# with the block device (which is currently ejected), that tree will be loaded 3060# as the medium. 3061# 3062# If the tray was already closed before, this will be a no-op. 3063# 3064# @device: #optional Block device name (deprecated, use @id instead) 3065# 3066# @id: #optional The name or QOM path of the guest device (since: 2.8) 3067# 3068# Since: 2.5 3069# 3070# Example: 3071# 3072# -> { "execute": "blockdev-close-tray", 3073# "arguments": { "id": "ide0-1-0" } } 3074# 3075# <- { "timestamp": { "seconds": 1418751345, 3076# "microseconds": 272147 }, 3077# "event": "DEVICE_TRAY_MOVED", 3078# "data": { "device": "ide1-cd0", 3079# "id": "ide0-1-0", 3080# "tray-open": false } } 3081# 3082# <- { "return": {} } 3083# 3084## 3085{ 'command': 'blockdev-close-tray', 3086 'data': { '*device': 'str', 3087 '*id': 'str' } } 3088 3089## 3090# @x-blockdev-remove-medium: 3091# 3092# Removes a medium (a block driver state tree) from a block device. That block 3093# device's tray must currently be open (unless there is no attached guest 3094# device). 3095# 3096# If the tray is open and there is no medium inserted, this will be a no-op. 3097# 3098# @device: #optional Block device name (deprecated, use @id instead) 3099# 3100# @id: #optional The name or QOM path of the guest device (since: 2.8) 3101# 3102# Note: This command is still a work in progress and is considered experimental. 3103# Stay away from it unless you want to help with its development. 3104# 3105# Since: 2.5 3106# 3107# Example: 3108# 3109# -> { "execute": "x-blockdev-remove-medium", 3110# "arguments": { "id": "ide0-1-0" } } 3111# 3112# <- { "error": { "class": "GenericError", 3113# "desc": "Tray of device 'ide0-1-0' is not open" } } 3114# 3115# -> { "execute": "blockdev-open-tray", 3116# "arguments": { "id": "ide0-1-0" } } 3117# 3118# <- { "timestamp": { "seconds": 1418751627, 3119# "microseconds": 549958 }, 3120# "event": "DEVICE_TRAY_MOVED", 3121# "data": { "device": "ide1-cd0", 3122# "id": "ide0-1-0", 3123# "tray-open": true } } 3124# 3125# <- { "return": {} } 3126# 3127# -> { "execute": "x-blockdev-remove-medium", 3128# "arguments": { "device": "ide0-1-0" } } 3129# 3130# <- { "return": {} } 3131# 3132## 3133{ 'command': 'x-blockdev-remove-medium', 3134 'data': { '*device': 'str', 3135 '*id': 'str' } } 3136 3137## 3138# @x-blockdev-insert-medium: 3139# 3140# Inserts a medium (a block driver state tree) into a block device. That block 3141# device's tray must currently be open (unless there is no attached guest 3142# device) and there must be no medium inserted already. 3143# 3144# @device: #optional Block device name (deprecated, use @id instead) 3145# 3146# @id: #optional The name or QOM path of the guest device (since: 2.8) 3147# 3148# @node-name: name of a node in the block driver state graph 3149# 3150# Note: This command is still a work in progress and is considered experimental. 3151# Stay away from it unless you want to help with its development. 3152# 3153# Since: 2.5 3154# 3155# Example: 3156# 3157# -> { "execute": "blockdev-add", 3158# "arguments": { 3159# "options": { "node-name": "node0", 3160# "driver": "raw", 3161# "file": { "driver": "file", 3162# "filename": "fedora.iso" } } } } 3163# <- { "return": {} } 3164# 3165# -> { "execute": "x-blockdev-insert-medium", 3166# "arguments": { "id": "ide0-1-0", 3167# "node-name": "node0" } } 3168# 3169# <- { "return": {} } 3170# 3171## 3172{ 'command': 'x-blockdev-insert-medium', 3173 'data': { '*device': 'str', 3174 '*id': 'str', 3175 'node-name': 'str'} } 3176 3177 3178## 3179# @BlockdevChangeReadOnlyMode: 3180# 3181# Specifies the new read-only mode of a block device subject to the 3182# @blockdev-change-medium command. 3183# 3184# @retain: Retains the current read-only mode 3185# 3186# @read-only: Makes the device read-only 3187# 3188# @read-write: Makes the device writable 3189# 3190# Since: 2.3 3191# 3192## 3193{ 'enum': 'BlockdevChangeReadOnlyMode', 3194 'data': ['retain', 'read-only', 'read-write'] } 3195 3196 3197## 3198# @blockdev-change-medium: 3199# 3200# Changes the medium inserted into a block device by ejecting the current medium 3201# and loading a new image file which is inserted as the new medium (this command 3202# combines blockdev-open-tray, x-blockdev-remove-medium, 3203# x-blockdev-insert-medium and blockdev-close-tray). 3204# 3205# @device: #optional Block device name (deprecated, use @id instead) 3206# 3207# @id: #optional The name or QOM path of the guest device 3208# (since: 2.8) 3209# 3210# @filename: filename of the new image to be loaded 3211# 3212# @format: #optional format to open the new image with (defaults to 3213# the probed format) 3214# 3215# @read-only-mode: #optional change the read-only mode of the device; defaults 3216# to 'retain' 3217# 3218# Since: 2.5 3219# 3220# Examples: 3221# 3222# 1. Change a removable medium 3223# 3224# -> { "execute": "blockdev-change-medium", 3225# "arguments": { "id": "ide0-1-0", 3226# "filename": "/srv/images/Fedora-12-x86_64-DVD.iso", 3227# "format": "raw" } } 3228# <- { "return": {} } 3229# 3230# 2. Load a read-only medium into a writable drive 3231# 3232# -> { "execute": "blockdev-change-medium", 3233# "arguments": { "id": "floppyA", 3234# "filename": "/srv/images/ro.img", 3235# "format": "raw", 3236# "read-only-mode": "retain" } } 3237# 3238# <- { "error": 3239# { "class": "GenericError", 3240# "desc": "Could not open '/srv/images/ro.img': Permission denied" } } 3241# 3242# -> { "execute": "blockdev-change-medium", 3243# "arguments": { "id": "floppyA", 3244# "filename": "/srv/images/ro.img", 3245# "format": "raw", 3246# "read-only-mode": "read-only" } } 3247# 3248# <- { "return": {} } 3249# 3250## 3251{ 'command': 'blockdev-change-medium', 3252 'data': { '*device': 'str', 3253 '*id': 'str', 3254 'filename': 'str', 3255 '*format': 'str', 3256 '*read-only-mode': 'BlockdevChangeReadOnlyMode' } } 3257 3258 3259## 3260# @BlockErrorAction: 3261# 3262# An enumeration of action that has been taken when a DISK I/O occurs 3263# 3264# @ignore: error has been ignored 3265# 3266# @report: error has been reported to the device 3267# 3268# @stop: error caused VM to be stopped 3269# 3270# Since: 2.1 3271## 3272{ 'enum': 'BlockErrorAction', 3273 'data': [ 'ignore', 'report', 'stop' ] } 3274 3275 3276## 3277# @BLOCK_IMAGE_CORRUPTED: 3278# 3279# Emitted when a disk image is being marked corrupt. The image can be 3280# identified by its device or node name. The 'device' field is always 3281# present for compatibility reasons, but it can be empty ("") if the 3282# image does not have a device name associated. 3283# 3284# @device: device name. This is always present for compatibility 3285# reasons, but it can be empty ("") if the image does not 3286# have a device name associated. 3287# 3288# @node-name: #optional node name (Since: 2.4) 3289# 3290# @msg: informative message for human consumption, such as the kind of 3291# corruption being detected. It should not be parsed by machine as it is 3292# not guaranteed to be stable 3293# 3294# @offset: #optional if the corruption resulted from an image access, this is 3295# the host's access offset into the image 3296# 3297# @size: #optional if the corruption resulted from an image access, this is 3298# the access size 3299# 3300# @fatal: if set, the image is marked corrupt and therefore unusable after this 3301# event and must be repaired (Since 2.2; before, every 3302# BLOCK_IMAGE_CORRUPTED event was fatal) 3303# 3304# Note: If action is "stop", a STOP event will eventually follow the 3305# BLOCK_IO_ERROR event. 3306# 3307# Example: 3308# 3309# <- { "event": "BLOCK_IMAGE_CORRUPTED", 3310# "data": { "device": "ide0-hd0", "node-name": "node0", 3311# "msg": "Prevented active L1 table overwrite", "offset": 196608, 3312# "size": 65536 }, 3313# "timestamp": { "seconds": 1378126126, "microseconds": 966463 } } 3314# 3315# Since: 1.7 3316## 3317{ 'event': 'BLOCK_IMAGE_CORRUPTED', 3318 'data': { 'device' : 'str', 3319 '*node-name' : 'str', 3320 'msg' : 'str', 3321 '*offset' : 'int', 3322 '*size' : 'int', 3323 'fatal' : 'bool' } } 3324 3325## 3326# @BLOCK_IO_ERROR: 3327# 3328# Emitted when a disk I/O error occurs 3329# 3330# @device: device name. This is always present for compatibility 3331# reasons, but it can be empty ("") if the image does not 3332# have a device name associated. 3333# 3334# @node-name: node name. Note that errors may be reported for the root node 3335# that is directly attached to a guest device rather than for the 3336# node where the error occurred. (Since: 2.8) 3337# 3338# @operation: I/O operation 3339# 3340# @action: action that has been taken 3341# 3342# @nospace: #optional true if I/O error was caused due to a no-space 3343# condition. This key is only present if query-block's 3344# io-status is present, please see query-block documentation 3345# for more information (since: 2.2) 3346# 3347# @reason: human readable string describing the error cause. 3348# (This field is a debugging aid for humans, it should not 3349# be parsed by applications) (since: 2.2) 3350# 3351# Note: If action is "stop", a STOP event will eventually follow the 3352# BLOCK_IO_ERROR event 3353# 3354# Since: 0.13.0 3355# 3356# Example: 3357# 3358# <- { "event": "BLOCK_IO_ERROR", 3359# "data": { "device": "ide0-hd1", 3360# "node-name": "#block212", 3361# "operation": "write", 3362# "action": "stop" }, 3363# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } 3364# 3365## 3366{ 'event': 'BLOCK_IO_ERROR', 3367 'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType', 3368 'action': 'BlockErrorAction', '*nospace': 'bool', 3369 'reason': 'str' } } 3370 3371## 3372# @BLOCK_JOB_COMPLETED: 3373# 3374# Emitted when a block job has completed 3375# 3376# @type: job type 3377# 3378# @device: The job identifier. Originally the device name but other 3379# values are allowed since QEMU 2.7 3380# 3381# @len: maximum progress value 3382# 3383# @offset: current progress value. On success this is equal to len. 3384# On failure this is less than len 3385# 3386# @speed: rate limit, bytes per second 3387# 3388# @error: #optional error message. Only present on failure. This field 3389# contains a human-readable error message. There are no semantics 3390# other than that streaming has failed and clients should not try to 3391# interpret the error string 3392# 3393# Since: 1.1 3394# 3395# Example: 3396# 3397# <- { "event": "BLOCK_JOB_COMPLETED", 3398# "data": { "type": "stream", "device": "virtio-disk0", 3399# "len": 10737418240, "offset": 10737418240, 3400# "speed": 0 }, 3401# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } } 3402# 3403## 3404{ 'event': 'BLOCK_JOB_COMPLETED', 3405 'data': { 'type' : 'BlockJobType', 3406 'device': 'str', 3407 'len' : 'int', 3408 'offset': 'int', 3409 'speed' : 'int', 3410 '*error': 'str' } } 3411 3412## 3413# @BLOCK_JOB_CANCELLED: 3414# 3415# Emitted when a block job has been cancelled 3416# 3417# @type: job type 3418# 3419# @device: The job identifier. Originally the device name but other 3420# values are allowed since QEMU 2.7 3421# 3422# @len: maximum progress value 3423# 3424# @offset: current progress value. On success this is equal to len. 3425# On failure this is less than len 3426# 3427# @speed: rate limit, bytes per second 3428# 3429# Since: 1.1 3430# 3431# Example: 3432# 3433# <- { "event": "BLOCK_JOB_CANCELLED", 3434# "data": { "type": "stream", "device": "virtio-disk0", 3435# "len": 10737418240, "offset": 134217728, 3436# "speed": 0 }, 3437# "timestamp": { "seconds": 1267061043, "microseconds": 959568 } } 3438# 3439## 3440{ 'event': 'BLOCK_JOB_CANCELLED', 3441 'data': { 'type' : 'BlockJobType', 3442 'device': 'str', 3443 'len' : 'int', 3444 'offset': 'int', 3445 'speed' : 'int' } } 3446 3447## 3448# @BLOCK_JOB_ERROR: 3449# 3450# Emitted when a block job encounters an error 3451# 3452# @device: The job identifier. Originally the device name but other 3453# values are allowed since QEMU 2.7 3454# 3455# @operation: I/O operation 3456# 3457# @action: action that has been taken 3458# 3459# Since: 1.3 3460# 3461# Example: 3462# 3463# <- { "event": "BLOCK_JOB_ERROR", 3464# "data": { "device": "ide0-hd1", 3465# "operation": "write", 3466# "action": "stop" }, 3467# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } 3468# 3469## 3470{ 'event': 'BLOCK_JOB_ERROR', 3471 'data': { 'device' : 'str', 3472 'operation': 'IoOperationType', 3473 'action' : 'BlockErrorAction' } } 3474 3475## 3476# @BLOCK_JOB_READY: 3477# 3478# Emitted when a block job is ready to complete 3479# 3480# @type: job type 3481# 3482# @device: The job identifier. Originally the device name but other 3483# values are allowed since QEMU 2.7 3484# 3485# @len: maximum progress value 3486# 3487# @offset: current progress value. On success this is equal to len. 3488# On failure this is less than len 3489# 3490# @speed: rate limit, bytes per second 3491# 3492# Note: The "ready to complete" status is always reset by a @BLOCK_JOB_ERROR 3493# event 3494# 3495# Since: 1.3 3496# 3497# Example: 3498# 3499# <- { "event": "BLOCK_JOB_READY", 3500# "data": { "device": "drive0", "type": "mirror", "speed": 0, 3501# "len": 2097152, "offset": 2097152 } 3502# "timestamp": { "seconds": 1265044230, "microseconds": 450486 } } 3503# 3504## 3505{ 'event': 'BLOCK_JOB_READY', 3506 'data': { 'type' : 'BlockJobType', 3507 'device': 'str', 3508 'len' : 'int', 3509 'offset': 'int', 3510 'speed' : 'int' } } 3511 3512## 3513# @PreallocMode: 3514# 3515# Preallocation mode of QEMU image file 3516# 3517# @off: no preallocation 3518# @metadata: preallocate only for metadata 3519# @falloc: like @full preallocation but allocate disk space by 3520# posix_fallocate() rather than writing zeros. 3521# @full: preallocate all data by writing zeros to device to ensure disk 3522# space is really available. @full preallocation also sets up 3523# metadata correctly. 3524# 3525# Since: 2.2 3526## 3527{ 'enum': 'PreallocMode', 3528 'data': [ 'off', 'metadata', 'falloc', 'full' ] } 3529 3530## 3531# @BLOCK_WRITE_THRESHOLD: 3532# 3533# Emitted when writes on block device reaches or exceeds the 3534# configured write threshold. For thin-provisioned devices, this 3535# means the device should be extended to avoid pausing for 3536# disk exhaustion. 3537# The event is one shot. Once triggered, it needs to be 3538# re-registered with another block-set-threshold command. 3539# 3540# @node-name: graph node name on which the threshold was exceeded. 3541# 3542# @amount-exceeded: amount of data which exceeded the threshold, in bytes. 3543# 3544# @write-threshold: last configured threshold, in bytes. 3545# 3546# Since: 2.3 3547## 3548{ 'event': 'BLOCK_WRITE_THRESHOLD', 3549 'data': { 'node-name': 'str', 3550 'amount-exceeded': 'uint64', 3551 'write-threshold': 'uint64' } } 3552 3553## 3554# @block-set-write-threshold: 3555# 3556# Change the write threshold for a block drive. An event will be 3557# delivered if a write to this block drive crosses the configured 3558# threshold. The threshold is an offset, thus must be 3559# non-negative. Default is no write threshold. Setting the threshold 3560# to zero disables it. 3561# 3562# This is useful to transparently resize thin-provisioned drives without 3563# the guest OS noticing. 3564# 3565# @node-name: graph node name on which the threshold must be set. 3566# 3567# @write-threshold: configured threshold for the block device, bytes. 3568# Use 0 to disable the threshold. 3569# 3570# Since: 2.3 3571# 3572# Example: 3573# 3574# -> { "execute": "block-set-write-threshold", 3575# "arguments": { "node-name": "mydev", 3576# "write-threshold": 17179869184 } } 3577# <- { "return": {} } 3578# 3579## 3580{ 'command': 'block-set-write-threshold', 3581 'data': { 'node-name': 'str', 'write-threshold': 'uint64' } } 3582 3583## 3584# @x-blockdev-change: 3585# 3586# Dynamically reconfigure the block driver state graph. It can be used 3587# to add, remove, insert or replace a graph node. Currently only the 3588# Quorum driver implements this feature to add or remove its child. This 3589# is useful to fix a broken quorum child. 3590# 3591# If @node is specified, it will be inserted under @parent. @child 3592# may not be specified in this case. If both @parent and @child are 3593# specified but @node is not, @child will be detached from @parent. 3594# 3595# @parent: the id or name of the parent node. 3596# 3597# @child: #optional the name of a child under the given parent node. 3598# 3599# @node: #optional the name of the node that will be added. 3600# 3601# Note: this command is experimental, and its API is not stable. It 3602# does not support all kinds of operations, all kinds of children, nor 3603# all block drivers. 3604# 3605# Warning: The data in a new quorum child MUST be consistent with that of 3606# the rest of the array. 3607# 3608# Since: 2.7 3609# 3610# Example: 3611# 3612# 1. Add a new node to a quorum 3613# -> { "execute": "blockdev-add", 3614# "arguments": { 3615# "options": { "driver": "raw", 3616# "node-name": "new_node", 3617# "file": { "driver": "file", 3618# "filename": "test.raw" } } } } 3619# <- { "return": {} } 3620# -> { "execute": "x-blockdev-change", 3621# "arguments": { "parent": "disk1", 3622# "node": "new_node" } } 3623# <- { "return": {} } 3624# 3625# 2. Delete a quorum's node 3626# -> { "execute": "x-blockdev-change", 3627# "arguments": { "parent": "disk1", 3628# "child": "children.1" } } 3629# <- { "return": {} } 3630# 3631## 3632{ 'command': 'x-blockdev-change', 3633 'data' : { 'parent': 'str', 3634 '*child': 'str', 3635 '*node': 'str' } } 3636