Bug 1086193

Summary: RFE: Add blockdev-delete QMP command in company with blockdev-add
Product: Red Hat Enterprise Linux 7 Reporter: Sibiao Luo <sluo>
Component: qemu-kvm-rhevAssignee: Kevin Wolf <kwolf>
Status: CLOSED ERRATA QA Contact: CongLi <coli>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.0CC: armbru, chayang, famz, hannsj_uhl, hhuang, juzhang, kwolf, michen, mrezanin, mtessun, mzhan, qzhang, rbalakri, virt-maint, xfu
Target Milestone: rcKeywords: FutureFeature
Target Release: 7.4   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qemu-kvm-rhev-2.9.0-1.el7 Doc Type: Enhancement
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-08-01 23:27:12 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 750801, 1288337    

Description Sibiao Luo 2014-04-10 10:43:37 UTC
Description of problem:
check the QMP which there is only a blockdev-add command but no blockdev-delete QMP command to clean up, and the 'device_del' fail to work(bug 1086190).

Version-Release number of selected component (if applicable):
host info:
# uname -r && rpm -q qemu-kvm
3.10.0-121.el7.x86_64
qemu-kvm-1.5.3-60.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.boot a QEMU with '-qmp tcp:0:4444,server,nowait'
2.query-commands in QMP.
{"execute":"qmp_capabilities"}
{"execute":"query-commands"}

Actual results:
check the QMP which there is only a blockdev-add command but no blockdev-delete QMP command to clean up.
{"execute":"query-commands"}
{"return": [{"name": "query-rx-filter"}, {"name": "blockdev-add"}, {"name": "chardev-remove"}, {"name": "chardev-add"}, {"name": "query-tpm-types"}, {"name": "query-tpm-models"}, {"name": "query-tpm"}, {"name": "query-target"}, {"name": "query-cpu-definitions"}, {"name": "query-machines"}, {"name": "device-list-properties"}, {"name": "qom-list-types"}, {"name": "change-vnc-password"}, {"name": "nbd-server-stop"}, {"name": "nbd-server-add"}, {"name": "nbd-server-start"}, {"name": "qom-get"}, {"name": "qom-set"}, {"name": "qom-list"}, {"name": "query-block-jobs"}, {"name": "query-balloon"}, {"name": "query-migrate-capabilities"}, {"name": "migrate-set-capabilities"}, {"name": "query-migrate"}, {"name": "query-command-line-options"}, {"name": "query-uuid"}, {"name": "query-name"}, {"name": "query-spice"}, {"name": "query-vnc"}, {"name": "query-mice"}, {"name": "query-status"}, {"name": "query-kvm"}, {"name": "query-pci"}, {"name": "query-cpus"}, {"name": "query-blockstats"}, {"name": "query-block"}, {"name": "query-chardev"}, {"name": "query-events"}, {"name": "query-commands"}, {"name": "query-version"}, {"name": "human-monitor-command"}, {"name": "qmp_capabilities"}, {"name": "add_client"}, {"name": "expire_password"}, {"name": "set_password"}, {"name": "block_set_io_throttle"}, {"name": "block_passwd"}, {"name": "query-fdsets"}, {"name": "remove-fd"}, {"name": "add-fd"}, {"name": "closefd"}, {"name": "getfd"}, {"name": "set_link"}, {"name": "balloon"}, {"name": "block-job-complete"}, {"name": "block-job-resume"}, {"name": "block-job-pause"}, {"name": "block-job-cancel"}, {"name": "block-job-set-speed"}, {"name": "block_resize"}, {"name": "netdev_del"}, {"name": "netdev_add"}, {"name": "dump-guest-memory"}, {"name": "client_migrate_info"}, {"name": "migrate_set_downtime"}, {"name": "migrate_set_speed"}, {"name": "query-migrate-cache-size"}, {"name": "migrate-set-cache-size"}, {"name": "migrate_cancel"}, {"name": "migrate"}, {"name": "xen-set-global-dirty-log"}, {"name": "xen-save-devices-state"}, {"name": "ringbuf-read"}, {"name": "ringbuf-write"}, {"name": "inject-nmi"}, {"name": "pmemsave"}, {"name": "memsave"}, {"name": "cpu-add"}, {"name": "cpu"}, {"name": "send-key"}, {"name": "device_del"}, {"name": "device_add"}, {"name": "system_powerdown"}, {"name": "system_reset"}, {"name": "system_wakeup"}, {"name": "cont"}, {"name": "stop"}, {"name": "__com.redhat_qxl_screendump"}, {"name": "screendump"}, {"name": "change"}, {"name": "__com.redhat_drive_del"}, {"name": "__com.redhat_drive_add"}, {"name": "eject"}, {"name": "quit"}]}


