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

10425 Commits

Author SHA1 Message Date
Zdenek Kabelac
243a135fe9 tests: capture and print thrown errors 2015-03-11 21:17:23 +01:00
Zdenek Kabelac
bdf4e3e2f2 tests: do not leak in mem in destructor 2015-03-11 21:17:23 +01:00
Zdenek Kabelac
e7e499e80f makefiles: split gcc -W options
Avoid using gcc only Warnings for compilation of g++ object files.
2015-03-11 21:17:23 +01:00
Zdenek Kabelac
8a2b9f045f tests: extend race
Mark test as skipped, if the test could not be made.
2015-03-11 11:02:35 +01:00
Zdenek Kabelac
ed2dcb796f tests: drop old workaround
Should be usable now without this 'should'.
2015-03-11 11:02:35 +01:00
Zdenek Kabelac
a042678a83 tests: specify old mirror type
Use old mirror (otherwise it would need  aux have_raid)
2015-03-11 11:02:35 +01:00
Zdenek Kabelac
6cecf61cc3 tests: cleanup some cxx warnings 2015-03-11 11:02:35 +01:00
Zdenek Kabelac
3f7e62b340 tests: enable kmsg by default
By default we want to capture kernel log into test trace
(since when test crashes it could be problem to reproduce).
2015-03-11 11:02:35 +01:00
Zdenek Kabelac
db5166fbfa tests: extend test timeout to 180sec
Some test could take more then minute (with slow udev and slow
emulation) - extend timeout to 180sec.
2015-03-11 11:02:35 +01:00
David Teigland
760cebf47d reporting: should not fail with foreign option if lvm1 pvs exist
When lvm1 PVs are visible, and lvmetad is used, and the foreign
option was included in the reporting command, the reporting
command would fail after the 'pvscan all devs' function saw
the lvm1 PVs.  There is no reason the command should fail
because of the lvm1 PVs; they should just be ignored.
2015-03-10 13:56:25 -05:00
David Teigland
c7290759b0 tests: update to not run vgconvert -M with lvmetad 2015-03-10 09:59:52 -05:00
David Teigland
f5cc96a54e WHATS_NEW vgconvert -M fix 2015-03-10 09:38:43 -05:00
David Teigland
321e19d9cc vgconvert: require lvmetad to not be used
lvmetad does not work with lvm1/format1 metadata,
and vgconvert -M converts to or from lvm1 metadata,
so disallow vgconvert -M when lvmetad is used.
2015-03-10 09:31:54 -05:00
Ondrej Kozina
5dbcbbea58 libdaemon: map error level properly
internal daemon error log level was wrongly mapped to debug syslog
level causing most error messages were lost in non-debug mode.
2015-03-10 14:42:40 +01:00
Zdenek Kabelac
0982c5c79f configure: check for sync-nand
Check whether gcc support this flag.
Some older compilers (gcc version 4.3.2) miss it.
2015-03-10 14:10:18 +01:00
Zdenek Kabelac
47b704462e display: fix return values
Return 1 on success in pvdisplay_short() and lvdisplay_full()
so commands like vgdisplay are not printinig stracktraces
on successful passes.

As the results of fail/success have been internally ignored for those
calls, it had no other visible side effect - command's return value was
still 0 (success).
2015-03-10 14:10:18 +01:00
Alasdair G Kergon
1d3711c0b2 format_text: Set system id directly.
Rearrange _read_vg code to set the appropriate system id field directly.
2015-03-09 19:33:27 +00:00
Alasdair G Kergon
379d9ec8ec systemid: Use temp status var for LVM_WRITE_LOCKED 2015-03-09 19:18:14 +00:00
Alasdair G Kergon
458b0210d1 vgchange: Additional system ID warnings.
Also prompt before setting a system ID on a VG when none is set
on the host.
Put quotes round system ID in messages where it could be blank.
2015-03-09 19:03:11 +00:00
Alasdair G Kergon
1334ea214e vgconvert: Check system ID compatibility.
If system ID is set, don't switch to a format that doesn't support it.
2015-03-09 19:01:12 +00:00
Alasdair G Kergon
a854546234 metadata: Detect internal use of LVM_WRITE_LOCKED.
Generate internal error if LVM_WRITE_LOCKED ever appears
in struct volume_group: it's only used in external
metadata.
2015-03-09 18:56:24 +00:00
Alasdair G Kergon
faccdeda83 comments: Use full flag names. 2015-03-09 18:53:22 +00:00
David Teigland
e9a233ee8e system_id: detect an lvm1 system id
Detect an lvm1 system id by looking at the WRITE_LOCKED flag.
Don't copy this lvm1 system id into vg->system_id so that the
restrictions associated with the new system id are not applied
to the old VG with the inherited lvm1 system id.
2015-03-09 13:27:34 -05:00
David Teigland
08371a8b80 tests: fix systemid uname test
The string reported by uname -n may include characters
that lvm omits from the system id (like parens, as seen
on a test machine.)  Check against the final system id
string that lvm uses.
2015-03-06 09:57:37 -06:00
Zdenek Kabelac
588b3bd7a1 tests: speed of many PVS in a VG 2015-03-06 14:29:26 +01:00
Zdenek Kabelac
85ef614b37 tests: slightly more efficient vgcreate
With larger set of devices it's faster to directly call
vgcreate on empty set of devices then going though separate
pvcreate call first.
2015-03-06 14:05:06 +01:00
Zdenek Kabelac
04101bc430 lib: drop unneeded vg_read call
Since we take a lock inside vg_lock_newname() and we do a full
detection of presence of  vgname inside all scanned labels,
there is no point to do this for second time to be sure
there is no such vg.

