Bug 1100140

Summary: some operation cause "lvremove" can not find the object
Product: Red Hat Enterprise Linux 6 Reporter: bfan
Component: libguestfsAssignee: Pino Toscano <ptoscano>
Status: CLOSED WONTFIX QA Contact: Virtualization Bugs <virt-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.5CC: leiwang, linl, mbooth, ptoscano, rjones, wshi, xchen
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: 1100138 Environment:
Last Closed: 2017-01-23 14:05:06 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: 1100138    
Bug Blocks: 1301844    

Description bfan 2014-05-22 06:03:00 UTC
+++ This bug was initially created as a clone of Bug #1100138 +++

Description of problem:
1. create a LV on /dev/sda1, then re-partition /dev/sda1 without remove LV
2. reload disk and re-partition again, we can see LV still exists.
3. LV can't be removed


Version-Release number of selected component (if applicable):
libguestfs-1.22.6-22.el7.x86_64


How reproducible:
100%


Steps to Reproduce:
1. create a disk.
# dd if=/dev/zero of=/tmp/lvmtest.img bs=1M count=1024

2.  create a lvm on /dev/sda1, then re-partition /dev/sda1 without remove lvm.
(All commands in one line)
# guestfish -a /tmp/lvmtest.img run : part-disk /dev/sda msdos : pvcreate /dev/sda1 : vgcreate vg /dev/sda1 : lvcreate lv vg 50 : lvs : part-disk /dev/sda msdos
/dev/vg/lv
libguestfs: error: part_disk: parted: /dev/sda: Error: Partition(s) 1 on /dev/sda have been written, but we have been unable to inform the kernel of the change, probably because it/they are in use.  As a result, the old partition(s) will remain in use.  You should reboot now before making further changes.

3. reload disk , re-partition and do lvremove
# guestfish -a /tmp/lvmtest.img run : part-disk /dev/sda msdos : lvs : lvremove /dev/vg/lv


Actual results:
libguestfs: error: lvremove: lvremove_stub: /dev/vg/lv: No such file or directory


Expected results:
lv can be removed.


Additional info:
Same operation on rhel7 guest, LV can be removed successfully

# parted -s -- /dev/xvdb mklabel msdos mkpart primary 128s -128s
# lvm pvcreate --force /dev/xvdb1
# lvm vgcreate vg /dev/xvdb1
# lvm lvcreate -L 50 -n lv vg
# parted -s -- /dev/xvdb mklabel msdos mkpart primary 128s -128s

After reboot,
# parted -s -- /dev/xvdb mklabel msdos mkpart primary 128s -128s
# lvremove /dev/vg/lv

Comment 4 Richard W.M. Jones 2017-01-23 14:05:06 UTC
I'm closing this as WONTFIX as it's not a customer bug and is
a minor irritation.