This service will be undergoing maintenance at 00:00 UTC, 2017-10-23 It is expected to last about 30 minutes
Bug 1465320 - active block commit failed with nbd backend
active block commit failed with nbd backend
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: qemu-kvm-rhev (Show other bugs)
Unspecified Unspecified
unspecified Severity unspecified
: rc
: ---
Assigned To: Eric Blake
Suqin Huang
Depends On:
Blocks: 1473046
  Show dependency treegraph
Reported: 2017-06-27 04:14 EDT by Suqin Huang
Modified: 2017-08-03 21:45 EDT (History)
10 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Suqin Huang 2017-06-27 04:14:07 EDT
Description of problem:
"Block format 'nbd' used by node '#block084' does not support reopening files" error when do active commit

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
{ "execute": "qmp_capabilities" }
{"return": {}}

{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1", "snapshot-file": "/root/sn1", "format": "qcow2" } }
{"return": {}}

{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1", "snapshot-file": "/root/sn2", "format": "qcow2" } }
{"return": {}}

{ "execute": "blockdev-snapshot-sync", "arguments": { "device": "drive_image1", "snapshot-file": "/root/sn3", "format": "qcow2" } }
{"return": {}}

{ "execute": "block-commit", "arguments": { "device": "drive_image1", "top": "/root/sn3", "speed": 1000000000 } }
{"error": {"class": "GenericError", "desc": "Block format 'nbd' used by node '#block084' does not support reopening files"}}

pass if run 
{ "execute": "block-commit", "arguments": { "device": "drive_image1", "top": "/root/sn2", "speed": 1000000000 } }

/usr/libexec/qemu-kvm \
    -S  \
    -name 'avocado-vt-vm1'  \
    -sandbox off  \
    -machine pc  \
    -nodefaults  \
    -vga std  \
    -chardev socket,id=qmp_id_qmpmonitor1,path=/tmp/monitor,server,nowait \
    -mon chardev=qmp_id_qmpmonitor1,mode=control  \
    -device pvpanic,ioport=0x505,id=id4FDckd  \
    -chardev socket,id=serial_id_serial0,path=/tmp/serial,server,nowait \
    -device isa-serial,chardev=serial_id_serial0  \
    -chardev socket,id=seabioslog_id_20160129-133009-OkYQqhNt,path=/tmp/seabios-20160129-133009-OkYQqhNt,server,nowait \
    -device isa-debugcon,chardev=seabioslog_id_20160129-133009-OkYQqhNt,iobase=0x402 \
    -device ich9-usb-ehci1,id=usb1,addr=1d.7,multifunction=on,bus=pci.0 \
    -device ich9-usb-uhci1,id=usb1.0,multifunction=on,masterbus=usb1.0,addr=1d.0,firstport=0,bus=pci.0 \
    -device ich9-usb-uhci2,id=usb1.1,multifunction=on,masterbus=usb1.0,addr=1d.2,firstport=2,bus=pci.0 \
    -device ich9-usb-uhci3,id=usb1.2,multifunction=on,masterbus=usb1.0,addr=1d.4,firstport=4,bus=pci.0 \
    -drive id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,file=nbd:// \
    -device virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=03 \
    -device virtio-net-pci,mac=9a:0d:0e:0f:10:11,id=idKK4Mdq,vectors=4,netdev=idgjGCvt,bus=pci.0,addr=05  \
    -netdev tap,id=idgjGCvt,vhost=on,script=/etc/qemu-ifup \
    -m 2048 \
    -smp 2,maxcpus=2,cores=2,threads=1,sockets=1  \
    -cpu Westmere \
    -vnc :2 \
    -rtc base=localtime,clock=host,driftfix=slew  \
    -boot order=cdn,once=c,menu=off,strict=off \
    -no-kvm \
    -monitor stdio 


Actual results:

Expected results:

Additional info:
Comment 3 Eric Blake 2017-06-28 09:15:55 EDT
Live commit has always required the ability to convert a backing file from read-only to read-write (if the backing file is not already read-write).  Specifying NBD as a backing file when starting qemu defaults to using NBD read-only, and there is no way to convert NBD from read-only to read-write at run-time.  But your use case is creating NBD as a read-write file (the initial active image), then adding snapshots on top:

>     -drive
> id=drive_image1,if=none,cache=none,snapshot=off,aio=native,format=qcow2,
> file=nbd:// \
>     -device
> virtio-blk-pci,id=image1,drive=drive_image1,bootindex=0,bus=pci.0,addr=03 \

Where it gets interesting is that you are showing a difference between live commit (merge the active image to the base NBD file, then make the base NBD file active again):

> { "execute": "block-commit", "arguments": { "device": "drive_image1", "top":
> "/root/sn3", "speed": 1000000000 } }
> {"error": {"class": "GenericError", "desc": "Block format 'nbd' used by node
> '#block084' does not support reopening files"}}

from intermediate commit (shrinking the backing chain, but keeping /root/sn3 as the live image):

> pass if run 
> { "execute": "block-commit", "arguments": { "device": "drive_image1", "top":
> "/root/sn2", "speed": 1000000000 } }

So you may have indeed discovered an oddity in the qemu code for live-commit (both versions of commit SHOULD be able to succeed, if the NBD image is indeed read-write).

I'll have to investigate further.
Comment 4 Suqin Huang 2017-06-28 19:15:47 EDT
reproduce with qemu-kvm-rhev-2.9.0-2.el7.x86_64, not regression
Comment 5 Eric Blake 2017-08-03 21:45:07 EDT
For my own notes, pared down reproducer:
window 1:
qemu-img create -f qcow2 bar 1m
qemu-nbd -t -f raw bar

window 2:
./x86_64-softmmu/qemu-system-x86_64 -nographic -nodefaults -qmp stdio \
-drive id=drive-image1,if=none,format=qcow2,file=nbd://localhost:10809 \
-device virtio-blk-pci,id=image1,drive=drive-image1


{'execute':'blockdev-snapshot-sync','arguments':{'device':'drive-image1', 'snapshot-file':'bar1','format':'qcow2'}}
{'execute':'blockdev-snapshot-sync','arguments':{'device':'drive-image1', 'snapshot-file':'bar2','format':'qcow2'}}
{'execute':'blockdev-snapshot-sync','arguments':{'device':'drive-image1', 'snapshot-file':'bar3','format':'qcow2'}}

intermediate works:

active fails:

Note You need to log in before you can comment on or make changes to this bug.