Bug 1942275

Summary: Can not restore guest from a block device
Product: Red Hat Enterprise Linux 8 Reporter: Lili Zhu <lizhu>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED ERRATA QA Contact: Lili Zhu <lizhu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 8.4CC: fjin, jdenemar, lmen, pkrempa, virt-maint, xuzhang, yafu, yalzhang
Target Milestone: rcKeywords: Triaged, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libvirt-7.8.0-1.module+el8.6.0+12978+7d7a0321 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2001392 (view as bug list) Environment:
Last Closed: 2022-05-10 13:18:42 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: 6.6.0
Embargoed:
Bug Depends On:    
Bug Blocks: 2001392    

Description Lili Zhu 2021-03-24 02:54:02 UTC
Description of problem:
Can not restore guest from a block device

Version-Release number of selected component (if applicable):
libvirt-6.0.0-35.module+el8.4.0+10230+7a9b21e4.x86_64
qemu-kvm-4.2.0-48.module+el8.4.0+10368+630e803b.x86_64
selinux-policy-3.14.3-67.el8.noarch

How reproducible:
100%

Steps to Reproduce:
1. prepare a block device
# lsblk
NAME                            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda                               8:0    0   223G  0 disk
├─sda1                            8:1    0     1G  0 part /boot
└─sda2                            8:2    0   222G  0 part
  ├─rhel_dell--per6415--04-root 253:0    0    70G  0 lvm  /
  ├─rhel_dell--per6415--04-swap 253:1    0  11.7G  0 lvm  [SWAP]
  └─rhel_dell--per6415--04-home 253:2    0 140.3G  0 lvm  /home
sdb                               8:16   0    20G  0 disk

2. check selinux mode
# getenforce 
Enforcing

3. save the guest to the block device
# virsh save avocado-vt-vm1 /dev/sdb

Domain avocado-vt-vm1 saved to /dev/sdb

4. check the context of sdb
# ll -aZ /dev/sdb
brw-rw----. 1 root root system_u:object_r:svirt_image_t:s0:c713,c725 8, 16 Mar 23 22:29 /dev/sdb

5. restore the guest from the block device
# virsh restore /dev/sdb
error: Failed to restore domain from /dev/sdb
error: internal error: child reported (status=125): unable to set security context 'system_u:object_r:virt_content_t:s0' on '/dev/sdb': No such file or directory
 
Expected results:
guest can be restored


Additional info:
when put put namespaces = [] in qemu.conf, it works well.
The same with Bug #1772838, difference is just the error msg.

Comment 2 Michal Privoznik 2021-03-24 08:40:29 UTC
Right, I think this was fixed upstream as:

https://gitlab.com/libvirt/libvirt/-/commit/824e349397b1f1fa5d7c1c5d21c88e04df21bf17

which aimed to fix bug 1851016.

Comment 6 Lili Zhu 2021-11-03 13:37:47 UTC
Verify this bug with:
libvirt-7.8.0-1.module+el8.6.0+12978+7d7a0321.x86_64
qemu-kvm-6.1.0-3.module+el8.6.0+12952+612d1b20.x86_64

Verification steps are the same with that in comment #0, guest can be restored from the block device, mark the bug as verified.

Comment 8 errata-xmlrpc 2022-05-10 13:18:42 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 (Moderate: virt:rhel and virt-devel:rhel 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:1759