summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* toollib: process different devices for duplicate pvsdev-dct-pvdup-splitDavid Teigland2015-01-133-4/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This hacks the lvmcache before processing the PV so that the PV appears to be from the duplicate devices instead of pv->dev. lvmcache state is returned to the way it was after process_single. With two duplicate devices, loop0 and loop3: # pvs Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop0 PV VG Fmt Attr PSize PFree /dev/loop3 loopa lvm2 a-- 12.00m 12.00m # pvs /dev/loop3 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop0 PV VG Fmt Attr PSize PFree /dev/loop3 loopa lvm2 a-- 12.00m 12.00m # pvs /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop0 PV /dev/loop3 selected by duplicate device /dev/loop0. PV VG Fmt Attr PSize PFree /dev/loop3 loopa lvm2 a-- 12.00m 12.00m # pvs /dev/loop0 /dev/loop3 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop0 PV /dev/loop3 repeated for duplicate device /dev/loop0. PV VG Fmt Attr PSize PFree /dev/loop0 loopa lvm2 a-- 12.00m 12.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m # pvs -o+dev_size /dev/loop0 /dev/loop3 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop0 PV /dev/loop3 repeated for duplicate device /dev/loop0. PV VG Fmt Attr PSize PFree DevSize /dev/loop0 loopa lvm2 a-- 12.00m 12.00m 16.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m With three duplicate devices, loop0, loop1, loop3: # pvs -o+dev_size Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV VG Fmt Attr PSize PFree DevSize /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop3 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV VG Fmt Attr PSize PFree DevSize /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 selected by duplicate device /dev/loop0. PV VG Fmt Attr PSize PFree DevSize /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop1 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 selected by duplicate device /dev/loop1. PV VG Fmt Attr PSize PFree DevSize /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop3 /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 repeated for duplicate device /dev/loop0. PV VG Fmt Attr PSize PFree DevSize /dev/loop0 loopa lvm2 a-- 12.00m 12.00m 16.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop3 /dev/loop1 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 repeated for duplicate device /dev/loop1. PV VG Fmt Attr PSize PFree DevSize /dev/loop1 loopa lvm2 a-- 12.00m 12.00m 32.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop0 /dev/loop1 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 selected by duplicate device /dev/loop0. PV /dev/loop3 repeated for duplicate device /dev/loop1. PV VG Fmt Attr PSize PFree DevSize /dev/loop1 loopa lvm2 a-- 12.00m 12.00m 32.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m # pvs -o+dev_size /dev/loop0 /dev/loop1 /dev/loop3 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop1 not /dev/loop0 Found duplicate PV XhLbpVo0hmuwrMQLjfxuAvPFUFZqD4vr: using /dev/loop3 not /dev/loop1 PV /dev/loop3 repeated for duplicate device /dev/loop0. PV /dev/loop3 repeated for duplicate device /dev/loop1. PV VG Fmt Attr PSize PFree DevSize /dev/loop0 loopa lvm2 a-- 12.00m 12.00m 16.00m /dev/loop1 loopa lvm2 a-- 12.00m 12.00m 32.00m /dev/loop3 loopa lvm2 a-- 12.00m 12.00m 32.00m
* toollib: handle duplicate pvs in process_in_pvDavid Teigland2015-01-132-38/+101
| | | | | | | | | | Processes a PV once for each time a device with its PV ID exists on the command line. The PV is identical each time it is processed, reflecting the same pv->dev device, instead of the device that was specified on the command line. Only works without lvmetad.
* tests: pvscan --cache DevicePath does not fail if the device is just filteredPeter Rajnoha2015-01-122-3/+5
| | | | | | | | | | It's not an error if the device is filtered out and hence cleared from lvmetad cache - "pvscan --cache DevPath" has now the same behaviour in this case as "pvscan --cache major:minor" (which is more consistent). Before, the tests expected failure return code for "pvscan --cache DevicePath" if the device was filtered (which is a different situation if the device is missing in the system completely!).
* dev-type: filter out partitioned device-mapper devices as unsuitable for use ↵Peter Rajnoha2015-01-123-1/+6
| | | | | | | | | | | | | | | | | | | | | as PVs Normally, if there are partitions defined on top of device-mapper device, there should be a device-mapper device created for each partiton on top of the old one and once the underlying DM device is used by another devices (partition mappings in this case), it can't be used as a PV anymore. However, sometimes, it may happen the partition mappings are missing - either the partitioning tool is not creating them if it does not contain full support for device-mapper devices or the mappings were removed. Better safe than sorry - check for partition header on DM devs and filter them out as unsuitable for PVs in case the check is positive. Whatever the user is doing, let's do our best to prevent unwanted corruption (...by running pvcreate on top of such device that would corrupt the partition header).
* pvscan: notify lvmetad about device that is gone and pvscan is run with ↵Peter Rajnoha2015-01-123-4/+18
| | | | | | | | | | | | | | | | | | | | | | device path instead of major:minor pair If pvscan is run with device path instead of major:minor pair and this device still exists in the system and the device is not visible anymore (due to a filter that is applied), notify lvmetad properly about this. This makes it more consistent with respect to existing pvscan with major:minor which already notifies lvmetad about device that is gone due to filters. However, if the device is not in the system anymore, we're not able to translate the original device path into major:minor pair which lvmetad needs for its action (lvmetad_pv_gone fn). So in this case, we still need to use major:minor pair only, not device path. But at least make "pvscan --cache DevicePath" as near as possible to "pvscan --cahce <major>:<minor>" functionality. Also add a note to pvscan man page about this difference when using pvscan --cache with DevicePath and major:minor pair.
* toollib: process_each_pv should match by deviceDavid Teigland2015-01-091-24/+72
| | | | | | | | | | | | | | | When processing PVs specified on the command line, the arg name was being matched against pv_dev_name, which will not always work: - The PV specified on the command line could be an alias, e.g. /dev/disk/by-id/... - The PV specified on the command line could be any random path to the device, e.g. /dev/../dev/sdb To fix this, first resolve the named PV args to struct device's, then iterate through the devices for processing.
* scripts: clvmd: replace awk functionality with LVM's selectionPeter Rajnoha2015-01-093-18/+6
| | | | | | No need to use awk now to get appropriate VGs/LVs, use LVM's own --select - it's quicker, it removes a need for external dependency on awk and it's also more readable.
* metadata: add "Failed to write VG <vg_name>." on failed vg_write and revert ↵Peter Rajnoha2015-01-091-1/+2
| | | | | | | | | | | | | | | | | previous patch Better than previous patch which changed log_warn to log_error - we can have multiple MDAs and if one of them fails to be written, we can still continue with other MDAs if we're in a mode where we can handle missing PVs - so keep the log_warn for single failed MDA write as it was before. However, add log_error with "Failed to write VG <vg_name>." in case we're not handling missing PVs or no MDA was written at all during VG write process. This also prevents an internal error in which the vg_write fails and we're not issuing any other log_error in vg_write caller or above, so we end up with: "Internal error: Failed command did not use log_error".
* metadata: log_error instead of log_warn on failed mda writePeter Rajnoha2015-01-091-1/+1
|
* WHATS_NEW: line for previous commitPeter Rajnoha2015-01-091-0/+1
|
* dev_manager: do not mark snapshot origins as unusable devices just because ↵Peter Rajnoha2015-01-091-8/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | of possible blocked mirror underneath At first, all snapshot-origins where marked as unusable unconditionally here, but we can't cut off whole snapshot-origin use in a stack just because of this possible mirror state. This whole "device_is_usable" check was even incorrectly part of persistent filter before commit a843d0d97c66aae1872c05b0f6cf4bda176aae2 (where filter cleanup was done). The persistent filter is used only if obtain_device_list_from_udev=0, which means that the former check for snapshot-origin here had not even been hit with default configuration for a few years before commit a843d0d97c66aae1872c05b0f6cf4bda176aae2 (the check for snapshot-origin and skipping of this LV was introduced with commit a71d6051ed3d72af6895733c599cc44b49f24dbb back in 2010). The obtain_device_list_from_udev=1 (and hence not using persistent filter and hence not hitting this check for snapshot-origins and skipping) has been in action since commit edcda01a1e18af6599275801a8237fe10112ed6f (that is 2011). So for 3 years this condition was not even checked with default configuration, making it superfluous. This all changed in 2014 with commit 8a843d0d97c66aae1872c05b0f6cf4bda176aae2 where "filter-usable" is introduced and since then all snapshot-origins have been marked as unusable more often than before and making snapshot-origins practically unusable in a stack. This patch removes this incorrect check from commit a71d6051ed3d72af6895733c599cc44b49f24dbb which caused snapshot-origins to be unusable more often recently. If we want to fix this eventually in a correct way, we need to look down the stack and if snapshot-origin is hit and there's a blocked mirror underneath, only then mark the device as unusable. But mirrors in stack are not supported anymore so it's questionable whether it's worth spending more time on this at all...
* WHATS_NEW: previous commitPeter Rajnoha2015-01-071-0/+1
|
* raid: fix mirror image naming when converting from mirror to raid1Heinz Mauelshagen2015-01-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | $ lvcreate -l1 -m1 --type mirror vg Logical volume "lvol0" created. $ lvconvert --type raid1 vg/lvol0 Before: $ lvs -a vg LV VG Active Attr LSize Cpy%Sync Layout Role lvol0 vg active rwi-a-r--- 4.00m 100.00 raid,raid1 public [lvol0_mimage_0_rimage_0] vg active iwi-aor--- 4.00m linear private,raid,image [lvol0_mimage_1_rimage_1] vg active iwi-aor--- 4.00m linear private,raid,image [lvol0_rmeta_0] vg active ewi-aor--- 4.00m linear private,raid,metadata [lvol0_rmeta_1] vg active ewi-aor--- 4.00m linear private,raid,metadata Incorrect name: lvol0_mimage_0_rimage_0 With this patch applied: $ lvs -a vg LV VG Active Attr LSize Cpy%Sync Layout Role lvol0 vg active rwi-a-r--- 4.00m 100.00 raid,raid1 public [lvol0_rimage_0] vg active iwi-aor--- 4.00m linear private,raid,image [lvol0_rimage_1] vg active iwi-aor--- 4.00m linear private,raid,image [lvol0_rmeta_0] vg active ewi-aor--- 4.00m linear private,raid,metadata [lvol0_rmeta_1] vg active ewi-aor--- 4.00m linear private,raid,metadata Proper name: lvol0_rimage_0
* mirror: do not try to reactivate inactive mirror when removing its LVs which ↵Peter Rajnoha2015-01-071-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | have missing PVs When mirror has missing PVs and there are mirror images on those missing PVs, we delete the images and during this delete operation, we also reactivate the LV. But if we're trying to reactivate the LV in cluster which is not active and at the same time cmirrord is not running (which is OK since we may have created the mirror LV as inactive), we end up with: "Error locking on node <node_name>: Shared cluster mirrors are not available." That is because we're trying to activate the mirror LV without cmirrord. However, there's no need to do this reactivation if the mirror LV (and hence it's sub LVs) were not activated before. This issue caused failure in mirror-vgreduce-removemissing.sh test recently with this sequence (excerpt from the test script): prepare_lvs_ lvcreate -an -Zn -l2 --type mirror -m1 --nosync -n $lv1 $vg "$dev1" $dev2" "$dev3":$BLOCKS mimages_are_on_ $lv1 "$dev1" "$dev2" mirrorlog_is_on_ $lv1 "$dev3" aux disable_dev "$dev2" vgreduce --removemissing --force $vg The important thing about that test is that we're not running cmirrord, we're activating the mirror with "-an" so it's inactive and then vgreduce --removemissing tries to reactivate the mirror images as part of the _delete_lv function call inside and since cmirrord is not running, we end up with the "Shared cluster mirrors are not available." error.
* pvremove: Avoid metadata re-reads & related error messages.Petr Rockai2015-01-066-26/+69
|
* lvmetad: Re-use fmt from the VG for PVs when possible.Petr Rockai2015-01-061-6/+7
|
* cmirror: do not check for cmirror availability when creating deactivated ↵Peter Rajnoha2015-01-061-2/+2
| | | | | | | | | cluster mirrors When creating cluster mirrors while they're not supposed to be activated immediately after creation, we don't need to check for cmirrord availability. We can just create these mirrors and let the check to be done on activation later on. This is addendum for commit cba6186325f0d5806cf1ddec276b3bb8e178687a.
* cmirror: check for cmirror availability during cluster mirror creation and ↵Peter Rajnoha2015-01-055-4/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | activation When creating/activating clustered mirrors, we should have cmirrord available and running. If it's not, we ended up with rather cryptic errors like: $ lvcreate -l1 -m1 --type mirror vg Error locking on node 1: device-mapper: reload ioctl on failed: Invalid argument Failed to activate new LV. $ vgchange -ay vg Error locking on node node 1: device-mapper: reload ioctl on failed: Invalid argument This patch adds check for cmirror availability and it errors out properly, also giving a more precise error messge so users are able to identify the source of the problem easily: $ lvcreate -l1 -m1 --type mirror vg Shared cluster mirrors are not available. $ vgchange -ay vg Error locking on node 1: Shared cluster mirrors are not available. Exclusively activated cluster mirror LVs are OK even without cmirrord: $ vgchange -aey vg 1 logical volume(s) in volume group "vg" now active
* libdm: report: add more comments about helper macros to get reserved valuesPeter Rajnoha2014-12-191-6/+19
| | | | | | | | | Since GET_FIELD_RESERVED_VALUE always returns a pointer, don't reference it with "&" when used - we already have that pointer value (this is an addendum to recent commit 028ff309472834e82fe4b849ea4c243feb5098b9). Only GET_TYPE_RESERVED_VALUE needs to be referenced with "&" as it returns directly the value of that type.
* report: fix segfault on NULL value hit in cache_settings fieldPeter Rajnoha2014-12-182-4/+18
| | | | | | | We have to use empty list, not NULL if we want to denote that the list has no items. Otherwise, the code further can segfault as it expects there's always a sane value (= some list), including empty list, but never NULL.
* report: properly set "undefined" reserved value for cache_policy fieldPeter Rajnoha2014-12-182-2/+3
| | | | | | | | | | | | | Use helper macros to handle reserved values and also define "undefined" reserved value as: FIELD_RESERVED_VALUE(cache_policy, cache_policy_undef, "", "", "undefined") Which means: - print "" if the cache_policy value is undefined (the first name for this reserved value is "") - recognize "undefined" reserved name as synonym to "" (so statements like "lvs -S cache_policy=undefined" are still recognized)
* cleanup: use helper macros to get reserved value from values.h for ↵Peter Rajnoha2014-12-182-25/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | vg_mda_copies and lv_read_ahead fields Avoid making a copy of the keyword which is already registered in values.h for "unmanaged" (vg_mda_copies field) and "auto" reserved value (lv_read_ahead field). Also use helper macros to handle these reserved - this is the correct approach - just do not copy the same thing again and do not mix it! The GET_FIELD_RESERVED_VALUE and GET_FIRST_RESERVED_NAME macros guarantees this - use it! In addition to that, rename reserved values: vg_mda_copies --> vg_mda_copies_unmanaged lv_read_ahead --> lv_read_ahead_auto So the field reserved values follows this scheme: "<field_name>_<reserved_value_name>". The same applies for type reserved values with this scheme: "<report type name in lowercase>_<reserved_value_name>" Add a comment about this scheme for others to follow as well when adding new fields and their reserved values. This makes it a bit easier to read the code then.
* refactor: rename existing helper macros for reserved value handling and add ↵Peter Rajnoha2014-12-182-55/+56
| | | | | | | | | | | | | GET_FIELD_RESERVED_VALUE macro RESERVED(id) --> GET_TYPE_RESERVED_VALUE(id) FIRST_NAME(id) --> GET_FIRST_RESERVED_NAME(id) Also add GET_FIELD_RESERVED_VALUE(id) macro to get per-field reserved value. This makes it much more readable and hopefully it'll make it easier to use these helper macros when adding new reporting fields with reserved values if needed.
* report: dup cache policy name string for report in cache_policy fieldPeter Rajnoha2014-12-181-3/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The cache policy name taken as LV segment property must be duped for report as the VG/LV/seg structure is destroyed after processing, reporting happens later: $ valgrind lvs -o+cache_policy ... ==16589== Invalid read of size 1 ==16589== at 0x54ABCC3: dm_report_compact_fields (libdm-report.c:1739) ==16589== by 0x153FC7: _report (reporter.c:619) ==16589== by 0x1540A6: lvs (reporter.c:641) ==16589== by 0x148021: lvm_run_command (lvmcmdline.c:1452) ==16589== by 0x1495CB: lvm2_main (lvmcmdline.c:1907) ==16589== by 0x164712: main (lvm.c:21) ==16589== Address 0x7d465f2 is 8,338 bytes inside a block of size 16,384 free'd ==16589== at 0x4C2ACE9: free (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so) ==16589== by 0x54B8C85: _free_chunk (pool-fast.c:318) ==16589== by 0x54B84FB: dm_pool_destroy (pool-fast.c:78) ==16589== by 0x1E59C7: _free_vg (vg.c:78) ==16589== by 0x1E5A6D: release_vg (vg.c:95) ==16589== by 0x159B6E: _process_lv_vgnameid_list (toollib.c:1967) ==16589== by 0x159DD7: process_each_lv (toollib.c:2030) ==16589== by 0x153ED8: _report (reporter.c:598) ==16589== by 0x1540A6: lvs (reporter.c:641) ==16589== by 0x148021: lvm_run_command (lvmcmdline.c:1452) ==16589== by 0x1495CB: lvm2_main (lvmcmdline.c:1907) ==16589== by 0x164712: main (lvm.c:21)
* libdm: report: also check whether field type is supported for field-specific ↵Peter Rajnoha2014-12-181-5/+24
| | | | | | | | | | | | | | | | reserved value We only checked global per-report-type reserved values for compatibility with selection code. This patch also adds a check for per-report-field reserved values. This avoids problems where unsupported report type is used as reserved value which could cause hard to debug problems otherwise. So this additional check stops from registering unsupported and unhandled per-field reserved values. Registerting such unsupported reserved value is a programmatic error, so report internal error in this case to stop us from making a mistake here in the future or even today where STR_LIST fields can't have reserved values yet.
* WHATS_NEW: previous commitPeter Rajnoha2014-12-171-1/+1
|
* report: Add cache_policy and cache_settings (LV) segment fields.Petr Rockai2014-12-177-0/+150
|
* man: put back the --binary reference in {pv,vg,lv}display man pagePeter Rajnoha2014-12-113-0/+3
|
* tools, man: --binary option is available with -C for {pv,vg,lv}displayPeter Rajnoha2014-12-115-9/+18
| | | | | | The {pv,vg,lv}display *do* use reporting in case "-C|--columns" is used. The man page was correct, the recognition for the --binary was missing in the code though!
* man: remove reference to --binary in {pv,vg,lv}display man pagePeter Rajnoha2014-12-113-3/+0
| | | | | | The {pv,vg,lv}display commands don't use reporting capabilites and as such they can't use --binary. This got into the man pages by mistake - the display commands do not recognize --binary option.
* vgimportclone: also notify lvmetad about changes if it's usedPeter Rajnoha2014-12-102-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All the LVM commands are run in mode without lvmetad use (since lvmetad can't handle duplicates). When we're finished with vgimportclone, we need to notify lvmetad about changes. Before this patch (/dev/sda and /dev/sdb contains a copy VG called "vg"): $ vgimportclone --basevgname vg_snap /dev/sdb WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: Activation disabled. No device-mapper interaction will be attempted. WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Physical volume "/tmp/snap.zcJ8LCmj/vgimport0" changed 1 physical volume changed / 0 physical volumes not changed WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: Activation disabled. No device-mapper interaction will be attempted. WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully changed WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully renamed to "vg_snap" Reading all physical volumes. This may take a while... Found volume group "vg" using metadata type lvm2 Found volume group "fedora" using metadata type lvm2 $ vgs VG #PV #LV #SN Attr VSize VFree fedora 1 2 0 wz--n- 9.50g 0 vg 1 1 0 wz--n- 124.00m 120.00m (...lvmetad doesn't see the new "vg_snap"!) With this patch applied: $ vgimportclone --basevgname vg_snap /dev/sdb ... WARNING: lvmetad is running but disabled. Restart lvmetad before enabling it! Volume group "vg" successfully renamed to "vg_snap" Notifying lvmetad about changes since it was disabled temporarily. Reading all physical volumes. This may take a while... Found volume group "vg_snap" using metadata type lvm2 Found volume group "fedora" using metadata type lvm2 Found volume group "vg" using metadata type lvm2 $ vgs VG #PV #LV #SN Attr VSize VFree fedora 1 2 0 wz--n- 9.50g 0 vg 1 1 0 wz--n- 124.00m 120.00m vg_snap 1 1 0 wz--n- 124.00m 120.00m The "restart lvmetad before enabling it" message is a bit misleading here - we should probably suppress this one, but we can't suppress warning messages selectively at the moment and we don't want to lose other warning/error messages printed...
* vgimportclone: replace awk with dumpconfig to generate temporary lvm.conf ↵Peter Rajnoha2014-12-102-11/+12
| | | | | | | | | | | | for vgimportclone With current dumpconfig, we can generate lvm.conf easily - we can merge current lvm.conf with the config given on cmd line: lvm dumpconfig --mergedconfig --config "..." This is a bit simpler than using awk and it also avoids problems when some of the configuration is missing in existing lvm.conf file and hardcoded defaults are used instead. The dumpconfig handles this transparently.
* WHATS_NEW: f94f846 actually fixes DM issue, not LVM issuePeter Rajnoha2014-12-092-1/+1
|
* libdm: report: fix incorrect memory use while using --select with ↵Peter Rajnoha2014-12-092-17/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --unbuffered for reporting Under certain circumstances, the selection code can segfault: $ vgs --select 'pv_name=~/dev/sda' --unbuffered vg0 VG #PV #LV #SN Attr VSize VFree vg0 6 3 0 wz--n- 744.00m 588.00m Segmentation fault (core dumped) The problem here is the use of --ubuffered together with regex used in selection criteria. If the report output is not buffered, each row is discarded as soon as it is reported. The bug is in the use of report handle's memory - in the example above, what happens is: 1) report handle is initialized together with its memory pool 2) selection tree is initialized from selection criteria string (using the report handle's memory pool!) 2a) this also means the regex is initialized from report handle's mem pool 3) the object (row) is reported 3a) any memory needed for output is intialized out of report handle's mem pool 3b) selection criteria matching is executed - if the regex is checked the very first time (for the very first row reported), some more memory allocation happens as regex allocates internal structures "on-demand", it's allocating from report handle's mem pool (see also step 2a) 4) the report output is executed 5) the object (row) is discarded, meaning discarding all the mem pool memory used since step 3. Now, with step 5) we have discarded the regex internal structures from step 3b. When we execute reporting for another object (row), we're using the same selection criteria (step 3b), but tihs is second time we're using the regex and as such, it's already initialized completely. But the regex is missing the internal structures now as they got discarded in step 5) from previous object (row) reporting (because we're using "unbuffered" reporting). To resolve this issue and to prevent any similar future issues where each object/row memory is discarded after output (the unbuffered reporting) while selection tree is global for all the object/rows, use separate memory pool for report's selection. This patch replaces "struct selection_node *selection_root" in struct dm_report with new struct selection which contains both "selection_root" and "mem" for separate mem pool used for selection. We can change struct dm_report this way as it is not exposed via libdevmapper. (This patch will have even more meaning for upcoming patches where selection is used even for non-reporting commands where "internal" reporting and selection criteria matching happens and where the internal reporting is not buffered.)
* configure: fix automatic use of configure --enable-udev-systemd-background-jobsPeter Rajnoha2014-12-083-2/+3
| | | | | | | | Fix incorrect test in configure which sets --enable-udev-systemd-background-jobs automatically if proper systemd version is available. The UDEV_SYSTEMD_BACKGROUND_JOBS variable was not properly set to "yes" in case systemd is available and we had "maybe" for this variable before.
* libdm: report: return immediately from dm_report_compact_fields without ↵Peter Rajnoha2014-12-051-3/+4
| | | | | | | error if there are no rows Let's make dm_report_compact_fields consistent with dm_report_output fn which also returns with success immediately if there are no rows.
* libdm: report: compact output applicable only if report is bufferedPeter Rajnoha2014-12-053-1/+7
|
* raid: properly rename split imageZdenek Kabelac2014-12-053-0/+19
| | | | | | | | When we split leg from raid - we take a proper new lock for a new LV. However for now activation checks only 'existince' of device UUID, but it's not validating device has a proper name. As a quick fix call suspend()/resume() to rename after split mirror.
* config: add report/compact_output lvm.conf setting to enable or isable field ↵Peter Rajnoha2014-12-055-0/+12
| | | | | | | | | | | | | | | | | | | | | | compacting $ lvm dumpconfig report/compact_output compact_output=0 $ lvs vg LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert lvol0 vg owi-a-s--- 4.00m lvol1 vg -wi-a----- 4.00m lvol2 vg swi-a-s--- 4.00m lvol0 0.00 $ lvm dumpconfig report/compact_output compact_output=1 $ lvs vg LV VG Attr LSize Origin Data% lvol0 vg owi-a-s--- 4.00m lvol1 vg -wi-a----- 4.00m lvol2 vg swi-a-s--- 4.00m lvol0 0.00
* libdm: report: add dm_report_compact_fieldsPeter Rajnoha2014-12-053-9/+66
| | | | | | | Add new dm_report_compact_fields function to cause report outout (dm_report_output) to ignore fields which don't have any value set in any of the rows reported. This provides support for compact report output where only fields which have something to report are displayed.
* libdm: remove unimplemented dm_report_set_output_selection fnPeter Rajnoha2014-12-052-2/+1
| | | | | | The dm_report_set_output_selection was not implemented in the end - we have dm_report_init_with_selection instead. This is just a remnant from development code that got into libdevmapper.h by mistake.
* pool: fix typo in error message: then -> thanPeter Rajnoha2014-12-041-1/+1
|
* mirror: Validate raid region size config setting.Alasdair G Kergon2014-12-031-1/+30
| | | | | If necessary, round down to a power of 2 the raid/mirror region size taken from the config files.
* mirror: Restrict region size to power of 2.Alasdair G Kergon2014-12-022-1/+2
|
* post-releaseAlasdair G Kergon2014-11-284-2/+8
|
* pre-releasev2_02_114Alasdair G Kergon2014-11-284-8/+5
|
* libdaemon: Fix some client leaks.Alasdair G Kergon2014-11-284-11/+31
| | | | | | | | | | Free (and clear) h.protocol string on daemon_open() error paths so it's OK for caller to skip calling daemon_close() if returned h.socket_fd is -1. Close h.socket_fd in daemon_close() to avoid possible leak. https://bugzilla.redhat.com/1164234
* Update WHATS_NEW.Petr Rockai2014-11-271-0/+1
|
* lvcreate: Implement --cachepolicy/--cachesettings.Petr Rockai2014-11-273-2/+34
|
* metadata: Add cache_policy to lvcreate_params and honour it.Petr Rockai2014-11-272-0/+12
|