Bug 2001392

Summary: Can not restore guest from a block device
Product: Red Hat Enterprise Linux 9 Reporter: John Ferlan <jferlan>
Component: libvirtAssignee: Michal Privoznik <mprivozn>
Status: CLOSED NOTABUG QA Contact: Lili Zhu <lizhu>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 9.0CC: coli, fjin, jdenemar, lizhu, lmen, mprivozn, pkrempa, timao, virt-maint, xuzhang, yafu, yalzhang
Target Milestone: rcKeywords: Triaged, Upstream
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1942275 Environment:
Last Closed: 2021-09-09 11:13:04 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:
Embargoed:
Bug Depends On: 1942275    
Bug Blocks:    

Description John Ferlan 2021-09-05 23:48:45 UTC
+++ This bug was initially created as a clone of Bug #1942275 +++

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.

--- Additional comment from Peter Krempa on 2021-03-24 08:06:04 UTC ---

It seems that the issue was already fixed upstream. Targetting to rhel-8.6 which will be rebased.

--- Additional comment from Michal Privoznik on 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 1 Jiri Denemark 2021-09-09 11:13:04 UTC
This bug was never present in RHEL-9 (beta).