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: Han Han
Subject: Re: [Qemu-discuss] Cannot block-commit to nbd backend
Date: Thu, 29 Jun 2017 08:08:37 +0800

Thanks for your reply :)

On Wed, Jun 28, 2017 at 9:07 PM, Eric Blake <address@hidden> wrote:

> 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
>
>


-- 
Han Han
Associate Quality Engineer
Redhat

Email: address@hidden
Phone: +861065339333


reply via email to

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