1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00
Commit Graph

182 Commits

Author SHA1 Message Date
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Dave Wysochanski
a9d8bf269a Allow 'all' and 'unmanaged' values for --vgmetadatacopies.
Allowing an 'all' and 'unmanaged' value is more intuitive, and
provides a simple way for users to get back to original LVM behavior
of metadata written to all PVs in the volume group.

If the user requests "--vgmetadatacopies unmanaged", this instructs
LVM not to manage the ignore bits to achieve a specific number of
metadata copies in the volume group.  The user is free to use
"pvchange --metadataignore" to control the mdas on a per-PV basis.
If the user requests "--vgmetadatacopies all", this instructs LVM
to do 2 things: 1) clear all ignore bits, and 2) set the "unmanaged"
policy going forward.

Internally, we use the special MAX_UINT32 value to indicate 'all'.
This 'just' works since it's the largest value possible for the
field and so all 'ignore' bits on all mdas in the VG will get
cleared inside _vg_metadata_balance().  However, after we've
called the _vg_metadata_balance function, we check for the special
'all' value, and if set, we write the "unmanaged" value into the
metadata.  As such, the 'all' value is never written to disk.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:40:01 +00:00
Dave Wysochanski
3534fb40df Add vg_mda_copies display field to 'vgs' command.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:37:23 +00:00
Dave Wysochanski
cdbe475fe3 Define new functions and vgs/pvs fields related to mda ignore.
Define a new pvs field, pv_mda_used_count, and a new vgs field,
vg_mda_used_count to match the existing pv_mda_count and vg_mda_count.
These new fields count the number of mdas that have the 'ignored' bit
clear (they are in use on the PV / VG).  Also define various supporting
functions to implement the counting as well as setting the ignored
flag and determining if an mda is ignored.  These high level functions
call into the lower level location independent mda ignore functions
defined by earlier patches.

Note that counting ignored mdas in a vg requires traversing both lists
and checking for the ignored bit on the mda.  The count of 'ignored'
mdas then is defined by having the bit set, not by which list the mda
is on.  The list does determine whether LVM actually does read/write to
the mda, though we must count the bits in order to return accurate numbers
for the various counts.  Also, pv_mda_set_ignored must search both vg
lists for ignored mda.  If the state changes and needs to be committed
to disk, the ignored mda will be on the non-ignored list.

Note also in pv_mda_set_ignored(), we must properly manage the mda lists.
If we change the ignored state of an mda, we must change any mdas on
vg->fid->metadata_areas that correspond to this pv.  Also, we may
need to allocate a copy of the mda, as is done when fid->metadata_areas
is populated from _vg_read(), if we are un-ignoring an ignored mda.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:33:44 +00:00
Dave Wysochanski
9ccac021a7 Add metadata_areas_ignored list and functions to manage ignored mdas.
Add a second mda list, metadata_areas_ignored to fid, and a couple
functions, fid_add_mda() and fid_add_mdas() to help manage the lists.

These functions are needed to properly count the ignored mdas and
manage the lists attached to the 'fid' and ultimately the 'vg'.

Ensure metadata_areas_ignored is initialized in other formats, even
if the list is never used.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-06-28 20:33:22 +00:00
Dave Wysochanski
f55a20eb36 Rename fid->metadata_areas to fid->metadata_areas_in_use.
Rename the metadata_areas list to an 'in_use' list to prepare for
future 'ignored' list.
2010-06-28 20:32:44 +00:00
Alasdair Kergon
07ae1d4943 Add lv_path to reports to offer full /dev pathname. 2010-06-23 12:32:08 +00:00
Alasdair Kergon
ae6164cee3 If unable to obtain snapshot percentage leave value blank on reports. 2010-05-20 22:24:33 +00:00
Zdenek Kabelac
d251e86856 Use dm_report_field_int32 instead of dm_report_field_uint64 for printing '-1' 2010-02-15 20:27:33 +00:00
Zdenek Kabelac
810349313a Cleanup float arithmetic gcc warning. 2010-02-15 18:35:06 +00:00
Zdenek Kabelac
88c4995d1d * add more 'const' - fixes gcc constness warning 2010-02-15 18:34:00 +00:00
Dave Wysochanski
629efc6a89 Export lvm_pv_get_size(), lvm_pv_get_free(), lvm_pv_get_dev_size in lvm2app.
We add these exports to show the pv_size and pv_free and dev_size
fields.
Fixes rhbz561423.

Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2010-02-14 03:21:37 +00:00
Mike Snitzer
c79b425135 Add snapshot merge wrappers to abstract the associations and flags used
to represent merging origin and snapshot volumes.
2010-01-13 01:55:43 +00:00
Mike Snitzer
c582e3c039 Merge on activate support.
If either the origin or snapshot that is to be merged is open the merge
will not start; only the merge metadata will be written.  The merge will
start on the next activation of the origin (or via lvchange --refresh)
IFF both the origin and snapshot are closed.

