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

12802 Commits

Author SHA1 Message Date
Tony Asleson
41ebed7077 lvmdbusd: Change print statement to py3 syntax 2016-06-10 15:28:42 -05:00
Tony Asleson
b717c5efae lvmdbusd: Bug fix for missing LV properties
When we are processing the LVs we need to build up dbus objects from least
dependent to most dependent, so that we have information available when
constructing.
2016-06-10 15:28:42 -05:00
Tony Asleson
e04705b305 lvmdbusd: Add data_lv and metadata_lv to cache pool interface
See: https://bugzilla.redhat.com/show_bug.cgi?id=1342558
2016-06-10 15:28:42 -05:00
Tony Asleson
3bf43a65fe lvmdbusd: Add roles property to LV common interface
See: https://bugzilla.redhat.com/show_bug.cgi?id=1342559
2016-06-10 15:28:42 -05:00
David Teigland
8a667f5887 WHATS_NEW: add recent changes 2016-06-10 13:39:23 -05:00
Zdenek Kabelac
ad414e5ad6 cleanup: typo in WHATS_NEW_DM 2016-06-10 16:01:22 +02:00
Zdenek Kabelac
35612bd27c display: yes no prompt improvement
Original code missed to catch all apperances of SIGINT.
Also enhance logging when running in shell without tty.
Accept this regex as valid input:
'^[ ^t]*([Yy]([Ee]([Ss]|)|)|[Nn]([Oo]|))[ ^t]*$'
2016-06-10 16:00:31 +02:00
Peter Rajnoha
cfdc87b623 lvmdump: also collect output from lsblk command when running lvmdump -s
lsblk provides nice and quick overview of the storage/sysfs structure
that is useful for debugging - collect its output when running lvmdump -s.
2016-06-09 13:54:15 +02:00
David Teigland
86f9271457 vgcreate, pvcreate, vgextend: don't use a device with duplicates
If duplicate orphan PVs exist, don't allow one of them to be
used for vgcreate/pvcreate/vgextend.
2016-06-07 15:21:07 -05:00
David Teigland
199b7b55c2 lvmcache: fix duplicate handling with multiple scans
Some commands scan labels to populate lvmcache multiple
times, i.e. lvmcache_init, scan labels to fill lvmcache,
lvmcache_destroy, then later repeat

Each time labels are scanned, duplicates are detected,
and preferred devices are chosen.  Each time this is done
within a single command, we want to choose the same
preferred devices.  So, check for existing preferences
when choosing preferred devices.

This also fixes a problem with the list of unused duplicate
devs when run in an lvm shell.  The devs had been allocated
from cmd memory, resulting in invalid list entries between
commands.
2016-06-07 15:15:51 -05:00
David Teigland
01156de6f7 lvmcache: add optional dev arg to lvmcache_info_from_pvid
A number of places are working on a specific dev when they
call lvmcache_info_from_pvid() to look up an info struct
based on a pvid.  In those cases, pass the dev being used
to lvmcache_info_from_pvid().  When a dev is specified,
lvmcache_info_from_pvid() will verify that the cached
info it's using matches the dev being processed before
returning the info.  Calling code will not mistakenly
get info for the wrong dev when duplicate devs exist.

This confusion was happening when scanning labels when
duplicate devs existed.  label_read for the first dev
would add an info struct to lvmcache for that dev/pvid.
label_read for the second dev would see the pvid in
lvmcache from first dev, and mistakenly conclude that
the label_read from the second dev can be skipped
because it's already been done.  By verifying that the
dev for the cached pvid matches the dev being read,
this mismatch is avoided and the label is actually read
from the second duplicate.
2016-06-07 15:15:47 -05:00
David Teigland
ed6ffc7a34 lvmetad: handle update failures
If a command gets stuck during an lvmetad update, lvmetad
will cancel that update after the timeout.  The next command
to check the lvmetad will see that lvmetad needs to be
populated because lvmetad will return token of "none" after
a timed out update (same as when lvmetad is not populated
at all after starting.)

If a command gets an error during an lvmetad update, it
will now just quit and leave its updating token in place.
That update will be cancelled after the timeout.
2016-06-07 10:17:00 -05:00
David Teigland
851ccfccaf lvmetad: remove disabled case for "scan error"
Failures while populating lvmetad will be handling
differently in a subsequent commit.
2016-06-07 10:17:00 -05:00
David Teigland
0e7f352c70 lvmetad: define special update in progress string 2016-06-07 10:17:00 -05:00
Peter Rajnoha
7ae05adf46 blkdeactivate: fix regression in blkdeactivate causing dm and md devices to be skipped.
Commit #5b3a4a9 caused the "name" variable to be cleared if
declaration and assignment is on two lines so put it back
so it's on one line for it to work again.
2016-06-06 14:57:46 +02:00
Alasdair G Kergon
7c894911ae post-release 2016-06-03 23:20:43 +01:00
Alasdair G Kergon
767c9d653e pre-release 2016-06-03 23:16:50 +01:00
David Teigland
b321d2b1b9 pvmove: disallow tag args
pvmove began processing tags unintentionally from commit,
6d7dc87cb pvmove: use toollib

