summaryrefslogtreecommitdiffstats
path: root/tools
Commit message (Collapse)AuthorAgeFilesLines
* RAID: Properly handle resync of RAID LVsJonathan Brassow2012-09-111-14/+37
| | | | | | | Issuing a 'lvchange --resync <VG>/<RAID_LV>' had no effect. This is because the code to handle RAID LVs was not present. This patch adds the code that will clear the metadata areas of RAID LVs - causing them to resync upon activation.
* cleanup: Restructure code that handles mirror resyncingJonathan Brassow2012-09-111-29/+86
| | | | | | | | | | | | | | | | | When an LV is to be resynced, the metadata areas are cleared and the LV is reactivated. This is true for mirroring and will also be true for RAID LVs. We restructure the code in lvchange_resync() so that we keep all the common steps necessary (validation of ability to resync, deactivation, activation of meta/log devices, clearing of those devices, etc) and place the code that will be divergent in separate functions: detach_metadata_devices() attach_metadata_devices() The common steps will be processed on lists of metadata devices. Before RAID capability is added, this will simply be the mirror log device (if found). This patch lays the ground-work for adding resync of RAID LVs.
* cleanup: Reduce indentation by short-circuiting functionJonathan Brassow2012-09-111-43/+55
| | | | | | | | | By changing the conditional for resyncing mirrors with core-logs a bit, we can short-circuit the rest of the function for that case and reduce the amount of indenting in the rest of the function. This cleanup will simplify future patches aimed at properly handling the resync of RAID LVs.
* cleanup: Use segtype->ops->name() instead of segtype->name where applicableJonathan Brassow2012-09-052-3/+3
| | | | | | | | When printing a message for the user and the lv_segment pointer is available, use segtype->ops->name() instead of segtype->name. This gives a better user-readable name for the segment. This is especially true for the 'striped' segment type, which prints "linear" if there is an area_count of one.
* setvbuf: reopen only valid fdPeter Rajnoha2012-08-271-1/+1
| | | | | | We should check whether the fd is opened before trying to reopen it. For example, the stdin is closed in test/lib/harness.c causing the test suite to fail.
* config: add silent modeAlasdair G Kergon2012-08-2529-134/+133
| | | | | | | | | | | | | | | | Accept -q as the short form of --quiet. Suppress non-essential standard output if -q is given twice. Treat log/silent in lvm.conf as equivalent to -qq. Review all log_print messages and change some to log_print_unless_silent. When silent, the following commands still produce output: dumpconfig, lvdisplay, lvmdiskscan, lvs, pvck, pvdisplay, pvs, version, vgcfgrestore -l, vgdisplay, vgs. [Needs checking.] Non-essential messages are shifted from log level 4 to log level 5 for syslog and lvm2_log_fn purposes.
* RAID: Add support for RAID10Jonathan Brassow2012-08-242-3/+38
| | | | | | This patch adds support for RAID10. It is not the default at this stage. The user needs to specify '--type raid10' if they would like RAID10 instead of stacked mirror over stripe.
* thin: discardZdenek Kabelac2012-08-232-3/+3
|
* lvconvert: use _reload_lv on more placesZdenek Kabelac2012-08-231-60/+30
| | | | Use common subroutine.
* lvconvert: move _reload_lv()Zdenek Kabelac2012-08-231-27/+28
| | | | Just move in front
* check: add internal errors for unexpected pathsZdenek Kabelac2012-08-232-0/+10
| | | | | | | | | | | | | | | | | | | | Adding couple INTERNAL_ERROR reports for unwanted parameters: Ensure the 'top' metadata node cannot be NULL for lvmetad. Make obvious vginfo2 cannot be NULL. Report internal error if handler and vg is undefined. Check for handle in poll_vg(). Ensure seg is not NULL in dev_manager_transient(). Report missing read_ahead for _lv_read_ahead_single(). Check for report handler in dm_report_object(). Check missing VG in _vgreduce_single().
* cleanup: use proper activation_change_tZdenek Kabelac2012-08-232-2/+4
|
* cleanup: cast to matching typeZdenek Kabelac2012-08-231-2/+2
|
* cleanup: uint64_t castsZdenek Kabelac2012-08-231-1/+1
|
* cleanup: keep MKNOD type cast cleanZdenek Kabelac2012-08-231-1/+1
| | | | Setup major already a dev_t type before it gets shifted.
* cleanup: drop unneeded included header filesZdenek Kabelac2012-08-236-13/+0
| | | | | This headers were not resolving anything used for compiled .c files. Remove unused util.c file.
* dmsetup: check if new_name is non NULLZdenek Kabelac2012-08-231-1/+1
|
* dmsetup: fix udev warning messageZdenek Kabelac2012-08-231-1/+1
| | | | Configure option is --enable-udev_sync.
* dmsetup: fix memleak in _get_split_nameZdenek Kabelac2012-08-231-1/+3
| | | | Free allocated buffer in _get_split_name error path.
* thin: lvcreate --discardsZdenek Kabelac2012-08-092-1/+12
|
* RAID: Improve RAID argument handling.Jonathan Brassow2012-08-081-0/+21
| | | | | Disallow '-m' for RAID types that have no mirror component and disallow '-i' argument for RAID types that have no stripe component.
* thin: use discards as plural rather than singularAlasdair G Kergon2012-08-075-25/+25
| | | | Global change from --discard to --discards, as that feels more natural.
* thin: tidy commands.h arg listsAlasdair G Kergon2012-08-071-11/+8
| | | | | | args are listed alphabetically. lvconvert -T is covered in the second section not the first. It could be tidied further or split out.
* thin: mention discard/zero in lvchange errmsgAlasdair G Kergon2012-08-071-5/+4
|
* args: increase major:minor limit to 4095:1048575Peter Rajnoha2012-08-065-38/+47
| | | | | | | | | Remove the limit for major and minor number arguments used while specifying persistent numbers via -My --major <major> --minor <minor> option which was set to 255 before. Follow the kernel limit instead which is 12 bits for major and 20 bits for minor number (kernel >= 2.6 and LVM formats that does not have FMT_RESTRICTED_LVIDS - so still keep the old limit of 255 for lvm1 format).
* dmsetup: allow --noflush with status/wait for thinAlasdair G Kergon2012-07-271-2/+5
| | | | | Allow --noflush with dmsetup status and wait (for thin target 1.3.0 / ioctl 4.23.0).
* vgextend: Allow PVs to be added to VGs that have PVs missingJonathan Brassow2012-07-261-2/+7
| | | | | | | | | | | | | | | | | Allowing people to add devices to a VG that has PVs missing helps people avoid the inability to repair RAID LVs in certain cases. For example, if a user creates a RAID 4/5/6 LV using all of the available devices in a VG, there will be no spare devices to repair the LV with if a device should fail. Further, because the VG is missing a device, new devices cannot be added to allow the repair. If 'vgreduce --removemissing' were attempted, the "MISSING" PV could not be removed without also destroying the RAID LV. Allowing vgextend to operate solves the circular dependency. When the PV is added by a vgextend operation, the sequence number is incremented and the 'MISSING' flag is put on the PVs which are missing.
* thin: add lvchange for discard and zero changeZdenek Kabelac2012-07-182-3/+92
| | | | | | | Update lvchange to allow change of 'zero' flag for thinpool. Add support for changing discard handling. N.B. from/to ignore could be only changed for inactive pool.
* thin: add discard support for thin poolZdenek Kabelac2012-07-184-1/+20
| | | | | | | | Add arg support for discard. Add discard ignore, nopassdown, passdown (=default) support. Flags could be set per pool. lvcreate [--discard {ignore|no_passdown|passdown}] vg/thinlv
* lvconvert: count % upwards when merging a snapshotPeter Rajnoha2012-07-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | Before: # lvconvert --merge -i 1 vg/lvol1 Merging of volume lvol1 started. lvol0: Merged: 36.7% lvol0: Merged: 21.3% lvol0: Merged: 5.8% lvol0: Merged: 0.0% Merge of snapshot into logical volume lvol0 has finished. Logical volume "lvol1" successfully removed After: # lvconvert --merge -i 1 vg/lvol1 Merging of volume lvol1 started. lvol0: Merged: 61.4% lvol0: Merged: 73.0% lvol0: Merged: 88.4% lvol0: Merged: 100.0% Merge of snapshot into logical volume lvol0 has finished. Logical volume "lvol1" successfully removed
* activate: skip manual activation for --sysinit -aayPeter Rajnoha2012-07-102-0/+14
| | | | | | | | | | | | | When --sysinit -a ay is used with vg/lvchange and lvmetad is up and running, we should skip manual activation as that would be a useless step - all volumes are autoactivated once all the PVs for a VG are present. If lvmetad is not active at the time of the vgchange --sysinit -a ay call, the activation proceeds in standard 'manual' way. This way, we can still have vg/lvchange --sysinit -a ay called unconditionally in system initialization scripts no matter if lvmetad is used or not.
* RAID: Fix extending size of RAID 4/5/6 logical volumes.Jonathan Brassow2012-06-261-2/+8
| | | | | | Reducing a RAID 4/5/6 LV or extending it with a different number of stripes is still not implemented. This patch covers the "simple" case where the LV is extended with the same number of stripes as the orginal.
* toollib: fix ignored_mdas process_each_pv rescanAlasdair G Kergon2012-06-291-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In process_each_pv() if we haven't yet scanned and the PV appears to be an orphan, we must scan the other PVs looking for mdas that reference it to find out what VG it is in. 1. If the PV has no mdas, we must scan. 2. If the PV has an mda that is not ignored we do not need to scan. 3. If the PV has an mda that is ignored, we do need to scan. This patch fixes case 3. > pvs -o +mda_count,vg_mda_count /dev/loop[0123] PV VG Fmt Attr PSize PFree #PMda #VMda /dev/loop0 vg3 lvm2 a- 96.00m 96.00m 0 1 /dev/loop1 vg3 lvm2 a- 96.00m 96.00m 1 1 /dev/loop2 vg2 lvm2 a- 96.00m 96.00m 1 2 /dev/loop3 vg2 lvm2 a- 28.00m 28.00m 1 2 Before: > pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered PV VG Fmt Attr PSize PFree /dev/loop2 lvm2 a-- 100.00m 100.00m /dev/loop3 vg2 lvm2 a-- 28.00m 28.00m /dev/loop0 lvm2 a-- 100.00m 100.00m /dev/loop1 vg3 lvm2 a-- 96.00m 96.00m After: > pvs /dev/loop2 /dev/loop3 /dev/loop0 /dev/loop1 --unbuffered PV VG Fmt Attr PSize PFree /dev/loop2 vg2 lvm2 a-- 96.00m 96.00m /dev/loop3 vg2 lvm2 a-- 28.00m 28.00m /dev/loop0 vg3 lvm2 a-- 96.00m 96.00m /dev/loop1 vg3 lvm2 a-- 96.00m 96.00m
* lvcreate: add --activate ay (autoactivate)Peter Rajnoha2012-06-282-1/+7
| | | | | | | | | | One can use "lvcreate --aay" to have the newly created volume activated or not activated based on the activation/auto_activation_volume_list this way. Note: -Z/--zero is not compatible with -aay, zeroing is not used in this case! When using lvcreate -aay, a default warning message is also issued that zeroing is not done.
* lvchange: add --activate ay (autoactivate)Peter Rajnoha2012-06-282-1/+7
| | | | The same as for vgchange...
* pvscan: add --activate ay option (autoactivate)Peter Rajnoha2012-06-282-1/+30
| | | | | | | | | | | Define auto_activation_handler that activates VGs/LVs automatically based on the activation/auto_activation_volume_list (activating all volumes by default if the list is not defined). The autoactivation is done within the pvscan call in 69-dm-lvmetad.rules that watches for udev events (device appearance/removal). For now, this works for non-clustered and complete VGs only.
* vgchange: add --activate ay option (autoactivate)Peter Rajnoha2012-06-282-1/+7
| | | | | | | | | | | | | | | | | | | | | | Normally, the 'vgchange -ay' activates all volume groups (that pass the activation/volume_list filter if set). This call can appear in two scenarios: - system boot (so activation within a script in general) - manual call on command line (so activaton on user's direct request) For the former one, we would like to select which VGs should be actually activated. One can define the list of VGs directly to do that. But that would require the same list to be provided in all the scripts. The 'vgchange -aay' will check for the activation/auto_activation_volume_list in adition and it will activate only those VGs/LVs that pass this filter (assuming all to be activated if the list is not defined - the same logic we already have for activation/volume_list). Init/boot scripts should use this form of activation primarily (which, anyway, becomes only a fallback now with autoactivation done on PV appearance in tandem with lvmetad in place).
* activate: add autoactivation hooksPeter Rajnoha2012-06-285-24/+31
| | | | | | | | | | | | | | | | Define an 'activation_handler' that gets called automatically on PV appearance/disappearance while processing the lvmetad_pv_found and lvmetad_pv_gone functions that are supposed to update the lvmetad state based on PV availability state. For now, the actual support is for PV appearance only, leaving room for PV disappearance support as well (which is a more complex problem to solve as this needs to count with possible device stack). Add a new activation change mode - CHANGE_AAY exposed as '--activate ay/-aay' argument ('activate automatically'). Factor out the vgchange activation functionality for use in other tools (like pvscan...).
* args: add --activate synonym for --available argPeter Rajnoha2012-06-288-53/+54
| | | | | | | | We're refererring to 'activation' all over the code and we're talking about 'LVs being activated' all the time so let's use 'activation/activate' everywhere for clarity and consistency (still providing the old 'available' keyword as a synonym for backward compatibility with existing environments).
* thin: fix lvconvert error path NULL dereferenceZdenek Kabelac2012-06-221-2/+2
| | | | For printing the name, use given command line parameter.
* cleanup: replace memset with struct initilizationZdenek Kabelac2012-06-222-6/+3
| | | | | Simplifies the code, properly detects too long socket paths, drops unused parameter.
* cleanup: use struct initializers instead of memsetZdenek Kabelac2012-06-201-8/+2
| | | | No need to call memset if we the language can do that.
* More .gitignore files for an in-source-tree build.Alasdair G Kergon2012-06-081-0/+2
| | | | Tell git to ignore files generated by a build inside the source tree.
* Add .gitignore files for an in-source-tree build.Alasdair G Kergon2012-06-081-0/+1
| | | | Tell git to ignore files generated by a build inside the source tree.
* Remove unsupported udev_get_dev_path libudev call used for checking udev dir.Peter Rajnoha2012-05-291-18/+12
| | | | | | | | | | | | With latest changes in the udev, some deprecated functions were removed from libudev amongst which there was the "udev_get_dev_path" function we used to compare a device directory used in udev and directore set in libdevmapper. The "/dev" is hardcoded in udev now (udev version >= 183). Amongst other changes and from packager's point of view, it's also important to note that the libudev development library ("libudev-devel") could now be a part of the systemd development library ("systemd-devel") because of the udev + systemd merge.
* Initial support for lvconvert for thin pool volumes.Zdenek Kabelac2012-05-092-1/+230
| | | | | | | | | | | | | | | Support has many limitations and lots of FIXMEs inside, however it makes initial task when user creates a separate LV for thin pool data and thin metadata already usable, so let's enable it for testing. Easiest API: lvconvert --chunksize XX --thinpool data_lv metadata_lv More functionality extensions will follow up. TODO: Code needs some rework since a lot of same code is getting copied.
* Also rename DevNos header to DevNosUsed in dmsetup info -c output.Peter Rajnoha2012-04-241-1/+1
|
* Rename (Blk)DevNames header to (Blk)DevNamesUsed in dmsetup info -c output.Peter Rajnoha2012-04-241-2/+2
| | | | | | | | | | | | | | | Just to make it clearer since there is the "dmsetup info -c -o blkdevname" as well that shows the "block device name for this mapping", having a "BlkDevName" header on output. It's a bit confusing then if the "dmsetup info -c -o devs_used,blkdevs_used" is named with a plural "DevNames"/"BlkDevNames" but at the same time having a totally different meaning than the singular form "BlkDevName". DevNames --> DevNamesUsed BlkDevNames --> BlkDevNamesUsed ...makes it much more comprehensible.
* Fix for bug 807776: invalid lvconvert --merge output should mention raid1 nowJonathan Earl Brassow2012-04-191-1/+1
| | | | s/snapshot/mergeable volume/
* Remove 'up' from rounding message that sometimes rounds down.Alasdair Kergon2012-04-121-1/+16
| | | | Detect reduction of 0 after rounding for stripes and avoid warning of potential data loss.