master - tests: skip test for older cache target
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=3a4267ade462e9...
Commit: 3a4267ade462e9066fbe70076da0eff679b3cdb6
Parent: b26604c8d84a189fc3ee276d6e8711a49eecd831
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Tue Aug 30 13:28:36 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 31 11:13:59 2016 +0200
tests: skip test for older cache target
Some test on older can targets are not going to work, and
since there is no other fix then using newer kernel - skip
such tests completely.
---
test/shell/lvconvert-cache-chunks.sh | 16 +++++++++++-----
1 files changed, 11 insertions(+), 5 deletions(-)
diff --git a/test/shell/lvconvert-cache-chunks.sh b/test/shell/lvconvert-cache-chunks.sh
index 806db0f..4631e0e 100644
--- a/test/shell/lvconvert-cache-chunks.sh
+++ b/test/shell/lvconvert-cache-chunks.sh
@@ -10,6 +10,7 @@
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
# Exercise number of cache chunks in cache pool
+# Skips creation of real cached device for older cache targets...
SKIP_WITH_LVMLOCKD=1
SKIP_WITH_LVMPOLLD=1
@@ -34,8 +35,11 @@ lvcreate -L1M -n $lv1 $vg
# Not let pass small chunks when caching origin
fail lvconvert -H --chunksize 128K --cachepool $vg/cpool $vg/$lv1
-# Though 2M is valid
-lvconvert -y -H --chunksize 2M --cachepool $vg/cpool $vg/$lv1
+# Thought 2M is valid
+if aux have_cache 1 8 0 ; then
+ # Without SMQ we run out of kernel memory easily
+ lvconvert -y -H --chunksize 2M --cachepool $vg/cpool $vg/$lv1
+fi
lvremove -f $vg
@@ -46,8 +50,10 @@ lvcreate -L1T -n cpool $vg
# Not allowed to create more then 10e6 chunks
fail lvconvert -y --type cache-pool --chunksize 128K $vg/cpool
-# Let operation pass when max_chunk limit is raised
-lvconvert -y --type cache-pool --chunksize 128K $vg/cpool \
- --config 'allocation/cache_pool_max_chunks=10000000'
+if aux have_cache 1 8 0 ; then
+ # Let operation pass when max_chunk limit is raised
+ lvconvert -y --type cache-pool --chunksize 128K $vg/cpool \
+ --config 'allocation/cache_pool_max_chunks=10000000'
+fi
vgremove -f $vg
7 years, 3 months
master - dmeventd: typo and debug name fix
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=b26604c8d84a18...
Commit: b26604c8d84a189fc3ee276d6e8711a49eecd831
Parent: 16ed726610eca266bc6ef03989a156862ebf3d7a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Aug 31 11:05:39 2016 +0200
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Aug 31 11:13:59 2016 +0200
dmeventd: typo and debug name fix
Fix 'raw' -> 'row' fix.
Consitently use thin pool as a type of monitored device in info message.
---
daemons/dmeventd/plugins/thin/dmeventd_thin.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/daemons/dmeventd/plugins/thin/dmeventd_thin.c b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
index 622910f..d5a3a59 100644
--- a/daemons/dmeventd/plugins/thin/dmeventd_thin.c
+++ b/daemons/dmeventd/plugins/thin/dmeventd_thin.c
@@ -251,7 +251,7 @@ static int _umount_device(char *buffer, unsigned major, unsigned minor,
if ((major == data->info.major) && dm_bit(data->minors, minor)) {
if (dm_split_words(buffer, DM_ARRAY_SIZE(words), 0, words) < DM_ARRAY_SIZE(words))
words[9] = NULL; /* just don't show device name */
- log_info("Unmounting thin %s (%d:%d) of thin-pool %s (%u:%u) from mount point \"%s\".",
+ log_info("Unmounting thin %s (%d:%d) of thin pool %s (%u:%u) from mount point \"%s\".",
words[9] ? : "", major, minor, data->device,
data->info.major, data->info.minor,
target);
@@ -429,7 +429,7 @@ out:
if (state->fails >= MAX_FAILS) {
log_warn("WARNING: Dropping monitoring of %s. "
- "lvm2 command fails too often (%u times in raw).",
+ "lvm2 command fails too often (%u times in row).",
device, state->fails);
pthread_kill(pthread_self(), SIGALRM);
}
@@ -458,11 +458,11 @@ int register_device(const char *device,
state->data_percent_check = CHECK_MINIMUM;
*user = state;
- log_info("Monitoring thin %s.", device);
+ log_info("Monitoring thin pool %s.", device);
return 1;
bad:
- log_error("Failed to monitor thin %s.", device);
+ log_error("Failed to monitor thin pool %s.", device);
return 0;
}
@@ -476,7 +476,7 @@ int unregister_device(const char *device,
struct dso_state *state = *user;
dmeventd_lvm2_exit_with_pool(state);
- log_info("No longer monitoring thin %s.", device);
+ log_info("No longer monitoring thin pool %s.", device);
return 1;
}
7 years, 3 months
master - lvmdump: use lsblk -s and lsblk -O in lvmdump only if these options are supported
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=16ed726610eca2...
Commit: 16ed726610eca266bc6ef03989a156862ebf3d7a
Parent: 52d1ddd601d278821d69aa35914e0db18f018749
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Tue Aug 30 15:33:50 2016 +0200
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Tue Aug 30 15:38:34 2016 +0200
lvmdump: use lsblk -s and lsblk -O in lvmdump only if these options are supported
The lsblk is just a nice helper here - it's not crucial for lvmdump so
do best effort here and use the most we can from current version of
lsblk that is installed on system. The lsblk -s option was added a bit
later after lsblk introduction and lsblk -O support even more later -
so if these are not available, use only pure lsblk output without any
extras.
---
WHATS_NEW | 1 +
scripts/lvmdump.sh | 13 ++++++++++---
2 files changed, 11 insertions(+), 3 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index ad3d174..3f7eaf1 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.165 -
===================================
+ Use lsblk -s and lsblk -O in lvmdump only if these options are supported.
Fix number of stripes shown in lvcreate raid10 message when too many.
Do not monitor cache-pool metadata when LV is just being cleared.
Add allocation/cache_pool_max_chunks to prevent misuse of cache target.
diff --git a/scripts/lvmdump.sh b/scripts/lvmdump.sh
index d13a69b..85f8e5c 100755
--- a/scripts/lvmdump.sh
+++ b/scripts/lvmdump.sh
@@ -28,6 +28,7 @@ PS=ps # need alx
SED=sed
DD=dd
CUT=cut
+GREP=grep
DATE=date
BASENAME=basename
UDEVADM=udevadm
@@ -259,8 +260,14 @@ if (( $sysreport )); then
if test -z "LSBLK"; then
myecho "WARNING: lsblk not found"
else
- log "$LSBLK -O >> \"$sysreport_dir/lsblk\""
- log "$LSBLK -s >> \"$sysreport_dir/lsblk_s\""
+ if $LSBLK --help | $GREP -- --output-all >/dev/null; then
+ log "$LSBLK -O >> \"$sysreport_dir/lsblk_O\""
+ else
+ log "$LSBLK >> \"$sysreport_dir/lsblk\""
+ fi
+ if $LSBLK --help | $GREP -- --inverse >/dev/null; then
+ log "$LSBLK -s >> \"$sysreport_dir/lsblk_s\""
+ fi
fi
if test -z "$SYSTEMCTL"; then
@@ -281,7 +288,7 @@ if (( $sysreport )); then
lvm2-activation-net.service \
> \"$sysreport_dir/systemd_lvm2_services_status\" 2>> \"$log\""
log "$SYSTEMCTL list-units -l -a --no-legend --no-pager > \"$sysreport_dir/systemd_unit_list\" 2>> \"$log\""
- for unit in $(cat $sysreport_dir/systemd_unit_list | grep lvm2-pvscan | cut -d " " -f 1); do
+ for unit in $(cat $sysreport_dir/systemd_unit_list | $GREP lvm2-pvscan | cut -d " " -f 1); do
log "$SYSTEMCTL status -l --no-pager -n $log_lines -o short-precise $unit >> \"$sysreport_dir/systemd_lvm2_pvscan_service_status\""
done
fi
7 years, 3 months
master - config: regenerate
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=52d1ddd601d278...
Commit: 52d1ddd601d278821d69aa35914e0db18f018749
Parent: be85c22f6591435f27380e944f4770612b3b6d3c
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 30 13:23:39 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 30 13:23:39 2016 +0100
config: regenerate
---
conf/example.conf.in | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/conf/example.conf.in b/conf/example.conf.in
index b98a19f..b1a2a9c 100644
--- a/conf/example.conf.in
+++ b/conf/example.conf.in
@@ -428,6 +428,12 @@ allocation {
# 32KiB to 1GiB in multiples of 32.
# This configuration option does not have a default value defined.
+ # Configuration option allocation/cache_pool_max_chunks.
+ # The maximum number of chunks in a cache pool.
+ # For cache target v1.9 the recommended maximumm is 1000000 chunks.
+ # Using cache pool with more chunks may degrade cache performance.
+ # This configuration option does not have a default value defined.
+
# Configuration option allocation/thin_pool_metadata_require_separate_pvs.
# Thin pool metdata and data will always use different PVs.
thin_pool_metadata_require_separate_pvs = 0
@@ -1684,11 +1690,11 @@ activation {
# This configuration option has an automatic default value.
# quoted = 1
- # Configuration option report/colums_as_rows.
+ # Configuration option report/columns_as_rows.
# Output each column as a row.
# If set, this also implies report/prefixes=1.
# This configuration option has an automatic default value.
- # colums_as_rows = 0
+ # columns_as_rows = 0
# Configuration option report/binary_values_as_numeric.
# Use binary values 0 or 1 instead of descriptive literal values.
7 years, 3 months
master - raid10: Fix #stripes in lvcreate msg when too many.
by Alasdair Kergon
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=be85c22f659143...
Commit: be85c22f6591435f27380e944f4770612b3b6d3c
Parent: 7412690dd2ca55d0a790ba50a3425565758130ce
Author: Alasdair G Kergon <agk(a)redhat.com>
AuthorDate: Tue Aug 30 12:04:23 2016 +0100
Committer: Alasdair G Kergon <agk(a)redhat.com>
CommitterDate: Tue Aug 30 12:04:23 2016 +0100
raid10: Fix #stripes in lvcreate msg when too many.
---
WHATS_NEW | 1 +
tools/lvcreate.c | 2 +-
2 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/WHATS_NEW b/WHATS_NEW
index 6980e17..ad3d174 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.165 -
===================================
+ Fix number of stripes shown in lvcreate raid10 message when too many.
Do not monitor cache-pool metadata when LV is just being cleared.
Add allocation/cache_pool_max_chunks to prevent misuse of cache target.
Give error not segfault in lvconvert --splitmirrors when PV lies outside LV.
diff --git a/tools/lvcreate.c b/tools/lvcreate.c
index 33664c5..387c8d4 100644
--- a/tools/lvcreate.c
+++ b/tools/lvcreate.c
@@ -591,7 +591,7 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,
/* FIMXE: raid10 check has to change once we support data copies and odd numbers of stripes */
if (seg_is_raid10(lp) && lp->mirrors * lp->stripes > max_images) {
log_error("Only up to %u stripes in %s supported currently.",
- max_images, lp->segtype->name);
+ max_images / lp->mirrors, lp->segtype->name);
return 0;
} else if (seg_is_mirrored(lp)) {
if (lp->mirrors > max_images) {
7 years, 3 months
master - lvmdbusd: Prefix tag string with '@'
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7412690dd2ca55...
Commit: 7412690dd2ca55d0a790ba50a3425565758130ce
Parent: 257ce5733e386dbf3b270ca0efffe744f8d888c5
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Aug 29 18:00:21 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Aug 29 18:00:21 2016 -0500
lvmdbusd: Prefix tag string with '@'
---
daemons/lvmdbusd/cmdhandler.py | 5 +----
1 files changed, 1 insertions(+), 4 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 2739497..c8c7baa 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -235,10 +235,7 @@ def pv_remove(device, remove_options):
def _qt(tag_name):
- # When running in lvm shell you need to quote the tags
- if cfg.SHELL_IN_USE:
- return '"%s"' % tag_name
- return tag_name
+ return '@%s' % tag_name
def _tag(operation, what, add, rm, tag_options):
7 years, 3 months
master - lvmdbustest.py: Add tag regression test
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=257ce5733e386d...
Commit: 257ce5733e386dbf3b270ca0efffe744f8d888c5
Parent: 5392a612dc722fa9ca20959f362cd8c130b5ab48
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Aug 29 17:59:42 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Aug 29 17:59:42 2016 -0500
lvmdbustest.py: Add tag regression test
Add '-' back in as acceptable tag character
---
test/dbus/lvmdbustest.py | 23 ++++++++++++++++++-----
1 files changed, 18 insertions(+), 5 deletions(-)
diff --git a/test/dbus/lvmdbustest.py b/test/dbus/lvmdbustest.py
index 4327a96..ea3f220 100755
--- a/test/dbus/lvmdbustest.py
+++ b/test/dbus/lvmdbustest.py
@@ -1107,13 +1107,10 @@ class TestDbusService(unittest.TestCase):
vg_proxy.Vg.LvCreateLinear(r + rs(8, '_lv'),
mib(4), False, -1, {})
- # Wait until BZ https://bugzilla.redhat.com/show_bug.cgi?id=1370002
- # is corrected before we add '-' in the allowable character set
- #_ALLOWABLE_TAG_CH = string.ascii_letters + string.digits + "._-+/=!:&#"
- _ALLOWABLE_TAG_CH = string.ascii_letters + string.digits + "._+/=!:&#"
+ _ALLOWABLE_TAG_CH = string.ascii_letters + string.digits + "._-+/=!:&#"
def _invalid_tag_characters(self):
- bad_tag_ch_set = set(string.printable) - set(self._ALLOWABLE_TAG_CH + '-')
+ bad_tag_ch_set = set(string.printable) - set(self._ALLOWABLE_TAG_CH)
return ''.join(bad_tag_ch_set)
def test_invalid_tags(self):
@@ -1150,6 +1147,22 @@ class TestDbusService(unittest.TestCase):
self.assertEqual(i, len(vg_proxy.Vg.Tags), "%d != %d" %
(i, len(vg_proxy.Vg.Tags)))
+ def test_tag_regression(self):
+ mgr = self.objs[MANAGER_INT][0].Manager
+ pv_paths = [self.objs[PV_INT][0].object_path]
+
+ vg_path = mgr.VgCreate("test", pv_paths, -1, {})[0]
+ vg_proxy = ClientProxy(self.bus, vg_path)
+
+ tag = '--h/K.6g0A4FOEatf3+k_nI/Yp&L_u2oy-=j649x:+dUcYWPEo6.IWT0c'
+
+ r = vg_proxy.Vg.TagsAdd([tag], -1, {})
+ self.assertTrue(r == '/')
+ vg_proxy.update()
+
+ self.assertTrue(tag in vg_proxy.Vg.Tags, "%s not in %s" %
+ (tag, str(vg_proxy.Vg.Tags)))
+
if __name__ == '__main__':
# Test forking & exec new each time
7 years, 3 months
master - lvmdbusd: WS/pep8 corrections
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5392a612dc722f...
Commit: 5392a612dc722fa9ca20959f362cd8c130b5ab48
Parent: 1870b3293a26f6d946e8451a10e8c9762ae9f31c
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Aug 29 15:07:55 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Aug 29 15:28:06 2016 -0500
lvmdbusd: WS/pep8 corrections
---
daemons/lvmdbusd/background.py | 10 +++++-----
daemons/lvmdbusd/cmdhandler.py | 1 +
daemons/lvmdbusd/lv.py | 12 ++++++------
daemons/lvmdbusd/lvm_shell_proxy.py | 3 +--
daemons/lvmdbusd/main.py | 32 ++++++++++++++++++--------------
daemons/lvmdbusd/manager.py | 1 +
daemons/lvmdbusd/objectmanager.py | 2 +-
7 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/daemons/lvmdbusd/background.py b/daemons/lvmdbusd/background.py
index 0c0b509..6190f0d 100644
--- a/daemons/lvmdbusd/background.py
+++ b/daemons/lvmdbusd/background.py
@@ -135,11 +135,11 @@ def background_execute(command, background_job):
# the command always!
command.insert(0, cfg.LVM_CMD)
process = subprocess.Popen(command, stdout=subprocess.PIPE,
- env=os.environ,
+ env=os.environ,
stderr=subprocess.PIPE, close_fds=True)
log_debug("Background process for %s is %d" %
- (str(command), process.pid))
+ (str(command), process.pid))
lines_iterator = iter(process.stdout.readline, b"")
for line in lines_iterator:
@@ -149,8 +149,8 @@ def background_execute(command, background_job):
try:
if line_str.count(':') == 2:
(device, ignore, percentage) = line_str.split(':')
- background_job.Percent = \
- round(float(percentage.strip()[:-1]), 1)
+ background_job.Percent = round(
+ float(percentage.strip()[:-1]), 1)
except ValueError:
log_error("Trying to parse percentage which failed for %s" %
line_str)
@@ -161,7 +161,7 @@ def background_execute(command, background_job):
background_job.Percent = 100
else:
log_error("Failed to execute background job %s, STDERR= %s"
- % (str(command), out[1]))
+ % (str(command), out[1]))
background_job.set_result(process.returncode, out[1])
log_debug("Background process %d complete!" % process.pid)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 9b0c877..2739497 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -120,6 +120,7 @@ def call_lvm(command, debug=False):
# from forking a new process to using lvm shell
_t_call = call_lvm
+
def _shell_cfg():
global _t_call
try:
diff --git a/daemons/lvmdbusd/lv.py b/daemons/lvmdbusd/lv.py
index 3d0b78c..4ec6f23 100644
--- a/daemons/lvmdbusd/lv.py
+++ b/daemons/lvmdbusd/lv.py
@@ -260,7 +260,7 @@ class LvCommon(AutomatedProperties):
'e': 'raid or pool metadata or pool metadata spare',
'-': 'Unspecified'}
return dbus.Struct((self.state.Attr[0], type_map[self.state.Attr[0]]),
- signature="as")
+ signature="as")
@property
def Permissions(self):
@@ -268,7 +268,7 @@ class LvCommon(AutomatedProperties):
'R': 'Read-only activation of non-read-only volume',
'-': 'Unspecified'}
return dbus.Struct((self.state.Attr[1], type_map[self.state.Attr[1]]),
- signature="(ss)")
+ signature="(ss)")
@property
def AllocationPolicy(self):
@@ -278,7 +278,7 @@ class LvCommon(AutomatedProperties):
'l': 'cling', 'L': 'cling locked',
'n': 'normal', 'N': 'normal locked', '-': 'Unspecified'}
return dbus.Struct((self.state.Attr[2], type_map[self.state.Attr[2]]),
- signature="(ss)")
+ signature="(ss)")
@property
def FixedMinor(self):
@@ -294,7 +294,7 @@ class LvCommon(AutomatedProperties):
'i': 'mapped device present with inactive table',
'X': 'unknown', '-': 'Unspecified'}
return dbus.Struct((self.state.Attr[4], type_map[self.state.Attr[4]]),
- signature="(ss)")
+ signature="(ss)")
@property
def TargetType(self):
@@ -302,7 +302,7 @@ class LvCommon(AutomatedProperties):
's': 'snapshot', 't': 'thin', 'u': 'unknown',
'v': 'virtual', '-': 'Unspecified'}
return dbus.Struct((self.state.Attr[6], type_map[self.state.Attr[6]]),
- signature="(ss)")
+ signature="(ss)")
@property
def ZeroBlocks(self):
@@ -314,7 +314,7 @@ class LvCommon(AutomatedProperties):
'm': 'mismatches', 'w': 'writemostly',
'X': 'X unknown', '-': 'Unspecified'}
return dbus.Struct((self.state.Attr[8], type_map[self.state.Attr[8]]),
- signature="(ss)")
+ signature="(ss)")
@property
def SkipActivation(self):
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py b/daemons/lvmdbusd/lvm_shell_proxy.py
index 910ac2c..12e7e36 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py
@@ -115,7 +115,6 @@ class LVMShellProxy(object):
local_env["LVM_REPORT_FD"] = "32"
local_env["LVM_COMMAND_PROFILE"] = "lvmdbusd"
-
flags = fcntl(self.report_r, F_GETFL)
fcntl(self.report_r, F_SETFL, flags | os.O_NONBLOCK)
@@ -223,7 +222,7 @@ if __name__ == "__main__":
end = time.time()
print(("RC: %d" % ret))
- #print(("OUT:\n%s" % out))
+ # print(("OUT:\n%s" % out))
print(("ERR:\n%s" % err))
print("Command = %f seconds" % (end - start))
diff --git a/daemons/lvmdbusd/main.py b/daemons/lvmdbusd/main.py
index 5cf522d..65a66db 100644
--- a/daemons/lvmdbusd/main.py
+++ b/daemons/lvmdbusd/main.py
@@ -96,20 +96,24 @@ def main():
start = time.time()
# Add simple command line handling
parser = argparse.ArgumentParser()
- parser.add_argument("--udev", action='store_true',
- help="Use udev for updating state", default=False,
- dest='use_udev')
- parser.add_argument("--debug", action='store_true',
- help="Dump debug messages", default=False,
- dest='debug')
- parser.add_argument("--nojson", action='store_false',
- help="Do not use LVM JSON output (Note: This "
- "does not work with --lvmshell", default=True,
- dest='use_json')
- parser.add_argument("--lvmshell", action='store_true',
- help="Use the lvm shell, not fork & exec lvm",
- default=False,
- dest='use_lvm_shell')
+ parser.add_argument(
+ "--udev", action='store_true',
+ help="Use udev for updating state",
+ default=False,
+ dest='use_udev')
+ parser.add_argument(
+ "--debug", action='store_true',
+ help="Dump debug messages", default=False,
+ dest='debug')
+ parser.add_argument(
+ "--nojson", action='store_false',
+ help="Do not use LVM JSON output (disables lvmshell)", default=True,
+ dest='use_json')
+ parser.add_argument(
+ "--lvmshell", action='store_true',
+ help="Use the lvm shell, not fork & exec lvm",
+ default=False,
+ dest='use_lvm_shell')
use_session = os.getenv('LVMDBUSD_USE_SESSION', False)
diff --git a/daemons/lvmdbusd/manager.py b/daemons/lvmdbusd/manager.py
index b141929..b7d7b10 100644
--- a/daemons/lvmdbusd/manager.py
+++ b/daemons/lvmdbusd/manager.py
@@ -19,6 +19,7 @@ from .request import RequestEntry
from .refresh import event_add
from . import udevwatch
+
# noinspection PyPep8Naming
class Manager(AutomatedProperties):
_Version_meta = ("s", MANAGER_INTERFACE)
diff --git a/daemons/lvmdbusd/objectmanager.py b/daemons/lvmdbusd/objectmanager.py
index 178003e..0b810d8 100644
--- a/daemons/lvmdbusd/objectmanager.py
+++ b/daemons/lvmdbusd/objectmanager.py
@@ -125,7 +125,7 @@ class ObjectManager(AutomatedProperties):
path, props = dbus_object.emit_data()
# print('Registering object path %s for %s' %
- # (path, dbus_object.lvm_id))
+ # (path, dbus_object.lvm_id))
# We want fast access to the object by a number of different ways
# so we use multiple hashs with different keys
7 years, 3 months
master - lvmdbusd/lvmdb.py: Make stand alone execution work
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1870b3293a26f6...
Commit: 1870b3293a26f6d946e8451a10e8c9762ae9f31c
Parent: 96a0604bd036d78af964392460d0309456b58b1a
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Aug 29 14:52:41 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Aug 29 15:26:56 2016 -0500
lvmdbusd/lvmdb.py: Make stand alone execution work
This was broken when the args were moved to cfg
---
daemons/lvmdbusd/cmdhandler.py | 10 +++++-----
daemons/lvmdbusd/utils.py | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/daemons/lvmdbusd/cmdhandler.py b/daemons/lvmdbusd/cmdhandler.py
index 877f17c..9b0c877 100644
--- a/daemons/lvmdbusd/cmdhandler.py
+++ b/daemons/lvmdbusd/cmdhandler.py
@@ -38,10 +38,6 @@ total_count = 0
# at the same time.
cmd_lock = threading.RLock()
-# The actual method which gets called to invoke the lvm command, can vary
-# from forking a new process to using lvm shell
-_t_call = None
-
class LvmExecutionMeta(object):
@@ -113,12 +109,16 @@ def call_lvm(command, debug=False):
_debug_c(command, process.returncode, (stdout_text, stderr_text))
if process.returncode == 0:
- if cfg.args.debug and out[1] and len(out[1]) and 'help' not in command:
+ if cfg.args and cfg.args.debug and out[1] and len(out[1]) and \
+ 'help' not in command:
log_error('WARNING: lvm is out-putting text to STDERR on success!')
_debug_c(command, process.returncode, (stdout_text, stderr_text))
return process.returncode, stdout_text, stderr_text
+# The actual method which gets called to invoke the lvm command, can vary
+# from forking a new process to using lvm shell
+_t_call = call_lvm
def _shell_cfg():
global _t_call
diff --git a/daemons/lvmdbusd/utils.py b/daemons/lvmdbusd/utils.py
index 06301cd..7d217df 100644
--- a/daemons/lvmdbusd/utils.py
+++ b/daemons/lvmdbusd/utils.py
@@ -262,7 +262,7 @@ def _common_log(msg, *attributes):
# @param msg Message to output to stdout
# @return None
def log_debug(msg, *attributes):
- if cfg.args.debug:
+ if cfg.args and cfg.args.debug:
_common_log(msg, *attributes)
7 years, 3 months
master - lvmdbusd: Correct imports
by tasleson
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=96a0604bd036d7...
Commit: 96a0604bd036d78af964392460d0309456b58b1a
Parent: 756f51eac8f42c85f091ebbc4dc8bb2f1569a38e
Author: Tony Asleson <tasleson(a)redhat.com>
AuthorDate: Mon Aug 29 14:51:26 2016 -0500
Committer: Tony Asleson <tasleson(a)redhat.com>
CommitterDate: Mon Aug 29 15:26:56 2016 -0500
lvmdbusd: Correct imports
---
daemons/lvmdbusd/cfg.py | 6 ++----
daemons/lvmdbusd/lvm_shell_proxy.py | 9 ++-------
daemons/lvmdbusd/lvmdb.py | 8 ++------
daemons/lvmdbusd/lvmdbusd | 4 ++--
daemons/lvmdbusd/utils.py | 5 +----
5 files changed, 9 insertions(+), 23 deletions(-)
diff --git a/daemons/lvmdbusd/cfg.py b/daemons/lvmdbusd/cfg.py
index 1d773c3..8965ec7 100644
--- a/daemons/lvmdbusd/cfg.py
+++ b/daemons/lvmdbusd/cfg.py
@@ -11,10 +11,8 @@ import os
import multiprocessing
import queue
import itertools
-try:
- from . import path
-except SystemError:
- import path
+
+from lvmdbusd import path
LVM_CMD = os.getenv('LVM_BINARY', path.LVM_BINARY)
diff --git a/daemons/lvmdbusd/lvm_shell_proxy.py b/daemons/lvmdbusd/lvm_shell_proxy.py
index 3455342..910ac2c 100755
--- a/daemons/lvmdbusd/lvm_shell_proxy.py
+++ b/daemons/lvmdbusd/lvm_shell_proxy.py
@@ -23,18 +23,13 @@ import select
import copy
try:
- from simplejson.scanner import JSONDecodeError
import simplejson as json
except ImportError:
import json
-try:
- from .cfg import LVM_CMD
- from .utils import log_debug, log_error
-except:
- from cfg import LVM_CMD
- from utils import log_debug, log_error
+from lvmdbusd.cfg import LVM_CMD
+from lvmdbusd.utils import log_debug, log_error
SHELL_PROMPT = "lvm> "
diff --git a/daemons/lvmdbusd/lvmdb.py b/daemons/lvmdbusd/lvmdb.py
index 187a930..ac60a80 100755
--- a/daemons/lvmdbusd/lvmdb.py
+++ b/daemons/lvmdbusd/lvmdb.py
@@ -15,12 +15,8 @@ import pprint as prettyprint
import os
import sys
-try:
- from . import cmdhandler
- from .utils import log_debug, log_error
-except SystemError:
- import cmdhandler
- from utils import log_debug
+from lvmdbusd import cmdhandler
+from lvmdbusd.utils import log_debug, log_error
class DataStore(object):
diff --git a/daemons/lvmdbusd/lvmdbusd b/daemons/lvmdbusd/lvmdbusd
index 7ea243b..73d0f13 100755
--- a/daemons/lvmdbusd/lvmdbusd
+++ b/daemons/lvmdbusd/lvmdbusd
@@ -10,7 +10,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
-import lvmdbusd
+from lvmdbusd import main
if __name__ == '__main__':
- sys.exit(lvmdbusd.main())
+ sys.exit(main())
diff --git a/daemons/lvmdbusd/utils.py b/daemons/lvmdbusd/utils.py
index c80290f..06301cd 100644
--- a/daemons/lvmdbusd/utils.py
+++ b/daemons/lvmdbusd/utils.py
@@ -18,11 +18,8 @@ import datetime
import dbus
import dbus.service
import dbus.mainloop.glib
+from lvmdbusd import cfg
-try:
- from . import cfg
-except SystemError:
- import cfg
STDOUT_TTY = os.isatty(sys.stdout.fileno())
7 years, 3 months