pvmove works on a single PV, but tags can match multiple PVs.
If we allowed tags, but processed only the first matching PV,
then the resulting PV would be unpredictable.

Also, the current processing code does not allow us to simply
report an error and do nothing if more than one PV matches the tag,
because the command starts processing PVs as they are found,
so it's too late to do nothing if a second PV matches.
2016-06-03 09:56:48 -05:00
Tobias Stoeckmann
68e0979724 man: fixed typo in lvcreate.8
It's supposed to be "smaller than" instead of "smaller then".
2016-06-03 12:46:47 +02:00
Zdenek Kabelac
8e4db009b8 cleanup: compile fixes for --disable-devmapper
Make lvm2 compilable when configured with: --disable-devmapper.
2016-06-03 12:46:43 +02:00
Peter Rajnoha
8012c223e0 man: lvmconfig: add note about --type diff and --mergedconfig 2016-06-02 14:07:07 +02:00
Peter Rajnoha
687bc5cecf lvmconfig: fix lvmconfig --type diff to display complete diff if config cascade used
If configuration consists of several sources in config cascade
("config cascade" defined in man lvmconfig(8)), lvmconfig displayed
only difference from defaults of the topmost config in the cascade.
Fix lvmconfig to display complete difference, considering all
the configuration in the cascade.

For example, before this patch:

	(use_lvmetad=0 set in lvm.conf which differs from defaults)
	$ lvmconfig --type diff
	global {
		use_lvmetad=0
	}

	(compact_output=1 set on cmd line)
	$ lvmconfig --type diff --config report/compact_output=1
	report {
		compact_output=1
	}

	(headings=0 set in profile)
	$ lvmconfig --type diff --commandprofile test
	report {
		headings=0
	}

	(difference in topmost configuration source is displayed)
	$ lvmconfig --type diff --commandprofile test --config report/compact_output=1
	report {
		compact_output=1
	}

With this patch applied (the config cascade is merged before looking for
difference from defaults in configuration):

	$ lvmconfig --type diff
	global {
		use_lvmetad=0
	}

	$ lvmconfig --type diff --config report/compact_output=1
	report {
		compact_output=1
	}
	global {
		use_lvmetad=0
	}

	$ lvmconfig --type diff --profile test
	report {
		headings=0
	}
	global {
		use_lvmetad=0
	}

	$ lvmconfig --type diff --profile test --config report/compact_output=1
	report {
		headings=0
		compact_output=1
	}
	global {
		use_lvmetad=0
	}
2016-06-02 13:49:38 +02:00
Peter Rajnoha
fc37ee63c0 make: add generated parts of lvmdbusd to DISTCLEAN_TARGETS for make distclean 2016-06-02 11:58:54 +02:00
Zdenek Kabelac
21cefd3f07 cleanup: use display_name 2016-06-01 17:40:26 +02:00
Zdenek Kabelac
a5d65b4a51 tests: check losetup -P is correctly handled
Validate pvcreate will not overwrite partitioned loop device.
2016-06-01 17:37:52 +02:00
Zdenek Kabelac
d73a83e8cf tests: extend prepare_loop
Treat args after size  as 'extra' params for losetup.
2016-06-01 17:37:52 +02:00
Zdenek Kabelac
d37a26b680 devices: handle partscan loop devices
Treat loop device created with 'losetup -P' as regular
partitioned device - so if it has partition table,
prevent its usage in commands like 'pvcreate'.

