1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00
Commit Graph

8432 Commits

Author SHA1 Message Date
Jonathan Brassow
df181cc51e cache: Add DM interface for retrieving a cache's status
This patch defines a structure for holding all of the device-mapper
cache target's status information.  The associated function provides
an easy way for higher levels (LVM) to consume the information.

This patch finishes the device-mapper interface for the cache and
cachepool segment types (i.e. the cache target).
2014-01-27 05:30:42 -06:00
Jonathan Brassow
1ff7e214e0 cache: New 'cache' segment type
This patch adds the cache segment type - the second of two necessary
to create cache logical volumes.  This segment type references the
cachepool (the small fast device) and the origin (the large slow device);
linking them to create the cache device.  The cache device is the
hierarchical device-mapper device that the user ulitmately makes use
of.

The cache segment sources the information necessary to construct the
device-mapper cache target from the origin and cachepool segments to
which it links.
2014-01-27 05:29:35 -06:00
Jonathan Brassow
90bbed3255 cache: New 'cachepool' segment type
This patch adds the new cachepool segment type - the first of two
necessary to eventually create 'cache' logical volumes.  In addition
to the new segment type, updates to makefiles, configure files, the
lv_segment struct, and some necessary libdevmapper flags.

The cachepool is the LV and corresponding segment type that will hold
all information pertinent to the cache itself - it's size, cachemode,
cache policy, core arguments (like migration_threshold), etc.
2014-01-27 05:27:16 -06:00
Jonathan Brassow
94377dfd5e Misc: New function for reading lvm config file fields
Introduce 'dm_config_get_int', which will be used by the upcoming
cachepool segment type.
2014-01-27 05:26:19 -06:00
Zdenek Kabelac
6b73d21ba9 locking: avoid dropping locks
When lvm2 command forks, it calls reset_locking(),
which as an unwanted side effect unlinked lock file from filesystem.

Patch changes the behavior to just close locked file descriptor
in children - so the lock is being still properly hold in the parent.
2014-01-27 12:13:29 +01:00
Zdenek Kabelac
f18ee04fab lvmetad: respect LVM_LVMETAD_PIDFILE settings in lvm
Test LVM_LVMETAD_PIDFILE for pid for lvm command.
Fix WHATS_NEW envvar name usage
Fix init order in prepare_lvmetad to respect set vars
and avoid clash with system settings.
Update test to really test the 'is running' message.
2014-01-24 15:59:38 +01:00
Zdenek Kabelac
89d7732617 thin: fix missing ~ in previous commit 2014-01-24 13:13:37 +01:00
Zdenek Kabelac
731c298e12 thin: use LV_TEMPORARY for metadata initialization
This flag need to be specified when we create thin pool - to avoid
scanning device with watch rules.
2014-01-24 12:30:28 +01:00
Zdenek Kabelac
432ff4bd72 cleanup: indent 2014-01-24 12:30:28 +01:00
Jonathan Brassow
5e4647ec99 Typo: s/Unale/Unable/ 2014-01-22 23:04:27 -06:00
Zdenek Kabelac
c1df1f3a81 tests: thin external origin resize 2014-01-23 14:22:34 +01:00
Zdenek Kabelac
f8b20fb8e8 thin: fix feature compare function
Comparing for available feature missed the code path, when
maj is already bigger.

The bug would be only hit in the case, thin pool target would have
increased major version.
2014-01-23 14:22:31 +01:00
Zdenek Kabelac
902b343e0e thin: validate resize of thin LV with ext. origin
When thin volume is using external origin, current thin target
is not able to supply 'extended' size with empty pages.

lvm2 detects version and disables extension of LV past the external
origin size in this case.

Thin LV could be however still reduced and extended freely bellow
this size.
2014-01-23 14:20:34 +01:00
Zdenek Kabelac
2dae78b722 thin: rename function
Rename pool_can_resize_metadata() to more reusable
thin_pool_feature_supported() which could be queried
for mutiple different features.
2014-01-23 14:19:17 +01:00
Zdenek Kabelac
1d7b2715e5 missed pool_manip.c
Seems like this file is missing from the thin_manip move.
Make the tree compilable again.
2014-01-23 09:57:22 +01:00
Jonathan Brassow
998af1a4fb Misc: Change name of lvcreate_params field - s/create_thin_pool/create_pool/
In preparation for other segment types that create and use "pools", we
s/create_thin_pool/create_pool/.  This way it is not awkward when creating
a cachepool, for example, to use "create_thin_pool".
2014-01-22 10:30:55 -06:00
Jonathan Brassow
5590448c32 Misc: Move some thin pool functions to a new file
Functions that handle set-up, tear-down and creation of thin pool
volumes will be more generally applicable when more targets exist
that make use of device-mapper's persistent data format.  One of
these targets is the dm-cache target.  I've selected some functions
that will be useful for the cache segment type to be moved, since
they will no longer be thin pool specific but are more broadly
useful to any segment type that makes use of a 'pool' LV.
2014-01-22 10:11:29 -06:00
Peter Rajnoha
2b9d25133e wiping: issue error if libblkid detects signature and fails to return offset/length
We need both offset and length when trying to wipe detected signatures.
The libblkid can fail so it's good to have an error message issued for
this state instead of being silent (libblkid does not issue any error
messages here). We just issued "stack" here before but that was not
quite useful if some error occurs...
2014-01-22 16:29:52 +01:00
Peter Rajnoha
cb595a5a13 coverity: check return value of dev_close in dev_get_block_size() 2014-01-22 16:20:09 +01:00
Peter Rajnoha
34e6d59bba WHATS_NEW: be more specific about cryptsetup version that sets the udev flags 2014-01-22 15:48:40 +01:00
Peter Rajnoha
36a09cf463 udev: drop cryptsetup specific rules from 10-dm.rules
These udev flags are set directly in cryptsetup for some
time now so there's no need to have it in our rules then.

