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

14866 Commits

Author SHA1 Message Date
Tony Asleson
7a6e438df8 lvmdbusd: Ensure vg_uuid is present
In some cases we are seeing where there are no VGs, but the data returned from
lvm shows that the PVs have the following for the VG:

"vg_name":"[unknown]", "vg_uuid":""

The code was only checking for the exitence of the VG name and we called into
the function get_object_path_by_uuid_lvm_id which requires both the VG name and
the LV name to exist (asserts this) which results in the following stack trace:

Traceback (most recent call last):
  File "/home/tasleson/lvm2/daemons/lvmdbusd/utils.py", line 563, in runner
    obj._run()
  File "/home/tasleson/lvm2/daemons/lvmdbusd/utils.py", line 584, in _run
    self.rc = self.f(*self.args)
  File "/home/tasleson/lvm2/daemons/lvmdbusd/fetch.py", line 26, in
		_main_thread_load
    cache_refresh=False)[1]
  File "/home/tasleson/lvm2/daemons/lvmdbusd/pv.py", line 48, in load_pvs
    emit_signal, cache_refresh)
  File "/home/tasleson/lvm2/daemons/lvmdbusd/loader.py", line 37, in common
    objects = retrieve(search_keys, cache_refresh=False)
  File "/home/tasleson/lvm2/daemons/lvmdbusd/pv.py", line 40, in
		pvs_state_retrieve
    p["pv_attr"], p["pv_tags"], p["vg_name"], p["vg_uuid"]))
  File "/home/tasleson/lvm2/daemons/lvmdbusd/pv.py", line 84, in __init__
    vg_uuid, vg_name, vg_obj_path_generate)
  File "/home/tasleson/lvm2/daemons/lvmdbusd/objectmanager.py", line 318,
		in get_object_path_by_uuid_lvm_id
    assert uuid
AssertionError
2017-09-21 14:35:36 -05:00
Tony Asleson
e3965d392c lvmdbusd: Fix hang in MThreadRunner
When executing in the main thread, if we encounter an exception we
will bypass the notify_all call on the condition and the calling thread
never wakes up.

@staticmethod
    def runner(obj):
        # noinspection PyProtectedMember
Exception thrown here
 ----> obj._run()
So the following code doesn't run, which causes calling thread to hang
	with obj.cond:
            obj.function_complete = True
            obj.cond.notify_all()

Additionally for some unknown reason the stderr is lost.
Best guess is it's something to do with scheduling a python function
into the GLib.idle_add.  That made finding issue quite difficult.
2017-09-21 14:35:36 -05:00
Peter Rajnoha
096fcb5a6e blkdeactivate: also try to unmount /boot on blkdeactivate -u if on top of supported device
There's nothing special about /boot other than it's used during boot.
But when blkdeactivate is called either on all devices or including a
device where the /boot is on top, we should also include this mount
point when doing unmount before deactivation of supported devices.
2017-09-21 17:15:48 +02:00
Peter Rajnoha
584b4ae38b blk-availability: use blkdeactivate -r wait in blk-availability systemd service/initscript 2017-09-21 17:10:15 +02:00
Peter Rajnoha
95087c8f96 blkdeactivate: add blkdeactivate -r wait option to wait for MD resync/recovery/reshape
The new blkdeactivate -r|mdraidoption wait causes blkdeactivate to wait
for any resync/recovery/reshape that is currently in progress before
deactivating the device.

If this option is used, blkdeactivate calls mdadm -W|--wait before
mdadm -S|--stop.
2017-09-21 17:10:15 +02:00
Peter Rajnoha
7fa0d52262 blkdeactivate: fix blkdeactivate regression with failing DM/MD devs deactivation
Revert dc50f2f4a0.

We're canonicalizing/escaping the names here and we're reusing the
variable name so the code doesn't need to use extra variables and
further assignments that may confuse us. Let's keep the code simple.

The

   local name=(...$name)

is not the same as

   local name
   name=(...$name)

(I know various code-checking tools fuss about this and recommend
the 2nd way, but let's ignore those tools' nitpicking here please.)
2017-09-21 17:10:15 +02:00
Peter Rajnoha
9f34125d5d blkdeactivate: fix --{dm,lvm,mpath}options option name recognition
There was a typo in blkdeactivate --dmoption/--lvmoption/mpathoption,
it had missing "s" at the end and it was not recognized properly, only
short names for the options (-d/-l/-m).
2017-09-21 17:08:44 +02:00
David Teigland
0ab9e4b6a7 improve error messages when command rules fail
When certain cmd def RULE's fail, the error messages can
sometimes be confusing.  This expands the error messages
to help clarify why the rule failed, especially in cases
where options are used incorrectly.
2017-09-20 11:10:35 -05:00
David Teigland
f2ee0e7aca pvmove: require LV name in a shared VG
In a shared VG, only allow pvmove with a named LV,
so that only PE's used by the LV will be moved.
The LV is then activated exclusively, ensuring that
the PE's being moved are not used from another host.