The only side-effect of such call would be a full validation of
some already exising VG metadata - but that's not the task for
vgcreate when create a new VG.

This call noticable reduces number of scans during 'vgcreate'.
2015-03-06 14:05:06 +01:00
Zdenek Kabelac
a9b28a4f21 lib: reduce parsing in vgname_from_mda
Use similar logic as with text_vg_import_fd() and avoid repeated
parsing of same mda and its config tree for vgname_from_mda().

Remember last parsed vgname, vgid and creation_host in labeller
structure and if the  metadata have the same size and checksum,
return this stored info.

TODO: The reuse of labeller struct is not ideal, some lvmcache API for
this functionality would be nicer.
2015-03-06 13:53:13 +01:00
Zdenek Kabelac
7e7411966a lib: avoid reparsing same metadata
When reading VG mda from multiple PVs - do all the validation only
when mda is seen for the first time and  when mda checksum and length
is same just return already existing VG pointer.

(i.e. using 300PVs for a VG would lead to create and destroy 300 config trees....)
2015-03-06 13:53:12 +01:00
Zdenek Kabelac
6a2ae250ff cleanup: add stack trace
Missed stack in error path.
2015-03-06 13:51:54 +01:00
Zdenek Kabelac
60427d5d42 lib: return value
Drop label out: with goto and return NULL directly.
Add log_debug() for zero metadata offset.
2015-03-06 13:51:43 +01:00
Zdenek Kabelac
4d16bfaabb lib: zero returned labeller struct
Return zeroed struct.
(Structure will be extended, so ensure all members are initilized.)
2015-03-06 13:17:39 +01:00
Zdenek Kabelac
6f68f4364b devices: avoid extra open() syscall
If the device is already opened by lvm's device cache,
avoid extra syscall opening devices for obtaining its size.
2015-03-06 13:17:39 +01:00
David Teigland
b48ff3b94e man: add info to lvmsystemid
about losing access to a VG if lvm is downgraded
to an earlier version.
2015-03-05 12:12:42 -06:00
David Teigland
5e25bca1a9 system_id: avoid munging vg and lv fields
Munge the WRITE/WRITE_LOCKED flags in a temp variable
instead of in the vg/lv fields.
2015-03-05 10:23:16 -06:00
David Teigland
8bb76aea81 system_id: undo the previous changes to the lvm1 code
The system_id and lock_type compat changes do not apply
to the lvm1 code.
2015-03-05 10:13:05 -06:00
David Teigland
1e65fdd9ba system_id: make new VGs read-only for old lvm versions
Previous versions of lvm will not obey the restrictions
imposed by the new system_id, and would allow such a VG
to be written.  So, a VG with a new system_id is further
changed to force previous lvm versions to treat it as
read-only.  This is done by removing the WRITE flag from
the metadata status line of these VGs, and putting a new
WRITE_LOCKED flag in the flags line of the metadata.

Versions of lvm that recognize WRITE_LOCKED, also obey the
new system_id.  For these lvm versions, WRITE_LOCKED is
identical to WRITE, and the rules associated with matching
system_id's are imposed.

A new VG lock_type field is also added that causes the same
WRITE/WRITE_LOCKED transformation when set.  A previous
version of lvm will also see a VG with lock_type as read-only.

Versions of lvm that recognize WRITE_LOCKED, must also obey
the lock_type setting.  Until the lock_type feature is added,
lvm will fail to read any VG with lock_type set and report an
error about an unsupported lock_type.  Once the lock_type
feature is added, lvm will allow VGs with lock_type to be
used according to the rules imposed by the lock_type.

When both system_id and lock_type settings are removed, a VG
is written with the old WRITE status flag, and without the
new WRITE_LOCKED flag.  This allows old versions of lvm to
use the VG as before.
2015-03-05 09:50:43 -06:00
David Teigland
c6a57dc4f3 Revert "systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag."
This reverts commit bfbb5d269a.

This will be done differently.
2015-03-05 09:50:43 -06:00
David Teigland
06b408ecce system_id: enable the options in config file and command line 2015-03-05 09:50:43 -06:00
Peter Rajnoha
190d591fbe report: fix seg_monitor field to display monitoring status for thick snapshots and mirrors
The seg_monitor did not display monitored status for thick snapshots
and mirrors (with mirror log *not* mirrored). The seg monitor did work
correctly even before for other segtypes - thins and raids.

Before (mirrors and snapshots, only mirrors with mirrored log properly displayed monitoring status):

