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

43 Commits

Author SHA1 Message Date
David Teigland
d6ffc99052 vgck: fix updatemetadata writing different descriptions
vgck --updatemetadata would write the same correct
metadata to good mdas, and then to bad mdas, but the
sequence of vg_write/vg_commit calls betwen good and
bad mdas could cause a different description field to
be generated for good/bad mdas. (The description field
describing the command was recently included in the
ondisk copy of the metadata text.)
2019-10-11 12:57:32 -05:00
David Teigland
b4402bd821 exported vg handling
The exported VG checking/enforcement was scattered and
inconsistent.  This centralizes it and makes it consistent,
following the existing approach for foreign and shared
VGs/PVs, which are very similar to exported VGs/PVs.

The access policy that now applies to foreign/shared/exported
VGs/PVs, is that if a foreign/shared/exported VG/PV is named
on the command line (i.e. explicitly requested by the user),
and the command is not permitted to operate on it because it
is foreign/shared/exported, then an access error is reported
and the command exits with an error.  But, if the command is
processing all VGs/PVs, and happens to come across a
foreign/shared/exported VG/PV (that is not explicitly named on
the command line), then the command silently skips it and does
not produce an error.

A command using tags or --select handles inaccessible VGs/PVs
the same way as a command processing all VGs/PVs, and will
not report/return errors if these inaccessible VGs/PVs exist.

The new policy fixes the exit codes on a somewhat random set of
commands that previously exited with an error if they were
looking at all VGs/PVs and an exported VG existed on the system.

There should be no change to which commands are allowed/disallowed
on exported VGs/PVs.

Certain LV commands (lvs/lvdisplay/lvscan) would previously not
display LVs from an exported VG (for unknown reasons).  This has
not changed.  The lvm fullreport command would previously report
info about an exported VG but not about the LVs in it.  This
has changed to include all info from the exported VG.
2019-06-25 15:39:08 -05:00
David Teigland
47effdc025 vgck --updatemetadata is a new command
uses vg_write to correct more common or less severe issues,
and also adds the ability to repair some metadata corruption
that couldn't be handled previously.
2019-06-07 15:54:04 -05:00
David Teigland
117160b27e Remove lvmetad
Native disk scanning is now both reduced and
async/parallel, which makes it comparable in
performance (and often faster) when compared
to lvm using lvmetad.

Autoactivation now uses local temp files to record
online PVs, and no longer requires lvmetad.

There should be no apparent command-level change
in behavior.
2018-07-11 11:26:42 -05:00
Peter Rajnoha
8cfc385491 toollib: make it possible to also process internal VGs, add 'include_internal' switch to process_each_vg fn
The lvm fullreport works per VG and as such, the vg, lv, pv, seg and
pvseg subreport is done for each VG. However, if the PV is not part of
any VG yet, we still want to display pv and pvseg subreports for these
"orphan" PVs - so enable this for lvm fullreport's process_each_vg call.
2016-06-20 11:33:42 +02:00
David Teigland
55683a659f toollib: add vg name list arg to process_each_vg 2016-05-23 11:18:16 -05:00
David Teigland
5e9e43074a lvmetad: rework command connection setup and checking
The lvmetad connection is created within the
init_connections() path during command startup,
rather than via the old lvmetad_active() check.

The old lvmetad_active() checks are replaced
with lvmetad_used() which is a simple check that
tests if the command is using/connected to lvmetad.

The old lvmetad_set_active(cmd, 0) calls, which
stopped the command from using lvmetad (to revert to
disk scanning), are replaced with lvmetad_make_unused(cmd).
2016-04-19 14:00:02 -05:00
Zdenek Kabelac
fcbef05aae doc: change fsf address
Hmm rpmlint suggest fsf is using a different address these days,
so lets keep it up-to-date
2016-01-21 12:11:37 +01:00
David Teigland
ea74215fa1 vgextend: pass single vgname as process_each_vg arg
Pass the single vgname as a new process_each_vg arg
instead of setting a cmd flag to tell process_each_vg
to take only the first vgname arg from argv.

