summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
* hints: new pvs_online typedev-dct-activation-switch-5David Teigland2021-10-126-6/+130
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use a new form of hints to reduce device scanning in vgchange -aay run by the udev rule for event based autoactivation. Standard hints allow a command with a named VG arg to scan only the PVs in the named VG, rather than scanning all available PVs. Standard hints are useful with a stable set of system devices. When new devices are arriving, as occurs during system startup, the hints are repeatedly invalidated, which makes standard hints unhelpful while devices are regularly appearing. This is the situation in which vgchange -aay is used, so standard hints are not generally helpful for autoactivation. In the context of system startup, pvscan --cache is keeping track of available PVs using the pvs_online files, similar to what the hints file does for a running system. Given this, a new hint mode, hints = "pvs_online", is added which derives an equivalent to standard hints, based on pvs_online files that are being created by udev-run pvscans. This hint mode is useful while devices are appearing, e.g. during system startup, and vgchange -aay can benefit from it. pvscan --cache -aay autoactivation already has a similar optimization (the "quick" activation case) that is based on the pvs_online file, but it is not implemented as a form of hints. This new form of hints is mainly useful in the context of event based autoactivation, during which standard hints are not useful. Once the system is in a steady state after startup (devices are not regularly appearing), the standard hints are most useful. The pvs_online hint method could be used on a running system, but would be no better than standard hints, and may be inferior because pvs_online files are not rigidly updated after system startup.
* add fixed event activation servicesDavid Teigland2021-10-1219-87/+470
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add two new fixed activation services for startup: lvm-activate-vgs-main and lvm-activate-vgs-last. The -main service runs early, without service dependencies. The -last service runs later, after other services have started that may set up devices for PVs, like mulitpathd. These services both run "vgchange -aay" to activate all VGs that are preset and complete at the time of system startup. When there are many VGs, these two vgchange commands will replace many per-VG vgchange commands. The last service enables event activation by creating the file /run/lvm/event-activation-on. After that, new devices that appear will be processed by event based autoactivation commands. Prior to the existence of the event-activation-on file, event-based commands do nothing. lvm.conf event_activation_options can be used to configure service-based activation only, or event-based activation only, or the approach described above which begins with service based activation and then switches to event-based. service_only: only the -main and -last services will activate VGs. VGs on devices that appear later will not be autoactivated. event_only: the -main and -last services will not activate any VGs, and all VGs will be activated from per-VG event-based activation commands. service_to_event: the -main and -last services will activate VGs that are complete at the time the services run, and VGs that appear later will be activated from per-VG event-based activation commands.
* vgchange: add vgonline optionDavid Teigland2021-10-124-6/+16
| | | | | | | | | Using --vgonline with vgchange -aay makes vgchange use /run/lvm/vgs_online/ files in the same way as pvscan. If the online file for the vg does not exist and the command is able to exclusively create it, then it will activate the VG. If the online file exists or the create fails, then the VG will not be activated.
* fix syslog settingDavid Teigland2021-10-114-9/+11
| | | | | | | | Just setting lvm.conf level=N should not send messages to syslog (now the journal by default.) Sending messages to syslog should require setting lvm.conf log { syslog=1 level=N }.
* make: generateMarian Csontos2021-10-0746-88/+932
|
* lvmdbusd: Use ID_FS_TYPE UDev property in udevwatchVojtech Trefny2021-10-071-2/+2
| | | | | | | '.ID_FS_TYPE_NEW' is a custom property added by an LVM UDev rule which is now being removed and 'ID_FS_TYPE' has the same value. Signed-off-by: Vojtech Trefny <vtrefny@redhat.com>
* configure: updateMarian Csontos2021-10-072-0/+115
|
* new udev autoactivationDavid Teigland2021-10-075-4/+492
| | | | | | | | | | | | | | new udev rule 69-dm-lvm.rules replaces 69-dm-lvm-meta.rules and lvm2-pvscan.service udev rule calls pvscan directly on the added device pvscan output indicates if a complete VG can be activated udev env var LVM_VG_NAME_COMPLETE is used to pass complete VG name from pvscan to the udev rule udev rule uses systemd-run to run vgchange -aay <vgname>
* logging: to the systemd journalDavid Teigland2021-10-079-1/+159
| | | | | | | | | | | | | Configure via lvm.conf log/journal or command line --journal. Possible values: "command" records command information. "output" records default command output. "debug" records full command debugging. Multiple values can be set in lvm.conf as an array. One value can be set in --journal which is added to values set in lvm.conf
* pvscan: add options listlvs listvg checkcompleteDavid Teigland2021-10-079-99/+431
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | pvscan --cache <dev> . read only dev . create online file for dev pvscan --listvg <dev> . read only dev . list VG using dev pvscan --listlvs <dev> . read only dev . list VG using dev . list LVs using dev pvscan --cache --listvg [--checkcomplete] <dev> . read only dev . create online file for dev . list VG using dev . [check online files and report if VG is complete] pvscan --cache --listlvs [--checkcomplete] <dev> . read only dev . create online file for dev . list VG using dev . list LVs using dev . [check online files and report if VG is complete] . [check online files and report if LVs are complete] [--vgonline] can be used with --checkcomplete, to enable use of a vg online file. This results in only the first pvscan command to see the complete VG to report 'VG complete', and others will report 'VG finished'. This allows the caller to easily run a single activation of the VG. [--udevoutput] can be used with --cache --listvg --checkcomplete, to enable an output mode that prints LVM_VG_NAME_COMPLETE='vgname' that a udev rule can import, and prevents other output from the command (other output causes udev to ignore the command.) The list of complete LVs is meant to be passed to lvchange -aay, or the complete VG used with vgchange -aay. When --checkcomplete is used, lvm assumes that that the output will be used to trigger event-based autoactivation, so the pvscan does nothing if event_activation=0 and --checkcomplete is used. Example of listlvs ------------------ $ lvs -a vg -olvname,devices LV Devices lv_a /dev/loop0(0) lv_ab /dev/loop0(1),/dev/loop1(1) lv_abc /dev/loop0(3),/dev/loop1(3),/dev/loop2(1) lv_b /dev/loop1(0) lv_c /dev/loop2(0) $ pvscan --cache --listlvs --checkcomplete /dev/loop0 pvscan[35680] PV /dev/loop0 online, VG vg incomplete (need 2). VG vg incomplete LV vg/lv_a complete LV vg/lv_ab incomplete LV vg/lv_abc incomplete $ pvscan --cache --listlvs --checkcomplete /dev/loop1 pvscan[35681] PV /dev/loop1 online, VG vg incomplete (need 1). VG vg incomplete LV vg/lv_b complete LV vg/lv_ab complete LV vg/lv_abc incomplete $ pvscan --cache --listlvs --checkcomplete /dev/loop2 pvscan[35682] PV /dev/loop2 online, VG vg is complete. VG vg complete LV vg/lv_c complete LV vg/lv_abc complete Example of listvg ----------------- $ pvscan --cache --listvg --checkcomplete /dev/loop0 pvscan[35684] PV /dev/loop0 online, VG vg incomplete (need 2). VG vg incomplete $ pvscan --cache --listvg --checkcomplete /dev/loop1 pvscan[35685] PV /dev/loop1 online, VG vg incomplete (need 1). VG vg incomplete $ pvscan --cache --listvg --checkcomplete /dev/loop2 pvscan[35686] PV /dev/loop2 online, VG vg is complete. VG vg complete
* system_id: new appmachineid optionDavid Teigland2021-10-075-6/+76
| | | | | | | The new system_id_source="appmachineid" will cause lvm to use an lvm-specific derivation of the machine-id, instead of the machine-id directly. This is now recommended in place of using machineid.
* config: change default use_devicesfile to 1David Teigland2021-10-071-1/+1
|
* config: comment all default settingsDavid Teigland2021-10-071-87/+87
|
* cleanup: use dm_list_emptyZdenek Kabelac2021-10-064-4/+4
| | | | Instant check for 'dm_list_size() == 0' without any size calc.
* cleanup: skip zeroing buffer overwritten by memcpyZdenek Kabelac2021-10-062-20/+20
| | | | | | | Since the buffer is going to be overwritten by memcpy, reset only last char to 0. Also more use of DM_LIST_INIT list.h macro.
* cleanup: all lvmcache_add users pass char with 0Zdenek Kabelac2021-10-061-9/+3
| | | | No local copy needed, both users submit zero-end string as pv/vgid.
* cleanup: always initialize historical ptrZdenek Kabelac2021-10-061-6/+8
| | | | Set ptr for all paths.
* cleanup: remove unused codeZdenek Kabelac2021-10-062-15/+0
|
* archiving: refactor code to allocate less memoryZdenek Kabelac2021-10-062-41/+64
| | | | | | | | | | | | | | | | | | | | Do not store full path with each archived name reduces memory usage if the directory has thousands of entries and just add 'dir' path when needed. Also emit info print message to a user if the total size of archived files for a VG is more then 128MiB or 8192 files. TODO: Consider wheather adding a new 'lvm.conf archive{option}' to support trimming these wild archive sizes can make situation better. We already support retain_min && retain_days - but if user is generating too many and too large archives with minutes - maybe archiving should be disabled by a user - as it's not producing anything largely usable and just slows-down command ?? If we add 'retain_max & retain_max_size' the condition will go against each other and we need to chose priorities. mm
* metadata: enhance internal errorZdenek Kabelac2021-10-061-6/+6
| | | | | | | | Consider missing config tree from vg read to be an internal error since we do not want to 'regenerate' this one in expesive parsing way. Also if there is any failure on recreating committed VG, make it also a 'vg_write' error.
* debug: fix stack tracingZdenek Kabelac2021-10-061-4/+4
| | | | | Emit stack trace only on log_error path, and avoid on 'expected' not-found path.
* metadata: simplify codeZdenek Kabelac2021-10-061-10/+7
|
* device_id: update stacked PVs for vgchange uuidDavid Teigland2021-10-044-0/+100
| | | | | If a VG uuid is changed, update the device_id of any PVs stacked on LVs in the changed VG.
* handle bad metadata text in vg_read pathDavid Teigland2021-09-286-15/+49
| | | | | | | | | | | | | | | | | | Corrupt metadata text (with good mda header) was being handled in the label_scan phase, but not in the vg_read phase. This was sufficient because metadata areas would always be read and checksummed during label_scan (metadata parsing was skipped previously as an optimization.) This changed with the optimization in commit 61a6f9905e87e650f0bddae83fec6923bb100a57 "metadata: optimize reading metadata copies in scan" Now, some metadata areas will not be read and checksummed at all during the label_scan phase, only during the vg_read phase. This means that bad metadata text may first be detected in the vg_read phase. So, add equivalent bad metadata handling to the vg_read path to match the label_scan path.
* debug: shorter codeZdenek Kabelac2021-09-271-55/+16
|
* cleanup: use already known lv sizeZdenek Kabelac2021-09-271-1/+1
|
* cleanup: reuse existing code for free pathZdenek Kabelac2021-09-271-12/+4
|
* cleanup: use first parameter uintZdenek Kabelac2021-09-271-1/+1
| | | | Easier with struct zeroing and matching assing of type uint.
* cov; matching enum typeZdenek Kabelac2021-09-271-1/+1
|
* cov: ignoringZdenek Kabelac2021-09-272-0/+2
|
* make: build without versionsortZdenek Kabelac2021-09-271-0/+4
| | | | Reported-by: adamboardman of gemian
* make: opened can be needed for either defines caseZdenek Kabelac2021-09-271-1/+3
| | | | Reported-by: adamboardman of gemian
* make: replace legacy use rindex with strrchrZdenek Kabelac2021-09-273-3/+3
| | | | | | Seems already dropped by some systems. Reported-by: adamboardman of gemian
* make: fix compilation for undefined RAID_INTERNALZdenek Kabelac2021-09-271-1/+1
| | | | Reported-by: adamboardman of gemian
* make: fix compilation for some compilerZdenek Kabelac2021-09-271-1/+1
| | | | Reported-by: adamboardman of gemian
* utils: define macro for ffsZdenek Kabelac2021-09-271-0/+8
| | | | | | | Provide ffs() macro using __builtin_ffs(), when there is missing ffs() implementation in header file. Reported-by: adamboardman of gemian
* configure: replace AC_HELP_STRING with AS_Zdenek Kabelac2021-09-271-98/+98
| | | | | Upgrade to newer autoconf setup is approaching... Will cause large set of configure changes.
* configure: check ffs __builtin_ffs versionsortZdenek Kabelac2021-09-273-9/+68
| | | | Check for presence of ffs(), __builtin_ffs() and versionsort().
* cov: make more obvious buffer is zero endedZdenek Kabelac2021-09-271-1/+2
|
* metadata: avoid excessive check of /etc/localtimeZdenek Kabelac2021-09-271-0/+5
| | | | | | | With larger metadata, decoding 'localtime()' for hinting time creation of every LV may cause excessive check of /etc/localtime file. Set TZ to ":/etc/localtime" so glibc reads this file just once instead of check everytime if there has anything changed.
* metadata: optimize reading metadata copies in scanZdenek Kabelac2021-09-272-2/+7
| | | | | | | | | | | While being in lockless scanning phase, we can avoid reading and checking matching metadata copies if we already know them from other PV and just rely on matching metadata header information. These copies will be examined later during locked metadata read/write access. This patch may postpone discovering some read failures to locked phase.
* metadata: remember parsing size of VG metadataZdenek Kabelac2021-09-273-1/+3
| | | | | | | | When creating lvm2 metadata for VG, lvm2 allocate some buffer, and if buffer is not big enough, the buffer is 'reallocated' bigger, and whole metadata creation is repeated until metadata fits. We can try to use 'previous' metadata size as hint to reduce looping here.
* metadata: remember crc32 when writing vg metadataZdenek Kabelac2021-09-272-7/+7
| | | | | | | | Preserve computed crc32 check from first written PV, just like we preserve generated metadata. Also there is no need to call crc32 twice on wrapping buffer with 2 calcs, result must be always the same as with single crc32 checking.
* dmsetup: fix measure handlingZdenek Kabelac2021-09-271-1/+2
| | | | | | Previous patch f853a1bc7afdebb44aeb8c1167e8784d155cad84 enabled ima measurement unconditionally for every status call, but it needs to be set only for 'dmsetup measure' command.
* lvmlockd: update error messageDavid Teigland2021-09-241-1/+1
| | | | refer specifically to the "use_lvmlockd" setting in lvm.conf
* devicemapper: in sync with libdmZdenek Kabelac2021-09-235-4/+31
|
* libdm: dmsetup measure support for IMAAlasdair G Kergon2021-09-239-4/+51
| | | | | | | Add support for DM_IMA_MEASUREMENT_FLAG with DM_TABLE_STATUS_CMD. This feature requires DM version 4.45 (5.15+ kernels)
* devicemapper: add DM_NAME_LIST_FLAGZdenek Kabelac2021-09-231-0/+14
| | | | Match libdm part
* libdm: support DM_NAME_LIST_FLAGZdenek Kabelac2021-09-232-0/+15
| | | | | | | | | | | | | | | | | Kernel patch 8b638081bd4520f63db1defc660666ec5f65bc15 introduced support to return UUID in DM_LIST_DEVICES_CMD. Useful when asking for UUID of each device where the list could be now returned directly with NAME && UUID for each device. Returning UUID is done in backward-compatible way. There's one unused 32-bit word value after the event number. This patch sets the bit DM_NAME_LIST_FLAG_HAS_UUID if UUID is present and DM_NAME_LIST_FLAG_DOESNT_HAVE_UUID if it isn't (if none of these bits is set, then we have an old kernel that doesn't support returning UUIDs). The UUID is stored after this word. The 'next' value is updated to point after the UUID, so that old version of libdevmapper will skip the UUID without attempting to interpret it.
* gcc: match typesZdenek Kabelac2021-09-222-2/+3
|