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 1958302 - cannot attach disk with libvirt secret to a vm
Summary: cannot attach disk with libvirt secret to a vm
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: All
OS: Unspecified
high
high
Target Milestone: beta
: ---
Assignee: Peter Krempa
QA Contact: yisun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-07 15:20 UTC by yisun
Modified: 2021-12-07 22:01 UTC (History)
8 users (show)

Fixed In Version: libvirt-7.3.0-1.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2021-12-07 21:57:54 UTC
Type: Bug
Target Upstream Version: 7.2.0
Embargoed:


Attachments (Terms of Use)

Description yisun 2021-05-07 15:20:05 UTC
description:
cannot attach disk with libvirt secret to a vm

versions:
(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# rpm -qa | egrep "^qemu-kvm-6|^libvirt-7"
qemu-kvm-6.0.0-1.el9.x86_64
libvirt-7.0.0-6.el9.x86_64

how reproducible:
100%

pls note, there is a qemu related issue bz1944985 closed as NOTABUG. So pls help to confirm if this should be fixed in libvirt or we should reopen that bug

steps:
1. prepare a disk xml with authentication, here I used a ceph disk to be hot plugged
(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# cat vdb.xml 
<disk device="disk" type="network"><source name="incremental_backup_pool/inc_bkup.qcow2" protocol="rbd"><host name="libvirtauthceph.usersys.redhat.com" port="6789" /><auth username="admin"><secret type="ceph" uuid="2411a785-fd8a-4d0f-998c-97cee1ad9489" /></auth></source><driver name="qemu" type="qcow2" /><target bus="virtio" dev="vdb" /></disk>


(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# virsh secret-list
 UUID                                   Usage
----------------------------------------------------------
 2411a785-fd8a-4d0f-998c-97cee1ad9489   ceph client.ceph

2. clear libvirtd debug log
(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# systemctl restart libvirtd
(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# echo "" > /var/log/libvirtd-debug.log 

3. hot plug the disk, error happens
(.libvirt-ci-venv-ci-runtest-5NxYiG) [root@dell-per740xd-08 ~]# virsh attach-device avocado-vt-vm1 vdb.xml 
error: Failed to attach device from vdb.xml
error: internal error: unable to execute QEMU command 'object-add': Parameter 'props' is unexpected


4. libvirtd log as follow:
libvirtd-debug.log
...
2021-05-07 15:11:23.920+0000: 108148: info : qemuMonitorSend:948 : QEMU_MONITOR_SEND_MSG: mon=0x7fbccc004090 msg={"execute":"object-add","arguments":{"qom-type":"secret","id":"libvirt-3-storage-auth-secret0","props":{"data":"2lSldJcjKTmHnXZyrS/gqeojWc00cm7qE/JH1NCxTZs=","keyid":"masterKey0","iv":"+/2EdeIEuInzQW2AKsYyKg==","format":"base64"}},"id":"libvirt-13"}^M
 fd=-1
2021-05-07 15:11:23.920+0000: 108226: info : virObjectRef:403 : OBJECT_REF: obj=0x7fbccc004090
2021-05-07 15:11:23.921+0000: 108226: info : qemuMonitorIOWrite:435 : QEMU_MONITOR_IO_WRITE: mon=0x7fbccc004090 buf={"execute":"object-add","arguments":{"qom-type":"secret","id":"libvirt-3-storage-auth-secret0","props":{"data":"2lSldJcjKTmHnXZyrS/gqeojWc00cm7qE/JH1NCxTZs=","keyid":"masterKey0","iv":"+/2EdeIEuInzQW2AKsYyKg==","format":"base64"}},"id":"libvirt-13"}^M
 len=251 ret=251 errno=0
2021-05-07 15:11:23.921+0000: 108226: info : virObjectRef:403 : OBJECT_REF: obj=0x7fbccc004090
2021-05-07 15:11:23.921+0000: 108226: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7fbccc004090
2021-05-07 15:11:23.921+0000: 108226: info : virObjectUnref:381 : OBJECT_UNREF: obj=0x7fbccc004090
2021-05-07 15:11:23.924+0000: 108226: info : virObjectRef:403 : OBJECT_REF: obj=0x7fbccc004090
2021-05-07 15:11:23.924+0000: 108226: debug : qemuMonitorJSONIOProcessLine:222 : Line [{"id": "libvirt-13", "error": {"class": "GenericError", "desc": "Parameter 'props' is unexpected"}}]
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONValueFromString:1865 : string={"id": "libvirt-13", "error": {"class": "GenericError", "desc": "Parameter 'props' is unexpected"}}
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleStartMap:1749 : parser=0x7fbd34ad86e0
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleMapKey:1730 : parser=0x7fbd34ad86e0 key=0x7fbce80e43c2
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleString:1708 : parser=0x7fbd34ad86e0 str=0x7fbce80e43c8
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleMapKey:1730 : parser=0x7fbd34ad86e0 key=0x7fbce80e43d6
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleStartMap:1749 : parser=0x7fbd34ad86e0
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleMapKey:1730 : parser=0x7fbd34ad86e0 key=0x7fbce80e43e0
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleString:1708 : parser=0x7fbd34ad86e0 str=0x7fbce80e43e9
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleMapKey:1730 : parser=0x7fbd34ad86e0 key=0x7fbce80e43f9
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleString:1708 : parser=0x7fbd34ad86e0 str=0x7fbce80e4401
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleEndMap:1775 : parser=0x7fbd34ad86e0
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONParserHandleEndMap:1775 : parser=0x7fbd34ad86e0
2021-05-07 15:11:23.924+0000: 108226: debug : virJSONValueFromString:1909 : result=0x7fbce82d8a70
2021-05-07 15:11:23.924+0000: 108226: info : qemuMonitorJSONIOProcessLine:241 : QEMU_MONITOR_RECV_REPLY: mon=0x7fbccc004090 reply={"id": "libvirt-13", "error": {"class": "GenericError", "desc": "Parameter 'props' is unexpected"}}
...

Comment 2 Peter Krempa 2021-05-07 16:12:44 UTC
This is fixed already upstream by:

commit 4f33b817b2926198ec626f10c3fca1c8aaececf6
Author: Peter Krempa <pkrempa>
Date:   Fri Mar 12 15:44:19 2021 +0100

    qemu: command: Use JSON for QAPIfied -object directly
    
    Skip the lossy conversion to legacy commandline arguments by using the
    JSON props directly when -object is QAPIfied. This avoids issues with
    conversion of bitmaps and also allows validation of the generated JSON
    against the QMP schema in the tests.
    
    Since the new approach is triggered by a qemu capability the code
    from 'virQEMUBuildObjectCommandlineFromJSON' in util/virqemu.c was moved
    to 'qemuBuildObjectCommandlineFromJSON' in qemu/qemu_command.c which has
    the virQEMUCaps type.
    
    Some functions needed to be modified to propagate qemuCaps.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>

commit 96850dfe216f99019978a55027a1e763135ae88f
Author: Peter Krempa <pkrempa>
Date:   Mon Nov 30 18:30:46 2020 +0100

    qemu: monitor: Don't add 'props' wrapper if qemu has QEMU_CAPS_OBJECT_QAPIFIED
    
    Set 'objectAddNoWrap' when the capability is present.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>

commit 71828a7bc0646ef834af37509fa8300ef4e74340
Author: Peter Krempa <pkrempa>
Date:   Mon Nov 30 17:08:46 2020 +0100

    qemuMonitorCreateObjectPropsWrap: Open-code in qemuBuildMemoryBackendProps
    
    There's just one caller left. Since qemuBuildMemoryBackendProps is too
    complex to be modified for now, just move the adding of 'id' and 'qom'
    type directly into the function.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>

commit e0eeb2cc67d960a48937f99c659fb63dbd4049dc
Author: Peter Krempa <pkrempa>
Date:   Mon Nov 30 16:03:57 2020 +0100

    qemu: monitor: Make wrapping of 'props' of 'object-add' optional
    
    Construct the JSON object which is used for object-add without the
    'props' wrapper and add the wrapper only in the monitor code.
    
    This simplifies the JSON->commandline generator in the first place and
    also prepares for upcoming qemu where 'props' will be removed.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Michal Privoznik <mprivozn>


v7.1.0-301-g4f33b817b2

Comment 3 Jing Qi 2021-05-31 07:12:38 UTC
Attaching memory device also met an issue whose root cause seems the same.  -

virsh attach-device avocado-vt-vm1 mem.xml
error: Failed to attach device from mem.xml
error: internal error: unable to execute QEMU command 'object-add': Parameter 'size' is missing

It's also fixed by this patch, right? Would you please help to comfirm it? Thanks

Comment 6 yisun 2021-06-02 02:44:19 UTC
(In reply to Jing Qi from comment #3)
> Attaching memory device also met an issue whose root cause seems the same.  -
> 
> virsh attach-device avocado-vt-vm1 mem.xml
> error: Failed to attach device from mem.xml
> error: internal error: unable to execute QEMU command 'object-add':
> Parameter 'size' is missing
> 
> It's also fixed by this patch, right? Would you please help to comfirm it?
> Thanks

this bug is ON_QA right now, pls have a check if your case can be passed with latest libvirt, thx

Comment 7 yisun 2021-06-02 14:02:30 UTC
auto case passed with: libvirt-7.3.0-1.el9

Comment 9 Peter Krempa 2021-08-06 15:59:21 UTC
(In reply to Jing Qi from comment #3)
> Attaching memory device also met an issue whose root cause seems the same.  -
> 
> virsh attach-device avocado-vt-vm1 mem.xml
> error: Failed to attach device from mem.xml
> error: internal error: unable to execute QEMU command 'object-add':
> Parameter 'size' is missing
> 
> It's also fixed by this patch, right? Would you please help to comfirm it?
> Thanks

Yes that's the same issue.


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