[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
  LV                                     Layout     Role                             Monitor
  mirror                                 mirror     public
  [mirror_mimage_0]                      linear     private,mirror,image
  [mirror_mimage_1]                      linear     private,mirror,image
  [mirror_mlog]                          linear     private,mirror,log

  mirror_with_mirror_log                 mirror     public                           monitored
  [mirror_with_mirror_log_mimage_0]      linear     private,mirror,image
  [mirror_with_mirror_log_mimage_1]      linear     private,mirror,image
  [mirror_with_mirror_log_mlog]          mirror     private,mirror,log               monitored
  [mirror_with_mirror_log_mlog_mimage_0] linear     private,mirror,image
  [mirror_with_mirror_log_mlog_mimage_1] linear     private,mirror,image

  thick_origin                           linear     public,origin,thickorigin
  thick_snapshot                         linear     public,snapshot,thicksnapshot

With this patch applied (monitoring status displayed for all mirrors and snapshots):

[0] f21/~ # lvs -a -o lv_name,lv_layout,lv_role,seg_monitor vg
  LV                                     Layout     Role                             Monitor
  mirror                                 mirror     public                           monitored
  [mirror_mimage_0]                      linear     private,mirror,image
  [mirror_mimage_1]                      linear     private,mirror,image
  [mirror_mlog]                          linear     private,mirror,log

  mirror_with_mirror_log                 mirror     public                           monitored
  [mirror_with_mirror_log_mimage_0]      linear     private,mirror,image
  [mirror_with_mirror_log_mimage_1]      linear     private,mirror,image
  [mirror_with_mirror_log_mlog]          mirror     private,mirror,log               monitored
  [mirror_with_mirror_log_mlog_mimage_0] linear     private,mirror,image
  [mirror_with_mirror_log_mlog_mimage_1] linear     private,mirror,image

  thick_origin                           linear     public,origin,thickorigin
  thick_snapshot                         linear     public,snapshot,thicksnapshot    monitored
2015-03-05 14:05:34 +01:00
Alasdair G Kergon
56606b5f21 post-release 2015-03-04 14:00:46 +00:00
Alasdair G Kergon
930fa3290d pre-release 2015-03-04 13:49:51 +00:00
Peter Rajnoha
a7bfc2cbb5 cleanup: tools: "or use -S for selection" --> "or use --select for selection" 2015-03-04 14:40:58 +01:00
Alasdair G Kergon
733bfe36f5 systemid: Disable --systemid.
Disable use of --systemid for this release.
2015-03-04 13:14:51 +00:00
Peter Rajnoha
67c52a4453 config: add CFG_DISABLED flag and mark system_id settings with that flag
If configuration setting is marked in config_setting.h with CFG_DISABLED
flag, default value is always used for such setting, no matter if it's defined
by user (in --config/lvm.conf/lvmlocal.conf).

A warning message is displayed if this happens:

For example:

[1] f21/~ # lvm dumpconfig --validate
  WARNING: Configuration setting global/system_id_source is disabled. Using default value.
  LVM configuration valid.

[1] f21/~ # pvs
  WARNING: Configuration setting global/system_id_source is disabled. Using default value.
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sdb          lvm2 ---  128.00m 128.00m
  ...
2015-03-04 14:08:47 +01:00
Peter Rajnoha
e73dad7874 vgremove: select: direct selection to be done per-VG, not per-LV
Though vgremove operates per VG by definition, internally, it
actually means iterating over each LV it contains to do the
remove.

So we need to direct selection a bit in this case so that the
selection is done per-VG, not per-LV.

That means, use processing handle with void_handle.internal_report_for_select=0
for the process_each_lv_in_vg that is called later in vgremove_single fn.
We need to disable internal selection for process_each_lv_in_vg
here as selection is already done by process_each_vg which calls
vgremove_single. Otherwise selection would be done per-LV and not
per-VG as we intend!

An intra-release fix for commit 00744b053f.
2015-03-04 10:44:31 +01:00
Alasdair G Kergon
bfbb5d269a systemid: Add ACCESS_NEEDS_SYSTEM_ID VG flag.
Set ACCESS_NEEDS_SYSTEM_ID VG status flag whenever there is
a non-lvm1 system_id set.  Prevents concurrent access from
older LVM2 versions.
Not set on VGs that bear a system_id only due to conversion
from lvm1 metadata.
2015-03-04 01:16:32 +00:00
Alasdair G Kergon
3562b5ab39 systemid: Init and merge lvm2 and lvm1 fields.
Use system_id field in preference to lvm1_system_id.
Initialise both for now.
2015-03-04 01:00:51 +00:00
Alasdair G Kergon
dcba4781ea vgchange: Prevent lvm1 system ID changes.
(This system_id setting code shouldn't be in two places.)
2015-03-04 00:50:54 +00:00
Alasdair G Kergon
340369ab25 format1: Export generate_lvm1_system_id.
Export _lvm1_system_id as generate_lvm1_system_id and call it in
vg_setup() so it is set before writing the metadata to disk
and not missing from the initial metadata backup file.
2015-03-04 00:44:15 +00:00