Other commands with different argv formats will be
able to use it this way.
2015-12-01 09:36:45 -06:00
Peter Rajnoha
51d96a1703 toollib: replace void *handle with struct processing_handle for use in processing functions (process_each_*/process_single_* and related)
This patch replaces "void *handle" with "struct processing_handle *handle"
in process_each_*, process_single_* and related functions.

The struct processing_handle consists of two handles inside now:

  - the "struct selection_handle *selection_handle" used for
    applying selection criteria while processing process_each_*,
    process_single_* and related functions (patches using this
    logic will follow)

  - the "void* custom_handle" (this is actually the original handle
    used before this patch - a pointer to custom data passed into
    process_each_*, process_single_* and related functions).
2015-02-10 16:05:24 +01:00
Peter Rajnoha
a5f01dad22 filters: refresh filters when lvmetad use is toggled
We need to use proper filter chain when we disable lvmetad use
explicitly in the code by calling lvmetad_set_active(0) while
overriding existing configuration. We need to reinitialize filters
in this case so proper filter chain is used. The same applies
for the other way round - when we enable lvmetad use explicitly in
the code (though this is not yet used).
2014-09-30 16:08:05 +02:00
Petr Rockai
0da72743ca vgck: Fix #894136, notice on-disk corruption in spite of lvmetad. 2013-08-13 23:25:49 +02:00
Alasdair G Kergon
f56a1819e9 tools: remove metadata-exported.h
metadata-exported.h is included by tools.h
2013-07-09 03:07:55 +01:00
Alasdair G Kergon
9d5bdc91ca tools: remove metadata.h 2013-07-09 02:51:24 +01:00
Alasdair G Kergon
1280a3c7ed tools: remove metadata.h from pvresize/vgck 2013-07-09 02:41:56 +01:00
Zdenek Kabelac
b90450b8a0 cleanup: introduce return_ECMD_FAILED macro
Use shortening macro for common code sequence
stack;
return ECMD_FAILED;
2013-07-01 23:10:33 +02:00
Petr Rockai
82c99fb63f Make vgck warn about missing PVs. 2010-07-27 20:05:29 +00:00
Alasdair Kergon
08f1ddea6c Use __attribute__ consistently throughout. 2010-07-09 15:34:40 +00:00
Dave Wysochanski
266214db84 Fix process_each_vg / _process_one_vg when vg_read() returns FAILED_LOCKING.
Remove the checks for vg_read_error() in most of the tools callback
functions and instead make the check in _process_one_vg() more general.

In all but vgcfgbackup, we do not want to proceed if we get any error
from vg_read().  In vgcfgbackup's case, we may proceed if the backup
is to proceed with inconsistent VGs.  This is a special case though,
and we mark it with the READ_ALLOW_INCONSISTENT flag passed to
process_each_vg (and subsequently to _process_one_vg).

NOTE: More cleanup is needed in the vg_read_error() path cases.
This patch is a start.
2009-09-15 01:38:59 +00:00
Alasdair Kergon
651ff9b328 Add lots of missing stack debug messages to tools.
Make readonly locking available as locking type 4.
Fix readonly locking to permit writeable global locks (for vgscan). (2.02.49)
2009-09-14 22:47:49 +00:00
Dave Wysochanski
1f74536332 Fix vgck and vgremove segfault if non-existent vg given.
Signed-off-by: Dave Wysochanski <dwysocha@redhat.com>
2009-07-14 19:37:18 +00:00
Dave Wysochanski
13e8c7e434 Rework the toollib interface (process_each_*) on top of new vg_read.
Sun May  3 12:32:30 CEST 2009  Petr Rockai <me@mornfall.net>
  * Rework the toollib interface (process_each_*) on top of new vg_read.

Rebased 6/26/09 by Dave W.
- Add skipping message to process_each_lv
- Remove inconsistent_t.
2009-07-01 17:00:50 +00:00
Milan Broz
66086ce962 Fix double releasing of vg when repairing of vg is requested.
Several commands calls process_each_vg() and in provided
callback it explicitly recovers VG if inconsistent.
(vgchange, vgconvert, vgscan)

It means that old VG is released and reread  but the function
above (process_one_vg) tries to unlock and release old VG.

Patch moves the repair logic into _process_one_vg() function.

