Bug 1482737

Summary: virt-resize failed to expand swap partition for RHEL5.11 guest image with "parsing UUID failed"
Product: Red Hat Enterprise Linux 7 Reporter: Xianghua Chen <xchen>
Component: libguestfsAssignee: Richard W.M. Jones <rjones>
Status: CLOSED ERRATA QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.4CC: jsuchane, ptoscano, toneata, wshi, xchen, yoguo
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libguestfs-1.36.5-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2018-04-10 09:18:10 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: 1472272    
Bug Blocks:    
Attachments:
Description Flags
log.virt-resize_expand_swap.rhel5.11 none

Description Xianghua Chen 2017-08-18 02:02:01 UTC
Created attachment 1314986 [details]
log.virt-resize_expand_swap.rhel5.11

Description of problem:
virt-resize failed to expand swap partition for RHEL5.11 guest image with "parsing UUID failed".
Please refer to the attachment for detailed log.


Version-Release number of selected component (if applicable):
libguestfs-1.36.3-6.el7_4.2.x86_64

How reproducible:
100%


Steps:

1. Prepare a RHEL5.11 guest image: RHEL-Server-5.11-64-hvm.raw
2. Check the swap partition:
# virt-filesystems -a RHEL-Server-5.11-64-hvm.raw -lh --extra
Name                      Type        VFS   Label  Size  Parent
/dev/sda1                 filesystem  ext3  /boot  102M  -
/dev/VolGroup00/LogVol00  filesystem  ext3  -      5.9G  -
/dev/VolGroup00/LogVol01  filesystem  swap  -      2.0G  -
3. Create a image for test:
# qemu-img create libguestfs_virt-resize_test.img 22474836480
4. Expand the swap partition:
# virt-resize --expand /dev/sda2 --LV-expand /dev/VolGroup00/LogVol01 RHEL-Server-5.11-64-hvm.raw libguestfs_virt-resize_test.img[   0.0] Examining RHEL-Server-5.11-64-hvm.raw
**********

Summary of changes:

/dev/sda1: This partition will be left alone.

/dev/sda2: This partition will be resized from 7.9G to 8.8G.  The LVM PV on 
/dev/sda2 will be expanded using the 'pvresize' method.

/dev/VolGroup00/LogVol01: This logical volume will be expanded to maximum 
size.  The swap on /dev/VolGroup00/LogVol01 will be expanded using the 
'mkswap' method.

**********
[   3.4] Setting up initial partition table on libguestfs_virt-resize_test.img
[   3.6] Copying /dev/sda1
[   4.0] Copying /dev/sda2
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[  87.1] Expanding /dev/sda2 using the 'pvresize' method
[  87.1] Expanding /dev/VolGroup00/LogVol01 using the 'mkswap' method
virt-resize: error: libguestfs error: mkswap: /dev/VolGroup00/LogVol01: 
mkswap: error: parsing UUID failed

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

  virt-resize -v -x [...]



Actual results:
Failed to expand the swap partition.

Expected results:
The swap partition should be expanded successfully.

Additional info:
This command passed on RHEL4.8/RHEL6.9/RHEL7.3.

Comment 3 Pino Toscano 2017-08-18 08:57:08 UTC
Patch posted:
https://www.redhat.com/archives/libguestfs/2017-August/msg00106.html

Comment 4 Pino Toscano 2017-08-18 14:58:15 UTC
Fixed upstream with
https://github.com/libguestfs/libguestfs/commit/6befd1464d9939b9c15373b19296e796bea3d8d5
which is in libguestfs >= 1.37.22.

Comment 9 YongkuiGuo 2017-09-29 07:10:02 UTC
Verified with the package:
libguestfs-1.36.6-2.el7.x86_64


Steps:

1. Prepare a RHEL5.11 guest image: RHEL-Server-5.11-64-hvm.raw

2. Check the swap partition:
# virt-filesystems -a RHEL-Server-5.11-64-hvm.raw -lh --extra
Name                      Type        VFS   Label  Size  Parent
/dev/sda1                 filesystem  ext3  /boot  102M  -
/dev/VolGroup00/LogVol00  filesystem  ext3  -      5.9G  -
/dev/VolGroup00/LogVol01  filesystem  swap  -      2.0G  -

3. Create a image for test:
# qemu-img create libguestfs_virt-resize_test.img 22474836480

4. Expand the swap partition:
# virt-resize --expand /dev/sda2 --LV-expand /dev/VolGroup00/LogVol01 RHEL-Server-5.11-64-hvm.raw libguestfs_virt-resize_test.img
--------------------------------------------------------
[   0.0] Examining RHEL-Server-5.11-64-hvm.raw
**********

Summary of changes:

/dev/sda1: This partition will be left alone.

/dev/sda2: This partition will be resized from 7.9G to 20.8G.  The LVM PV 
on /dev/sda2 will be expanded using the 'pvresize' method.

/dev/VolGroup00/LogVol01: This logical volume will be expanded to maximum 
size.  The swap on /dev/VolGroup00/LogVol01 will be expanded using the 
'mkswap' method.

**********
[   4.7] Setting up initial partition table on libguestfs_virt-resize_test.img
[   5.1] Copying /dev/sda1
[   5.4] Copying /dev/sda2
 100% ⟦▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒⟧ 00:00
[  49.4] Expanding /dev/sda2 using the 'pvresize' method
[  49.4] Expanding /dev/VolGroup00/LogVol01 using the 'mkswap' method
virt-resize: warning: UUID in swap partition /dev/VolGroup00/LogVol01 
changed from ‘’ to ‘9f11776b-d783-4c3f-a717-726c27552cfd’

Resize operation completed with no errors.  Before deleting the old disk, 
carefully check that the resized disk boots and works correctly.
--------------------------------------------------------

The swap partition can be expanded successfully with the new libguestfs version. So verified this bug.

Comment 12 errata-xmlrpc 2018-04-10 09:18:10 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, 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/RHBA-2018:0677