Merge on activate is particularly important if we want to merge over a
mounted filesystem that cannot be unmounted (until next boot) --- for
example root.
2010-01-13 01:54:34 +00:00
Mike Snitzer
c45af88a83 When there is merging snapshot, report percentage on the origin LV.
Because the snapshot LV will be hidden this is needed so the user can
see merging progress with "lvs" command.
2010-01-13 01:49:22 +00:00
Mike Snitzer
3b6a076e1e Report merging snapshot as 'S' instead of 's':
This is useful for when the snapshot is still active and merging hasn't
started yet; it shows a merge is pending.  Once merging starts the
merging snapshot will be hidden but can still be displayed with 'lvs -a'

Report snapshot origin with merging snapshot as 'O' instead of 'o':
Before merge starts this shows that a merge is pending.  While merging
the snapshot will be hidden, 'O' enables a user to see that there is a
snapshot merging.
2010-01-13 01:48:38 +00:00
Zdenek Kabelac
c75550f5ba Use offsetof() macro and avoid defining dummy static union for FIELD() macro.
Makes it compilable by clang compiler.
2010-01-07 14:37:11 +00:00
Dave Wysochanski
29aa56df68 Add vg_mda_count library function. 2009-10-31 17:26:13 +00:00
Alasdair Kergon
984abde146 Permit snapshots of mirrors. (brassow) 2009-10-26 10:01:56 +00:00
Alasdair Kergon
3d32c5f88b Add percent_range to copy_percent too. 2009-10-01 01:04:27 +00:00
Alasdair Kergon
78ad1549a5 Introduce percent_range_t and centralise snapshot full/mirror in-sync checks. 2009-10-01 00:35:29 +00:00
Dave Wysochanski
68fac97a07 Add vg_is_resizeable() and cleanup references.
Clean up VG_RESIZEABLE flag by creating vg_is_resizeable().
Update comment - we no longer have ALLOW_RESIZEABLE.
Also use vg_is_exported() in one place missed by earlier patch.
Should be no functional change.
2009-09-15 18:35:13 +00:00
Dave Wysochanski
905240f91d Use vg_is_exported(vg) macro everywhere.
This patch is all just cleanup and no other patch depends on it.
Replace explicit dereference and check with vg_is_exported().
Update a few copyrights and remove unnecessary whitespace.
Should be no functional change.
2009-09-14 19:44:15 +00:00
Dave Wysochanski
483a7cb6d5 Refactor a few report field calculations into separate functions.
For liblvm 'get' functions, we should share code with the reporting functions.
This means we need common code to return the values for the fields.
In this patch we refactor a few of the fields needed in liblvm.
Unfortunately, for the simple fields that do derefernces of structure
members (for example, vg_extent_count), we cannot call the common function
from the reporting infrastructure without more refactoring.  The reason is
that the dereference of the simple fields is done deep inside the reporting
code (to get the generic "data" pointer), and the display function is a
generic 'size32' function.  We can fix these issues later with more
refactoring.

Should be no functional change and the testsuite should cover any possible
regressions.  The only fields in the report affected by this patch are:
vg_size, vg_free, and pv_mda_count.


Author: Dave Wysochanski <dwysocha@redhat.com>
2009-07-26 12:41:09 +00:00
Alasdair Kergon
25a2e7b80e Pre-release cleanups. 2009-05-21 03:04:52 +00:00
Milan Broz
afd9ba98c1 Merge lv_is_displayable and lv_is_visible.
Displayable and visible is the same thing.

