Bug 1525131

Summary: Virt-v2v can't convert rhel7 guest whose partitions have different encrypted luks
Product: Red Hat Enterprise Linux 7 Reporter: mxie <mxie>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.5CC: dyuan, jsuchane, juzhou, mzhan, ptoscano, rjones, tzheng, xiaodwan, zili
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Unspecified   
Whiteboard: V2V
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1658126 (view as bug list) Environment:
Last Closed: 2019-06-25 13:28:41 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:    
Bug Blocks: 1558351, 1658126    
Attachments:
Description Flags
virt-v2v-rhel7-encryption.log
none
rhel7.5-encrypted guest converts successfully none

Description mxie@redhat.com 2017-12-12 16:34:48 UTC
Created attachment 1366811 [details]
virt-v2v-rhel7-encryption.log

Description of problem:
Virt-v2v can't convert rhel7 guest which has encrypted partition


Version-Release number of selected component (if applicable):
virt-v2v-1.36.10-4.el7.x86_64
libguestfs-1.36.10-4.el7.x86_64
libvirt-3.9.0-6.el7.x86_64
qemu-kvm-rhev-2.10.0-12.el7.x86_64
kernel-3.10.0-799.el7.x86_64

How reproducible:
100%

Steps to Reproduce:
1.Use v2v to convert a rhel7 guest which has encrypted partition but the conversion will be failed with below error.
# virt-v2v rhel7.5-encryption -o rhv -os 10.73.131.93:/home/nfs_export
[   0.0] Opening the source -i libvirt rhel7.5-encryption
[   0.1] Creating an overlay to protect the source from being modified
[   1.2] Initializing the target -o rhv -os 10.73.131.93:/home/nfs_export
[   1.6] Opening the overlay
[  17.4] Inspecting the overlay
virt-v2v: error: inspection could not detect the source guest (or physical
machine).

Assuming that you are running virt-v2v/virt-p2v on a source which is
supported (and not, for example, a blank disk), then this should not
happen.

No root device found in this operating system image.

If reporting bugs, run virt-v2v with debugging enabled and include the
complete output:

  virt-v2v -v -x [...]



Actual results:
As above description

Expected results:
Virt-v2v can convert encrypted rhel7 guest

Additional info:
Virt-v2v can convert encrypted rhel6 guest

Comment 2 Richard W.M. Jones 2017-12-12 17:16:13 UTC
This is not a dupe of bug 1398191?

Comment 3 Richard W.M. Jones 2017-12-12 17:17:13 UTC
OK wrong product.  This is the downstream bug so I'll set the
dependency.

Comment 4 mxie@redhat.com 2017-12-13 04:14:16 UTC
Hi rjones,

   Sorry for description of problem is not unclear, below is some details info for your reference:

1.The rhel7 encrypted guest maintained in bug is created by below way:
Create a new guest in virt-manager -> try to install rhel7 OS for guest via is o file->encrypting all partitions except /boot at partition interface during installation-> begin installation

2.Below is disk info of rhel7 encrypted guest after finishing OS installtion
# lsblk
NAME                                        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                           8:0    0    9G  0 disk  
├─sda1                                        8:1    0    1G  0 part  /boot
└─sda2                                        8:2    0    8G  0 part  
  ├─rhel-root                               253:0    0  7.1G  0 lvm   
  │ └─luks-07934cf9-3cef-4677-8ce3-0eb047d641f0
                                            253:3    0  7.1G  0 crypt /
  └─rhel-swap                               253:1    0  924M  0 lvm   
    └─luks-262fb950-61a0-47f7-a1f6-bb23d8a5fddf
                                            253:2    0  922M  0 crypt [SWAP]


Actually,I reported a same problem (Bug 1451665) on rhel7.4 product before, but bug 1451665 only fixed the problem for rhel6 guest, so I file this bug to fix the problem for rhel7 guest


As Pino said in https://bugzilla.redhat.com/show_bug.cgi?id=1398191#c6, this bug needs very different fixes/implementations with bug 1398191, so maybe this bug shouldn't depend on bug1398191?

Comment 5 Pino Toscano 2017-12-13 14:44:22 UTC
This is a different type of encryption layout, and it is not supported yet.

See the difference between the partitions in bug 1451665 comment 3:

|  #lsblk
| NAME                          MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
| xvda                          202:0    0 14.7G  0 disk  
| ├─xvda1                       202:1    0  500M  0 part  /boot
| └─xvda2                       202:2    0 14.2G  0 part  
|   └─luks-6b952cdc-9d5b-426d-bd0c-1ba16e00b4eb (dm-0)
|                               253:0    0 14.2G  0 crypt 
|     ├─VolGroup-lv_root (dm-1) 253:1    0 12.7G  0 lvm   /
|     └─VolGroup-lv_swap (dm-2) 253:2    0  1.5G  0 lvm   [SWAP]

