Bug 1910856

Summary: Disk pool changed to be inactive after restarting libvirtd
Product: Red Hat Enterprise Linux 9 Reporter: Meina Li <meili>
Component: libvirtAssignee: Peter Krempa <pkrempa>
libvirt sub component: General QA Contact: Meina Li <meili>
Status: CLOSED ERRATA Docs Contact:
Severity: low    
Priority: low CC: jdenemar, jsuchane, pkrempa, virt-maint, xuzhang
Version: 9.0Keywords: Regression, Triaged
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-8.1.0-1.el9 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-15 10:03:03 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: 8.1.0
Embargoed:

Description Meina Li 2020-12-25 09:04:48 UTC
Description of problem:
Disk pool changed to be inactive after restarting libvirtd

Version-Release number of selected component (if applicable):
libvirt-6.6.0-11.module+el8.3.1+9196+74a80ca4.x86_64
qemu-kvm-5.1.0-17.module+el8.3.1+9213+7ace09c3.x86_64

How reproducible:
100%

Steps to Reproduce:
1. Define disk pool.
# cat disk-pool.xml 
<pool type='disk'>
  <name>disk-pool</name>
  <source>
    <device path='/dev/sdc'/>
    <format type='dos'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>
# virsh pool-define disk-pool.xml 
Pool disk-pool defined from disk-pool.xml
# virsh pool-build disk-pool --overwrite 
Pool disk-pool built
2. Start the disk pool and check the status.
# virsh pool-start disk-pool 
Pool disk-pool started
# virsh pool-list --all
 Name         State    Autostart
----------------------------------
 disk-pool   active   yes
 images       active   yes
3. Restart libvirtd.
# systemctl restart libvirtd
4. Check the status of the disk pool.
# virsh pool-list --all
 Name         State      Autostart
------------------------------------
 disk-pool   inactive   yes
 images       active     yes


Actual results:
The disk pool change to be inactive

Expected results:
The disk pool should be in active status

Additional info:
Find an error in log:
2020-12-25 03:15:16.748+0000: 83740: error : virStoragePoolObjSourceFindDuplicate:1516 : operation failed: Storage source conflict with pool: 'disk-pool'

Comment 1 John Ferlan 2021-09-08 13:31:17 UTC
Bulk update: Move RHEL-AV bugs to RHEL9. If necessary to resolve in RHEL8, then clone to the current RHEL8 release.

Comment 2 Peter Krempa 2022-01-20 08:45:33 UTC
I can't reproduce the issue any more with current libvirt. Could you please re-try? If you manage to reproduce it please attach debug logs.

Comment 3 Peter Krempa 2022-01-20 09:32:37 UTC
I didn't notice that libvirtd doesn't autostart objects on plain restart now. So never-mind for now. I need to dig a bit deeper.

Comment 4 Peter Krempa 2022-01-20 13:48:27 UTC
Fixed upstream:

commit 9911a6f2ff888a53cc27bdca10efe31fd371dfb
Author: Peter Krempa <pkrempa>
Date:   Thu Jan 20 11:46:51 2022 +0100

    storage: Implement 'checkPool' method for 'disk' type pools
    
    If 'checkPool' is not implemented, the pool will be made inactive when
    restarting libvirtd and subsequently re-loading the state from the pool
    state XML.
    
    Base the 'checkPool' implementation on logic similar to 'startPool'.
    
    Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1910856
    Signed-off-by: Peter Krempa <pkrempa>
    Reviewed-by: Ján Tomko <jtomko>

v8.0.0-123-g9911a6f2ff

Comment 5 Meina Li 2022-03-15 01:29:13 UTC
Pre-verified Version:
libvirt-8.1.0-1.el9.x86_64
qemu-kvm-6.2.0-11.el9.x86_64

Pre-verified Steps:
S1: Create disk pool in split daemon mode.
1. Create a disk pool.
# lsscsi
[0:0:0:0]    disk    ATA      VB0250EAVER      HPG7  /dev/sda 
[1:0:0:0]    disk    ATA      VB0250EAVER      HPG7  /dev/sdb 
[5:0:0:0]    cd/dvd  HP       DV-18S-B         G.Y4  /dev/sr0 
[6:0:0:0]    disk    LIO-ORG  device.emulated  4.0   /dev/sdc 
# cat disk.pool 
<pool type='disk'>
  <name>disk-pool</name>
  <source>
    <device path='/dev/sdc'/>
    <format type='dos'/>
  </source>
  <target>
    <path>/dev</path>
  </target>
</pool>
# virsh pool-define disk.pool 
Pool disk-pool defined from disk.pool
# virsh pool-build disk-pool --overwrite
Pool disk-pool built
2. Start the disk pool and check the status.
# virsh pool-start disk-pool
Pool disk-pool started
# virsh pool-autostart disk-pool
Pool disk-pool marked as autostarted
# virsh pool-list --all
 Name        State    Autostart
---------------------------------
 disk-pool   active   yes
 images      active   yes
3. Restart the virtqemud and virtstoraged.
# systemctl restart virtstoraged;systemctl restart virtqemud
# virsh pool-list --all
 Name        State    Autostart
---------------------------------
 disk-pool   active   yes
 images      active   yes

S2: Create disk pool in libvirtd mode.
1. Repeat the above step1 ~ step2.
2. Restart the libvirtd service and check the status of disk pool.
# systemctl restart libvirtd
# virsh pool-list --all
 Name        State    Autostart
---------------------------------
 disk-pool   active   yes
 images      active   yes

Comment 9 Meina Li 2022-04-14 07:31:05 UTC
The test scenarios in Comment 5 are passed with libvirt-8.2.0-1.el9.x86_64 and
qemu-kvm-6.2.0-12.el9.x86_64.

Comment 10 Meina Li 2022-04-28 06:38:13 UTC
Hi Peter,

For disk pool, there's another regression issues: the disk pool will be active after restart virtstoraged even though we set no autostart to it. I'm not sure if it's related with this patch. Would you like to have a look? Thank you very much.

Test Version:
libvirt-8.2.0-1.el9.x86_64
qemu-kvm-7.0.0-1.el9.x86_64

Test Steps:
1. Define the inactive disk pool with autostart=no.
# virsh pool-autostart virsh_pool_test --disable
Pool virsh_pool_test unmarked as autostarted
# virsh pool-list --all
 Name              State      Autostart
-----------------------------------------
 images            active     yes
 virsh_pool_test   inactive   no

2. Restart virtstoraged.
# systemctl restart virtstoraged

3. Check the status of disk pool again.
# virsh pool-list --all
 Name              State    Autostart
---------------------------------------
 images            active   yes
 virsh_pool_test   active   no

Comment 11 Peter Krempa 2022-04-28 07:31:30 UTC
(In reply to Meina Li from comment #10)
> Hi Peter,
> 
> For disk pool, there's another regression issues: the disk pool will be
> active after restart virtstoraged even though we set no autostart to it. I'm
> not sure if it's related with this patch. Would you like to have a look?
> Thank you very much.

That is intended behaviour. The directory pool does exactly the same.

Comment 13 errata-xmlrpc 2022-11-15 10:03:03 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 (Low: libvirt security, bug fix, and enhancement update), 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-2022:8003