volumes_count(vg) is now vg_visible_lvs() and always
returns number of LVs from user perspective.
2009-05-13 21:27:43 +00:00
Milan Broz
2f9a9d1a7f Remove snapshot_count from VG and use function instead. 2009-05-12 19:12:09 +00:00
Dave Wysochanski
14f5aa2753 Update columns.h comment. 2009-05-06 15:25:23 +00:00
Alasdair Kergon
87f42fda5e Add sparse devices: lvcreate -s --virtualoriginsize (hidden zero origin).
Add lvs origin_size field.
Fix linux configure --enable-debug to exclude -O2.

Still a few rough edges, but hopefully usable now:
  lvcreate -s vg1 -L 100M --virtualoriginsize 1T
2009-04-25 01:17:59 +00:00
Dave Wysochanski
d85cf5d14d Update columns.h comment to describe macro args. 2009-04-23 16:27:58 +00:00
Milan Broz
81c7482974 Fix pvs -a for segmented output
# pvs -a -o devices
   Volume group name (null) has invalid characters
   Skipping volume group (null)

...
_pvsegs_sub_single creates fake vg, we need to check
that pv is real here.
2009-04-21 12:57:31 +00:00
Milan Broz
83d026861c pe_start can be overwritten in VG metadata, so it is not PV label-only field. 2009-02-25 23:31:06 +00:00
Milan Broz
ea0cdd28c1 Separate PV label attributes which do not need parse metadata when reporting.
When reporting explicitly label attributes (pv_uuid for example), we do not
need to read metadata.

This patch separate the label fileds and removes scan_vgs_for_pvs
in process_each_pv() if not needed.

(There should be no user visible change in output.)
2009-02-09 09:45:49 +00:00
Milan Broz
92a4d6b28a Fix pvs segfault when pv mda attributes requested for not available PV. 2009-02-06 12:41:51 +00:00
Alasdair Kergon
9bbd343f3a More fields can cause segfaults with orphans.
Fix these by populating the dummy VG struct more completely.
2009-01-10 17:09:40 +00:00
Dave Wysochanski
2815870302 Fix pvs segfault when run with orphan PV and vg_mda_size or vg_mda_free fields
We display '0' for these fields now in this case.  Ideally these values are
undefined for an orphan PV but today there is no way to specify undefined
with display functions such as _size64_disp().
2009-01-10 15:04:28 +00:00
Dave Wysochanski
e9f57f2beb Add pv_mda_size to 'pvs' and vg_mda_size to 'vgs'.
Reports the size of the smallest metadata area in a PV or a VG.
Useful to confirm pvcreate --metadatasize or pvmetadatasize setting in
/etc/lvm/lvm.conf file.

NOTE: Actual value in these fields will most always differ from that
given in pvcreate options due to rounding and alignment effects.
2009-01-09 22:44:33 +00:00
Dave Wysochanski
539f903fd2 Fix segfault when invalid field given in reporting commands.
Problem is dm_report_init() may return NULL and subsequent call to
dm_report_set_output_field_name_prefix() doesn't handle NULL value.

Example:
	pvs --nameprefixes --rows --unquoted --noheadings -opv_name,fred
  Logical Volume Fields
  ---------------------
    lv_uuid              - Unique identifier
    lv_name              - Name.  LVs created for internal use are enclosed in brackets.
 ...

  Physical Volume Segment Fields
  ------------------------------
    pvseg_start          - Physical Extent number of start of segment.
    pvseg_size           - Number of extents in segment.

  Unrecognised field: fred
Segmentation fault
2008-12-15 13:30:45 +00:00
Peter Rajnoha
b47952641a Added displayable_lvs_in_vg and lv_is_displayable functions to deal with
the counts of visible LVs from user's perspective consistently throughout
the code.
2008-12-04 15:54:26 +00:00
Alasdair Kergon
2c44337bd5 Right, a simple build (without options) is working again. 2008-11-03 22:14:30 +00:00
Alasdair Kergon
8c5bcdabab Improve the way VGs with PVs missing are handled so manual intervention
is required in fewer circumstances.  (mornfall)
2008-09-19 06:42:00 +00:00
Alasdair Kergon
36081ccf2d Fix reporting of LV fields alongside unallocated PV segments. 2008-06-25 16:52:27 +00:00
Alasdair Kergon
1f787aca28 Add --rows to reports. 2008-06-24 22:48:53 +00:00
Alasdair Kergon
30ef4c738a Add --unquoted to reporting tools. 2008-06-24 21:21:04 +00:00
Alasdair Kergon
ec40d92889 post-release 2008-06-06 19:28:35 +00:00
Alasdair Kergon
697e3bb2df back out unnecessary changes for this release 2008-06-06 17:36:19 +00:00
Alasdair Kergon
eddc0f3307 post-release - reinstate incomplete enhancements 2008-04-29 16:11:28 +00:00
Alasdair Kergon
04ed52f6a0 pre-release (bug fixes only - enhancements excluded) 2008-04-29 15:58:25 +00:00
Alasdair Kergon
f419a87150 Add --prefixes to reporting tools for field name prefix output format.
E.g. lvs --prefixes --noheadings --unbuffered --units m --nosuffix

