qcow2: try load bitmaps only once
[qemu/kevin.git] / qapi / net.json
blob9117c569723b81dc3209068f422911f1ec3d913c
1 # -*- Mode: Python -*-
4 ##
5 # = Net devices
6 ##
8 { 'include': 'common.json' }
11 # @set_link:
13 # Sets the link status of a virtual network adapter.
15 # @name: the device name of the virtual network adapter
17 # @up: true to set the link status to be up
19 # Returns: Nothing on success
20 #          If @name is not a valid network device, DeviceNotFound
22 # Since: 0.14.0
24 # Notes: Not all network adapters support setting link status.  This command
25 #        will succeed even if the network adapter does not support link status
26 #        notification.
28 # Example:
30 # -> { "execute": "set_link",
31 #      "arguments": { "name": "e1000.0", "up": false } }
32 # <- { "return": {} }
35 { 'command': 'set_link', 'data': {'name': 'str', 'up': 'bool'} }
38 # @netdev_add:
40 # Add a network backend.
42 # @type: the type of network backend. Possible values are listed in
43 #        NetClientDriver (excluding 'none' and 'nic')
45 # @id: the name of the new network backend
47 # Additional arguments depend on the type.
49 # TODO: This command effectively bypasses QAPI completely due to its
50 # "additional arguments" business.  It shouldn't have been added to
51 # the schema in this form.  It should be qapified properly, or
52 # replaced by a properly qapified command.
54 # Since: 0.14.0
56 # Returns: Nothing on success
57 #          If @type is not a valid network backend, DeviceNotFound
59 # Example:
61 # -> { "execute": "netdev_add",
62 #      "arguments": { "type": "user", "id": "netdev1",
63 #                     "dnssearch": "example.org" } }
64 # <- { "return": {} }
67 { 'command': 'netdev_add',
68   'data': {'type': 'str', 'id': 'str'},
69   'gen': false }                # so we can get the additional arguments
72 # @netdev_del:
74 # Remove a network backend.
76 # @id: the name of the network backend to remove
78 # Returns: Nothing on success
79 #          If @id is not a valid network backend, DeviceNotFound
81 # Since: 0.14.0
83 # Example:
85 # -> { "execute": "netdev_del", "arguments": { "id": "netdev1" } }
86 # <- { "return": {} }
89 { 'command': 'netdev_del', 'data': {'id': 'str'} }
92 # @NetdevNoneOptions:
94 # Use it alone to have zero network devices.
96 # Since: 1.2
98 { 'struct': 'NetdevNoneOptions',
99   'data': { } }
102 # @NetLegacyNicOptions:
104 # Create a new Network Interface Card.
106 # @netdev: id of -netdev to connect to
108 # @macaddr: MAC address
110 # @model: device model (e1000, rtl8139, virtio etc.)
112 # @addr: PCI device address
114 # @vectors: number of MSI-x vectors, 0 to disable MSI-X
116 # Since: 1.2
118 { 'struct': 'NetLegacyNicOptions',
119   'data': {
120     '*netdev':  'str',
121     '*macaddr': 'str',
122     '*model':   'str',
123     '*addr':    'str',
124     '*vectors': 'uint32' } }
127 # @NetdevUserOptions:
129 # Use the user mode network stack which requires no administrator privilege to
130 # run.
132 # @hostname: client hostname reported by the builtin DHCP server
134 # @restrict: isolate the guest from the host
136 # @ipv4: whether to support IPv4, default true for enabled
137 #        (since 2.6)
139 # @ipv6: whether to support IPv6, default true for enabled
140 #        (since 2.6)
142 # @ip: legacy parameter, use net= instead
144 # @net: IP network address that the guest will see, in the
145 #       form addr[/netmask] The netmask is optional, and can be
146 #       either in the form a.b.c.d or as a number of valid top-most
147 #       bits. Default is 10.0.2.0/24.
149 # @host: guest-visible address of the host
151 # @tftp: root directory of the built-in TFTP server
153 # @bootfile: BOOTP filename, for use with tftp=
155 # @dhcpstart: the first of the 16 IPs the built-in DHCP server can
156 #             assign
158 # @dns: guest-visible address of the virtual nameserver
160 # @dnssearch: list of DNS suffixes to search, passed as DHCP option
161 #             to the guest
163 # @ipv6-prefix: IPv6 network prefix (default is fec0::) (since
164 #               2.6). The network prefix is given in the usual
165 #               hexadecimal IPv6 address notation.
167 # @ipv6-prefixlen: IPv6 network prefix length (default is 64)
168 #                  (since 2.6)
170 # @ipv6-host: guest-visible IPv6 address of the host (since 2.6)
172 # @ipv6-dns: guest-visible IPv6 address of the virtual
173 #            nameserver (since 2.6)
175 # @smb: root directory of the built-in SMB server
177 # @smbserver: IP address of the built-in SMB server
179 # @hostfwd: redirect incoming TCP or UDP host connections to guest
180 #           endpoints
182 # @guestfwd: forward guest TCP connections
184 # Since: 1.2
186 { 'struct': 'NetdevUserOptions',
187   'data': {
188     '*hostname':  'str',
189     '*restrict':  'bool',
190     '*ipv4':      'bool',
191     '*ipv6':      'bool',
192     '*ip':        'str',
193     '*net':       'str',
194     '*host':      'str',
195     '*tftp':      'str',
196     '*bootfile':  'str',
197     '*dhcpstart': 'str',
198     '*dns':       'str',
199     '*dnssearch': ['String'],
200     '*ipv6-prefix':      'str',
201     '*ipv6-prefixlen':   'int',
202     '*ipv6-host':        'str',
203     '*ipv6-dns':         'str',
204     '*smb':       'str',
205     '*smbserver': 'str',
206     '*hostfwd':   ['String'],
207     '*guestfwd':  ['String'] } }
210 # @NetdevTapOptions:
212 # Connect the host TAP network interface name to the VLAN.
214 # @ifname: interface name
216 # @fd: file descriptor of an already opened tap
218 # @fds: multiple file descriptors of already opened multiqueue capable
219 # tap
221 # @script: script to initialize the interface
223 # @downscript: script to shut down the interface
225 # @br: bridge name (since 2.8)
227 # @helper: command to execute to configure bridge
229 # @sndbuf: send buffer limit. Understands [TGMKkb] suffixes.
231 # @vnet_hdr: enable the IFF_VNET_HDR flag on the tap interface
233 # @vhost: enable vhost-net network accelerator
235 # @vhostfd: file descriptor of an already opened vhost net device
237 # @vhostfds: file descriptors of multiple already opened vhost net
238 # devices
240 # @vhostforce: vhost on for non-MSIX virtio guests
242 # @queues: number of queues to be created for multiqueue capable tap
244 # @poll-us: maximum number of microseconds that could
245 # be spent on busy polling for tap (since 2.7)
247 # Since: 1.2
249 { 'struct': 'NetdevTapOptions',
250   'data': {
251     '*ifname':     'str',
252     '*fd':         'str',
253     '*fds':        'str',
254     '*script':     'str',
255     '*downscript': 'str',
256     '*br':         'str',
257     '*helper':     'str',
258     '*sndbuf':     'size',
259     '*vnet_hdr':   'bool',
260     '*vhost':      'bool',
261     '*vhostfd':    'str',
262     '*vhostfds':   'str',
263     '*vhostforce': 'bool',
264     '*queues':     'uint32',
265     '*poll-us':    'uint32'} }
268 # @NetdevSocketOptions:
270 # Connect the VLAN to a remote VLAN in another QEMU virtual machine using a TCP
271 # socket connection.
273 # @fd: file descriptor of an already opened socket
275 # @listen: port number, and optional hostname, to listen on
277 # @connect: port number, and optional hostname, to connect to
279 # @mcast: UDP multicast address and port number
281 # @localaddr: source address and port for multicast and udp packets
283 # @udp: UDP unicast address and port number
285 # Since: 1.2
287 { 'struct': 'NetdevSocketOptions',
288   'data': {
289     '*fd':        'str',
290     '*listen':    'str',
291     '*connect':   'str',
292     '*mcast':     'str',
293     '*localaddr': 'str',
294     '*udp':       'str' } }
297 # @NetdevL2TPv3Options:
299 # Connect the VLAN to Ethernet over L2TPv3 Static tunnel
301 # @src: source address
303 # @dst: destination address
305 # @srcport: source port - mandatory for udp, optional for ip
307 # @dstport: destination port - mandatory for udp, optional for ip
309 # @ipv6: force the use of ipv6
311 # @udp: use the udp version of l2tpv3 encapsulation
313 # @cookie64: use 64 bit coookies
315 # @counter: have sequence counter
317 # @pincounter: pin sequence counter to zero -
318 #              workaround for buggy implementations or
319 #              networks with packet reorder
321 # @txcookie: 32 or 64 bit transmit cookie
323 # @rxcookie: 32 or 64 bit receive cookie
325 # @txsession: 32 bit transmit session
327 # @rxsession: 32 bit receive session - if not specified
328 #             set to the same value as transmit
330 # @offset: additional offset - allows the insertion of
331 #          additional application-specific data before the packet payload
333 # Since: 2.1
335 { 'struct': 'NetdevL2TPv3Options',
336   'data': {
337     'src':          'str',
338     'dst':          'str',
339     '*srcport':     'str',
340     '*dstport':     'str',
341     '*ipv6':        'bool',
342     '*udp':         'bool',
343     '*cookie64':    'bool',
344     '*counter':     'bool',
345     '*pincounter':  'bool',
346     '*txcookie':    'uint64',
347     '*rxcookie':    'uint64',
348     'txsession':    'uint32',
349     '*rxsession':   'uint32',
350     '*offset':      'uint32' } }
353 # @NetdevVdeOptions:
355 # Connect the VLAN to a vde switch running on the host.
357 # @sock: socket path
359 # @port: port number
361 # @group: group owner of socket
363 # @mode: permissions for socket
365 # Since: 1.2
367 { 'struct': 'NetdevVdeOptions',
368   'data': {
369     '*sock':  'str',
370     '*port':  'uint16',
371     '*group': 'str',
372     '*mode':  'uint16' } }
375 # @NetdevBridgeOptions:
377 # Connect a host TAP network interface to a host bridge device.
379 # @br: bridge name
381 # @helper: command to execute to configure bridge
383 # Since: 1.2
385 { 'struct': 'NetdevBridgeOptions',
386   'data': {
387     '*br':     'str',
388     '*helper': 'str' } }
391 # @NetdevHubPortOptions:
393 # Connect two or more net clients through a software hub.
395 # @hubid: hub identifier number
396 # @netdev: used to connect hub to a netdev instead of a device (since 2.12)
398 # Since: 1.2
400 { 'struct': 'NetdevHubPortOptions',
401   'data': {
402     'hubid':     'int32',
403     '*netdev':    'str' } }
406 # @NetdevNetmapOptions:
408 # Connect a client to a netmap-enabled NIC or to a VALE switch port
410 # @ifname: Either the name of an existing network interface supported by
411 #          netmap, or the name of a VALE port (created on the fly).
412 #          A VALE port name is in the form 'valeXXX:YYY', where XXX and
413 #          YYY are non-negative integers. XXX identifies a switch and
414 #          YYY identifies a port of the switch. VALE ports having the
415 #          same XXX are therefore connected to the same switch.
417 # @devname: path of the netmap device (default: '/dev/netmap').
419 # Since: 2.0
421 { 'struct': 'NetdevNetmapOptions',
422   'data': {
423     'ifname':     'str',
424     '*devname':    'str' } }
427 # @NetdevVhostUserOptions:
429 # Vhost-user network backend
431 # @chardev: name of a unix socket chardev
433 # @vhostforce: vhost on for non-MSIX virtio guests (default: false).
435 # @queues: number of queues to be created for multiqueue vhost-user
436 #          (default: 1) (Since 2.5)
438 # Since: 2.1
440 { 'struct': 'NetdevVhostUserOptions',
441   'data': {
442     'chardev':        'str',
443     '*vhostforce':    'bool',
444     '*queues':        'int' } }
447 # @NetClientDriver:
449 # Available netdev drivers.
451 # Since: 2.7
453 # 'dump' - removed with 2.12
455 { 'enum': 'NetClientDriver',
456   'data': [ 'none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
457             'bridge', 'hubport', 'netmap', 'vhost-user' ] }
460 # @Netdev:
462 # Captures the configuration of a network device.
464 # @id: identifier for monitor commands.
466 # @type: Specify the driver used for interpreting remaining arguments.
468 # Since: 1.2
470 # 'l2tpv3' - since 2.1
472 { 'union': 'Netdev',
473   'base': { 'id': 'str', 'type': 'NetClientDriver' },
474   'discriminator': 'type',
475   'data': {
476     'none':     'NetdevNoneOptions',
477     'nic':      'NetLegacyNicOptions',
478     'user':     'NetdevUserOptions',
479     'tap':      'NetdevTapOptions',
480     'l2tpv3':   'NetdevL2TPv3Options',
481     'socket':   'NetdevSocketOptions',
482     'vde':      'NetdevVdeOptions',
483     'bridge':   'NetdevBridgeOptions',
484     'hubport':  'NetdevHubPortOptions',
485     'netmap':   'NetdevNetmapOptions',
486     'vhost-user': 'NetdevVhostUserOptions' } }
489 # @NetLegacy:
491 # Captures the configuration of a network device; legacy.
493 # @vlan: vlan number
495 # @id: identifier for monitor commands
497 # @name: identifier for monitor commands, ignored if @id is present
499 # @opts: device type specific properties (legacy)
501 # Since: 1.2
503 { 'struct': 'NetLegacy',
504   'data': {
505     '*vlan': 'int32',
506     '*id':   'str',
507     '*name': 'str',
508     'opts':  'NetLegacyOptions' } }
511 # @NetLegacyOptionsType:
513 # Since: 1.2
515 { 'enum': 'NetLegacyOptionsType',
516   'data': ['none', 'nic', 'user', 'tap', 'l2tpv3', 'socket', 'vde',
517            'bridge', 'netmap', 'vhost-user'] }
520 # @NetLegacyOptions:
522 # Like Netdev, but for use only by the legacy command line options
524 # Since: 1.2
526 { 'union': 'NetLegacyOptions',
527   'base': { 'type': 'NetLegacyOptionsType' },
528   'discriminator': 'type',
529   'data': {
530     'none':     'NetdevNoneOptions',
531     'nic':      'NetLegacyNicOptions',
532     'user':     'NetdevUserOptions',
533     'tap':      'NetdevTapOptions',
534     'l2tpv3':   'NetdevL2TPv3Options',
535     'socket':   'NetdevSocketOptions',
536     'vde':      'NetdevVdeOptions',
537     'bridge':   'NetdevBridgeOptions',
538     'netmap':   'NetdevNetmapOptions',
539     'vhost-user': 'NetdevVhostUserOptions' } }
542 # @NetFilterDirection:
544 # Indicates whether a netfilter is attached to a netdev's transmit queue or
545 # receive queue or both.
547 # @all: the filter is attached both to the receive and the transmit
548 #       queue of the netdev (default).
550 # @rx: the filter is attached to the receive queue of the netdev,
551 #      where it will receive packets sent to the netdev.
553 # @tx: the filter is attached to the transmit queue of the netdev,
554 #      where it will receive packets sent by the netdev.
556 # Since: 2.5
558 { 'enum': 'NetFilterDirection',
559   'data': [ 'all', 'rx', 'tx' ] }
562 # @RxState:
564 # Packets receiving state
566 # @normal: filter assigned packets according to the mac-table
568 # @none: don't receive any assigned packet
570 # @all: receive all assigned packets
572 # Since: 1.6
574 { 'enum': 'RxState', 'data': [ 'normal', 'none', 'all' ] }
577 # @RxFilterInfo:
579 # Rx-filter information for a NIC.
581 # @name: net client name
583 # @promiscuous: whether promiscuous mode is enabled
585 # @multicast: multicast receive state
587 # @unicast: unicast receive state
589 # @vlan: vlan receive state (Since 2.0)
591 # @broadcast-allowed: whether to receive broadcast
593 # @multicast-overflow: multicast table is overflowed or not
595 # @unicast-overflow: unicast table is overflowed or not
597 # @main-mac: the main macaddr string
599 # @vlan-table: a list of active vlan id
601 # @unicast-table: a list of unicast macaddr string
603 # @multicast-table: a list of multicast macaddr string
605 # Since: 1.6
607 { 'struct': 'RxFilterInfo',
608   'data': {
609     'name':               'str',
610     'promiscuous':        'bool',
611     'multicast':          'RxState',
612     'unicast':            'RxState',
613     'vlan':               'RxState',
614     'broadcast-allowed':  'bool',
615     'multicast-overflow': 'bool',
616     'unicast-overflow':   'bool',
617     'main-mac':           'str',
618     'vlan-table':         ['int'],
619     'unicast-table':      ['str'],
620     'multicast-table':    ['str'] }}
623 # @query-rx-filter:
625 # Return rx-filter information for all NICs (or for the given NIC).
627 # @name: net client name
629 # Returns: list of @RxFilterInfo for all NICs (or for the given NIC).
630 #          Returns an error if the given @name doesn't exist, or given
631 #          NIC doesn't support rx-filter querying, or given net client
632 #          isn't a NIC.
634 # Since: 1.6
636 # Example:
638 # -> { "execute": "query-rx-filter", "arguments": { "name": "vnet0" } }
639 # <- { "return": [
640 #         {
641 #             "promiscuous": true,
642 #             "name": "vnet0",
643 #             "main-mac": "52:54:00:12:34:56",
644 #             "unicast": "normal",
645 #             "vlan": "normal",
646 #             "vlan-table": [
647 #                 4,
648 #                 0
649 #             ],
650 #             "unicast-table": [
651 #             ],
652 #             "multicast": "normal",
653 #             "multicast-overflow": false,
654 #             "unicast-overflow": false,
655 #             "multicast-table": [
656 #                 "01:00:5e:00:00:01",
657 #                 "33:33:00:00:00:01",
658 #                 "33:33:ff:12:34:56"
659 #             ],
660 #             "broadcast-allowed": false
661 #         }
662 #       ]
663 #    }
666 { 'command': 'query-rx-filter', 'data': { '*name': 'str' },
667   'returns': ['RxFilterInfo'] }
670 # @NIC_RX_FILTER_CHANGED:
672 # Emitted once until the 'query-rx-filter' command is executed, the first event
673 # will always be emitted
675 # @name: net client name
677 # @path: device path
679 # Since: 1.6
681 # Example:
683 # <- { "event": "NIC_RX_FILTER_CHANGED",
684 #      "data": { "name": "vnet0",
685 #                "path": "/machine/peripheral/vnet0/virtio-backend" },
686 #      "timestamp": { "seconds": 1368697518, "microseconds": 326866 } }
687 #    }
690 { 'event': 'NIC_RX_FILTER_CHANGED',
691   'data': { '*name': 'str', 'path': 'str' } }