[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-block] [RFC] block-insert-node and block-job-delete

From: Manos Pitsidianakis
Subject: [Qemu-block] [RFC] block-insert-node and block-job-delete
Date: Wed, 26 Jul 2017 17:19:24 +0300
User-agent: NeoMutt/20170609-57-1e93be (1.8.3)

This proposal follows a discussion we had with Kevin and Stefan on filter node management.

With block filter drivers arises a need to configure filter nodes on runtime with QMP on live graphs. A problem with doing live graph modifications is that some block jobs modify the graph when they are done and don't operate under any synchronisation, resulting in a race condition if we try to insert a filter node in the place of an existing edge.

The race can be overcome if we introduce an optional manual-delete flag in the creation of a block job to indicate that they will not be deleted automatically, but rather wait until the user explicitly calls block-job-delete to remove the block job and apply the graph modifications. This makes filter insertion require that there are no active block jobs with manual-delete set to false. The graph operations will be synchronous unlike block-job-complete; the BlockJobDeferToMainLoopFn completion callback will be executed from QMP instead of using block_job_defer_to_main_loop.

block-job-delete will be defined as { 'command': 'block-job-delete', 'data': { 'device': 'str' } }

With this change we can define block-insert-node. New nodes will be created with blockdev-add with the appropriate children nodes. On calling block-insert-node we specify the node to add, and the edge we wish to replace:
{ 'command': 'block-insert-node',
'data' : { '*parent' : 'str', 'child' : 'str', 'node' : 'str', '*device' : 'str' } }

This will be similar to x-blockdev-change, but instead of bdrv_add_child the parent driver must implement bdrv_reopen_* to change the child. If instead of parent we specify device, the node will be inserted as the root bs of the specified BlockBackend device. If 'child' is not in the bs->children of 'node', we should abort. I'm not certain if there's need to implement an option between bs->file/bs->backing.

In the following example we insert a throttle filter node (T) between A and B:


{ "execute": "blockdev-add",
 "arguments": {
   "driver": "throttle",
   "node-name": "T",
   "throttling-group": "foobar",
   "limits" : {
     "iops-total" : 1000,
   "file": "B"

 A  T
 \ /

{ "execute" : "block-insert-node",
"arguments" : {
 "parent" : "A",
 "child" : "B",
 "node" : "T"

If bdrv_reopen is ever introduced to QMP this command, except for the BB root case, might be obsolete.

Attachment: signature.asc
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]