Previously, pvmove was mistakenly allowed on a full PV.
This won't work when LVs using that PV are active on
other hosts.
2017-09-20 09:56:51 -05:00
David Teigland
518a8e8cfb lvmlockd: activate mirror LVs in shared mode with cmirrord
Previously lvmlockd disallowed mirror LVs to be activated
in shared mode.
2017-09-20 09:55:34 -05:00
Zdenek Kabelac
d9f9ce1268 tests: use portable df output
For awk parsing more 'predictable' format of output line is needed.
2017-09-20 15:34:02 +02:00
Zdenek Kabelac
a15b796146 tests: repair of cachepool 2017-09-20 15:14:16 +02:00
Zdenek Kabelac
2fd2b197ab tests: check for free space in test dir
Avoid starting test, when test dir has less then 50M of free space.
Better to crash early before letting die machine on weird crash
in OOM cases...

Also show free disk space when test starts
2017-09-20 15:14:16 +02:00
Zdenek Kabelac
a02db1c45a libdm: fix parentheses in assignment + comparison
As reported, fix incorrect placement of parentheses.
TODO: add testing code.
2017-09-20 15:14:16 +02:00
Zdenek Kabelac
a65649b45d lvconvert: support repair of cache/cachepool
Extend repair for cache and cachepool target
and user 'lvconvert_repair' routine name.
2017-09-20 15:14:16 +02:00
Zdenek Kabelac
aeb4f2bf3d lvconvert: repair supports poometadatespare switch
Enable handling of  --poolmetadataspare so if user can prevent
creation of _pmspare volume during --repair operation (just
like during actual lvcreate or lvconvert) for pool volumes.
2017-09-20 15:14:16 +02:00
Marian Csontos
03bcd29481 configure: Add warning for D-Bus w/o notifications
Building D-Bus support without notifications is not recommended.
2017-09-20 13:07:06 +02:00
Marian Csontos
0c46f9cf0c configure: Update configure 2017-09-20 13:07:06 +02:00
Marian Csontos
8493df8edd liblvm: Add deprecation warning to configure 2017-09-20 13:07:06 +02:00
Marian Csontos
4cbacf6bac liblvm: Deprecate library and bindings
It is recommended to use D-Bus API instead of liblvm2app or python
bindings.
2017-09-20 13:07:06 +02:00
David Teigland
5407327bc6 toollib: fix parentheses in assignment + comparison 2017-09-19 09:19:24 -05:00
David Teigland
200793edc6 man pvscan: just write --activate in description
rather than -a|--activate, because web pages on
man7.org are not printing the | character.
2017-09-18 10:56:39 -05:00
Alasdair G Kergon
d73eddcdc0 dmsetup: Process -S to filter input device lists.
The following commands now pass the device list through a
--select|-S filter before processing:

suspend resume clear wipe_table remove deps status table
2017-09-14 23:41:17 +01:00
David Teigland
8e8755319c lvcreate: use cmd defs to deny unspported lockd cases
In a shared VG, lvconvert must be used to create thin pools
and cache pools, not the lvcreate variants of those commands.
Deny these cases early in lvcreate using the new command defs.
Denying these cases deeper in the code was missing some
cleanup of the partially completed command.
2017-09-14 12:28:48 -05:00
David Teigland
d93a2bb741 revert tidy: prefer not using else after return
Revert the lvmlockd.c changes from:
  commit 0bf836aa14
  "tidy: prefer not using else after return"

