RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1371758 - RFE:Add json pseudo protocol support for rbd
Summary: RFE:Add json pseudo protocol support for rbd
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: libvirt
Version: 7.4
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: lijuan men
URL:
Whiteboard:
Depends On: 1457088
Blocks:
TreeView+ depends on / blocked
 
Reported: 2016-08-31 03:09 UTC by Han Han
Modified: 2017-08-02 01:27 UTC (History)
7 users (show)

Fixed In Version: libvirt-2.5.0-1.el7
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-08-01 17:14:13 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Bugzilla 1451557 0 high CLOSED Update json parsing in libvirt 2021-02-22 00:41:40 UTC
Red Hat Product Errata RHEA-2017:1846 0 normal SHIPPED_LIVE libvirt bug fix and enhancement update 2017-08-01 18:02:50 UTC

Internal Links: 1451557

Description Han Han 2016-08-31 03:09:04 UTC
Just like what we did in BZ1134878 and pacthes http://post-office.corp.redhat.com/archives/rhvirt-patches/2016-August/msg00280.html . Add rbd json backing support in libvirt.

Comment 2 Peter Krempa 2016-09-06 12:07:47 UTC
Added upstream:

commit 3de7da9448a5edb8440eeeb32b98f282880229e1
Author: Peter Krempa <pkrempa>
Date:   Mon Sep 5 15:15:22 2016 +0200

    util: storage: Add json pseudo protocol support for legacy RBD strings
    
    RBD in qemu still uses only the legacy 'filename' syntax.

Comment 3 Han Han 2016-09-07 08:15:19 UTC
It works well with upstream libvirt:
# qemu-img create -f qcow2 -b 'json:{"file.driver":"rbd","file.filename":"rbd:rbd/hhan:mon_host=10.73.75.52"}' /var/lib/libvirt/images/rbd.img
Formatting '/var/lib/libvirt/images/rbd.img', fmt=qcow2 size=104857600 backing_file=json:{"file.driver":"rbd",,"file.filename":"rbd:rbd/hhan:mon_host=10.73.75.52"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16

# virsh attach-disk V  /var/lib/libvirt/images/nbd.img vdb --subdriver qcow2  
Disk attached successfully

Read/Write on the image works well.
# virsh dumpxml V|awk '/<disk/,/<\/disk/'                                     
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/V.qcow2'/>
      <backingStore/>
      <target dev='vda' bus='virtio'/>
      <alias name='virtio-disk0'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
    </disk>
    <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/nbd.img'/>
      <backingStore type='network' index='1'>
        <format type='raw'/>
        <source protocol='nbd'>
          <host name='10.66.6.236' port='8888'/>
        </source>
        <backingStore/>
      </backingStore>
      <target dev='vdb' bus='virtio'/>
      <alias name='virtio-disk1'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/>
    </disk>
# virsh detach-disk V vdb                
Disk detached successfully

Comment 5 lijuan men 2017-04-17 09:33:31 UTC
verify the bug

version:
libvirt-3.2.0-2.el7.x86_64
qemu-kvm-rhev-2.8.0-6.el7.x86_64

steps:

[root@lmen1 ~]# qemu-img create -f qcow2 -b 'json:{"file.driver":"rbd","file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"}' /var/lib/libvirt/images/test1.qcow2
Formatting '/var/lib/libvirt/images/test1.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file.driver":"rbd",,"file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16


[root@lmen1 ~]# qemu-img info /var/lib/libvirt/images/test1.qcow2
image: /var/lib/libvirt/images/test1.qcow2
file format: qcow2
virtual size: 100M (104857600 bytes)
disk size: 196K
cluster_size: 65536
backing file: json:{"file.driver":"rbd","file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"}
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false


[root@lmen1 ~]# virsh attach-disk test /var/lib/libvirt/images/test1.qcow2 sda --subdriver qcow2  
Disk attached successfully

[root@lmen1 ~]# virsh domblklist test
Target     Source
------------------------------------------------
hda        /var/lib/libvirt/images/test.qcow2
sda        /var/lib/libvirt/images/test1.qcow2


[root@lmen1 ~]# virsh dumpxml test
...
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test1.qcow2'/>
      <backingStore type='network' index='1'>
        <format type='raw'/>
        <source protocol='rbd' name='lmen/test.img'>
          <host name='10.73.75.52'/>
        </source>
        <backingStore/>
      </backingStore>
      <target dev='sda' bus='scsi'/>
      <alias name='scsi0-0-0-0'/>
      <address type='drive' controller='0' bus='0' target='0' unit='0'/>
    </disk>

...

the disk can be read/wrote in the guest

[root@lmen1 ~]# virsh detach-disk test sda
Disk detached successfully

Comment 6 Han Han 2017-05-31 06:23:01 UTC
Blocked by BZ1457088 in RHEL7.4.

Comment 7 lijuan men 2017-06-21 06:18:21 UTC
verify the bug 

version:
libvirt-3.2.0-11.el7.x86_64
qemu-kvm-rhev-2.9.0-12.el7.x86_64

steps:

1)create the img

