qapi: Polish command flags documentation in qapi-code-gen.txt
Signed-off-by: Markus Armbruster <armbru@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20180703085358.13941-33-armbru@redhat.com>
This commit is contained in:
		
							parent
							
								
									774a6b67a4
								
							
						
					
					
						commit
						153d73f320
					
				@ -624,60 +624,48 @@ its return value.
 | 
				
			|||||||
In rare cases, QAPI cannot express a type-safe representation of a
 | 
					In rare cases, QAPI cannot express a type-safe representation of a
 | 
				
			||||||
corresponding Client JSON Protocol command.  You then have to suppress
 | 
					corresponding Client JSON Protocol command.  You then have to suppress
 | 
				
			||||||
generation of a marshalling function by including a key 'gen' with
 | 
					generation of a marshalling function by including a key 'gen' with
 | 
				
			||||||
boolean value false, and instead write your own function.  Please try
 | 
					boolean value false, and instead write your own function.  For
 | 
				
			||||||
to avoid adding new commands that rely on this, and instead use
 | 
					example:
 | 
				
			||||||
type-safe unions.  For an example of this usage:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 { 'command': 'netdev_add',
 | 
					 { 'command': 'netdev_add',
 | 
				
			||||||
   'data': {'type': 'str', 'id': 'str'},
 | 
					   'data': {'type': 'str', 'id': 'str'},
 | 
				
			||||||
   'gen': false }
 | 
					   'gen': false }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					Please try to avoid adding new commands that rely on this, and instead
 | 
				
			||||||
 | 
					use type-safe unions.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Normally, the QAPI schema is used to describe synchronous exchanges,
 | 
					Normally, the QAPI schema is used to describe synchronous exchanges,
 | 
				
			||||||
where a response is expected.  But in some cases, the action of a
 | 
					where a response is expected.  But in some cases, the action of a
 | 
				
			||||||
command is expected to change state in a way that a successful
 | 
					command is expected to change state in a way that a successful
 | 
				
			||||||
response is not possible (although the command will still return a
 | 
					response is not possible (although the command will still return a
 | 
				
			||||||
normal dictionary error on failure).  When a successful reply is not
 | 
					normal dictionary error on failure).  When a successful reply is not
 | 
				
			||||||
possible, the command expression should include the optional key
 | 
					possible, the command expression includes the optional key
 | 
				
			||||||
'success-response' with boolean value false.  So far, only QGA makes
 | 
					'success-response' with boolean value false.  So far, only QGA makes
 | 
				
			||||||
use of this member.
 | 
					use of this member.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A command can be declared to support out-of-band (OOB) execution.  By
 | 
					Key 'allow-oob' declares whether the command supports out-of-band
 | 
				
			||||||
default, commands do not support OOB.  To declare a command that
 | 
					(OOB) execution.  It defaults to false.  For example:
 | 
				
			||||||
supports it, the schema includes an extra 'allow-oob' field.  For
 | 
					 | 
				
			||||||
example:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 { 'command': 'migrate_recover',
 | 
					 { 'command': 'migrate_recover',
 | 
				
			||||||
   'data': { 'uri': 'str' }, 'allow-oob': true }
 | 
					   'data': { 'uri': 'str' }, 'allow-oob': true }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To execute a command with out-of-band priority, the client uses key
 | 
					See qmp-spec.txt for out-of-band execution syntax and semantics.
 | 
				
			||||||
"exec-oob" instead of "execute".  Example:
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 => { "exec-oob": "migrate-recover",
 | 
					Commands supporting out-of-band execution can still be executed
 | 
				
			||||||
      "arguments": { "uri": "tcp:192.168.1.200:12345" } }
 | 
					in-band.
 | 
				
			||||||
 <= { "return": { } }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
Without it, even the commands that support out-of-band execution will
 | 
					When a command is executed in-band, its handler runs in the main
 | 
				
			||||||
still be run in-band.
 | 
					thread with the BQL held.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Under normal QMP command execution, the following apply to each
 | 
					When a command is executed out-of-band, its handler runs in a
 | 
				
			||||||
command:
 | 
					dedicated monitor I/O thread with the BQL *not* held.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- They are executed in order,
 | 
					An OOB-capable command handler must satisfy the following conditions:
 | 
				
			||||||
- They run only in main thread of QEMU,
 | 
					 | 
				
			||||||
- They run with the BQL held.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
When a command is executed with OOB, the following changes occur:
 | 
					- It terminates quickly.
 | 
				
			||||||
 | 
					- It does not invoke system calls that may block.
 | 
				
			||||||
- They can be completed before a pending in-band command,
 | 
					 | 
				
			||||||
- They run in a dedicated monitor thread,
 | 
					 | 
				
			||||||
- They run with the BQL not held.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
OOB command handlers must satisfy the following conditions:
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
- It terminates quickly,
 | 
					 | 
				
			||||||
- It does not invoke system calls that may block,
 | 
					 | 
				
			||||||
- It does not access guest RAM that may block when userfaultfd is
 | 
					- It does not access guest RAM that may block when userfaultfd is
 | 
				
			||||||
  enabled for postcopy live migration,
 | 
					  enabled for postcopy live migration.
 | 
				
			||||||
- It takes only "fast" locks, i.e. all critical sections protected by
 | 
					- It takes only "fast" locks, i.e. all critical sections protected by
 | 
				
			||||||
  any lock it takes also satisfy the conditions for OOB command
 | 
					  any lock it takes also satisfy the conditions for OOB command
 | 
				
			||||||
  handler code.
 | 
					  handler code.
 | 
				
			||||||
@ -686,17 +674,18 @@ The restrictions on locking limit access to shared state.  Such access
 | 
				
			|||||||
requires synchronization, but OOB commands can't take the BQL or any
 | 
					requires synchronization, but OOB commands can't take the BQL or any
 | 
				
			||||||
other "slow" lock.
 | 
					other "slow" lock.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
If in doubt, do not implement OOB execution support.
 | 
					When in doubt, do not implement OOB execution support.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
A command may use the optional 'allow-preconfig' key to permit its execution
 | 
					Key 'allow-preconfig' declares whether the command is available before
 | 
				
			||||||
at early runtime configuration stage (preconfig runstate).
 | 
					the machine is built.  It defaults to false.  For example:
 | 
				
			||||||
If not specified then a command defaults to 'allow-preconfig': false.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
An example of declaring a command that is enabled during preconfig:
 | 
					 | 
				
			||||||
 { 'command': 'qmp_capabilities',
 | 
					 { 'command': 'qmp_capabilities',
 | 
				
			||||||
   'data': { '*enable': [ 'QMPCapability' ] },
 | 
					   'data': { '*enable': [ 'QMPCapability' ] },
 | 
				
			||||||
   'allow-preconfig': true }
 | 
					   'allow-preconfig': true }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					QMP is available before the machine is built only when QEMU was
 | 
				
			||||||
 | 
					started with --preconfig.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
=== Events ===
 | 
					=== Events ===
 | 
				
			||||||
 | 
					
 | 
				
			||||||
Usage: { 'event': STRING, '*data': COMPLEX-TYPE-NAME-OR-DICT,
 | 
					Usage: { 'event': STRING, '*data': COMPLEX-TYPE-NAME-OR-DICT,
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user