diff mbox

[v4,1/7] qapi: Add BlockOperationType enum

Message ID 1385097894-1380-2-git-send-email-famz@redhat.com
State New
Headers show

Commit Message

Fam Zheng Nov. 22, 2013, 5:24 a.m. UTC
This adds the enum of all the operations that can be taken on a block
device.

Signed-off-by: Fam Zheng <famz@redhat.com>
---
 qapi-schema.json | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

Comments

Eric Blake Nov. 22, 2013, 8:25 p.m. UTC | #1
On 11/21/2013 10:24 PM, Fam Zheng wrote:
> This adds the enum of all the operations that can be taken on a block
> device.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>
> ---
>  qapi-schema.json | 25 +++++++++++++++++++++++++
>  1 file changed, 25 insertions(+)


>  
>  ##
> +# @BlockOperationType
> +# Type of a block operation.
> +#
> +# Since: 1.8

It might be worth adding a bit more docs, as in one line per enum value
with a cross-reference to the command(s) that can trigger that
operation.  Something like:

@backup: See the 'drive-backup' command.
@change: See the 'change' command.

This is especially true if we later add new block ops later than 1.8, so
such additions can have the useful '(since 1.9)' notation.
Kevin Wolf Nov. 25, 2013, 11:26 a.m. UTC | #2
Am 22.11.2013 um 06:24 hat Fam Zheng geschrieben:
> This adds the enum of all the operations that can be taken on a block
> device.
> 
> Signed-off-by: Fam Zheng <famz@redhat.com>

Okay, so now I've read the whole series and I still couldn't solve this
mystery: Why is this a QAPI type and not some internal enum?

Kevin
Fam Zheng Nov. 26, 2013, 1:58 a.m. UTC | #3
On 2013年11月25日 19:26, Kevin Wolf wrote:
> Am 22.11.2013 um 06:24 hat Fam Zheng geschrieben:
>> This adds the enum of all the operations that can be taken on a block
>> device.
>>
>> Signed-off-by: Fam Zheng <famz@redhat.com>
>
> Okay, so now I've read the whole series and I still couldn't solve this
> mystery: Why is this a QAPI type and not some internal enum?
>
The logic is becoming complicated, I think even more rules will come 
with Quorum and BlockBackend, etc. By then we probably will have to add 
an interface to query the blockers, so user knows what operation is 
possible and what is not, without trial and error.

Eric, any ideas?

Fam
diff mbox

Patch

diff --git a/qapi-schema.json b/qapi-schema.json
index 83fa485..4656e8c 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -1440,6 +1440,31 @@ 
   'data': ['commit', 'stream', 'mirror', 'backup'] }
 
 ##
+# @BlockOperationType
+# Type of a block operation.
+#
+# Since: 1.8
+##
+{ 'enum': 'BlockOpType',
+  'data': [
+    'backup',
+    'change',
+    'commit',
+    'dataplane',
+    'drive-del',
+    'eject',
+    'external-snapshot',
+    'internal-snapshot',
+    'internal-snapshot-delete',
+    'mirror',
+    'nbd-server-add',
+    'passwd',
+    'resize',
+    'set-io-throttle',
+    'stream'
+] }
+
+##
 # @BlockJobInfo:
 #
 # Information about a long-running block device operation.