Before 'pvcreate /dev/loop0' could have erased and formated as PV,
after this patch, device is filtered out and cannot be used.
2016-06-01 17:37:47 +02:00
Peter Rajnoha
3d333e5a29 coverity: fix warnings about missing return value check for sscanf
All the variables for sscanf in lvmlockctl.c and lvmlockd-sanlock.c are
zeroed before sscanf call so the failure is detected by seeing the zero
value instead of proper one in subsequent code - so use (void) for
sscanf calls to ignore return value here.
2016-05-31 10:06:25 +02:00
Peter Rajnoha
48877e215d coverity: missing check for id_write_format return value 2016-05-31 09:56:10 +02:00
Peter Rajnoha
5b3a4a9595 coverity: blkdeactivate: separate format and args for printf and declare and assign separately to avoid masking return values 2016-05-31 09:39:06 +02:00
Peter Rajnoha
02d67848eb coverity: fix possible resource leak of descendants_buffer in _print_historical_lv fn 2016-05-31 09:36:58 +02:00
Peter Rajnoha
cfe7d2368c tests: add dmstats to CLEAN_TARGETS for make clean 2016-05-31 09:14:23 +02:00
Peter Rajnoha
4fb224a553 toollib: properly reset selection handle on selection failure in select_match_{pv,vg,lv} 2016-05-31 09:08:59 +02:00
Peter Rajnoha
e4ec6bcdd3 report: fix lvm devtypes internal error if -S is used with field name from pvs/vgs/lvs
Before this fix, when reporting 'lvm devtypes', the report was
initialized with incorrect reserved values - the ones used for
pvs/vgs/lvs report were used instead of NULL value (because devtypes
doesn't have any reserved values).

For example, trying to (incorrectly) use lv_name for the -S|--select
with lvm devtypes which doesn't have this field at all:

Before this patch (internal error issued):

$ lvm devtypes -S 'lv_name=lvol0'
  Internal error: _check_reserved_values_supported: field-specific reserved value of type 0x0 for field  not supported
  Internal error: dm_report_init_with_selection: trying to register unsupported reserved value type, skipping report selection
  DevType       MaxParts Description
  aoe                 16 ATA over Ethernet
  ataraid             16 ATA Raid
  bcache               1 bcache block device cache
  ...

With this patch applied (correct error displayed about
unrecognized selection field):

$ lvm devtypes -S 'lv_name=lvol0'
  Device Types Fields
  -------------------
    devtype_name           - Name of Device Type exactly as it appears in /proc/devices. [string]
    devtype_max_partitions - Maximum number of partitions. (How many device minor numbers get reserved for each device.) [number]
    devtype_description    - Description of Device Type. [string]

  Special Fields
  --------------
    selected               - Set if item passes selection criteria. [number]
    help                   - Show help. [unselectable number]
    ?                      - Show help. [unselectable number]

  Unrecognised selection field: lv_name
  Selection syntax error at 'lv_name=lvol0'.
  Use 'help' for selection to get more help.
2016-05-30 16:46:18 +02:00
Peter Rajnoha
815f1ee26d toollib: simplify internal selection calls for non-reporting tools
Some of the variables were set superfluously - we can just use existing
"struct processing_handle" which includes "struct selection_handle".
2016-05-30 16:44:18 +02:00
Zdenek Kabelac
7d4d0ff606 tests: check thin is not flushed for status
We finally approach a moment where we generally avoid
flushing thin-pool with every lvs command...
2016-05-27 17:25:52 +02:00
Zdenek Kabelac
88eeb004e9 snapshot: for invalid snapshot show 100%
Recent commit 92eba53a79 started to report
empty "" data usage of invalid snapshot, restore 100% to be shown.
2016-05-27 17:25:37 +02:00
Zdenek Kabelac
43dfc2011c tests: stacked snapshot merge 2016-05-27 15:47:24 +02:00
Zdenek Kabelac
a67adbfe2e tests: check cache_mode change on cachepool 2016-05-27 15:47:24 +02:00
Zdenek Kabelac
090ecaabed debug: use display_lvname 2016-05-27 15:47:24 +02:00
Zdenek Kabelac
04003cf1ff cache: add log_error on error path
Validate and report error when lv_cache_status is called
for inactive LV, or pending delete or unused cache_pool.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
ecfb90de74 report: convert more options to use single status
Convert fields into using a single status ioctl call per LV.
This is a bit tricky since when there are more complicated
stacks, at this moment its undefined which values should be shown.

It's clear we need to cache more then single ioctl per LV,
but also we need to define more explicitely relation between
reported values for snapshots.

This patch is not a final state, rather a transitional step.
It should not be giving more 'worst' values then previous
many-ioctl-calls-per-lv solution.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
80603ad49a snapshot: use seg_status for attrs 2016-05-27 15:47:24 +02:00
Zdenek Kabelac
92eba53a79 lv: introduce lvseg_percent_with_info_and_seg_status
Add function to obtain percentage value for cache lv_seg_status.
This API is rather evolving 'middle' step as the ultimate goal
is segment API fuctionality.

But first we need to be clear at reporting level which values
are needed to be reported for which LVs and segments.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
f7f395667e lvstatus: enhance seg_status to handle snapshot
Add more code to properly store status for snapshot segment
maintaining lvm2 fiction of COW and snapshot internal volumes.

The key issue here is however not though-through reporting
logic - as there is no single answer for whole line state.
It not counting with layer and we may need few more ioctl to
cover all reporting needs depending upon what is actually
needed.

In reality we need to 'cache' more ioctl status queries for
individual LVs and their segments (so they checked at most once).

The other 'hard' topic for conversion is mirror segment handling.

Also we definitelly need to relocate some logic into segment's methods,
yet it might be complex as we have not clear border between targets.

TODO: define more clearly how are reporting fields defined in case
we 'stack' volumes like   -   cache of stacked  thin LV snapshot origin.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
067c0a23e5 refresh: call resume after failing suspend
lv_refresh_suspend_resume() has escaped with fail ret code
after failing suspend and could have left many volumes in suspend state.

So always unconditionally call resume also  when suspend has failed.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
98b41db324 cleanup: drop cmd and constify lv for lv_refresh_suspend_resume()
Like with most other lv_manip* functions take just LV arg and get cmd
from embeded pointer when needed.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
cb49ceeaba cleanup: substract integers
Instead of doing float arithmetic, do integer math first and
convert result to float.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
1c07e67462 cache: enhance lv_cache_wait_for_clean
Handle passthrough mode when checking cache mode state explicitely.
2016-05-27 15:47:24 +02:00
Zdenek Kabelac
0424277c00 cache: call status only on cache pool in use
Check show cache status only for cache pool in use.
2016-05-27 15:47:24 +02:00