It always tries to read vg (even inconsistent) and then decides
what to do according new defined parameter.

Also patch unifies inconsistent error messages.

The only slight change if for vgremove command, where
it now tries to repair VG before it removes if force arg is given.
(It works similar way before, just the order of operation changed).
2009-06-05 20:00:52 +00:00
Milan Broz
d726767f14 Fix warning in previous commit. 2009-03-16 15:19:29 +00:00
Milan Broz
7f436a0f39 Fix lv_count when manipulating with snapshots and max_lv is set.
Patch fixes these problems:
 - during the snapshot creation process, it needs create 2 LVs,
   one is cow, second becomes snapshot.
   If the code fails in vg_add_snapshot, code lvcreate will not remove
   LV cow volume.

 - if max_lv is set and VG contains snapshot, it can happen that
   during the activation lv_count is temporarily increased over the limit
   and VG metadata are not properly processed
   see https://bugzilla.redhat.com/show_bug.cgi?id=490298

 - vgcfgrestore alows restore with max_lv set to lower valuer that actual
   LV count. This later leads to situation that max_lv is completely ignored.

 - vgck doesn't call vg_validate(). It should at least try:-)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2009-03-16 14:34:57 +00:00
Alasdair Kergon
67cdbd7e4d Some whitespace tidy-ups. 2008-01-30 14:00:02 +00:00
Alasdair Kergon
be6845999b Fix inconsistent licence notices: executables are GPLv2; libraries LGPLv2.1. 2007-08-20 20:55:30 +00:00
Dave Wysochanski
d6b1de30fe Convert vg->status checks to use vg_check_status function.\nRename status_flags to status in vg_check_status. 2007-06-19 04:36:12 +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
6606c3ae81 Update copyright notices. 2004-03-30 19:35:44 +00:00
Alasdair Kergon
cfb7bfc7d9 More consistent error code usage. 2003-10-21 22:06:07 +00:00
Alasdair Kergon
364a71ca82 Correct order of consistency/exists checks. 2003-09-15 15:00:01 +00:00
Alasdair Kergon
914c97239f Another sync point - numerous fixes & clean ups. 2003-07-04 22:34:56 +00:00
Alasdair Kergon
4c64ed4ced New column-based reporting tools: lvs, pvs & vgs. 2002-12-12 20:55:49 +00:00
Alasdair Kergon
5a52dca9c2 Some new features. 2002-11-18 14:04:08 +00:00
Alasdair Kergon
25b733809a Merge with text format branch.
Lots of changes/very little testing so far => there'll be bugs!

Use 'vgcreate -M text' to create a volume group with its metadata stored
in text files.  Text format metadata changes should be reasonably atomic,
with a (basic) automatic recovery mechanism if the system crashes while a
change is in progress.

Add a metadata section to lvm.conf to specify multiple directories if
you want (recommended) to keep multiple copies of the metadata (eg on
different filesystems).

e.g. metadata {
        dirs = ["/etc/lvm/metadata1","/usr/local/lvm/metadata2"]
}

Plenty of refinements still in the pipeline.
2002-04-24 18:20:51 +00:00
Alasdair Kergon
568d7229bf Review locking: block signals instead of ignoring them and restore state
afterwards; avoid race condition with unlink; add LCK_HOLD to process_each_vg.
2002-03-15 16:07:38 +00:00
Alasdair Kergon
6fda126dd7 Run through indent - no (intentional) changes to any code. 2002-02-11 21:00:35 +00:00
Alasdair Kergon
60274aba6e Preparation for an LVM2 liblvm - pass cmd_context into each tool and
link some globals that the tools need into that structure.
2002-02-11 20:50:53 +00:00
Alasdair Kergon
7d0e6e800e o Support locking with local lock files
o Disable control-c during updates (except if blocked waiting for a lock)
2002-02-11 15:42:34 +00:00
Heinz Mauelshagen
08907484f5 quotes around names in output 2002-01-30 15:04:48 +00:00
Alasdair Kergon
277237805a iospace restructured 2001-11-12 15:10:01 +00:00
Alasdair Kergon
677a06d5fd vgrename & vgck 2001-10-08 18:44:22 +00:00