See also:
https://code.google.com/p/cryptsetup/source/detail?spec=svn4f14b43a3d3e7310465005c401f37e19f8cb85e6&r=4f14b43a3d3e7310465005c401f37e19f8cb85e6
2014-01-22 15:18:57 +01:00
Alasdair G Kergon
d2956f0a59 autoconf: Update config.guess/sub to 2014-01-01. 2014-01-21 22:00:15 +00:00
Zdenek Kabelac
efe36fcd43 tests: more testing for online thin metadata resize
Some more tests for online resize, but it's still disabled
by default, since kernel doesn't work yet for this feature.
2014-01-21 13:53:10 +01:00
Zdenek Kabelac
22d9daff12 thin: online metadata resize requires 1.10
Version 1.10 starts to look promissing, let's enable
online resize when this thin-pool kernel target is present.
2014-01-21 13:50:17 +01:00
Alasdair G Kergon
899a079c8f post-release 2014-01-20 19:41:30 +00:00
Alasdair G Kergon
aa21e79991 pre-release 2014-01-20 19:22:56 +00:00
Peter Rajnoha
cf97d8d5f9 udev: clear temporary variable properly
Clear temporary DM_DISABLE_OTHER_RULES_FLAG properly. This did not
cause any bug or problem as the temporary variable is overwritten next
time it's used again, but we should still clean it properly!
2014-01-20 12:54:10 +01:00
Peter Rajnoha
91b26b63b4 thin: fix thin LV flagging for udev to skip scanning
Only flag thin LV for no scanning in udev if this LV is about
to be wiped. This happens only in case the thin LV's pool was not
created with zeroing of the new blocks enabled.
2014-01-20 12:38:21 +01:00
Zdenek Kabelac
79768b2e9c tests: update testing for xfs 2014-01-20 12:02:33 +01:00
Zdenek Kabelac
59336a2a06 fsadm: use xfs_repair when available
Since support for xfs_check is going to be obsoleted,
replace its usage with xfs_repair -n tool.

However this tool needs further intrumentation, since for really small
xfs devices (having just 1 allocation group) it needs to pass in
flag: "-o force_geometry". As we run the tool with '-n', it should
be safe to pass this flag always.

FIXME: figure way without always passing this flag.
2014-01-20 11:57:39 +01:00
Zdenek Kabelac
5f90353636 libdm: WHATSNEW 2014-01-17 11:02:29 +01:00
Zdenek Kabelac
0638d1d82e libdm: preload revert after failing callback
Revert activated volumes if callback fails.
This is currently used only for thin_check failure support.

When thin_check detects failure in thin metadata device, it deactivate
volumes in reversed order that have been preloaded for thin pool activation.
After this change lvm command will not leave active pool subvolumes
in dm table.
2014-01-17 10:48:49 +01:00
Zdenek Kabelac
d98511c717 cleanup: indent 2014-01-17 10:48:49 +01:00
Alasdair G Kergon
5eee73bd7c pvresize: Fix orphan PV size calculation.
The size of any metadata must be ignored when calculating the size of an
orphan PV.