with the one in comment 4.

Also, none of the scenarios in bug 1398191 is this one.

Comment 6 liuzi 2018-10-29 07:34:35 UTC
Virt-v2v can convert RHEL7.5 guest which has encrypted partition with builds:
virt-v2v-1.38.2-12.el7.x86_64
libvirt.x86_64 0:4.5.0-10.el7  
qemu-kvm-rhev-2.12.0-18.el7.x86_64
libguestfs-1.38.2-12.el7.x86_64
kernel-3.10.0-954.el7.x86_64

Steps:
1.Prepare a rhel7.5 guest which has encrypted partition.
# lsblk
NAME                                          MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                             8:0    0   16G  0 disk 
├─sda1                                          8:1    0    1G  0 part  /boot
└─sda2                                          8:2    0   15G  0 part 
  └─luks-383d1b33-687e-44ec-a405-51aee70ecedb 253:0    0   15G  0 crypt
    ├─rhel-root                               253:1    0 13.4G  0 lvm   /
    └─rhel-swap                               253:2    0  1.6G  0 lvm   [SWAP]
sr0                                            11:0    1 1024M  0 rom  
2.Use virt-v2v to convert the above guest,and the conversion could be finished without error.
# virt-v2v -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1 esx6.7-rhel7.5-encrypted --password-file /tmp/passwd
[   0.0] Opening the source -i libvirt -ic vpx://root.73.141/data/10.73.75.219/?no_verify=1 esx6.7-rhel7.5-encrypted
[   2.0] Creating an overlay to protect the source from being modified
[   2.7] Initializing the target -o libvirt -os default
[   2.7] Opening the overlay
Enter key or passphrase ("/dev/sda2"): 
[  46.8] Inspecting the overlay
[ 204.1] Checking for sufficient free disk space in the guest
[ 204.1] Estimating space required on target for each disk
[ 204.1] Converting Red Hat Enterprise Linux Server 7.5 (Maipo) to run on KVM
virt-v2v: This guest has virtio drivers installed.
[1568.9] Mapping filesystem data to avoid copying unused and blank areas
virt-v2v: warning: fstrim on guest filesystem /dev/rhel/root failed.  
Usually you can ignore this message.  To find out more read "Trimming" in 
virt-v2v(1).

Original message: fstrim: fstrim: /sysroot/: the discard operation is not 
supported
[1573.2] Closing the overlay
[1573.8] Checking if the guest needs BIOS or UEFI to boot
[1573.8] Assigning disks to buses
[1573.8] Copying disk 1/1 to /var/lib/libvirt/images/esx6.7-rhel7.5-encrypted-sda (raw)
    (100.00/100%)
[2998.4] Creating output metadata
Pool default refreshed

Domain esx6.7-rhel7.5-encrypted defined from /tmp/v2vlibvirt21d9b0.xml

[2999.6] Finishing off

3.New guest boots successfully and checkpoints of guest are passed.

Additional info:
The conversion log please refer to attachment.

Comment 7 liuzi 2018-10-29 07:37:12 UTC
Created attachment 1498428 [details]
rhel7.5-encrypted guest converts successfully

Comment 8 mxie@redhat.com 2018-12-11 10:15:42 UTC
After debugging, found v2v can't convert rhel7 guest which has below encrypted partitions (the guest of comment0 has below partitions)
# lsblk
NAME                                        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
fd0                                           2:0    1    4K  0 disk  
sda                                           8:0    0   10G  0 disk  
├─sda1                                        8:1    0    1G  0 part  /boot
└─sda2                                        8:2    0    9G  0 part  
  ├─rhel_bootp--73--75--88-root             253:0    0    8G  0 lvm   
  │ └─luks-859f7daa-476a-406f-a67f-604384bdd55c
                                            253:2    0    8G  0 crypt /
  └─rhel_bootp--73--75--88-swap             253:1    0    1G  0 lvm   
    └─luks-698ae8a1-5149-4de3-9050-5eca22747230


But v2v can convert rhel7 guest which has below encrypted partitions (the guest of comment6 has below partitions)
# lsblk
NAME                                        MAJ:MIN RM  SIZE RO TYPE  MOUNTPOINT
sda                                           8:0    0   16G  0 disk  
├─sda1                                        8:1    0    1G  0 part  /boot
└─sda2                                        8:2    0   15G  0 part  
  └─luks-870d71c5-1155-4018-8cb5-a668ea88b036
                                            253:0    0   15G  0 crypt 
    ├─rhel-root                             253:1    0 13.4G  0 lvm   /
    └─rhel-swap                             253:2    0  1.6G  0 lvm   [SWAP]

Comment 9 Jaroslav Suchanek 2019-06-25 13:28:41 UTC
This issue will be addressed in next major release of RHEL.