More Block Device Configuration Max Reitz <mreitz@redhat.com> - - PowerPoint PPT Presentation

more block device configuration max reitz mreitz redhat
SMART_READER_LITE
LIVE PREVIEW

More Block Device Configuration Max Reitz <mreitz@redhat.com> - - PowerPoint PPT Presentation

More Block Device Configuration Max Reitz <mreitz@redhat.com> Kevin Wolf <kwolf@redhat.com> KVM Forum 2014 Part I What we have BlockDriverState BDS BDS types Protocol Format Simple BDS tree Guest device IDE qcow2 Format BDS


slide-1
SLIDE 1

More Block Device Configuration Max Reitz <mreitz@redhat.com> Kevin Wolf <kwolf@redhat.com> KVM Forum 2014

slide-2
SLIDE 2

Part I What we have

slide-3
SLIDE 3

BlockDriverState

BDS

slide-4
SLIDE 4

BDS types

Protocol Format

slide-5
SLIDE 5

Simple BDS tree

Guest device Format BDS Protocol BDS IDE qcow2 file

slide-6
SLIDE 6

Terminology

Frontend (guest device) Backend (BDS tree) IDE qcow2 Root file qcow2 http backing

slide-7
SLIDE 7

What is possible today

IDE raw quorum qcow2 blkdebug file qcow2 http raw nbd qcow2 qcow2 nfs file c h i l d [ ] child[1] c h i l d [ 2 ] file file backing file file file file

slide-8
SLIDE 8

How to configure this? Legacy syntax:

  • hda nbd:localhost:10809

Separate backend and frontend; Option syntax for backend:

  • drive if=none,\

id=disk0,driver=raw,\ file.driver=nbd,\ file.host=localhost

  • device ide-hd,drive=disk0

IDE raw nbd file

slide-9
SLIDE 9

blockdev-add

  • drive if=none,id=disk0,driver=raw,\

file.driver=nbd,file.host=localhost { "execute": "blockdev-add", "arguments": { "options": { "id": "disk0", "driver": "raw", "file": { "driver": "nbd", "host": "localhost" } } } }

disk0 raw nbd file

slide-10
SLIDE 10

What is possible today (again)

"options": { "id": "disk0", "driver": "raw", "file": { "driver": "quorum", "vote-threshold": 2, "children": [ { "driver": "qcow2", "backing": "back0", "file": "file0", }, "qc1", "qc2" ] } }

disk0 raw quorum qcow2 file0 back0 qc1 qc2 file child[0] backing file child[1] child[2]

slide-11
SLIDE 11

node-name vs. id BDS directly connected to guest devices (legacy!) BDS id used to connect both blockdev-add: id ⇐ ⇒ top-level BDS → id ≈ guest-accessible BDS Naming and accessing non-top-level BDS? → node-name Common namespace for id and node-name

slide-12
SLIDE 12

Options in filenames, revisited

json:{"driver": "qcow2", "cache-size": 0, "file": { "driver": "file", "filename": "file.qcow2" } }

Why? Some options cannot be given in filenames (e.g. qcow2 metadata cache size) Sometimes you can only give filenames (e.g. backing file field in COW files)

slide-13
SLIDE 13

Part II Some unsolved problems

slide-14
SLIDE 14

Section 1 Make everything use blockdev-add

slide-15
SLIDE 15

Make everything use blockdev-add

Opening block devices (blockdev-add) If you use blockdev-add... All required options are specified Optional options get defaults

We’ll get to the problems there later

Building the graph is straightforward

slide-16
SLIDE 16

Make everything use blockdev-add

Opening block devices (-drive) If you use -drive, we’d like to translate that into a clean blockdev-add, but... Not even the block driver (image format) is required

More involved magic to fill in defaults

New nodes may be automatically created No specification of this magic exists We need to stay compatible with old versions

slide-17
SLIDE 17

Make everything use blockdev-add

Inherited options (I)

disk [qcow2]

Determining cache mode for a single node:

1 Explicitly specified

e.g. -drive cache.direct=on

2 Default is cache=writeback

slide-18
SLIDE 18

Make everything use blockdev-add

Inherited options (II)

disk [qcow2] disk.file [file] file

Determining cache mode for the protocol level:

1 Explicitly specified 2 Inherit from parent node (disk) 3 Default is cache=writeback

slide-19
SLIDE 19

Make everything use blockdev-add

Inherited options (III)

disk [qcow2] disk.file [file] backing [qcow2] backing.file [nbd] file backing file

Determining cache mode for the backing file:

1 Explicitly specified 2 Backing file path: json:{cache:...} 3 Inherit from parent node (disk) 4 Default is cache=writeback

slide-20
SLIDE 20

Make everything use blockdev-add

It goes both ways

disk [qcow2] disk.file [file] file existence drive cache driver

Format probing: Must open protocol layer first Options for protocol depend on format layer Protocol only added by default if format driver requires a protocol

slide-21
SLIDE 21

Make everything use blockdev-add

It goes both ways Format probing: Must open protocol layer first Options for protocol depend on format layer Protocol only added by default if format driver requires a protocol So we can’t easily translate everything into plain blockdev-add options in a wrapper.

slide-22
SLIDE 22

Section 2 Reopening

slide-23
SLIDE 23

Reopening

Reopen: The traditional case

bdrv reopen(cache=none) disk [writeback] disk.file [writeback] backing [writeback] backing.file [writeback] file backing file

Cache mode of backing file wasn’t explicitly configurable: All nodes inherited from the root Reopen affects all nodes

slide-24
SLIDE 24

Reopening

Reopen: blockdev-add world (I)

bdrv reopen(cache=writethrough) disk [writeback] disk.file [writeback] backing [none] backing.file [none] file backing file

What happens if the backing file has... ...inherited the cache mode ...an explicitly set cache mode ...got its cache mode from a json: filename

slide-25
SLIDE 25

Reopening

No inheritance with references

disk [qcow2] disk.file [file] backing [qcow2] backing.file [nbd] file backing file

Cache mode for a separately created backing file:

1 Explicitly specified 2 Default is cache=writeback

Don’t change options when a node is referenced

slide-26
SLIDE 26

Reopening

Reopen: blockdev-add world (II)

bdrv reopen(cache=writethrough) disk [writeback] disk.file [writeback] backing [none] backing.file [none] file backing file

What happens if the backing file was created separately and has... ...an explicitly set cache mode ...the default cache mode

slide-27
SLIDE 27

Section 3 Dynamic Reconfiguration

slide-28
SLIDE 28

Dynamic Reconfiguration

Adding and removing nodes

virtio-blk qcow2 file file virtio-blk throttle qcow2 file file file

Let’s add a new node at runtime: Take a live snapshot Add an I/O throttling filter ...

slide-29
SLIDE 29

Dynamic Reconfiguration

...but where?

virtio-blk NBD server throttle qcow2 file file virtio-blk NBD server throttle qcow2 file file virtio-blk NBD server throttle qcow2 file file

Need to specify where to insert the node Set of arrows to replace Works only for nodes with one child A general solution looks complex – necessary?

slide-30
SLIDE 30

Dynamic Reconfiguration

Addressing nodes and edges Nodes can be addressed by their node-name Edges can be addresed by node + role role: file, backing, child[3], ... Complication: Automatically created nodes e.g. for block jobs or throttling QMP commands Makes non-explict changes to the graph

slide-31
SLIDE 31

Dynamic Reconfiguration

Block jobs and reconfiguration Long-running background jobs may be affected by changes to the graph Disable conflicting reconfiguration commands Don’t restrict functionality too much Jeff Cody will talk about this

slide-32
SLIDE 32

Questions?