master - test: Time out the entire testsuite after an hour.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=d52c4154c5e9d3...
Commit: d52c4154c5e9d300cbee96231f0b95fa416453bf
Parent: af8580d756d3d4ed56a00d377fd6bfb18d5bed41
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Mon Dec 16 11:47:09 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Jan 8 17:11:32 2014 +0100
test: Time out the entire testsuite after an hour.
---
test/lib/harness.c | 10 +++++++++-
1 files changed, 9 insertions(+), 1 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index 19859a0..9613543 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -59,6 +59,8 @@ static const char *results;
static unsigned fullbuffer = 0;
static int unlimited = 0;
+static time_t harness_start;
+
static FILE *outfile = NULL;
char testdirdebug[PATH_MAX];
@@ -544,9 +546,15 @@ int main(int argc, char **argv) {
default: signal(i, handler);
}
+ harness_start = time(NULL);
/* run the tests */
- for (i = 1; !die && i < argc; ++i)
+ for (i = 1; !die && i < argc; ++i) {
run(i, argv[i]);
+ if ( time(NULL) - harness_start > 3600 ) {
+ printf("an hour passed, giving up...\n");
+ break;
+ }
+ }
free(subst[0].value);
free(subst[1].value);
10 years, 3 months
master - test: Use klogctl in the harness instead of reading /var/log/messages.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=af8580d756d3d4...
Commit: af8580d756d3d4ed56a00d377fd6bfb18d5bed41
Parent: 1937715d2ccdd46122da862c6d7c1ef0ed7d1230
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Sun Dec 15 21:10:57 2013 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Jan 8 17:11:32 2014 +0100
test: Use klogctl in the harness instead of reading /var/log/messages.
---
test/lib/harness.c | 45 +++++++++++++++++++++++++++------------------
1 files changed, 27 insertions(+), 18 deletions(-)
diff --git a/test/lib/harness.c b/test/lib/harness.c
index f27fbeb..19859a0 100644
--- a/test/lib/harness.c
+++ b/test/lib/harness.c
@@ -25,6 +25,7 @@
#include <sys/time.h>
#include <sys/types.h>
#include <sys/wait.h>
+#include <sys/klog.h>
#include <time.h>
#include <unistd.h>
#include <stdint.h>
@@ -260,6 +261,23 @@ static void drain(int fd, size_t size_limit)
}
}
+#define SYSLOG_ACTION_READ_CLEAR 4
+#define SYSLOG_ACTION_CLEAR 5
+
+static void clear_dmesg(void)
+{
+ klogctl(SYSLOG_ACTION_CLEAR, 0, 0);
+}
+
+static void drain_dmesg(void)
+{
+ char buf[16392 + 1];
+ size_t sz = klogctl(SYSLOG_ACTION_READ_CLEAR, buf, sizeof(buf) - 1);
+ buf[sz] = 0;
+ _append_buf(buf, sz);
+}
+
+
static const char *duration(time_t start, const struct rusage *usage)
{
static char buf[100];
@@ -345,6 +363,7 @@ static void run(int i, char *f) {
struct rusage usage;
char flavour[512], script[512];
+ clear_dmesg();
pid = fork();
if (pid < 0) {
perror("Fork failed.");
@@ -382,8 +401,7 @@ static void run(int i, char *f) {
int runaway = 0;
int no_write = 0;
int collect_debug = 0;
- FILE *varlogmsg;
- int fd_vlm = -1;
+ int fd_debuglog = -1;
//close(fds[1]);
testdirdebug[0] = '\0'; /* Capture RUNTESTDIR */
@@ -396,13 +414,6 @@ static void run(int i, char *f) {
if (!(outfile = fopen(outpath, "w")))
perror("fopen");
- /* Mix in kernel log message */
- if (!(varlogmsg = fopen("/var/log/messages", "r")))
- perror("fopen");
- else if (((fd_vlm = fileno(varlogmsg)) >= 0) &&
- fseek(varlogmsg, 0L, SEEK_END))
- perror("fseek");
-
while ((w = wait4(pid, &st, WNOHANG, &usage)) == 0) {
if ((fullbuffer && fullbuffer++ == 8000) ||
(no_write > 180 * 2)) /* a 3 minute timeout */
@@ -446,24 +457,22 @@ static void run(int i, char *f) {
}
drain(fds[0], INT32_MAX);
no_write = 0;
- if (fd_vlm >= 0)
- drain(fd_vlm, INT32_MAX);
+ drain_dmesg();
}
if (w != pid) {
perror("waitpid");
exit(206);
}
drain(fds[0], INT32_MAX);
- if (fd_vlm >= 0)
- drain(fd_vlm, INT32_MAX);
+ drain_dmesg();
if (die == 2)
interrupted(i, f);
else if (runaway) {
if (collect_debug &&
- (fd_vlm = open(testdirdebug, O_RDONLY)) != -1) {
+ (fd_debuglog = open(testdirdebug, O_RDONLY)) != -1) {
/* Normally read only first 4MB */
- drain(fd_vlm, unlimited ? INT32_MAX : 4 * 1024 * 1024);
- close(fd_vlm);
+ drain(fd_debuglog, unlimited ? INT32_MAX : 4 * 1024 * 1024);
+ close(fd_debuglog);
}
timeout(i, f);
} else if (WIFEXITED(st)) {
@@ -476,8 +485,8 @@ static void run(int i, char *f) {
} else
failed(i, f, st);
- if (varlogmsg)
- fclose(varlogmsg);
+ if (fd_debuglog >= 0)
+ close(fd_debuglog);
if (outfile)
fclose(outfile);
if (fullbuffer)
10 years, 3 months
master - test: Add a regression test for pvcreate -ff.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=1937715d2ccdd4...
Commit: 1937715d2ccdd46122da862c6d7c1ef0ed7d1230
Parent: 8a8e59fb5afd1f85be5cb96744b3eb34ad9a5e71
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Jan 8 15:23:30 2014 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Jan 8 15:24:43 2014 +0100
test: Add a regression test for pvcreate -ff.
---
test/shell/pvcreate-ff.sh | 19 +++++++++++++++++++
1 files changed, 19 insertions(+), 0 deletions(-)
diff --git a/test/shell/pvcreate-ff.sh b/test/shell/pvcreate-ff.sh
new file mode 100644
index 0000000..38284af
--- /dev/null
+++ b/test/shell/pvcreate-ff.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+# Copyright (C) 2014 Red Hat, Inc. All rights reserved.
+#
+# This copyrighted material is made available to anyone wishing to use,
+# modify, copy, or redistribute it subject to the terms and conditions
+# of the GNU General Public License v.2.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+. lib/test
+
+aux prepare_devs 2
+pvcreate $dev1
+vgcreate foo $dev1
+pvcreate -ff -y $dev1
+vgs
+vgcreate foo $dev1
10 years, 3 months
master - lvmetad: Fix getting vgid_old & avoid removing in-transition VGs.
by Petr Rockai
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=8a8e59fb5afd1f...
Commit: 8a8e59fb5afd1f85be5cb96744b3eb34ad9a5e71
Parent: 2b7f7d0ab488f4f179100e91223788fe268299be
Author: Petr Rockai <prockai(a)redhat.com>
AuthorDate: Wed Jan 8 14:54:26 2014 +0100
Committer: Petr Rockai <prockai(a)redhat.com>
CommitterDate: Wed Jan 8 15:22:24 2014 +0100
lvmetad: Fix getting vgid_old & avoid removing in-transition VGs.
---
daemons/lvmetad/lvmetad-core.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 0659c9d..eefbf1d 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -859,7 +859,7 @@ static response pv_found(lvmetad_state *s, request r)
const char *pvid = daemon_request_str(r, "pvmeta/id", NULL);
const char *vgname = daemon_request_str(r, "vgname", NULL);
const char *vgid = daemon_request_str(r, "metadata/id", NULL);
- const char *vgid_old;
+ const char *vgid_old = NULL;
struct dm_config_node *pvmeta = dm_config_find_node(r.cft->root, "pvmeta");
uint64_t device;
struct dm_config_tree *cft, *pvmeta_old_dev = NULL, *pvmeta_old_pvid = NULL;
@@ -881,12 +881,7 @@ static response pv_found(lvmetad_state *s, request r)
if ((old = dm_hash_lookup_binary(s->device_to_pvid, &device, sizeof(device)))) {
pvmeta_old_dev = dm_hash_lookup(s->pvid_to_pvmeta, old);
dm_hash_remove(s->pvid_to_pvmeta, old);
-
- if ((vgid_old = dm_hash_lookup(s->pvid_to_vgid, pvid))) {
- lock_vg(s, vgid_old);
- vg_remove_if_missing(s, vgid_old, 1);
- unlock_vg(s, vgid_old);
- }
+ vgid_old = dm_hash_lookup(s->pvid_to_vgid, old);
}
pvmeta_old_pvid = dm_hash_lookup(s->pvid_to_pvmeta, pvid);
@@ -953,6 +948,12 @@ static response pv_found(lvmetad_state *s, request r)
unlock_vg(s, vgid);
}
+ if (vgid_old && (!vgid || strcmp(vgid, vgid_old))) {
+ lock_vg(s, vgid_old);
+ vg_remove_if_missing(s, vgid_old, 1);
+ unlock_vg(s, vgid_old);
+ }
+
return daemon_reply_simple("OK",
"status = %s", orphan ? "orphan" :
(complete ? "complete" : "partial"),
10 years, 3 months
master - tests: use compiled lvm for clvmd executed lvs
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=2b7f7d0ab488f4...
Commit: 2b7f7d0ab488f4f179100e91223788fe268299be
Parent: 5f246bf768ae194fa19e71e596f99ca02547c55c
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 8 13:52:05 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 8 13:52:05 2014 +0100
tests: use compiled lvm for clvmd executed lvs
---
test/lib/aux.sh | 2 ++
1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/test/lib/aux.sh b/test/lib/aux.sh
index ac6e111..2a882a2 100644
--- a/test/lib/aux.sh
+++ b/test/lib/aux.sh
@@ -31,6 +31,8 @@ prepare_clvmd() {
# skip if we don't have our own clvmd...
(which clvmd 2>/dev/null | grep "$abs_builddir") || skip
+ # lvs is executed from clvmd - use our version
+ export LVM_BINARY=$(which lvm)
# skip if we singlenode is not compiled in
(clvmd --help 2>&1 | grep "Available cluster managers" | grep "singlenode") || skip
10 years, 3 months
master - liblvm: mark constant as unsigned
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=5f246bf768ae19...
Commit: 5f246bf768ae194fa19e71e596f99ca02547c55c
Parent: 4417cd288b69479ade4f4ab98adfc4d5eb7f483b
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 8 12:04:41 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 8 12:04:41 2014 +0100
liblvm: mark constant as unsigned
---
liblvm/lvm_pv.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/liblvm/lvm_pv.c b/liblvm/lvm_pv.c
index 163ea4f..64b01d5 100644
--- a/liblvm/lvm_pv.c
+++ b/liblvm/lvm_pv.c
@@ -126,7 +126,7 @@ int lvm_pv_remove(lvm_t libh, const char *pv_name)
return rc;
}
-#define PV_LIST_MAGIC 4026907153
+#define PV_LIST_MAGIC 4026907153U
static struct dm_list *_lvm_list_pvs(lvm_t libh)
{
10 years, 3 months
master - lvmetad: add parentheses around assignment
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=4417cd288b6947...
Commit: 4417cd288b69479ade4f4ab98adfc4d5eb7f483b
Parent: af7297c73eb824f30898ba7dbb4a4b23406625ca
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 8 11:54:28 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 8 11:57:43 2014 +0100
lvmetad: add parentheses around assignment
---
daemons/lvmetad/lvmetad-core.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/daemons/lvmetad/lvmetad-core.c b/daemons/lvmetad/lvmetad-core.c
index 19e0b6b..0659c9d 100644
--- a/daemons/lvmetad/lvmetad-core.c
+++ b/daemons/lvmetad/lvmetad-core.c
@@ -882,7 +882,7 @@ static response pv_found(lvmetad_state *s, request r)
pvmeta_old_dev = dm_hash_lookup(s->pvid_to_pvmeta, old);
dm_hash_remove(s->pvid_to_pvmeta, old);
- if (vgid_old = dm_hash_lookup(s->pvid_to_vgid, pvid)) {
+ if ((vgid_old = dm_hash_lookup(s->pvid_to_vgid, pvid))) {
lock_vg(s, vgid_old);
vg_remove_if_missing(s, vgid_old, 1);
unlock_vg(s, vgid_old);
10 years, 3 months
master - libdm: pass dnode to callback
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=af7297c73eb824...
Commit: af7297c73eb824f30898ba7dbb4a4b23406625ca
Parent: 95b1af72803336f8a2e559bae4eadefff9a48a7a
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 8 10:30:25 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 8 11:57:43 2014 +0100
libdm: pass dnode to callback
Pass dnode pointer instead of rather unknown child pointer.
The pointer is currently unused and passing child pointer
is quite undefined, while dnode has at least some usability.
---
libdm/libdm-deptree.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/libdm/libdm-deptree.c b/libdm/libdm-deptree.c
index 752a44b..7bc1f33 100644
--- a/libdm/libdm-deptree.c
+++ b/libdm/libdm-deptree.c
@@ -2619,7 +2619,7 @@ int dm_tree_preload_children(struct dm_tree_node *dnode,
dm_tree_set_cookie(dnode, 0);
if (!dnode->info.exists && dnode->callback &&
- !dnode->callback(child, DM_NODE_CALLBACK_PRELOADED,
+ !dnode->callback(dnode, DM_NODE_CALLBACK_PRELOADED,
dnode->callback_data))
return_0;
}
10 years, 3 months
master - thin: accept const struct
by Zdenek Kabelac
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=95b1af72803336...
Commit: 95b1af72803336f8a2e559bae4eadefff9a48a7a
Parent: de3abfa6222c7c35f8262032112fea3b6098fd58
Author: Zdenek Kabelac <zkabelac(a)redhat.com>
AuthorDate: Wed Jan 8 10:27:17 2014 +0100
Committer: Zdenek Kabelac <zkabelac(a)redhat.com>
CommitterDate: Wed Jan 8 11:57:43 2014 +0100
thin: accept const struct
---
lib/metadata/metadata-exported.h | 2 +-
lib/metadata/thin_manip.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h
index 6a959d1..8e36891 100644
--- a/lib/metadata/metadata-exported.h
+++ b/lib/metadata/metadata-exported.h
@@ -672,7 +672,7 @@ int lv_rename_update(struct cmd_context *cmd, struct logical_volume *lv,
uint64_t extents_from_size(struct cmd_context *cmd, uint64_t size,
uint32_t extent_size);
-struct logical_volume *find_pool_lv(struct logical_volume *lv);
+struct logical_volume *find_pool_lv(const struct logical_volume *lv);
int pool_is_active(const struct logical_volume *pool_lv);
int pool_can_resize_metadata(const struct logical_volume *pool_lv);
int update_pool_lv(struct logical_volume *lv, int activate);
diff --git a/lib/metadata/thin_manip.c b/lib/metadata/thin_manip.c
index 0223752..e12a8ad 100644
--- a/lib/metadata/thin_manip.c
+++ b/lib/metadata/thin_manip.c
@@ -392,7 +392,7 @@ struct lv_segment *find_pool_seg(const struct lv_segment *seg)
return pool_seg;
}
-struct logical_volume *find_pool_lv(struct logical_volume *lv)
+struct logical_volume *find_pool_lv(const struct logical_volume *lv)
{
struct lv_segment *seg;
10 years, 3 months
master - thin: cleanup _thin_pool_add_message
by Peter Rajnoha
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=de3abfa6222c7c...
Commit: de3abfa6222c7c35f8262032112fea3b6098fd58
Parent: 0a13815e68c3d85b140f8c6d4d91592ae2f8b992
Author: Peter Rajnoha <prajnoha(a)redhat.com>
AuthorDate: Wed Jan 8 10:56:05 2014 +0100
Committer: Peter Rajnoha <prajnoha(a)redhat.com>
CommitterDate: Wed Jan 8 10:56:05 2014 +0100
thin: cleanup _thin_pool_add_message
Make this code a bit more readable for Coverity as otherwise
it marks the "type" variable in the "_thin_pool_add_message" fn
as undefined for certain path (...which is normally unreachable anyway,
but let's clean this up).
---
lib/thin/thin.c | 12 +++---------
1 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/lib/thin/thin.c b/lib/thin/thin.c
index df6482e..ff263d9 100644
--- a/lib/thin/thin.c
+++ b/lib/thin/thin.c
@@ -62,16 +62,10 @@ static int _thin_pool_add_message(struct lv_segment *seg,
lv_name);
/* FIXME: switch to _SNAP later, if the created LV has an origin */
type = DM_THIN_MESSAGE_CREATE_THIN;
- }
-
- if (!dm_config_get_uint32(sn, "delete", &delete_id)) {
- if (!lv)
- return SEG_LOG_ERROR("Unknown message in");
- } else {
- if (lv)
- return SEG_LOG_ERROR("Unsupported message format in");
+ } else if (dm_config_get_uint32(sn, "delete", &delete_id))
type = DM_THIN_MESSAGE_DELETE;
- }
+ else
+ return SEG_LOG_ERROR("Unknown message in");
if (!attach_pool_message(seg, type, lv, delete_id, 1))
return_0;
10 years, 3 months