Bug 1723745
Summary: | vgextend and some other cmds don't build dev alias name cache before real job | ||
---|---|---|---|
Product: | [Community] LVM and device-mapper | Reporter: | heming.zhao <heming.zhao> |
Component: | lvm2 | Assignee: | David Teigland <teigland> |
lvm2 sub component: | Filtering and Stacking | QA Contact: | cluster-qe <cluster-qe> |
Status: | CLOSED CURRENTRELEASE | Docs Contact: | |
Severity: | unspecified | ||
Priority: | unspecified | CC: | agk, heinzm, jbrassow, msnitzer, prajnoha, zkabelac |
Version: | 2.02.180 | Flags: | pm-rhel:
lvm-technical-solution?
pm-rhel: lvm-test-coverage? |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | If docs needed, set a value | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2020-12-02 22:55:01 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
heming.zhao
2019-06-25 09:30:52 UTC
Thanks for the detailed report and analysis. Failing to recognize device aliases with lvmetad seems to be a problem in vgextend and pvremove (please let me know if you find any other cases.) I believe it's the result of this commit: https://sourceware.org/git/?p=lvm2.git;a=commit;h=c0973e70a58e7e14e9cca29a0f8ad12719ea554f The following diff fixes the problem for me. If you are already recompiling lvm source to test changes, I'd be happy to hear if this works for you. diff --git a/tools/toollib.c b/tools/toollib.c index 3221e5f1ca22..2e3fef66ffdc 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -5542,6 +5542,7 @@ int pvcreate_each_device(struct cmd_context *cmd, } lvmcache_label_scan(cmd); + dev_cache_scan(); /* * Translate arg names into struct device's. 1> I only find vgextend & pvremove have this issue. 2> It looks double call dev_cache_scan() if lvmetad disabled. (I'm not familiar with lvm2 code), below looks better: ```c lvmcache_label_scan(cmd); + if (!dev_cache_has_scanned()) + dev_cache_scan(); ``` I compiled & tried above codes, it work fine. Good suggestion, thanks for the confirmation, I'll get a fix pushed to the stable branch. pushed fix to stable-2.02 https://sourceware.org/git/?p=lvm2.git;a=commit;h=b13ebfa4c289a5bc6eb4f8ba26126db8e6d78296 # pvs --config 'devices/preferred_names=["/dev/disk/by-id/wwn"]' PV VG Fmt Attr PSize PFree /dev/disk/by-id/wwn-0x690b11c0000438ad0000056550910404 test5 lvm2 a-- <931.01g <931.01g /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 test5 lvm2 a-- <931.01g <931.01g # pvs PV VG Fmt Attr PSize PFree /dev/sdb test5 lvm2 a-- <931.01g <931.01g /dev/sdd test5 lvm2 a-- <931.01g <931.01g # vgreduce test5 /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 Removed "/dev/sdd" from volume group "test5" # pvremove /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 Labels on physical volume "/dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415" successfully wiped. # vgextend test5 /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 Physical volume "/dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415" successfully created. Volume group "test5" successfully extended # vgreduce test5 /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 Removed "/dev/sdd" from volume group "test5" # vgextend test5 /dev/disk/by-id/wwn-0x690b11c0000438ad0000056b50910415 Volume group "test5" successfully extended # vgreduce test5 /dev/sdd Removed "/dev/sdd" from volume group "test5" # vgextend test5 /dev/sdd Volume group "test5" successfully extended Hello David, Thank you for your quickly reply & fix. |