Bug 1171805

Summary: vgimportclone doesn't work in RHEL 6.6
Product: Red Hat Enterprise Linux 6 Reporter: Konstantin Volkov <wolf>
Component: lvm2Assignee: Peter Rajnoha <prajnoha>
lvm2 sub component: Scripts / lvmdump / vgimportclone (RHEL6) QA Contact: cluster-qe <cluster-qe>
Status: CLOSED ERRATA Docs Contact:
Severity: high    
Priority: high CC: agk, heinzm, jbrassow, msnitzer, nperic, prajnoha, prockai, zkabelac
Version: 6.6   
Target Milestone: rc   
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Fixed In Version: lvm2-2.02.117-1.el6 Doc Type: Bug Fix
Doc Text:
The vgimportclone script makes some assumptions about the content of the lvm2 configuration file(s) on the system. In some cases, one or more of these assumptions is false and may cause the script to fail. We have rewritten the problematic portion of the script to make it more robust. In technical terms, we now use a new 'dumpconfig' feature to manipulate the configuration file instead of 'awk'.
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-07-22 07:37:54 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Description Flags
vgimportclone-d.log none

Description Konstantin Volkov 2014-12-08 16:18:33 UTC
vgimportclone doesn't work in RHEL 6.6

Version-Release number of selected component (if applicable):
[root@rhel66 ~]# rpm -qa lvm2

How reproducible:

Steps to Reproduce:

1. Check existing VGs:
[root@rhel66 ~]# vgs
  VG          #PV #LV #SN Attr   VSize  VFree
  vg_rhel66     1   3   0 wz--n- 63,51g    0 
  vg_test       1   1   0 wz--n- 64,00g    0 

2. Try to rename a VG:
[root@rhel66 ~]# vgimportclone --basevgname vg_test2 /dev/sdb
Fatal: Temporary lvm.conf must contain 'filter' config.
[root@rhel66 ~]# echo $?

Actual results:
vgimportclone fails to rename an existing VG (error 5).

Expected results:
vgimportclone successfully renames an existing VG.

Additional info:
On lvm2 from RHEL 6.5 (lvm2-2.02.100-8.el6) all works as expected

Comment 2 Alasdair Kergon 2014-12-08 18:33:50 UTC
1) Please supply the output of 'bash -x vgimportclone...'

2) Please supply a copy of your LVM configuration file(s) e.g. /etc/lvm/lvm.conf

Comment 3 Alasdair Kergon 2014-12-08 18:40:04 UTC
You could also run with -d and look for the files in the temporary subdirectory it uses.

Comment 4 Konstantin Volkov 2014-12-09 11:28:11 UTC
Created attachment 966196 [details]

Comment 5 Konstantin Volkov 2014-12-09 11:29:01 UTC
Created attachment 966197 [details]


Comment 6 Konstantin Volkov 2014-12-09 11:45:27 UTC
Created attachment 966200 [details]


Comment 7 Alasdair Kergon 2014-12-09 14:14:38 UTC
Thanks for that - I've reproduced this.
Since that script was written, we've enhanced 'dumpconfig' and might be able to use a new option instead of the 'awk' which is going wrong.

Comment 9 Alasdair Kergon 2014-12-09 17:53:58 UTC
As a workaround, try uncommenting the line in lvm.conf:
  filter = [ "a/.*/" ]

(but there are several problems with the awk statement)

Comment 10 Peter Rajnoha 2014-12-10 13:22:48 UTC
This patch replaces the awk with dumpconfig to generate temporary lvm.conf for use in vgimportclone script:


There was also another bug and that is the vgimportclone did not call pvscan --cache to notify lvmetad about changes if lvmetad is used:


Comment 12 Nenad Peric 2015-04-13 18:21:52 UTC
[root@tardis-02 fd]# lvcreate -L3G -n volume vg
  Logical volume "volume" created.
[root@tardis-02 fd]# dd if=/dev/sdb2 of=/dev/sdc2 
39054015+0 records in
39054015+0 records out
19995655680 bytes (20 GB) copied, 315.655 s, 63.3 MB/s

[root@tardis-02 fd]# pvs -a -o+pv_uuid
  Found duplicate PV Sf85Osj554iody2xe3aHN8LJp3ihjfL7: using /dev/sdc2 not /dev/sdb2
  PV                       VG          Fmt  Attr PSize   PFree  PV UUID  
/dev/sdb2                                 ---       0      0  Sf85Os-j554-iody-2xe3-aHN8-LJp3-ihjfL7
  /dev/sdb3                                 ---       0      0                                        
  /dev/sdb5                                 ---       0      0                                        
  /dev/sdb6                                 ---       0      0                                        
  /dev/sdc1                                 ---       0      0                                        
  /dev/sdc2                vg          lvm2 a--   18.62g 15.62g Sf85Os-j554-iody-2xe3-aHN8-LJp3-ihjfL7

[root@tardis-02 fd]# vgimportclone -n oldvg /dev/sdc2
  Found duplicate PV Sf85Osj554iody2xe3aHN8LJp3ihjfL7: using /dev/sdc2 not /dev/sdb2
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Physical volume "/tmp/snap.pzwaQnM1/vgimport0" changed
  1 physical volume changed / 0 physical volumes not changed
  WARNING: Activation disabled. No device-mapper interaction will be attempted.
  Volume group "vg" successfully changed
  Volume group "vg" successfully renamed to "oldvg"
  Reading all physical volumes.  This may take a while...
  Found volume group "oldvg" using metadata type lvm2
  Found volume group "vg" using metadata type lvm2
  Found volume group "vg_tardis02" using metadata type lvm2
[root@tardis-02 fd]# echo $?

[root@tardis-02 fd]# vgs
  VG          #PV #LV #SN Attr   VSize   VFree 
  oldvg         1   1   0 wz--n-  18.62g 15.62g
  vg            1   1   0 wz--n-  18.62g 15.62g
  vg_tardis02   1   3   0 wz--n- 278.88g     0 
[root@tardis-02 fd]# lvs -a
  LV      VG          Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  volume  oldvg       -wi-------   3.00g                                                    
  volume  vg          -wi-a-----   3.00g                     

Marking VERIFIED with:


Comment 13 errata-xmlrpc 2015-07-22 07:37:54 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.