(Used '--prefixes' for now, but I'm looking for a better name.)
2008-04-20 00:15:08 +00:00
Alasdair Kergon
2e050bfc36 Fix vgdisplay 'Cur LV' field to match lvdisplay output.
Fix lv_count report field to exclude hidden LVs.
2008-04-10 17:19:02 +00:00
Dave Wysochanski
985ca02b6a Add vg_is_clustered() helper function.
Should be no functional change.
2008-04-10 17:09:32 +00:00
Alasdair Kergon
bb097a97ea split orphan VG by format type 2008-02-06 15:47:28 +00:00
Alasdair Kergon
4e9083db10 Fix mirror log name construction during lvconvert. (2.02.30)
Make monitor_dev_for_events recurse through the stack of LVs.
Clean up some more compiler warnings.
Add mirror names test script.
2008-01-31 12:19:36 +00:00
Alasdair Kergon
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
Alasdair Kergon
c51b9fff19 Use stack return macros throughout. 2008-01-30 13:19:47 +00:00
Alasdair Kergon
962b2a559d Rely upon internally-cached PV labels while corresponding VG lock is held. 2008-01-29 23:45:48 +00:00
Alasdair Kergon
72baf0c345 Maintain lists of stacked LV segments using each LV. 2008-01-16 19:00:59 +00:00
Alasdair Kergon
06ea7eaa27 Various lvconvert/polldaemon-related fixes from NEC. See lvm-devel
for original patches & explanations.
2008-01-10 18:35:51 +00:00
Alasdair Kergon
b9c69aa63a a few more changes/fixes to recent code 2007-12-22 02:13:00 +00:00
Alasdair Kergon
ac089d9015 avoid some compiler warnings 2007-12-20 16:49:37 +00:00
Alasdair Kergon
dd007cfdd5 Append fields to report/pvsegs_cols_verbose.
Permit LV segment fields with PV segment reports.
  Add seg_start_pe and seg_pe_ranges to reports.
2007-12-14 21:53:02 +00:00
Alasdair Kergon
204a12e594 Accept sizes with --readahead argument.
Store size arguments as sectors internally.
2007-11-14 00:08:25 +00:00
Alasdair Kergon
a6b22cf317 readahead activation code (but no dm support yet) 2007-11-12 20:51:54 +00:00
Alasdair Kergon
b4068515e8 Enhance the management of readahead settings. 2007-11-09 16:51:54 +00:00
Alasdair Kergon
00a7c302ea Add pv_mda_free and vg_mda_free fields to reports for raw text format. 2007-11-05 17:17:55 +00:00
Dave Wysochanski
a0fe21ccb6 Undo previous checkin - output format not good, info already available in other form(s) 2007-09-11 13:49:52 +00:00
Dave Wysochanski
45ea446910 Add pvseg_free field to 'pvs' output 2007-09-10 20:05:29 +00:00
Alasdair Kergon
21bc366486 Clean up numerous compiler warnings that crept in recently.
Remove several unused parameters from _allocate().
2007-08-22 14:38:18 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Alasdair Kergon
03eee0e2ed Split metadata-external.h out from metadata.h for the tools to use. 2007-07-18 15:38:58 +00:00
Alasdair Kergon
eac952f3fe tidy 2007-07-10 18:20:00 +00:00
Alasdair Kergon
19fa139341 Fix pv_mda_count to cope with missing PV.
[vgcreate vg1 pv1 pv2; pvremove -ff pv1; pvs -P -o+pv_mda_count =>segfault]
2007-07-10 18:18:33 +00:00
Alasdair Kergon
d27e123310 Add vg_mda_count and pv_mda_count columns to reports. 2007-07-09 15:40:43 +00:00
Alasdair Kergon
b4fb5226c0 Update lists of attribute characters in man pages.
Change cling alloc policy attribute character from 'C' to l'.
2007-03-27 13:35:33 +00:00
Alasdair Kergon
ce4c33102f Fix vgsplit to handle mirrors.
Reorder fields in reporting field definitions.
2007-01-29 23:01:18 +00:00
Alasdair Kergon
57fc4cc0b6 Add field definitions to report help text.
Remove unnecessary cmd arg from target_*monitor_events().
2007-01-24 16:51:24 +00:00
Alasdair Kergon
7fee061a6d Streamline dm_report_field_* interface. 2007-01-22 15:07:21 +00:00
Alasdair Kergon
594a27942b No longer necessary to specify alignment for report fields. 2007-01-18 17:48:29 +00:00
Alasdair Kergon
d838a1e314 Move basic reporting functions into libdevmapper. 2007-01-16 18:06:12 +00:00
Alasdair Kergon
de5c82a0d9 add cling allocation policy 2006-10-08 12:01:13 +00:00
Alasdair Kergon
d547cbb00d Add report columns with underscore before field names ending 'size'. 2006-10-07 10:42:27 +00:00
Alasdair Kergon
6c81ed26f0 Add LV column to reports listing kernel modules needed for activation. 2006-10-03 17:55:20 +00:00
Alasdair Kergon
1baed0e1ae Show available fields if report given invalid field. (e.g. lvs -o list) 2006-10-02 16:46:27 +00:00
Alasdair Kergon
0550c1b618 Move lvm_snprintf into libdevmapper. 2006-08-21 12:54:53 +00:00
Alasdair Kergon
d9ac88a501 M for unsynced mirror 2006-05-11 20:17:17 +00:00
Alasdair Kergon
898e6f8e41 Add mirror_library description to example.conf.
More compile-time cleanup.
2006-05-11 17:58:58 +00:00
Alasdair Kergon
72b2cb613a Make SIZE_SHORT the default for display_size().
Fix some memory leaks in error paths found by coverity.
Use C99 struct initialisers.
Move DEFS into configure.h.
Clean-ups to remove miscellaneous compiler warnings.
2006-05-09 21:23:51 +00:00
Alasdair Kergon
ace652e673 lv_is_visible() 2006-04-07 17:41:56 +00:00
Alasdair Kergon
472ac5bdd5 more snapshot code tidying 2006-04-06 14:06:27 +00:00
Alasdair Kergon
2cd0aa727a Introduce origin_from_cow() 2006-04-06 13:39:16 +00:00
Alasdair Kergon
5f4b2acfe5 Replacement activation code. [Don't use this yet!] 2005-11-08 22:52:26 +00:00
Alasdair Kergon
31b5c6e65c Add pe_start to pvs. 2005-10-20 22:24:46 +00:00
Alasdair Kergon
f894b4b1b7 Attempt to load missing targets using modprobe.
Simplify dev_manager_info().
2005-10-17 18:00:02 +00:00
Alasdair Kergon
2262b32057 Use hash, bitset, malloc, pool from libdevmapper. 2005-10-16 23:03:59 +00:00
Alasdair Kergon
88d2bdc668 Fix chunksize field in reports. 2005-09-23 17:06:01 +00:00
Alasdair Kergon
540b379902 Don't hide snapshots from default 'lvs' output. 2005-09-23 16:22:17 +00:00
Alasdair Kergon
3d38769798 Add clustered VG attribute to report. 2005-08-15 23:34:11 +00:00
Alasdair Kergon
5e947dac48 Various allocation-related pvmove fixes. 2005-06-14 17:54:48 +00:00
Alasdair Kergon
8211a13ce0 Always insert an intermediate layer for mirrors.
Suppress hidden LVs from reports unless --all is given.
Use square brackets for hidden LVs in reports.
Centralise restrictions on LV names.
2005-06-03 14:49:51 +00:00
Alasdair Kergon
60f13f01d2 Basic support for mirrors. 2005-06-01 16:51:55 +00:00