qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] blockdev-del


From: Kevin Wolf
Subject: Re: [Qemu-block] blockdev-del
Date: Mon, 5 Oct 2015 17:58:14 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

Am 05.10.2015 um 17:35 hat Alberto Garcia geschrieben:
> I would like to implement blockdev-del. Since 48f364dd0b there's no
> way to remove a block device added with blockdev-add.
> 
> Here's the use case:
> 
>  1. We can attach a disk to a running QEMU instance:
> 
>     {"execute": "blockdev-add",
>          "arguments": { "options": { "driver": "qcow2",
>                                      "file": { "driver": "file",
>                                                "filename": "hd.img"},
>                                      "id": "disk1"}}}
> 
>   2. We can attach a front-end device that uses the disk that we just
>      added.
> 
>     {"execute": "device_add",
>          "arguments": { "id": "dev1",
>                         "driver": "virtio-blk-pci",
>                         "drive": "disk1"}}
> 
>   3. When we're done, we can remove the front-end:
> 
>     {"execute": "device_del",
>          "arguments": { "id": "dev1" }}
> 
> However, it is not possible to remove the disk added in step 1 so
> if we want to attach a new disk we cannot reuse the device name
> ("disk1").
> 
> I know that blockdev-add is still a work in progress, but I wonder if
> there's anything else that is preventing us from writing blockdev-del
> (that's maybe not even the best name here, since what we want to
> destroy is the BlockBackend; the BDS can be already removed with
> 'eject').
> 
> Is this a good idea? Has it been discussed already? I would be happy
> to hear your opinions.

Yes, it has been discussed before, but we don't have patches yet. I
think Markus wanted to implement this eventually, so you should talk to
him to avoid wasted work.

What I recall is that the desired semantics for blockdev-del is that it
only works if the monitor reference is the only remaining reference and
that the name blockdev-del is therefore actually not too bad.

The reason why we want this restriction is that otherwise images could
stay in use without the user even noticing, which is rather dangerous.
Explicit monitor commands for adding and for removing an image seem to
be much easier to handle than images disappearing after e.g. a block job
decided to drop its reference (without any user interaction).

Kevin



reply via email to

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