The commit introduced at least one regression, which broke
lvcreate of a thin pool in a shared VG.
2017-09-14 12:28:48 -05:00
Alasdair G Kergon
29834b6e91 kernel: Refresh dm-ioctl.h
Adds DM_DEV_ARM_POLL
2017-09-14 17:50:56 +01:00
Alasdair G Kergon
71dbe0fe26 post-release 2017-09-13 20:46:25 +01:00
Alasdair G Kergon
918f0a92da pre-release 2017-09-13 20:38:29 +01:00
Alasdair G Kergon
901c919d22 README: Include new github links
We've decided to mirror the upstream code onto github for the
convenience of people already using that platform.
2017-09-13 20:20:04 +01:00
Zdenek Kabelac
03efec2712 deamonize: restore detection of errors
Keep forked environment for daemon more strick and check even
for nearly impossible to happen errors.
2017-09-06 11:47:53 +02:00
David Teigland
3071837e21 lvmlockd: always disallow mirror splitting
lv_raid_split() was correctly prevented in a shared VG,
but lv_raid_split_and_track() was missing that check.
2017-09-05 10:28:33 -05:00
David Teigland
09c792c206 lvmlockd: fix check for no running lock manager
In some cases it was reporting there was no running
lock manager when there is.
2017-08-29 15:18:12 -05:00
David Teigland
f847fcd31a lvmlockd: print error about starting lock manager
In the case where lvmlockd is running, but no lock manager
is running, we should print a specific error message about
that situation.
2017-08-28 16:24:00 -05:00
Zdenek Kabelac
c8fdc5c087 cleanup: easier to read code
Split into lines for better reading.
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
962874bfe2 dmsetup: validate strtol reading
Better validation for --mode option.
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
47b7d4a733 dmsetup: add missing -- for option 2017-08-25 14:20:59 +02:00
Zdenek Kabelac
26d97f179f reporting: validate time parsing with strtol
Check for out-of-range numbers being result of strtol parsing.
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
d79d919329 lvmlockd: log pthread_join errno code
Log possible errno with pthread_join (and one close() instance).
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
da9a8fdedc lvmlockctl: fix check for failing close
On  close() failure it's -1.
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
288e10cf8b lvmlockd: avoid double unlock of client_mutex
Avoid double unlocking of client_mutex and
and unlock client_mutex in 'else' branch
since it's already unlocked in 'if (cl->dead)' branch.
2017-08-25 14:20:59 +02:00
Zdenek Kabelac
b3b1e788e1 daemonize: more unified code
ATM we have several instances of daemonizing code.
Each has its 'special' logic so not completely easy
to unify them all into a single routine.

Start to unify them and use one strategy for rediricting
all input/outpus to /dev/null - use 'dup2' function for this
and open /dev/null before fork to make sure it's available.
2017-08-25 14:20:57 +02:00
Zdenek Kabelac
5de9444202 locking: avoid descriptor leak for nonblocking mode
When file-locking mode failed on locking, such description was leaked
(typically not an issue since command usually exists afterwards).
So shirt close() at the end of function and use it in all error paths.

Also make sure, when interrrupt is detected, it's really not holding
lock and returns 0.
2017-08-25 14:12:55 +02:00
David Teigland
043ff47b05 man lvmthin: change fsck references
to more generic terms like repair.
2017-08-24 10:25:01 -05:00
David Teigland
e71c3ff187 lvmlockd: fix mutex unlock
Remove an unwanted pthread_mutex_unlock which would
lead to a double unlock.
2017-08-23 11:30:55 -05:00
David Teigland
46ddd5520c lvmlockd: add comment about temp ls name 2017-08-23 11:25:18 -05:00
Zdenek Kabelac
539a48a328 debug: add stack trace point 2017-08-22 10:23:31 +02:00
Zdenek Kabelac
c1e3f96c97 lvmcache: check for lvmcache_foreach_mda return code
lvmcache_foreach_mda() can fail for numerous reasons
and failing error code cannot be ignored (out-of-memory...)

TODO: might need more error handling tunning.
2017-08-22 10:23:31 +02:00
Zdenek Kabelac
d4ce98de4d lvmlockd: shorter code
gcc warns here about storring 69 bytes in 64 byte array (losing
potentially 4 bytes from 'ls->name').

lvmlockd-core.c:2657:36: warning: ‘%s’ directive output may be truncated writing up to 64 bytes into a region of size 60 [-Wformat-truncation=]
  snprintf(tmp_name, MAX_NAME, "REM:%s", ls->name);
                                    ^~
lvmlockd-core.c:2657:2: note: ‘snprintf’ output between 5 and 69 bytes into a destination of size 64
  snprintf(tmp_name, MAX_NAME, "REM:%s", ls->name);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Replaced with slightly better code - but it still misses error path what
to do if the name would be truncated... - so added FIXME.

Also using all bytes for snprintf() buffer size
(as the size is with \0 included)
2017-08-22 10:23:31 +02:00
Zdenek Kabelac
0e42b31dc3 libdm: fix errpath for control node creation
When control node failure happens, umask was not restored.
Fix it by using common exit path.
2017-08-22 10:23:29 +02:00
David Teigland
df5c296426 lvmlockd: zero extended lvmlock LV
After the internal lvmlock LV (holding sanlock leases) is
extended to hold more leases, it needs to be zeroed.
sanlock expects to see either zeroed blocks or blocks
initialized with leases.
2017-08-15 11:56:31 -05:00