main - lvconvert: allow writecache with other thinpool command syntax
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c35f7722d588009edad...
Commit: c35f7722d588009edad22d59c68c82150bb5c216
Parent: f7730406254f023216d0727c82d46de82c124c92
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Thu Jun 17 16:15:18 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Thu Jun 17 16:15:18 2021 -0500
lvconvert: allow writecache with other thinpool command syntax
"lvconvert --thinpool LV" should allow LV to have a writecache,
but there was an extra type check preventing it.
---
tools/lvconvert.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/lvconvert.c b/tools/lvconvert.c
index e19c445b1..cbe4fa93a 100644
--- a/tools/lvconvert.c
+++ b/tools/lvconvert.c
@@ -4769,7 +4769,7 @@ static int _lvconvert_to_pool_or_swap_metadata_single(struct cmd_context *cmd,
switch (cmd->command->command_enum) {
case lvconvert_to_thinpool_or_swap_metadata_CMD:
- if (lv_is_cache(lv))
+ if (lv_is_cache(lv) || lv_is_writecache(lv))
/* For cached LV check the cache origin LV type */
lvt_enum = get_lvt_enum(seg_lv(first_seg(lv), 0));
to_thinpool = 1;
2 years, 10 months
main - lvmdbusd: Wrap json.load in try/except
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f7730406254f023216d...
Commit: f7730406254f023216d0727c82d46de82c124c92
Parent: c474f174cc8b0e855f984bf211f5416b42c644a1
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Jun 14 22:04:09 2021 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Jun 17 09:14:29 2021 -0500
lvmdbusd: Wrap json.load in try/except
In testing where we inject large amounts of additional output in stderr
we can occassionally get truncated stdout from lvm. Catching and dumping
the json for debug before we re-raise the exception. As this doesn't
happen without the error injecting wrapper around lvm, the error seems to
be with the wrapper.
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/cmdhandler.py | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 91f69abcf..b88bd9896 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -627,7 +627,13 @@ def lvm_full_report_json():
assert(type(out) == dict)
return out
else:
- return json.loads(out)
+ try:
+ return json.loads(out)
+ except json.decoder.JSONDecodeError as joe:
+ log_error("JSONDecodeError %s, \n JSON=\n%s\n" %
+ (str(joe), out))
+ raise joe
+
return None
2 years, 10 months
main - lvmdbusd: Handle arbitrary amounts stdout & stderr
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=c474f174cc8b0e855f9...
Commit: c474f174cc8b0e855f984bf211f5416b42c644a1
Parent: 71cb54d92f96b8da318c8f8380e7ce0bdf0a11bf
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Fri Jun 11 10:35:31 2021 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Thu Jun 17 09:14:29 2021 -0500
lvmdbusd: Handle arbitrary amounts stdout & stderr
When exec'ing lvm, it's possible to get large amounts of both stdout
and stderr depending on the state of lvm and the size of the lvm
configuration. If we allow any of the buffers to fill we can end
up deadlocking the process. Ensure we are handling stdout & stderr
during lvm execution.
Ref. https://bugzilla.redhat.com/show_bug.cgi?id=1966636
Signed-off-by: Tony Asleson <tasleson(a)redhat.com>
---
daemons/lvmdbusd/background.py | 71 +++++++++++++++-------------------
daemons/lvmdbusd/cmdhandler.py | 65 +++++++++++++++++++++++++------
daemons/lvmdbusd/lvm_shell_proxy.py.in | 26 ++++---------
daemons/lvmdbusd/utils.py | 14 +++++++
4 files changed, 107 insertions(+), 69 deletions(-)
diff --git a/daemons/lvmdbusd/background.py b/daemons/lvmdbusd/background.py
index 3b77a7cc6..32b2cdc38 100644
--- a/daemons/lvmdbusd/background.py
+++ b/daemons/lvmdbusd/background.py
@@ -9,13 +9,14 @@
import subprocess
from . import cfg
-from .cmdhandler import options_to_cli_args, LvmExecutionMeta
+from .cmdhandler import options_to_cli_args, LvmExecutionMeta, call_lvm
import dbus
from .utils import pv_range_append, pv_dest_ranges, log_error, log_debug,\
- add_no_notify
-import os
+ mt_async_call
+from .request import RequestEntry
import threading
import time
+import traceback
def pv_move_lv_cmd(move_options, lv_full_name,
@@ -39,58 +40,50 @@ def lv_merge_cmd(merge_options, lv_full_name):
return cmd
-def _move_merge(interface_name, command, job_state):
- # We need to execute these command stand alone by forking & exec'ing
- # the command always as we will be getting periodic output from them on
- # the status of the long running operation.
- command.insert(0, cfg.LVM_CMD)
-
- # Instruct lvm to not register an event with us
- command = add_no_notify(command)
+def _load_wrapper(ignored):
+ cfg.load()
- #(self, start, ended, cmd, ec, stdout_txt, stderr_txt)
- meta = LvmExecutionMeta(time.time(), 0, command, -1000, None, None)
- cfg.blackbox.add(meta)
+def _move_callback(job_state, line_str):
+ try:
+ if line_str.count(':') == 2:
+ (device, ignore, percentage) = line_str.split(':')
- process = subprocess.Popen(command, stdout=subprocess.PIPE,
- env=os.environ,
- stderr=subprocess.PIPE, close_fds=True)
+ job_state.Percent = int(round(
+ float(percentage.strip()[:-1]), 1))
- log_debug("Background process for %s is %d" %
- (str(command), process.pid))
+ # While the move is in progress we need to periodically update
+ # the state to reflect where everything is at. we will do this
+ # by scheduling the load to occur in the main work queue.
+ r = RequestEntry(
+ -1, _load_wrapper, ("_move_callback: load",), None, None, False)
+ cfg.worker_q.put(r)
+ except ValueError:
+ log_error("Trying to parse percentage which failed for %s" % line_str)
- lines_iterator = iter(process.stdout.readline, b"")
- for line in lines_iterator:
- line_str = line.decode("utf-8")
- # Check to see if the line has the correct number of separators
- try:
- if line_str.count(':') == 2:
- (device, ignore, percentage) = line_str.split(':')
- job_state.Percent = round(
- float(percentage.strip()[:-1]), 1)
+def _move_merge(interface_name, command, job_state):
+ # We need to execute these command stand alone by forking & exec'ing
+ # the command always as we will be getting periodic output from them on
+ # the status of the long running operation.
- # While the move is in progress we need to periodically update
- # the state to reflect where everything is at.
- cfg.load()
- except ValueError:
- log_error("Trying to parse percentage which failed for %s" %
- line_str)
+ meta = LvmExecutionMeta(time.time(), 0, command, -1000, None, None)
+ cfg.blackbox.add(meta)
- out = process.communicate()
+ ec, stdout, stderr = call_lvm(command, line_cb=_move_callback,
+ cb_data=job_state)
with meta.lock:
meta.ended = time.time()
- meta.ec = process.returncode
- meta.stderr_txt = out[1]
+ meta.ec = ec
+ meta.stderr_txt = stderr
- if process.returncode == 0:
+ if ec == 0:
job_state.Percent = 100
else:
raise dbus.exceptions.DBusException(
interface_name,
- 'Exit code %s, stderr = %s' % (str(process.returncode), out[1]))
+ 'Exit code %s, stderr = %s' % (str(ec), stderr))
cfg.load()
return '/'
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 1c15b7888..91f69abcf 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -8,6 +8,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
from subprocess import Popen, PIPE
+import select
import time
import threading
from itertools import chain
@@ -16,7 +17,8 @@ import traceback
import os
from lvmdbusd import cfg
-from lvmdbusd.utils import pv_dest_ranges, log_debug, log_error, add_no_notify
+from lvmdbusd.utils import pv_dest_ranges, log_debug, log_error, add_no_notify,\
+ make_non_block, read_decoded
from lvmdbusd.lvm_shell_proxy import LVMShellProxy
try:
@@ -82,16 +84,23 @@ def _debug_c(cmd, exit_code, out):
log_error(("STDERR=\n %s\n" % out[1]))
-def call_lvm(command, debug=False):
+def call_lvm(command, debug=False, line_cb=None,
+ cb_data=None):
"""
Call an executable and return a tuple of exitcode, stdout, stderr
- :param command: Command to execute
- :param debug: Dump debug to stdout
+ :param command: Command to execute
+ :param debug: Dump debug to stdout
+ :param line_cb: Call the supplied function for each line read from
+ stdin, CALL MUST EXECUTE QUICKLY and not *block*
+ otherwise call_lvm function will fail to read
+ stdin/stdout. Return value of call back is ignored
+ :param cb_data: Supplied to callback to allow caller access to
+ its own data
+
+ # Callback signature
+ def my_callback(my_context, line_read_stdin)
+ pass
"""
- # print 'STACK:'
- # for line in traceback.format_stack():
- # print line.strip()
-
# Prepend the full lvm executable so that we can run different versions
# in different locations on the same box
command.insert(0, cfg.LVM_CMD)
@@ -99,10 +108,44 @@ def call_lvm(command, debug=False):
process = Popen(command, stdout=PIPE, stderr=PIPE, close_fds=True,
env=os.environ)
- out = process.communicate()
- stdout_text = bytes(out[0]).decode("utf-8")
- stderr_text = bytes(out[1]).decode("utf-8")
+ stdout_text = ""
+ stderr_text = ""
+ stdout_index = 0
+ make_non_block(process.stdout)
+ make_non_block(process.stderr)
+
+ while True:
+ try:
+ rd_fd = [process.stdout.fileno(), process.stderr.fileno()]
+ ready = select.select(rd_fd, [], [], 2)
+
+ for r in ready[0]:
+ if r == process.stdout.fileno():
+ stdout_text += read_decoded(process.stdout)
+ elif r == process.stderr.fileno():
+ stderr_text += read_decoded(process.stderr)
+
+ if line_cb is not None:
+ # Process the callback for each line read!
+ while True:
+ i = stdout_text.find("\n", stdout_index)
+ if i != -1:
+ try:
+ line_cb(cb_data, stdout_text[stdout_index:i])
+ except:
+ st = traceback.format_exc()
+ log_error("call_lvm: line_cb exception: \n %s" % st)
+ stdout_index = i + 1
+ else:
+ break
+
+ # Check to see if process has terminated, None when running
+ if process.poll() is not None:
+ break
+ except IOError as ioe:
+ log_debug("call_lvm:" + str(ioe))
+ pass
if debug or process.returncode != 0:
_debug_c(command, process.returncode, (stdout_text, stderr_text))
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py.in b/daemons/lvmdbusd/lvm_shell_proxy.py.in
index b76b336c2..7816daa8b 100644
--- a/daemons/lvmdbusd/lvm_shell_proxy.py.in
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py.in
@@ -13,7 +13,6 @@
import subprocess
import shlex
-from fcntl import fcntl, F_GETFL, F_SETFL
import os
import traceback
import sys
@@ -29,7 +28,8 @@ except ImportError:
from lvmdbusd.cfg import LVM_CMD
-from lvmdbusd.utils import log_debug, log_error, add_no_notify
+from lvmdbusd.utils import log_debug, log_error, add_no_notify, make_non_block,\
+ read_decoded
SHELL_PROMPT = "lvm> "
@@ -43,13 +43,6 @@ def _quote_arg(arg):
class LVMShellProxy(object):
- @staticmethod
- def _read(stream):
- tmp = stream.read()
- if tmp:
- return tmp.decode("utf-8")
- return ''
-
# Read until we get prompt back and a result
# @param: no_output Caller expects no output to report FD
# Returns stdout, report, stderr (report is JSON!)
@@ -75,11 +68,11 @@ class LVMShellProxy(object):
for r in ready[0]:
if r == self.lvm_shell.stdout.fileno():
- stdout += LVMShellProxy._read(self.lvm_shell.stdout)
+ stdout += read_decoded(self.lvm_shell.stdout)
elif r == self.report_stream.fileno():
- report += LVMShellProxy._read(self.report_stream)
+ report += read_decoded(self.report_stream)
elif r == self.lvm_shell.stderr.fileno():
- stderr += LVMShellProxy._read(self.lvm_shell.stderr)
+ stderr += read_decoded(self.lvm_shell.stderr)
# Check to see if the lvm process died on us
if self.lvm_shell.poll():
@@ -124,11 +117,6 @@ class LVMShellProxy(object):
assert (num_written == len(cmd_bytes))
self.lvm_shell.stdin.flush()
- @staticmethod
- def _make_non_block(stream):
- flags = fcntl(stream, F_GETFL)
- fcntl(stream, F_SETFL, flags | os.O_NONBLOCK)
-
def __init__(self):
# Create a temp directory
@@ -162,8 +150,8 @@ class LVMShellProxy(object):
stderr=subprocess.PIPE, close_fds=True, shell=True)
try:
- LVMShellProxy._make_non_block(self.lvm_shell.stdout)
- LVMShellProxy._make_non_block(self.lvm_shell.stderr)
+ make_non_block(self.lvm_shell.stdout)
+ make_non_block(self.lvm_shell.stderr)
# wait for the first prompt
errors = self._read_until_prompt(no_output=True)[2]
diff --git a/daemons/lvmdbusd/utils.py b/daemons/lvmdbusd/utils.py
index 66dfbd691..cc221fc2d 100644
--- a/daemons/lvmdbusd/utils.py
+++ b/daemons/lvmdbusd/utils.py
@@ -14,6 +14,7 @@ import ctypes
import os
import string
import datetime
+from fcntl import fcntl, F_GETFL, F_SETFL
import dbus
from lvmdbusd import cfg
@@ -681,3 +682,16 @@ def _remove_objects(dbus_objects_rm):
# Remove dbus objects from main thread
def mt_remove_dbus_objects(objs):
MThreadRunner(_remove_objects, objs).done()
+
+
+# Make stream non-blocking
+def make_non_block(stream):
+ flags = fcntl(stream, F_GETFL)
+ fcntl(stream, F_SETFL, flags | os.O_NONBLOCK)
+
+
+def read_decoded(stream):
+ tmp = stream.read()
+ if tmp:
+ return tmp.decode("utf-8")
+ return ''
2 years, 10 months
main - coverity cleanups
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=71cb54d92f96b8da318...
Commit: 71cb54d92f96b8da318c8f8380e7ce0bdf0a11bf
Parent: f70d97b91620bc7c2e5c5ccc39913c54379322c2
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 16 13:22:54 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 16 13:42:51 2021 -0500
coverity cleanups
---
lib/cache/lvmcache.c | 5 +++++
lib/device/device_id.c | 1 +
tools/pvck.c | 5 +++--
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/lib/cache/lvmcache.c b/lib/cache/lvmcache.c
index 017134d7d..a798f5ab8 100644
--- a/lib/cache/lvmcache.c
+++ b/lib/cache/lvmcache.c
@@ -854,6 +854,11 @@ next:
dev_name(dev1), has_lv1 ? "is used for" : "is not used for",
dev_name(dev2), has_lv2 ? "is used for" : "is not used for");
+ free((void *)idname1);
+ free((void *)idname2);
+ idname1 = NULL;
+ idname2 = NULL;
+
change = 0;
if (prev_unchosen1 && !prev_unchosen2) {
diff --git a/lib/device/device_id.c b/lib/device/device_id.c
index f158e4f06..65912b9b6 100644
--- a/lib/device/device_id.c
+++ b/lib/device/device_id.c
@@ -1132,6 +1132,7 @@ id_done:
if (yes_no_prompt("Add device with duplicate PV to devices file?") == 'n') {
log_print("Device not added.");
+ free((void *)check_idname);
return 1;
}
}
diff --git a/tools/pvck.c b/tools/pvck.c
index aba6a9cc8..4e8814737 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -3053,7 +3053,7 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
}
}
- if (arg_is_set(cmd, dump_ARG)) {
+ if ((dump = arg_str_value(cmd, dump_ARG, NULL))) {
struct stat sb;
pv_name = argv[0];
@@ -3121,7 +3121,7 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
}
}
- if ((dump = arg_str_value(cmd, dump_ARG, NULL))) {
+ if (dump) {
cmd->use_hints = 0;
if (!strcmp(dump, "metadata"))
@@ -3145,6 +3145,7 @@ int pvck(struct cmd_context *cmd, int argc, char **argv)
} else
log_error("Unknown dump value.");
+ free(def);
if (!ret)
return ECMD_FAILED;
return ECMD_PROCESSED;
2 years, 10 months
main - lvmdbusd: Defer dbus object removal
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f70d97b91620bc7c2e5...
Commit: f70d97b91620bc7c2e5c5ccc39913c54379322c2
Parent: e8f3a63000e692b00070b337e475fd4a38e1f1c9
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Jun 10 13:38:38 2021 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Jun 16 12:19:02 2021 -0500
lvmdbusd: Defer dbus object removal
When we are walking the new lvm state comparing it to the old state we can
run into an issue where we remove a VG that is no longer present from the
object manager, but is still needed by LVs that are left to be processed.
When we try to process existing LVs to see if their state needs to be
updated, or if they need to be removed, we need to be able to reference the
VG that was associated with it. However, if it's been removed from the
object manager we fail to find it which results in:
Traceback (most recent call last):
File "/usr/lib/python3.6/site-packages/lvmdbusd/utils.py", line 666, in _run
self.rc = self.f(*self.args)
File "/usr/lib/python3.6/site-packages/lvmdbusd/fetch.py", line 36, in _main_thread_load
cache_refresh=False)[1]
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 146, in load_lvs
lv_name, object_path, refresh, emit_signal, cache_refresh)
File "/usr/lib/python3.6/site-packages/lvmdbusd/loader.py", line 68, in common
num_changes += dbus_object.refresh(object_state=o)
File "/usr/lib/python3.6/site-packages/lvmdbusd/automatedproperties.py", line 160, in refresh
search = self.lvm_id
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 483, in lvm_id
return self.state.lvm_id
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 173, in lvm_id
return "%s/%s" % (self.vg_name_lookup(), self.Name)
File "/usr/lib/python3.6/site-packages/lvmdbusd/lv.py", line 169, in vg_name_lookup
return cfg.om.get_object_by_path(self.Vg).Name
Instead of removing objects from the object manager immediately, we will
keep them in a list and remove them once we have processed all of the state.
Ref:
https://bugzilla.redhat.com/show_bug.cgi?id=1968752
---
daemons/lvmdbusd/fetch.py | 37 +++++++++++++++++++++++++++++--------
daemons/lvmdbusd/loader.py | 7 +++----
2 files changed, 32 insertions(+), 12 deletions(-)
diff --git a/daemons/lvmdbusd/fetch.py b/daemons/lvmdbusd/fetch.py
index b7eb8c83a..c17827b5a 100644
--- a/daemons/lvmdbusd/fetch.py
+++ b/daemons/lvmdbusd/fetch.py
@@ -20,22 +20,30 @@ import traceback
def _main_thread_load(refresh=True, emit_signal=True):
num_total_changes = 0
+ to_remove = []
- num_total_changes += load_pvs(
+ (changes, remove) = load_pvs(
refresh=refresh,
emit_signal=emit_signal,
- cache_refresh=False)[1]
- num_total_changes += load_vgs(
+ cache_refresh=False)[1:]
+ num_total_changes += changes
+ to_remove.extend(remove)
+
+ (changes, remove) = load_vgs(
refresh=refresh,
emit_signal=emit_signal,
- cache_refresh=False)[1]
+ cache_refresh=False)[1:]
+
+ num_total_changes += changes
+ to_remove.extend(remove)
- lv_changes = load_lvs(
+ (lv_changes, remove) = load_lvs(
refresh=refresh,
emit_signal=emit_signal,
- cache_refresh=False)[1]
+ cache_refresh=False)[1:]
num_total_changes += lv_changes
+ to_remove.extend(remove)
# When the LVs change it can cause another change in the VGs which is
# missed if we don't scan through the VGs again. We could achieve this
@@ -44,10 +52,23 @@ def _main_thread_load(refresh=True, emit_signal=True):
# changes causing the dbus object representing it to be removed and
# recreated.
if refresh and lv_changes > 0:
- num_total_changes += load_vgs(
+ (changes, remove) = load_vgs(
refresh=refresh,
emit_signal=emit_signal,
- cache_refresh=False)[1]
+ cache_refresh=False)[1:]
+
+ num_total_changes += changes
+ to_remove.extend(remove)
+
+ # Remove any objects that are no longer needed. We do this after we process
+ # all the objects to ensure that references still exist for objects that
+ # are processed after them.
+ to_remove.reverse()
+ for i in to_remove:
+ dbus_obj = cfg.om.get_object_by_path(i)
+ if dbus_obj:
+ cfg.om.remove_object(dbus_obj, True)
+ num_total_changes += 1
return num_total_changes
diff --git a/daemons/lvmdbusd/loader.py b/daemons/lvmdbusd/loader.py
index f0462ef2d..101502add 100644
--- a/daemons/lvmdbusd/loader.py
+++ b/daemons/lvmdbusd/loader.py
@@ -75,11 +75,10 @@ def common(retrieve, o_type, search_keys,
object_path = None
+ to_remove = []
if refresh:
- for k in list(existing_paths.keys()):
- cfg.om.remove_object(cfg.om.get_object_by_path(k), True)
- num_changes += 1
+ to_remove = list(existing_paths.keys())
num_changes += len(rc)
- return rc, num_changes
+ return rc, num_changes, to_remove
2 years, 10 months
main - lvmdbusd: Don't setup search key unless needed
by Tony Asleson
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e8f3a63000e692b0007...
Commit: e8f3a63000e692b00070b337e475fd4a38e1f1c9
Parent: 27abb03a0d5fb8342741c306b0ce187f41f8e3c1
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Thu Jun 10 13:26:15 2021 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Wed Jun 16 12:19:02 2021 -0500
lvmdbusd: Don't setup search key unless needed
self.lvm_id is a property which actually executes some code which doesn't
need to be executed everytime.
---
daemons/lvmdbusd/automatedproperties.py | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/automatedproperties.py b/daemons/lvmdbusd/automatedproperties.py
index b5919484d..d9f2c5e9f 100644
--- a/daemons/lvmdbusd/automatedproperties.py
+++ b/daemons/lvmdbusd/automatedproperties.py
@@ -157,14 +157,15 @@ class AutomatedProperties(dbus.service.Object):
if not self._ap_search_method:
return 0
- search = self.lvm_id
- if search_key:
- search = search_key
-
# Either we have the new object state or we need to go fetch it
if object_state:
new_state = object_state
else:
+ if search_key:
+ search = search_key
+ else:
+ search = self.lvm_id
+
new_state = self._ap_search_method([search])[0]
assert isinstance(new_state, State)
2 years, 10 months
main - tests: Fix building for IDM program
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=27abb03a0d5fb834274...
Commit: 27abb03a0d5fb8342741c306b0ce187f41f8e3c1
Parent: f25df0386edf6cd80fb577b477069a1705cf4869
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Wed Jun 16 21:44:27 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 16 10:35:12 2021 -0500
tests: Fix building for IDM program
When execute IDM testing, the command reports error:
/usr/bin/install: cannot stat ���lib/idm_inject_failure���: No such file
or directory
Since there have a stale program in my local environment, thus Makefile
always uses the stale program and doesn't report any issue. In the
brand new repository, it doesn't contain an idm_inject_failure program,
and Makefile doesn't build it without specifying the dependency, thus
the test command complaints the file 'idm_inject_failure' is not found.
This patch adds the dependency 'lib/idm_inject_failure' for IDM testing,
so it can firstly build the injection program and dismiss the error.
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/Makefile.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Makefile.in b/test/Makefile.in
index cd134129b..5f35c30b8 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -171,7 +171,7 @@ check_lvmlockd_dlm: .tests-stamp
endif
ifeq ("@BUILD_LVMLOCKD@", "yes")
-check_lvmlockd_idm: .tests-stamp
+check_lvmlockd_idm: .tests-stamp lib/idm_inject_failure
$(INSTALL_PROGRAM) lib/idm_inject_failure $(EXECDIR)
VERBOSE=$(VERBOSE) ./lib/runner \
--testdir . --outdir $(LVM_TEST_RESULTS) \
2 years, 10 months
main - tests: stress: Change to use $SHARED for vgcreate
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f25df0386edf6cd80fb...
Commit: f25df0386edf6cd80fb577b477069a1705cf4869
Parent: e5740e9646d08eb9804a40bf195cefa46e8006e2
Author: Leo Yan <leo.yan(a)linaro.org>
AuthorDate: Wed Jun 16 21:43:54 2021 +0800
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 16 10:35:12 2021 -0500
tests: stress: Change to use $SHARED for vgcreate
Use the variable $SHARED to replace "--shared" for vgcreate commands.
Signed-off-by: Leo Yan <leo.yan(a)linaro.org>
---
test/shell/stress_multi_threads_1.sh | 4 ++--
test/shell/stress_multi_threads_2.sh | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/shell/stress_multi_threads_1.sh b/test/shell/stress_multi_threads_1.sh
index e76810bbb..c5695eb0b 100644
--- a/test/shell/stress_multi_threads_1.sh
+++ b/test/shell/stress_multi_threads_1.sh
@@ -22,8 +22,8 @@ get_devs
pvcreate -M2 "${DEVICES[@]}"
-vgcreate --shared -M2 "$vg1" "$dev1" "$dev2" "$dev3"
-vgcreate --shared -M2 "$vg2" "$dev4" "$dev5" "$dev6"
+vgcreate $SHARED -M2 "$vg1" "$dev1" "$dev2" "$dev3"
+vgcreate $SHARED -M2 "$vg2" "$dev4" "$dev5" "$dev6"
test_vg_thread1()
{
diff --git a/test/shell/stress_multi_threads_2.sh b/test/shell/stress_multi_threads_2.sh
index 4e72b7447..9b586a263 100644
--- a/test/shell/stress_multi_threads_2.sh
+++ b/test/shell/stress_multi_threads_2.sh
@@ -26,14 +26,14 @@ test_vg_thread1()
{
for i in {1..1000}
do
- vgcreate --shared -M2 "$vg1" "$dev1" "$dev2" "$dev3"
+ vgcreate $SHARED -M2 "$vg1" "$dev1" "$dev2" "$dev3"
vgremove -ff $vg1
done
}
test_vg_thread2()
{
- vgcreate --shared -M2 "$vg2" "$dev4" "$dev5" "$dev6"
+ vgcreate $SHARED -M2 "$vg2" "$dev4" "$dev5" "$dev6"
for i in {1..1000}
do
2 years, 10 months
main - tests: fix skip in stress_single_thread.sh
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=e5740e9646d08eb9804...
Commit: e5740e9646d08eb9804a40bf195cefa46e8006e2
Parent: f8742b6df2a34df1867c7da6b1a057d2d23a7a37
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Wed Jun 16 09:37:04 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Wed Jun 16 09:37:04 2021 -0500
tests: fix skip in stress_single_thread.sh
---
test/shell/stress_single_thread.sh | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/test/shell/stress_single_thread.sh b/test/shell/stress_single_thread.sh
index ed9ce13c5..7982e9dad 100644
--- a/test/shell/stress_single_thread.sh
+++ b/test/shell/stress_single_thread.sh
@@ -13,10 +13,10 @@
SKIP_WITH_LVMPOLLD=1
-[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
-
. lib/inittest
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+
aux prepare_vg 3
for i in {1..1000}
2 years, 10 months
main - tests: add some LVM_TEST_LOCK_TYPE_IDM
by David Teigland
Gitweb: https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f8742b6df2a34df1867...
Commit: f8742b6df2a34df1867c7da6b1a057d2d23a7a37
Parent: 440d6ae79fb4df92c7992d3c1689ba4f2d242d6a
Author: David Teigland <teigland(a)redhat.com>
AuthorDate: Tue Jun 15 14:02:18 2021 -0500
Committer: David Teigland <teigland(a)redhat.com>
CommitterDate: Tue Jun 15 14:02:45 2021 -0500
tests: add some LVM_TEST_LOCK_TYPE_IDM
---
test/shell/stress_multi_threads_1.sh | 2 ++
test/shell/stress_multi_threads_2.sh | 2 ++
test/shell/stress_single_thread.sh | 2 ++
3 files changed, 6 insertions(+)
diff --git a/test/shell/stress_multi_threads_1.sh b/test/shell/stress_multi_threads_1.sh
index c96fa244b..e76810bbb 100644
--- a/test/shell/stress_multi_threads_1.sh
+++ b/test/shell/stress_multi_threads_1.sh
@@ -15,6 +15,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+
aux prepare_devs 6
get_devs
diff --git a/test/shell/stress_multi_threads_2.sh b/test/shell/stress_multi_threads_2.sh
index a035b5727..4e72b7447 100644
--- a/test/shell/stress_multi_threads_2.sh
+++ b/test/shell/stress_multi_threads_2.sh
@@ -15,6 +15,8 @@ SKIP_WITH_LVMPOLLD=1
. lib/inittest
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+
aux prepare_devs 8
get_devs
diff --git a/test/shell/stress_single_thread.sh b/test/shell/stress_single_thread.sh
index e18d4900b..ed9ce13c5 100644
--- a/test/shell/stress_single_thread.sh
+++ b/test/shell/stress_single_thread.sh
@@ -13,6 +13,8 @@
SKIP_WITH_LVMPOLLD=1
+[ -z "$LVM_TEST_LOCK_TYPE_IDM" ] && skip;
+
. lib/inittest
aux prepare_vg 3
2 years, 10 months