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 2004429 - Can't get vcpuinfo when the guest is shutoff
Summary: Can't get vcpuinfo when the guest is shutoff
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 9
Classification: Red Hat
Component: libvirt
Version: 9.0
Hardware: Unspecified
OS: Unspecified
high
unspecified
Target Milestone: rc
: ---
Assignee: Peter Krempa
QA Contact: Luyao Huang
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-09-15 09:41 UTC by Meina Li
Modified: 2022-05-17 13:04 UTC (History)
6 users (show)

Fixed In Version: libvirt-7.7.0-3.el9
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2022-05-17 12:45:32 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker RHELPLAN-97221 0 None None None 2021-09-15 09:45:21 UTC
Red Hat Product Errata RHBA-2022:2390 0 None None None 2022-05-17 12:45:58 UTC

Description Meina Li 2021-09-15 09:41:41 UTC
Description of problem:
Can't get vcpuinfo when the guest is shutoff

Version-Release number of selected component (if applicable):
libvirt-7.7.0-1.el9.x86_64
qemu-kvm-6.1.0-2.el9.x86_64
kernel-5.14.0-1.el9.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Prepare a shutoff guest.
# virsh domstate avocado-vt-vm1
shut off

2. Setvcpus to the guest.
# virsh setvcpus avocado-vt-vm1 1  --config

3. Check the vcpucount.
# virsh vcpucount avocado-vt-vm1
maximum      config         2
current      config         1

4. Check the vcpuinfo.
# virsh vcpuinfo avocado-vt-vm1
---no output


Actual results:
Can't get vcpuinfo when the guest is shutoff

Expected results:
Can get vcpuinfo even though the guest is off

Additional info:
auto case: virsh.setvcpus.normal_test.guest_off.option_config

Comment 1 Meina Li 2021-09-15 10:04:48 UTC
Can't reproduce in the last version: libvirt-7.6.0-2.el9.x86_64

Comment 2 Peter Krempa 2021-09-15 13:03:06 UTC
I've traced this to one of cleanup refactors of XML parsing in commit bd1f40fe7d4

Comment 3 Peter Krempa 2021-09-15 13:32:33 UTC
Fixed upstream:

commit eb2e317c65fdbbf45117d5f423da12870842cc59
Author: Peter Krempa <pkrempa>
Date:   Wed Sep 15 15:13:24 2021 +0200

    virshDomainGetVcpuBitmap: Refactor cleanup
    
    Rename the temp variable that is being returned and use automatic
    pointer clearing for it.
    
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Pavel Hrdina <phrdina>
    Reviewed-by: Jiri Denemark <jdenemar>
    Reviewed-by: Jonathon Jongsma <jjongsma>

commit 59e74c319384b766a50669c6248222da0cf10fd0
Author: Peter Krempa <pkrempa>
Date:   Wed Sep 15 15:09:00 2021 +0200

    virshDomainGetVcpuBitmap: Return bitmap when taking the fallback path
    
    In case the specific VCPU states are not present in the XML we were
    taking a fallback code path just noting that all cpus of the VM are
    enabled.
    
    This was broken by a mistake in a recent refactor where a 'goto cleanup'
    was mistakenly replaced by a 'return NULL'. This broke reporting of cpus
    and also caused a memory leak.
    
    Return the fallback cpu map.
    
    Fixes: bd1f40fe7d4
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2004429
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Pavel Hrdina <phrdina>
    Reviewed-by: Jiri Denemark <jdenemar>
    Reviewed-by: Jonathon Jongsma <jjongsma>

Comment 4 Luyao Huang 2021-10-15 02:19:38 UTC
Test passed on libvirt-7.8.0-1.el9.x86_64

Comment 7 Luyao Huang 2021-11-01 07:44:52 UTC
Verify this bug with libvirt-7.8.0-1.el9.x86_64:


# virsh domstate vm1
shut off

# virsh setvcpus vm1 1  --config


# virsh vcpucount vm1
maximum      config         2
current      config         1

# virsh vcpuinfo vm1
VCPU:           0
CPU:            N/A
State:          N/A
CPU time        N/A
CPU Affinity:   yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy

Comment 9 errata-xmlrpc 2022-05-17 12:45:32 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 (new packages: libvirt), 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/RHBA-2022:2390


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