Expected results:


Additional info:

Comment 1 Markus Armbruster 2014-07-16 14:37:47 UTC
Bug 750801 tracks the remaining blockdev-add work for 7.1.

Comment 3 Markus Armbruster 2014-10-31 08:37:05 UTC
Bug 750801 got deferred to 7.2, following suit.

Comment 10 Markus Armbruster 2015-09-07 10:59:43 UTC
Still no blockdev-del upstream.  Adding it shouldn't be hard, but makes little sense until blockdev-add is ready for prime time.  We've been making progress, but we're clearly not there, yet.

Comment 11 Markus Armbruster 2015-11-20 08:24:22 UTC
Upstream commit commit 81b936a "block: Add 'x-blockdev-del' QMP command" will be in 2.5.  It's flagged experimental because blockdev-add de facto still is.  They're expected to become stable interfaces together.

Comment 13 Ademar Reis 2017-01-17 16:58:13 UTC
Maybe this could be considered a duplicate of Bug 750801 (blockdev-add main BZ)?

Comment 14 Ademar Reis 2017-03-31 21:34:30 UTC
blockdev-add/del is declared stable in QEMU-2.9.

Comment 16 CongLi 2017-05-05 03:28:39 UTC
Verified this bug on:
qemu-kvm-rhev-2.9.0-2.el7.x86_64

1. There is 'blockdev-del' command when execute 'query-commands'
{"execute":"query-commands"}
{"return": [...
{"name": "blockdev-mirror"}, {"name": "blockdev-del"}, {"name": "blockdev-close-tray"}, {"name": "blockdev-change-medium"}, {"name": "blockdev-backup"}, {"name": "blockdev-add"}...]}