[root@lmen1 ~]# qemu-img create -f qcow2 -b 'json:{"file.driver":"rbd","file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"}' /var/lib/libvirt/images/test1.qcow2
qemu-img: Warning: 'filename' option specified. This is an unsupported option, and may be deprecated in the future
Formatting '/var/lib/libvirt/images/test1.qcow2', fmt=qcow2 size=104857600 backing_file=json:{"file.driver":"rbd",,"file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"} encryption=off cluster_size=65536 lazy_refcounts=off refcount_bits=16


[root@lmen1 ~]# qemu-img info /var/lib/libvirt/images/test1.qcow2
image: /var/lib/libvirt/images/test1.qcow2
file format: qcow2
virtual size: 100M (104857600 bytes)
disk size: 196K
cluster_size: 65536
backing file: json:{"file.driver":"rbd","file.filename":"rbd:lmen/test.img:mon_host=10.73.75.52"}
Format specific information:
    compat: 1.1
    lazy refcounts: false
    refcount bits: 16
    corrupt: false

2)hotplug

[root@lmen1 ~]# virsh attach-disk test /var/lib/libvirt/images/test1.qcow2 sdb --subdriver qcow2  
Disk attached successfully

[root@lmen1 ~]# virsh domblklist test
Target     Source
------------------------------------------------
hda        /var/lib/libvirt/images/RHEL-7.4-x86_64-latest.qcow2
sda        rhel7.3.iso
sdb        /var/lib/libvirt/images/test1.qcow2

[root@lmen1 ~]# virsh dumpxml test
...
 <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test1.qcow2'/>
      <backingStore type='network' index='1'>
        <format type='raw'/>
        <source protocol='rbd' name='lmen/test.img'>
          <host name='10.73.75.52'/>
        </source>
        <backingStore/>
      </backingStore>
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
...

the disk can be read/wrote in the guest

[root@lmen1 ~]# virsh detach-disk test sdb
Disk detached successfully

[root@lmen1 ~]# virsh domblklist test
Target     Source
------------------------------------------------
hda        /var/lib/libvirt/images/RHEL-7.4-x86_64-latest.qcow2
sda        rhel7.3.iso

there is not the disk in the guest

3)coldplug

start a guest with xml:
  <disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test1.qcow2'/>
      <target dev='sdb' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

[root@lmen1 ~]# virsh start test
Domain test started

[root@lmen1 ~]# virsh dumpxml test
...
<disk type='file' device='disk'>
      <driver name='qemu' type='qcow2'/>
      <source file='/var/lib/libvirt/images/test1.qcow2'/>
      <backingStore type='network' index='1'>
        <format type='raw'/>
        <source protocol='rbd' name='lmen/test.img'>
          <host name='10.73.75.52'/>
        </source>
        <backingStore/>
      </backingStore>
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>
...

the disk can be read/wrote in the guest

Comment 8 errata-xmlrpc 2017-08-01 17:14:13 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/RHEA-2017:1846

Comment 9 errata-xmlrpc 2017-08-01 23:55:08 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/RHEA-2017:1846

Comment 10 errata-xmlrpc 2017-08-02 01:27: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/RHEA-2017:1846


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