Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
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 1529472

Summary: the data of luks disk can't be accessed after cross migrating guest from rhel7.5 host to rhel7.4 host
Product: Red Hat Enterprise Linux 7 Reporter: lijuan men <lmen>
Component: libvirtAssignee: Libvirt Maintainers <libvirt-maint>
Status: CLOSED DUPLICATE QA Contact: yisun
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: pkrempa, rbalakri, xuzhang, yisun, zpeng
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-01-03 13:57:33 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:

Description lijuan men 2017-12-28 09:27:00 UTC
Description of problem:
the data of luks disk can't be accessed after cross migrating guest from rhel7.5 host to rhel7.4 host

Version-Release number of selected component (if applicable):

source rhel7.5 host:
libvirt-3.9.0-6.el7.x86_64
qemu-kvm-rhev-2.10.0-13.el7.x86_64

destination rhel7.4.z host:
libvirt-3.2.0-14.el7_4.5.x86_64
qemu-kvm-rhev-2.9.0-16.el7_4.13.x86_64

How reproducible:
100%

Steps to Reproduce:

1.prepare the luks secret in both hosts
1) prepare secret xml file
[root@lmen1 ~]# cat secret-luks.xml
<secret ephemeral='no' private='yes'>
  <uuid>f981dd17-143f-45bc-88e6-ed1fe20ce9da</uuid>
  <description>LUKS Sample Secret</description>
  <usage type='volume'>
    <volume>/var/libvirt/images/luks.img</volume>
  </usage>
</secret>

2) define luks secret
[root@lmen1 ~]# virsh secret-define secret-luks.xml
Secret f981dd17-143f-45bc-88e6-ed1fe20ce9da created

3) set value of the luks secret.
[root@lmen1 ~]# MYSECRET=`printf %s "redhat" | base64`
[root@lmen1 ~]# virsh secret-set-value  f981dd17-143f-45bc-88e6-ed1fe20ce9da $MYSECRET
  Secret value set

2.start a guest in rhel7.5 host with xml:  -->***encryption is the sub-element of source***
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/luks.img'>
        <encryption format='luks'>
          <secret type='passphrase' uuid='f981dd17-143f-45bc-88e6-ed1fe20ce9da'/>
        </encryption>
      </source>
      <target dev='sdb' bus='scsi'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

[root@lmen1 ~]# virsh start test
Domain test started

3.migrate the guest from rhel7.5 host to the rhel7.4.z destination  host
[root@lmen1 ~]# virsh migrate test --live  qemu+ssh://lmen/system


4.check the xml in the destination host:
[root@localhost ~]# virsh dumpxml test 
...
 <disk type='file' device='disk'>
      <driver name='qemu' type='raw' cache='none'/>
      <source file='/var/lib/libvirt/images/luks.img'/>  -->***there is not encryption element any more***
      <backingStore/>
      <target dev='sdb' bus='scsi'/>
      <alias name='scsi0-0-0-1'/>
      <address type='drive' controller='0' bus='0' target='0' unit='1'/>
    </disk>

...

login the guest in the destination host,
running "fdisk -l" can find the luks disk, but can't mount the disk:
#mount /dev/sda /mnt
mount:unknown filesystem type 'crypto_LUKS'

Actual results:
migration successfully,but can't access the data of the disk any more

Expected results:

If the customer migrate the guest with luks disk from rhel7.5 to rhel7.4,they will can not access the data after the migration successfully,and they also can not access the data if they migrate the guest back to rhel7.5 host(the encryption element still missing)

So I think the expected result is:
the migration should be prevented in the source rhel7.5 host

Additional info:

Comment 2 Peter Krempa 2018-01-03 13:57:33 UTC
You used a new feature and tried to migrate to an older libvirt which does not support it. We have a BZ which tracks adding an error for these cases.

*** This bug has been marked as a duplicate of bug 1371747 ***