Bug introduced by 603b45e0ed ("pvresize: Do
not use pv_read (get the PV from orphan VG).")
2014-01-17 01:12:04 +00:00
Alasdair G Kergon
ebac2ed5be pvresize: Avoid archiving orphan VG metadata.
Block creations of archive and backup files for internal orphan VGs.

Bug introduced by 603b45e0ed ("pvresize: Do
not use pv_read (get the PV from orphan VG).")
2014-01-16 23:02:59 +00:00
Peter Rajnoha
b662f3c8dd udev: do not drop SYSTEMD_READY for non-activating events
Do not drop device's flag to report readiness for systemd
processing if there's any event that follows the activatiion
event itself. Otherwise, systemd would lost track of this device
on any other event that follows the activating event (IOW, we
need to make SYSTEMD_READY variable change level-based, not edge-based).

This patch applies for MD and loop devices used as PVs.

(intra-release fix for commit 4c267c7286)
2014-01-14 17:59:56 +01:00
Alasdair G Kergon
3813cd7a3c format1: Mark obsolete and do not use with lvmetad.
DO NOT USE LVMETAD IF YOU HAVE ANY LVM1-FORMATTED PVS.

You may continue to use it without lvmetad, but do please schedule
an upgrade to the lvm2 format (with 'vgconvert').

Sending the original LVM1 formatted metadata to lvmetad is breaking
assumptions made by the code, so I am marking the format as obsolete for
now and no longer sending it to lvmetad.

This means that if you are using lvmetad, lvm1 volumes will usually
appear invisible - though not always: it depends on exactly what
sequence of commands you run!

The current situation is not satisfactory.

We'll either fix lvmetad and reenable this or we'll fix the code to
issue appropriate warning messages when lvm1 PVs are encountered
to avoid accidents.

(The latest unfixed problem is that lvmetad assumes metadata sequence
numbers exist and always increase - but the lvm1 format does not define
or store any sequence number, confusing both the daemon and client
when default values get passed to-and-fro.)
2014-01-14 03:27:45 +00:00
Alasdair G Kergon
5a450eab6a pvs: fix segfaults with orphans
Several fields used to display 0 if undefined.  Recent changes
to the way the fields are reported threw away some tests for
valid pointers, leading to segfaults with 'pvs -o all'.

Reinstate the original behaviour.
2014-01-14 03:17:27 +00:00
Alasdair G Kergon
4c2b4c37e7 lvmcache: Invalidate cached VG if PV is orphaned.
If a PV in an existing VG becomes orphaned (with 'pvcreate -ff', for
example) the VG struct cached against its vginfo must be invalidated.
This is because the struct device it references no longer contains
the PV label so becomes incorrect.

This triggers the error:
  Internal error: PV $dev unexpectedly not in cache.
when the PV from the cached VG metadata is subsequently looked up
in the cache.

Bug introduced in 2.02.87 by commit 7ad0d47c3c
("Cache and share generated VG structs").

Before:

lvm> pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/loop3 vg12 lvm2 a--  28.00m 28.00m
  /dev/loop4 vg12 lvm2 a--  28.00m 28.00m
lvm> pvcreate -ff /dev/loop3
Really INITIALIZE physical volume "/dev/loop3" of volume group "vg12" [y/n]? y
  WARNING: Forcing physical volume creation on /dev/loop3 of volume group "vg12"
  Physical volume "/dev/loop3" successfully created
lvm> pvs
  Internal error: PV /dev/loop3 unexpectedly not in cache.
  PV         VG   Fmt  Attr PSize  PFree
  /dev/loop3 vg12 lvm2 a--  28.00m 28.00m
  /dev/loop3      lvm2 a--  32.00m 32.00m
  /dev/loop4 vg12 lvm2 a--  28.00m 28.00m

After:
lvm> pvs
  PV         VG   Fmt  Attr PSize  PFree
  /dev/loop3 vg12 lvm2 a--  28.00m 28.00m
  /dev/loop4 vg12 lvm2 a--  28.00m 28.00m
lvm> pvcreate -ff /dev/loop3
Really INITIALIZE physical volume "/dev/loop3" of volume group "vg12" [y/n]? y
  WARNING: Forcing physical volume creation on /dev/loop3 of volume group "vg12"
  Physical volume "/dev/loop3" successfully created
lvm> pvs
  PV             VG   Fmt  Attr PSize  PFree
  /dev/loop3          lvm2 a--  32.00m 32.00m
  /dev/loop4     vg12 lvm2 a--  28.00m 28.00m
  unknown device vg12 lvm2 a-m  28.00m 28.00m
2014-01-14 02:57:03 +00:00
Petr Rockai
9c445f3c2c reporter: Set labeller on dummy labels (fixes missing fmt field). 2014-01-13 11:45:38 +01:00
Petr Rockai
d61c9eb52f report: Do not try to get dev_size of a NULL device. 2014-01-13 11:45:18 +01:00
Petr Rockai
5f7286f15d toollib: Fix a pool leak in _process_all_devs. 2014-01-13 11:26:43 +01:00
Petr Rockai
e892ac7398 test: Increase the overall timeout to 3 hours. 2014-01-08 17:11:32 +01:00
Petr Rockai
d52c4154c5 test: Time out the entire testsuite after an hour. 2014-01-08 17:11:32 +01:00
Petr Rockai
af8580d756 test: Use klogctl in the harness instead of reading /var/log/messages. 2014-01-08 17:11:32 +01:00
Petr Rockai
1937715d2c test: Add a regression test for pvcreate -ff. 2014-01-08 15:24:43 +01:00
Petr Rockai
8a8e59fb5a lvmetad: Fix getting vgid_old & avoid removing in-transition VGs. 2014-01-08 15:22:24 +01:00
Zdenek Kabelac
2b7f7d0ab4 tests: use compiled lvm for clvmd executed lvs 2014-01-08 13:52:05 +01:00
Zdenek Kabelac
5f246bf768 liblvm: mark constant as unsigned 2014-01-08 12:04:41 +01:00
Zdenek Kabelac
4417cd288b lvmetad: add parentheses around assignment 2014-01-08 11:57:43 +01:00