2. node is not attached to a device
{"execute": "blockdev-add","arguments": {"node-name": "drive2","driver": "raw", "file":    {"driver":"file", "filename": "/root/test.raw"}}}
{"return": {}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3. node is attached to a device.
All scenarios of 'info block -n' work well before and after blockdev-add and blockdev-del.

3.1 local - pass
3.1.1 virtio_scsi
{"execute": "blockdev-add","arguments": {"node-name": "drive2","driver": "raw", "file":    {"driver":"file", "filename": "/root/test.raw"}}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"virtio-scsi-pci","id":"scsi1","bus":"pci.0","addr":"0x8"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"scsi-hd","drive":"drive2","id":"data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"data-disk1"} }
{"timestamp": {"seconds": 1493790042, "microseconds": 560590}, "event": "DEVICE_DELETED", "data": {"device": "data-disk1", "path": "/machine/peripheral/data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"scsi1"} }
{"return": {}}
{"timestamp": {"seconds": 1493790053, "microseconds": 582917}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/scsi1/virtio-backend"}}
{"timestamp": {"seconds": 1493790053, "microseconds": 582995}, "event": "DEVICE_DELETED", "data": {"device": "scsi1", "path": "/machine/peripheral/scsi1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3.1.2 virtio_blk
{"execute": "blockdev-add","arguments": {"node-name": "drive2","driver": "raw", "file":    {"driver":"file", "filename": "/root/test.raw"}}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"virtio-blk-pci", "drive": "drive2", "id":"blk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id": "blk1"}}
{"return": {}}
{"timestamp": {"seconds": 1493791389, "microseconds": 53820}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/blk1/virtio-backend"}}
{"timestamp": {"seconds": 1493791389, "microseconds": 53912}, "event": "DEVICE_DELETED", "data": {"device": "blk1", "path": "/machine/peripheral/blk1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3.2 iscsi - pass
3.2.1 virtio_scsi
{
    "execute": "blockdev-add",
        "arguments": {
            "node-name": "drive2",
            "driver": "qcow2",
            "file": {
                "driver":"iscsi",
                "transport":"tcp",
                "portal":"10.73.199.233",
                "initiator-name":"iqn.2008-11.org.linux-kvm",
                "target":"iqn.2017-04.com.example:t3",
                "lun":0
            }
        }
}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"virtio-scsi-pci","id":"scsi1","bus":"pci.0","addr":"0x8"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"scsi-hd","drive":"drive2","id":"data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"data-disk1"} }
{"timestamp": {"seconds": 1493796907, "microseconds": 470991}, "event": "DEVICE_DELETED", "data": {"device": "data-disk1", "path": "/machine/peripheral/data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"scsi1"} }
{"return": {}}
{"timestamp": {"seconds": 1493796916, "microseconds": 366318}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/scsi1/virtio-backend"}}
{"timestamp": {"seconds": 1493796916, "microseconds": 366392}, "event": "DEVICE_DELETED", "data": {"device": "scsi1", "path": "/machine/peripheral/scsi1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3.2.2 virtio_blk
{
    "execute": "blockdev-add",
        "arguments": {
            "node-name": "drive2",
            "driver": "qcow2",
            "file": {
                "driver":"iscsi",
                "transport":"tcp",
                "portal":"10.73.199.233",
                "initiator-name":"iqn.2008-11.org.linux-kvm",
                "target":"iqn.2017-04.com.example:t3",
                "lun":0
            }
        }
}
{"return": {}}
{
    "execute":"device_add",
        "arguments":{
            "driver":"virtio-blk-pci",
            "drive":"drive2",
            "id":"blk1"
                   }
}
{"return": {}}
{"execute":"device_del","arguments":{"id": "blk1"}}
{"return": {}}
{"timestamp": {"seconds": 1493796700, "microseconds": 536194}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/blk1/virtio-backend"}}
{"timestamp": {"seconds": 1493796700, "microseconds": 536287}, "event": "DEVICE_DELETED", "data": {"device": "blk1", "path": "/machine/peripheral/blk1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3.3 glusterfs - pass
3.3.1 virtio_scsi
{
    "execute": "blockdev-add",
        "arguments": {
            "node-name": "drive2",
            "driver": "raw",
            "file": {
            "driver": "gluster",
"volume": "distdata01",
            "path": "test.raw",
            "server" : [
{ "type": "inet", "host": "gluster-virt-qe-01.lab.eng.pek2.redhat.com", "port": "24007"}]}}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"virtio-scsi-pci","id":"scsi1","bus":"pci.0","addr":"0x8"}}
{"return": {}}
{"execute":"device_add","arguments":{"driver":"scsi-hd","drive":"drive2","id":"data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"data-disk1"} }
{"timestamp": {"seconds": 1493954803, "microseconds": 900570}, "event": "DEVICE_DELETED", "data": {"device": "data-disk1", "path": "/machine/peripheral/data-disk1"}}
{"return": {}}
{"execute":"device_del","arguments":{"id":"scsi1"} }
{"return": {}}
{"timestamp": {"seconds": 1493954809, "microseconds": 427627}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/scsi1/virtio-backend"}}
{"timestamp": {"seconds": 1493954809, "microseconds": 427700}, "event": "DEVICE_DELETED", "data": {"device": "scsi1", "path": "/machine/peripheral/scsi1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}

3.3.2 virtio_blk
{
    "execute": "blockdev-add",
        "arguments": {
            "node-name": "drive2",
            "driver": "raw",
            "file": {
            "driver": "gluster",
"volume": "distdata01",
            "path": "test.raw",
            "server" : [
{ "type": "inet", "host": "gluster-virt-qe-01.lab.eng.pek2.redhat.com", "port": "24007"}]}}}
{"return": {}}
{
    "execute":"device_add",
        "arguments":{
            "driver":"virtio-blk-pci",
            "drive":"drive2",
            "id":"blk1"}
}
{"return": {}}
{"execute":"device_del","arguments":{"id": "blk1"}}
{"return": {}}
{"timestamp": {"seconds": 1493954631, "microseconds": 254479}, "event": "DEVICE_DELETED", "data": {"path": "/machine/peripheral/blk1/virtio-backend"}}
{"timestamp": {"seconds": 1493954631, "microseconds": 254586}, "event": "DEVICE_DELETED", "data": {"device": "blk1", "path": "/machine/peripheral/blk1"}}
{ "execute": "blockdev-del","arguments": { "node-name": "drive2"}}
{"return": {}}


4. block layer sanity test pass.

Comment 18 errata-xmlrpc 2017-08-01 23:27:12 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 19 errata-xmlrpc 2017-08-02 01:04:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 20 errata-xmlrpc 2017-08-02 01:56:50 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 21 errata-xmlrpc 2017-08-02 02:37:35 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 22 errata-xmlrpc 2017-08-02 03:02:18 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392

Comment 23 errata-xmlrpc 2017-08-02 03:22:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2017:2392