qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] Cannot block-commit to nbd backend


From: Eric Blake
Subject: Re: [Qemu-discuss] Cannot block-commit to nbd backend
Date: Wed, 28 Jun 2017 08:07:31 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0

On 06/27/2017 04:04 AM, Han Han wrote:
> Hi all, I get an error when block-commit to nbd backend:
> First, prepare a back file for nbd storage:
> # qemu-img create -f qcow2 -b 'json:{"file.driver":"nbd",
> "file.host":"xx.xx.xx.xx", "file.port":"10803", "file.export":"nbd_raw"}'
> -o backing_fmt=raw /tmp/n2.s1
> Formatting '/tmp/n2.s1', fmt=qcow2 size=10737418240
> backing_file=json:{"file.driver":"nbd",, "file.host":"xx.xx.xx.xx",,
> "file.port":"10803",, "file.export":"nbd_raw"} backing_fmt=raw

This setup uses NBD as a read-only backing file.

> Start the VM with the back file.
> # virsh dumpxml n2| awk '/<disk/,/<\/disk/'
> <disk type='file' device='disk'>
>       <driver name='qemu' type='qcow2'/>
>       <source file='/tmp/n2.s1'/>
>       <backingStore type='network' index='1'>
>         <format type='raw'/>
>         <source protocol='nbd' name='nbd_raw'>
>           <host name='xx.xx.xx.xx' port='10803'/>
>         </source>
>         <backingStore/>
>       </backingStore>
>       <target dev='vda' bus='virtio'/>
>       <alias name='virtio-disk0'/>
>       <address type='pci' domain='0x0000' bus='0x00' slot='0x08'
> function='0x0'/>
>     </disk>
> 
> Qemu cmdline:
> -drive file=/tmp/n2.s1,format=qcow2,if=none,id=drive-virtio-disk0
> 
> Then do block-commit:
> # virsh blockcommit n2 vda --active --shallow --wait --verbose --pivot
> error: internal error: unable to execute QEMU command 'block-commit': Block
> format 'nbd' used by node '#block265' does not support reopening files

Active block commit does indeed require the ability to convert a backing
file from read-only to read-write, and NBD does not yet implement that
ability.  It may be worth adding the ability to do this as a future
feature in qemu.

Also, it may already be possible to use a read-write NBD image as a
backing file by using QMP blockdev-add (or commandline -blockdev) to
manually specify a read-write NBD connection and then wire that up as an
explicit backing file (rather than the default read-only that you get
when following backing chains by default) if you plan to live-commit to
an NBD image, but libvirt does not yet use blockdev-add.

So for now, the error message you get (especially via libvirt) is
expected.  Live commit to a backing file is only possible where it is
easy to convert the backing file to writable, which is not easy with NBD.

> 
> qemu command:
> {"execute":"block-commit","arguments":{"device":"drive-virtio-disk0","top":"/tmp/n2.s1","base":"nbd://xx.xx.xx.xx:10803/nbd_raw"},"id":"libvirt-22"}
> 
> So is it a expected result? Does it support to block-commit to nbd?
> Thanks
> 

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

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