All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC] block-insert-node and block-job-delete
@ 2017-07-26 14:19 Manos Pitsidianakis
  2017-07-26 15:12 ` Stefan Hajnoczi
  0 siblings, 1 reply; 13+ messages in thread
From: Manos Pitsidianakis @ 2017-07-26 14:19 UTC (permalink / raw)
  To: qemu-block; +Cc: qemu-devel, Stefan Hajnoczi, Kevin Wolf, Alberto Garcia

[-- Attachment #1: Type: text/plain, Size: 2541 bytes --]

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:

    A
    |
    B

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

  A  T
  \ /
   B

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

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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2017-08-02 10:47 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-26 14:19 [Qemu-devel] [RFC] block-insert-node and block-job-delete Manos Pitsidianakis
2017-07-26 15:12 ` Stefan Hajnoczi
2017-07-26 18:23   ` Manos Pitsidianakis
2017-07-27 10:07     ` Stefan Hajnoczi
2017-07-28 12:08       ` Kevin Wolf
2017-07-31 14:53         ` Stefan Hajnoczi
2017-07-31 17:30         ` Manos Pitsidianakis
2017-08-01 13:50           ` Kevin Wolf
2017-08-01 13:57             ` Manos Pitsidianakis
2017-07-27 22:09     ` John Snow
2017-07-28  8:49       ` Manos Pitsidianakis
2017-07-28 11:55       ` Kevin Wolf
2017-08-02 10:47         ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.