Accepting request 535958 from network:ha-clustering:Unstable
- Update to LVM2.2.02.175 - Use week dependency for lvm2-lockd on libdlm and sanlock - Rename/refresh patches: - display-dm-name-for-lv-name.diff to fate-309425_display-dm-name-for-lv-name.patch - fsadm-add-support-for-btrfs.patch to fate-31841_fsadm-add-support-for-btrfs.patch - dmeventd-fix-dso-name-wrong-compare.patch to bug-935623_dmeventd-fix-dso-name-wrong-compare.patch - lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch to bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch - simplify-special-case-for-md-in-69-dm-lvm-metadata.patch to bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch - Drop resource agents for clvmd and cmirror (bsc#1058680) - clvmd.ocf - cmirrord.ocf - Drop all patches for cmirror (bsc#1058661) - cluster_support_mirrord_log.diff - cmirrord_improvment_performance.patch - lvconvert-cluster-mirrored-disk-failed.patch - improve-mirror-legs-on-different-tag-pvs.patch - make-mirror-legs-on-different-tag-pvs.patch - use-mirrortype-asdefault-whenclvmdrunning.patch - lvm2-testsuite.patch - Update to LVM2.2.02.175 - Use week dependency for lvm2-lockd on libdlm and sanlock - Rename/refresh patches: - display-dm-name-for-lv-name.diff to fate-309425_display-dm-name-for-lv-name.patch - fsadm-add-support-for-btrfs.patch to fate-31841_fsadm-add-support-for-btrfs.patch - dmeventd-fix-dso-name-wrong-compare.patch to bug-935623_dmeventd-fix-dso-name-wrong-compare.patch - lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch to bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch - simplify-special-case-for-md-in-69-dm-lvm-metadata.patch to bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch OBS-URL: https://build.opensuse.org/request/show/535958 OBS-URL: https://build.opensuse.org/package/show/Base:System/lvm2?expand=0&rev=204
This commit is contained in:
parent
aa0494a377
commit
fa5492787c
@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ceb9168c7e009ef487f96a1fe969b23cbb07d920ffb71769affdbdf30fea8d64
|
||||
size 2363504
|
@ -1,7 +0,0 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v2.0.14 (GNU/Linux)
|
||||
|
||||
iEYEABECAAYFAllw138ACgkQIoGRwVZ+LBcXbwCeI1gt2DZhVSuyEN784ynSzaHb
|
||||
VoYAoOOY7HFlESPCTBoFKks4zY/9Ou5D
|
||||
=Na9K
|
||||
-----END PGP SIGNATURE-----
|
3
LVM2.2.02.175.tgz
Normal file
3
LVM2.2.02.175.tgz
Normal file
@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:4db7a3ec6d082be212f759279b54bcdfd3c3797a5ea67605746049b004632559
|
||||
size 2373834
|
7
LVM2.2.02.175.tgz.asc
Normal file
7
LVM2.2.02.175.tgz.asc
Normal file
@ -0,0 +1,7 @@
|
||||
-----BEGIN PGP SIGNATURE-----
|
||||
Version: GnuPG v2.0.14 (GNU/Linux)
|
||||
|
||||
iEYEABECAAYFAlnX9XgACgkQIoGRwVZ+LBeZnQCg7JNQyFkEkfNptzLGNCVLlA2S
|
||||
77oAoPAYBrpUR+ID/KAH6+MkNU9bmTK4
|
||||
=0AnW
|
||||
-----END PGP SIGNATURE-----
|
@ -2,13 +2,24 @@ commit 0402acbbb9f8f6066a3f7899e8cc3ae72b84ee20
|
||||
Author: Zhilong Liu <zlliu@suse.com>
|
||||
Date: Wed Dec 7 02:43:10 2016 -0500
|
||||
|
||||
add a new test package named lvm2-testsuite(bnc#950089)
|
||||
+ lvm2-testsuite.patch
|
||||
Currently this new package is not enabled by default.
|
||||
Please set enable_testsuite to 1 to turn it on in the
|
||||
spec file.
|
||||
|
||||
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||
add a new test package named lvm2-testsuite(bnc#950089)
|
||||
+ lvm2-testsuite.patch
|
||||
Currently this new package is not enabled by default.
|
||||
Please set enable_testsuite to 1 to turn it on in the
|
||||
spec file.
|
||||
|
||||
Eric:
|
||||
|
||||
This patch is to solve the following obs building error:
|
||||
|
||||
"""
|
||||
E: arch-dependent-file-in-usr-share (Badness: 590) /usr/share/lvm2-testsuite/api/lvtest.t
|
||||
...
|
||||
"""
|
||||
|
||||
So, move the *.t binary into /usr/lib/lvm2-testsuite/.
|
||||
|
||||
Signed-off-by: Zhilong Liu <zlliu@suse.com>
|
||||
|
||||
diff --git a/test/Makefile.in b/test/Makefile.in
|
||||
index f152868..f0845d7 100644
|
@ -1,528 +0,0 @@
|
||||
Subject: Parallelize dispatching
|
||||
---
|
||||
daemons/cmirrord/Makefile.in | 2
|
||||
daemons/cmirrord/cluster.c | 110 +++++++++++++++++++++++++++----------------
|
||||
daemons/cmirrord/functions.c | 37 ++++++++++++--
|
||||
daemons/cmirrord/local.c | 3 -
|
||||
lib/metadata/mirror.c | 24 ---------
|
||||
lib/mirror/mirrored.c | 5 +
|
||||
tools/lvconvert.c | 9 ---
|
||||
7 files changed, 109 insertions(+), 81 deletions(-)
|
||||
|
||||
Index: LVM2.2.02.168/daemons/cmirrord/Makefile.in
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/daemons/cmirrord/Makefile.in
|
||||
+++ LVM2.2.02.168/daemons/cmirrord/Makefile.in
|
||||
@@ -26,7 +26,7 @@ TARGETS = cmirrord
|
||||
|
||||
include $(top_builddir)/make.tmpl
|
||||
|
||||
-LIBS += -ldevmapper
|
||||
+LIBS += -ldevmapper -lpthread
|
||||
LMLIBS += $(CPG_LIBS) $(SACKPT_LIBS)
|
||||
CFLAGS += $(CPG_CFLAGS) $(SACKPT_CFLAGS) $(EXTRA_EXEC_CFLAGS)
|
||||
LDFLAGS += $(EXTRA_EXEC_LDFLAGS)
|
||||
Index: LVM2.2.02.168/daemons/cmirrord/cluster.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/daemons/cmirrord/cluster.c
|
||||
+++ LVM2.2.02.168/daemons/cmirrord/cluster.c
|
||||
@@ -22,6 +22,7 @@
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
+#include <pthread.h>
|
||||
#if CMIRROR_HAS_CHECKPOINT
|
||||
#include <openais/saAis.h>
|
||||
#include <openais/saCkpt.h>
|
||||
@@ -152,9 +153,11 @@ struct clog_cpg {
|
||||
struct checkpoint_data *checkpoint_list;
|
||||
int idx;
|
||||
char debugging[DEBUGGING_HISTORY][DEBUGGING_BUFLEN];
|
||||
+ pthread_t thread_pid;
|
||||
};
|
||||
|
||||
static struct dm_list clog_cpg_list;
|
||||
+static pthread_rwlock_t clog_cpg_lock = PTHREAD_RWLOCK_INITIALIZER;
|
||||
|
||||
/*
|
||||
* cluster_send
|
||||
@@ -169,12 +172,14 @@ int cluster_send(struct clog_request *rq
|
||||
struct iovec iov;
|
||||
struct clog_cpg *entry;
|
||||
|
||||
+ pthread_rwlock_rdlock(&clog_cpg_lock);
|
||||
dm_list_iterate_items(entry, &clog_cpg_list)
|
||||
if (!strncmp(entry->name.value, rq->u_rq.uuid,
|
||||
CPG_MAX_NAME_LENGTH)) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
if (!found) {
|
||||
rq->u_rq.error = -ENOENT;
|
||||
@@ -255,11 +260,11 @@ static struct clog_request *get_matching
|
||||
return NULL;
|
||||
}
|
||||
|
||||
-static char rq_buffer[DM_ULOG_REQUEST_SIZE];
|
||||
static int handle_cluster_request(struct clog_cpg *entry __attribute__((unused)),
|
||||
struct clog_request *rq, int server)
|
||||
{
|
||||
int r = 0;
|
||||
+ char rq_buffer[DM_ULOG_REQUEST_SIZE];
|
||||
struct clog_request *tmp = (struct clog_request *)rq_buffer;
|
||||
|
||||
/*
|
||||
@@ -370,9 +375,13 @@ static struct clog_cpg *find_clog_cpg(cp
|
||||
{
|
||||
struct clog_cpg *match;
|
||||
|
||||
+ pthread_rwlock_rdlock(&clog_cpg_lock);
|
||||
dm_list_iterate_items(match, &clog_cpg_list)
|
||||
- if (match->handle == handle)
|
||||
+ if (match->handle == handle) {
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
return match;
|
||||
+ }
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -982,34 +991,21 @@ static int resend_requests(struct clog_c
|
||||
return r;
|
||||
}
|
||||
|
||||
-static int do_cluster_work(void *data __attribute__((unused)))
|
||||
+static void cluster_thread_fn(void *data)
|
||||
{
|
||||
int r = CS_OK;
|
||||
- struct clog_cpg *entry, *tmp;
|
||||
-
|
||||
- dm_list_iterate_items_safe(entry, tmp, &clog_cpg_list) {
|
||||
- r = cpg_dispatch(entry->handle, CS_DISPATCH_ALL);
|
||||
- if (r != CS_OK) {
|
||||
- if ((r == CS_ERR_BAD_HANDLE) &&
|
||||
- ((entry->state == INVALID) ||
|
||||
- (entry->state == LEAVING)))
|
||||
- /* It's ok if we've left the cluster */
|
||||
- r = CS_OK;
|
||||
- else
|
||||
- LOG_ERROR("cpg_dispatch failed: %s",
|
||||
- str_ais_error(r));
|
||||
- }
|
||||
-
|
||||
- if (entry->free_me) {
|
||||
- free(entry);
|
||||
- continue;
|
||||
- }
|
||||
- do_checkpoints(entry, 0);
|
||||
-
|
||||
- resend_requests(entry);
|
||||
+ struct clog_cpg *match = data;
|
||||
+ r = cpg_dispatch(match->handle, CS_DISPATCH_BLOCKING);
|
||||
+ if (r != CS_OK) {
|
||||
+ if ((r == CS_ERR_BAD_HANDLE) &&
|
||||
+ ((match->state == INVALID) ||
|
||||
+ (match->state == LEAVING)))
|
||||
+ /* It's ok if we've left the cluster */
|
||||
+ r = CS_OK;
|
||||
+ else
|
||||
+ LOG_ERROR("cpg_dispatch failed: %s",
|
||||
+ str_ais_error(r));
|
||||
}
|
||||
-
|
||||
- return (r == CS_OK) ? 0 : -1; /* FIXME: good error number? */
|
||||
}
|
||||
|
||||
static int flush_startup_list(struct clog_cpg *entry)
|
||||
@@ -1062,23 +1058,37 @@ static int flush_startup_list(struct clo
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static void do_cpg_message_callback(struct clog_cpg *match, uint32_t nodeid,
|
||||
+ void *msg, size_t msg_len);
|
||||
+
|
||||
static void cpg_message_callback(cpg_handle_t handle, const struct cpg_name *gname __attribute__((unused)),
|
||||
uint32_t nodeid, uint32_t pid __attribute__((unused)),
|
||||
void *msg, size_t msg_len)
|
||||
{
|
||||
+ struct clog_cpg *entry;
|
||||
+
|
||||
+ entry = find_clog_cpg(handle);
|
||||
+ if (!entry) {
|
||||
+ LOG_ERROR("Unable to find clog_cpg for cluster message");
|
||||
+ return;
|
||||
+ }
|
||||
+ do_cpg_message_callback(entry, nodeid, msg, msg_len);
|
||||
+
|
||||
+ do_checkpoints(entry, 0);
|
||||
+ resend_requests(entry);
|
||||
+
|
||||
+}
|
||||
+
|
||||
+static void do_cpg_message_callback(struct clog_cpg *match, uint32_t nodeid,
|
||||
+ void *msg, size_t msg_len)
|
||||
+{
|
||||
int i;
|
||||
int r = 0;
|
||||
int i_am_server;
|
||||
int response = 0;
|
||||
struct clog_request *rq = msg;
|
||||
struct clog_request *tmp_rq, *tmp_rq2;
|
||||
- struct clog_cpg *match;
|
||||
|
||||
- match = find_clog_cpg(handle);
|
||||
- if (!match) {
|
||||
- LOG_ERROR("Unable to find clog_cpg for cluster message");
|
||||
- return;
|
||||
- }
|
||||
|
||||
/*
|
||||
* Perform necessary endian and version compatibility conversions
|
||||
@@ -1384,7 +1394,7 @@ static void cpg_leave_callback(struct cl
|
||||
size_t member_list_entries)
|
||||
{
|
||||
unsigned i;
|
||||
- int j, fd;
|
||||
+ int j;
|
||||
uint32_t lowest = match->lowest_id;
|
||||
struct clog_request *rq, *n;
|
||||
struct checkpoint_data *p_cp, *c_cp;
|
||||
@@ -1395,10 +1405,9 @@ static void cpg_leave_callback(struct cl
|
||||
/* Am I leaving? */
|
||||
if (my_cluster_id == left->nodeid) {
|
||||
LOG_DBG("Finalizing leave...");
|
||||
+ pthread_rwlock_wrlock(&clog_cpg_lock);
|
||||
dm_list_del(&match->list);
|
||||
-
|
||||
- cpg_fd_get(match->handle, &fd);
|
||||
- links_unregister(fd);
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
cluster_postsuspend(match->name.value, match->luid);
|
||||
|
||||
@@ -1526,11 +1535,13 @@ static void cpg_config_callback(cpg_hand
|
||||
struct clog_cpg *match;
|
||||
int found = 0;
|
||||
|
||||
+ pthread_rwlock_rdlock(&clog_cpg_lock);
|
||||
dm_list_iterate_items(match, &clog_cpg_list)
|
||||
if (match->handle == handle) {
|
||||
found = 1;
|
||||
break;
|
||||
}
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
if (!found) {
|
||||
LOG_ERROR("Unable to find match for CPG config callback");
|
||||
@@ -1547,6 +1558,16 @@ static void cpg_config_callback(cpg_hand
|
||||
else
|
||||
cpg_leave_callback(match, left_list,
|
||||
member_list, member_list_entries);
|
||||
+
|
||||
+
|
||||
+ if (match->free_me) {
|
||||
+ LOG_DBG("closing thread %x", (unsigned int)match->thread_pid);
|
||||
+ free(match);
|
||||
+ return;
|
||||
+ }
|
||||
+
|
||||
+ do_checkpoints(match, 0);
|
||||
+ resend_requests(match);
|
||||
}
|
||||
|
||||
cpg_callbacks_t cpg_callbacks = {
|
||||
@@ -1614,12 +1635,16 @@ int create_cluster_cpg(char *uuid, uint6
|
||||
size_t size;
|
||||
struct clog_cpg *new = NULL;
|
||||
struct clog_cpg *tmp;
|
||||
+ pthread_t new_pid;
|
||||
|
||||
+ pthread_rwlock_rdlock(&clog_cpg_lock);
|
||||
dm_list_iterate_items(tmp, &clog_cpg_list)
|
||||
if (!strncmp(tmp->name.value, uuid, CPG_MAX_NAME_LENGTH)) {
|
||||
LOG_ERROR("Log entry already exists: %s", uuid);
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
return -EEXIST;
|
||||
}
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
new = malloc(sizeof(*new));
|
||||
if (!new) {
|
||||
@@ -1661,13 +1686,16 @@ int create_cluster_cpg(char *uuid, uint6
|
||||
}
|
||||
|
||||
new->cpg_state = VALID;
|
||||
+ pthread_rwlock_wrlock(&clog_cpg_lock);
|
||||
dm_list_add(&clog_cpg_list, &new->list);
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
+
|
||||
LOG_DBG("New handle: %llu", (unsigned long long)new->handle);
|
||||
LOG_DBG("New name: %s", new->name.value);
|
||||
|
||||
- /* FIXME: better variable */
|
||||
- cpg_fd_get(new->handle, &r);
|
||||
- links_register(r, "cluster", do_cluster_work, NULL);
|
||||
+ pthread_create(&new_pid, NULL, (void *)cluster_thread_fn, (void*)new);
|
||||
+ new->thread_pid = new_pid;
|
||||
+ pthread_detach(new_pid);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -1736,9 +1764,11 @@ int destroy_cluster_cpg(char *uuid)
|
||||
{
|
||||
struct clog_cpg *del, *tmp;
|
||||
|
||||
+ pthread_rwlock_rdlock(&clog_cpg_lock);
|
||||
dm_list_iterate_items_safe(del, tmp, &clog_cpg_list)
|
||||
if (!strncmp(del->name.value, uuid, CPG_MAX_NAME_LENGTH))
|
||||
_destroy_cluster_cpg(del);
|
||||
+ pthread_rwlock_unlock(&clog_cpg_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
Index: LVM2.2.02.168/daemons/cmirrord/functions.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/daemons/cmirrord/functions.c
|
||||
+++ LVM2.2.02.168/daemons/cmirrord/functions.c
|
||||
@@ -20,6 +20,7 @@
|
||||
#include <sys/stat.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
+#include <pthread.h>
|
||||
|
||||
#define BYTE_SHIFT 3
|
||||
|
||||
@@ -107,6 +108,9 @@ struct recovery_request {
|
||||
static DM_LIST_INIT(log_list);
|
||||
static DM_LIST_INIT(log_pending_list);
|
||||
|
||||
+static pthread_rwlock_t log_list_lock = PTHREAD_RWLOCK_INITIALIZER;
|
||||
+static pthread_rwlock_t log_pending_lock = PTHREAD_RWLOCK_INITIALIZER;
|
||||
+
|
||||
static int log_test_bit(dm_bitset_t bs, int bit)
|
||||
{
|
||||
return dm_bit(bs, bit) ? 1 : 0;
|
||||
@@ -153,11 +157,15 @@ static struct log_c *get_log(const char
|
||||
{
|
||||
struct log_c *lc;
|
||||
|
||||
+ pthread_rwlock_rdlock(&log_list_lock);
|
||||
dm_list_iterate_items(lc, &log_list)
|
||||
if (!strcmp(lc->uuid, uuid) &&
|
||||
- (!luid || (luid == lc->luid)))
|
||||
+ (!luid || (luid == lc->luid))) {
|
||||
+ pthread_rwlock_unlock(&log_list_lock);
|
||||
return lc;
|
||||
+ }
|
||||
|
||||
+ pthread_rwlock_unlock(&log_list_lock);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -173,10 +181,14 @@ static struct log_c *get_pending_log(con
|
||||
{
|
||||
struct log_c *lc;
|
||||
|
||||
+ pthread_rwlock_rdlock(&log_pending_lock);
|
||||
dm_list_iterate_items(lc, &log_pending_list)
|
||||
if (!strcmp(lc->uuid, uuid) &&
|
||||
- (!luid || (luid == lc->luid)))
|
||||
+ (!luid || (luid == lc->luid))) {
|
||||
+ pthread_rwlock_unlock(&log_pending_lock);
|
||||
return lc;
|
||||
+ }
|
||||
+ pthread_rwlock_unlock(&log_pending_lock);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
@@ -521,7 +533,9 @@ static int _clog_ctr(char *uuid, uint64_
|
||||
LOG_DBG("Disk log ready");
|
||||
}
|
||||
|
||||
+ pthread_rwlock_wrlock(&log_pending_lock);
|
||||
dm_list_add(&log_pending_list, &lc->list);
|
||||
+ pthread_rwlock_unlock(&log_pending_lock);
|
||||
|
||||
return 0;
|
||||
fail:
|
||||
@@ -651,7 +665,10 @@ static int clog_dtr(struct dm_ulog_reque
|
||||
|
||||
LOG_DBG("[%s] Cluster log removed", SHORT_UUID(lc->uuid));
|
||||
|
||||
+ pthread_rwlock_wrlock(&log_list_lock);
|
||||
dm_list_del(&lc->list);
|
||||
+ pthread_rwlock_unlock(&log_list_lock);
|
||||
+
|
||||
if (lc->disk_fd != -1 && close(lc->disk_fd))
|
||||
LOG_ERROR("Failed to close disk log: %s",
|
||||
strerror(errno));
|
||||
@@ -723,8 +740,13 @@ int cluster_postsuspend(char *uuid, uint
|
||||
lc->resume_override = 0;
|
||||
|
||||
/* move log to pending list */
|
||||
+ pthread_rwlock_wrlock(&log_list_lock);
|
||||
dm_list_del(&lc->list);
|
||||
+ pthread_rwlock_unlock(&log_list_lock);
|
||||
+
|
||||
+ pthread_rwlock_wrlock(&log_pending_lock);
|
||||
dm_list_add(&log_pending_list, &lc->list);
|
||||
+ pthread_rwlock_unlock(&log_pending_lock);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -828,9 +850,9 @@ no_disk:
|
||||
if (commit_log && (lc->disk_fd >= 0)) {
|
||||
rq->error = write_log(lc);
|
||||
if (rq->error)
|
||||
- LOG_ERROR("Failed initial disk log write");
|
||||
+ LOG_ERROR("[%s] Failed initial disk log write", SHORT_UUID(lc->uuid));
|
||||
else
|
||||
- LOG_DBG("Disk log initialized");
|
||||
+ LOG_DBG("[%s] Disk log initialized", SHORT_UUID(lc->uuid));
|
||||
lc->touched = 0;
|
||||
}
|
||||
out:
|
||||
@@ -912,8 +934,13 @@ int local_resume(struct dm_ulog_request
|
||||
}
|
||||
|
||||
/* move log to official list */
|
||||
+ pthread_rwlock_wrlock(&log_pending_lock);
|
||||
dm_list_del(&lc->list);
|
||||
+ pthread_rwlock_unlock(&log_pending_lock);
|
||||
+
|
||||
+ pthread_rwlock_wrlock(&log_list_lock);
|
||||
dm_list_add(&log_list, &lc->list);
|
||||
+ pthread_rwlock_unlock(&log_list_lock);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -1936,7 +1963,6 @@ void log_debug(void)
|
||||
|
||||
LOG_ERROR("");
|
||||
LOG_ERROR("LOG COMPONENT DEBUGGING::");
|
||||
- LOG_ERROR("Official log list:");
|
||||
LOG_ERROR("Pending log list:");
|
||||
dm_list_iterate_items(lc, &log_pending_list) {
|
||||
LOG_ERROR("%s", lc->uuid);
|
||||
@@ -1946,6 +1972,7 @@ void log_debug(void)
|
||||
print_bits(lc->clean_bits, 1);
|
||||
}
|
||||
|
||||
+ LOG_ERROR("Official log list:");
|
||||
dm_list_iterate_items(lc, &log_list) {
|
||||
LOG_ERROR("%s", lc->uuid);
|
||||
LOG_ERROR(" recoverer : %" PRIu32, lc->recoverer);
|
||||
Index: LVM2.2.02.168/daemons/cmirrord/local.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/daemons/cmirrord/local.c
|
||||
+++ LVM2.2.02.168/daemons/cmirrord/local.c
|
||||
@@ -29,13 +29,13 @@
|
||||
|
||||
static int cn_fd = -1; /* Connector (netlink) socket fd */
|
||||
static char recv_buf[2048];
|
||||
-static char send_buf[2048];
|
||||
|
||||
|
||||
/* FIXME: merge this function with kernel_send_helper */
|
||||
static int kernel_ack(uint32_t seq, int error)
|
||||
{
|
||||
int r;
|
||||
+ char send_buf[2048];
|
||||
struct nlmsghdr *nlh = (struct nlmsghdr *)send_buf;
|
||||
struct cn_msg *msg = NLMSG_DATA(nlh);
|
||||
|
||||
@@ -179,6 +179,7 @@ static int kernel_send_helper(void *data
|
||||
int r;
|
||||
struct nlmsghdr *nlh;
|
||||
struct cn_msg *msg;
|
||||
+ char send_buf[2048];
|
||||
|
||||
memset(send_buf, 0, sizeof(send_buf));
|
||||
|
||||
Index: LVM2.2.02.168/lib/metadata/mirror.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/lib/metadata/mirror.c
|
||||
+++ LVM2.2.02.168/lib/metadata/mirror.c
|
||||
@@ -1925,11 +1925,6 @@ int add_mirror_log(struct cmd_context *c
|
||||
unsigned old_log_count;
|
||||
int r = 0;
|
||||
|
||||
- if (vg_is_clustered(lv->vg) && (log_count > 1)) {
|
||||
- log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
if (dm_list_size(&lv->segments) != 1) {
|
||||
log_error("Multiple-segment mirror is not supported.");
|
||||
return 0;
|
||||
@@ -2090,27 +2085,6 @@ int lv_add_mirrors(struct cmd_context *c
|
||||
return 0;
|
||||
}
|
||||
|
||||
- if (vg_is_clustered(lv->vg)) {
|
||||
- /* FIXME: move this test out of this function */
|
||||
- /* Skip test for pvmove mirrors, it can use local mirror */
|
||||
- if (!lv_is_pvmove(lv) && !lv_is_locked(lv) &&
|
||||
- lv_is_active(lv) &&
|
||||
- !lv_is_active_exclusive_locally(lv) && /* lv_is_active_remotely */
|
||||
- !cluster_mirror_is_available(lv->vg->cmd)) {
|
||||
- log_error("Shared cluster mirrors are not available.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
- /*
|
||||
- * No mirrored logs for cluster mirrors until
|
||||
- * log daemon is multi-threaded.
|
||||
- */
|
||||
- if (log_count > 1) {
|
||||
- log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
|
||||
- return 0;
|
||||
- }
|
||||
- }
|
||||
-
|
||||
/* For corelog mirror, activation code depends on
|
||||
* the global mirror_in_sync status. As we are adding
|
||||
* a new mirror, it should be set as 'out-of-sync'
|
||||
Index: LVM2.2.02.168/lib/mirror/mirrored.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/lib/mirror/mirrored.c
|
||||
+++ LVM2.2.02.168/lib/mirror/mirrored.c
|
||||
@@ -293,12 +293,15 @@ static int _add_log(struct dm_pool *mem,
|
||||
return 0;
|
||||
}
|
||||
} else {
|
||||
- /* If core log, use mirror's UUID and set DM_CORELOG flag */
|
||||
+ /* If core log, use mirror's (UUID + CORE) and set DM_CORELOG flag */
|
||||
if (!(log_dlid = build_dm_uuid(mem, seg->lv, NULL))) {
|
||||
log_error("Failed to build uuid for mirror LV %s.",
|
||||
seg->lv->name);
|
||||
return 0;
|
||||
}
|
||||
+ if (clustered)
|
||||
+ memcpy(&log_dlid[strlen(log_dlid) - 4], "CORE", 4);
|
||||
+
|
||||
log_flags |= DM_CORELOG;
|
||||
}
|
||||
|
||||
Index: LVM2.2.02.168/tools/lvconvert.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.168.orig/tools/lvconvert.c
|
||||
+++ LVM2.2.02.168/tools/lvconvert.c
|
||||
@@ -1375,15 +1375,6 @@ static int _lvconvert_mirrors_parse_para
|
||||
|
||||
*new_log_count = arg_int_value(cmd, mirrorlog_ARG, lp->corelog ? MIRROR_LOG_CORE : DEFAULT_MIRRORLOG);
|
||||
|
||||
- /*
|
||||
- * No mirrored logs for cluster mirrors until
|
||||
- * log daemon is multi-threaded.
|
||||
- */
|
||||
- if ((*new_log_count == MIRROR_LOG_MIRRORED) && vg_is_clustered(lv->vg)) {
|
||||
- log_error("Log type, \"mirrored\", is unavailable to cluster mirrors.");
|
||||
- return 0;
|
||||
- }
|
||||
-
|
||||
log_verbose("Setting logging type to %s.", get_mirror_log_name(*new_log_count));
|
||||
|
||||
/*
|
353
clvmd.ocf
353
clvmd.ocf
@ -1,353 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2008 Xinwei Hu All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Further, this software is distributed without any warranty that it is
|
||||
# free of the rightful claim of any third person regarding infringement
|
||||
# or the like. Any license provided herein, whether implied or
|
||||
# otherwise, applies only to this software file. Patent licenses, if
|
||||
# any, provided herein do not apply to combinations of this program with
|
||||
# other software, or any other product whatsoever.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
# OCF initialization
|
||||
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
|
||||
|
||||
# Parameter defaults
|
||||
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
|
||||
: ${OCF_RESKEY_daemon_timeout:="80"}
|
||||
: ${OCF_RESKEY_daemon_options:="-d0"}
|
||||
|
||||
sbindir=$HA_SBIN_DIR
|
||||
|
||||
# Common variables
|
||||
DAEMON="${sbindir}/clvmd"
|
||||
CMIRRORD="${sbindir}/cmirrord"
|
||||
LVMCONF="${sbindir}/lvmconf"
|
||||
|
||||
time_to_seconds() {
|
||||
local val
|
||||
val=$1
|
||||
case $val in
|
||||
*h) echo $(( $(echo $val | sed -e "s/h$//") * 3600 ));;
|
||||
*ms) echo $(( $(echo $val | sed -e "s/ms$//") / 1000 ));;
|
||||
*s) echo $val | sed -e "s/s$//";;
|
||||
*m) echo $(( $(echo $val | sed -e "s/m$//") * 60 ));;
|
||||
*) echo "$val";;
|
||||
esac
|
||||
}
|
||||
|
||||
OCF_RESKEY_daemon_timeout=$(time_to_seconds ${OCF_RESKEY_daemon_timeout})
|
||||
|
||||
status_daemons()
|
||||
{
|
||||
PID=`pidofproc "$DAEMON"`
|
||||
NPID=`pidofproc "$CMIRRORD"`
|
||||
if [ -n "$PID" -a -n "$NPID" ]; then
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
return $OCF_NOT_RUNNING
|
||||
}
|
||||
|
||||
status_clvmd()
|
||||
{
|
||||
PID=`pidofproc "$DAEMON"`
|
||||
if [ -n "$PID" ]; then
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
return $OCF_NOT_RUNNING
|
||||
}
|
||||
|
||||
status_cmirrord()
|
||||
{
|
||||
PID=`pidofproc "$CMIRRORD"`
|
||||
if [ -n "$PID" ]; then
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
return $OCF_NOT_RUNNING
|
||||
}
|
||||
|
||||
bringup_clvmd()
|
||||
{
|
||||
if [ ! -e "$DAEMON" ]; then
|
||||
ocf_log err "Required binary not found: $DAEMON"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
start_daemon "$DAEMON" "$OCF_RESKEY_daemon_options"; rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
ocf_log err "Could not start $DAEMON"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
COUNT=0
|
||||
rc=$OCF_NOT_RUNNING
|
||||
|
||||
while [ $rc = $OCF_NOT_RUNNING ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $DAEMON` did not come up"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
status_clvmd; rc=$?
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return $rc
|
||||
}
|
||||
|
||||
bringup_cmirrord()
|
||||
{
|
||||
if [ ! -e "$CMIRRORD" ]; then
|
||||
ocf_log err "Required binary not found: $DAEMON"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
start_daemon "$CMIRRORD"; rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
ocf_log err "Could not start $CMIRRORD"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
COUNT=0
|
||||
rc=$OCF_NOT_RUNNING
|
||||
|
||||
while [ $rc = $OCF_NOT_RUNNING ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $DAEMON` did not come up"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
status_cmirrord; rc=$?
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return $rc
|
||||
}
|
||||
|
||||
|
||||
kill_clvmd()
|
||||
{
|
||||
status_clvmd; rc=$?
|
||||
if [ $rc != $OCF_SUCCESS ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
ocf_log info "Stopping `basename "$DAEMON"`"
|
||||
killproc -INT "$DAEMON"
|
||||
|
||||
sleep 1
|
||||
status_daemons; rc=$?
|
||||
|
||||
COUNT=0
|
||||
while [ $rc = $OCF_SUCCESS ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $DAEMON` shutdown emergency"
|
||||
killproc -9 "$DAEMON"
|
||||
status_clvmd; rc=$?
|
||||
if [ $rc = $OCF_NOT_RUNNING ]; then
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
killproc -INT "$DAEMON"
|
||||
sleep 1
|
||||
status_clvmd; rc=$?
|
||||
done
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
kill_cmirrord()
|
||||
{
|
||||
status_cmirrord; rc=$?
|
||||
if [ $rc != $OCF_SUCCESS ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
ocf_log info "Stopping `basename "$CMIRRORD"`"
|
||||
killproc -INT "$CMIRRORD"
|
||||
|
||||
sleep 1
|
||||
status_cmirrord; rc=$?
|
||||
|
||||
COUNT=0
|
||||
while [ $rc = $OCF_SUCCESS ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $CMIRRORD` shutdown emergency"
|
||||
killproc -9 "$CMIRRORD"
|
||||
status_cmirrord; rc=$?
|
||||
if [ $rc = $OCF_NOT_RUNNING ]; then
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
killproc -INT "$CMIRRORD"
|
||||
sleep 1
|
||||
status_cmirrord; rc=$?
|
||||
done
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
|
||||
clvmd_start()
|
||||
{
|
||||
clvmd_validate
|
||||
ocf_log info "Starting $OCF_RESOURCE_INSTANCE"
|
||||
|
||||
# autoset locking type to clusted when lvmconf tool is available
|
||||
if [ -x "$LVMCONF" ]; then
|
||||
$LVMCONF --enable-cluster > /dev/null 2>&1
|
||||
fi
|
||||
|
||||
status_clvmd; rc=$?
|
||||
if [ $rc == $OCF_NOT_RUNNING ]; then
|
||||
bringup_clvmd; rc=$?
|
||||
if [ $rc != $OCF_SUCCESS ]; then
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
|
||||
status_cmirrord; rc=$?
|
||||
if [ $rc == $OCF_NOT_RUNNING ]; then
|
||||
bringup_cmirrord; rc=$?
|
||||
if [ $rc != $OCF_SUCCESS ]; then
|
||||
kill_clvmd
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
clvmd_stop() {
|
||||
clvmd_validate
|
||||
ocf_log info "Stopping $OCF_RESOURCE_INSTANCE"
|
||||
|
||||
status_clvmd; rc=$?
|
||||
if [ $rc != $OCF_NOT_RUNNING ]; then
|
||||
kill_clvmd; krc=$?
|
||||
if [ $krc != $OCF_SUCCESS ]; then
|
||||
ocf_log err "Failed to stop clvmd"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
|
||||
status_cmirrord; rc=$?
|
||||
if [ $rc != $OCF_NOT_RUNNING ]; then
|
||||
kill_cmirrord; krc=$?
|
||||
if [ $krc != $OCF_SUCCESS ]; then
|
||||
ocf_log err "Failed to stop cmirrord"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
clvmd_monitor() {
|
||||
clvmd_validate
|
||||
|
||||
status_daemons
|
||||
return $?
|
||||
}
|
||||
|
||||
clvmd_usage() {
|
||||
echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
|
||||
echo " Expects to have a fully populated OCF RA-compliant environment set."
|
||||
echo " In particualr, a value for OCF_ROOT"
|
||||
}
|
||||
|
||||
clvmd_validate() {
|
||||
: TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED
|
||||
case ${OCF_RESKEY_CRM_meta_globally_unique} in
|
||||
yes|Yes|true|True|1)
|
||||
ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute"
|
||||
exit $OCF_ERR_CONFIGURED
|
||||
;;
|
||||
esac
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="clvmd">
|
||||
<version>1.0</version>
|
||||
<longdesc lang="en">
|
||||
This is a Resource Agent for both clvmd and cmirrord.
|
||||
It starts clvmd and cmirrord as anonymous clones.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">clvmd resource agent</shortdesc>
|
||||
<parameters>
|
||||
|
||||
<parameter name="daemon_timeout" unique="0">
|
||||
<longdesc lang="en">
|
||||
Number of seconds to allow the control daemon to come up and down
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Daemon Timeout</shortdesc>
|
||||
<content type="string" default="80"/>
|
||||
</parameter>
|
||||
|
||||
<parameter name="daemon_options" unique="0">
|
||||
<longdesc lang="en">
|
||||
Options to clvmd. Refer to clvmd.8 for detailed descriptions.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Daemon Options</shortdesc>
|
||||
<content type="string" default="-d0"/>
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
<actions>
|
||||
<action name="start" timeout="90"/>
|
||||
<action name="stop" timeout="100"/>
|
||||
<action name="monitor" timeout="20" depth="0"/>
|
||||
<action name="meta-data" timeout="5"/>
|
||||
<action name="validate-all" timeout="30"/>
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
case $__OCF_ACTION in
|
||||
meta-data) meta_data
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
start) clvmd_start
|
||||
;;
|
||||
stop) clvmd_stop
|
||||
;;
|
||||
monitor) clvmd_monitor
|
||||
;;
|
||||
validate-all) clvmd_validate
|
||||
;;
|
||||
usage|help) clvmd_usage
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
*) clvmd_usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
235
cmirrord.ocf
235
cmirrord.ocf
@ -1,235 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Copyright (c) 2008 Xinwei Hu All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of version 2 of the GNU General Public License as
|
||||
# published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Further, this software is distributed without any warranty that it is
|
||||
# free of the rightful claim of any third person regarding infringement
|
||||
# or the like. Any license provided herein, whether implied or
|
||||
# otherwise, applies only to this software file. Patent licenses, if
|
||||
# any, provided herein do not apply to combinations of this program with
|
||||
# other software, or any other product whatsoever.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write the Free Software Foundation,
|
||||
# Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
# OCF initialization
|
||||
. ${OCF_ROOT}/resource.d/heartbeat/.ocf-shellfuncs
|
||||
|
||||
# Parameter defaults
|
||||
: ${OCF_RESKEY_CRM_meta_globally_unique:="false"}
|
||||
: ${OCF_RESKEY_daemon_timeout:="80"}
|
||||
|
||||
sbindir=$HA_SBIN_DIR
|
||||
|
||||
# Common variables
|
||||
DAEMON="${sbindir}/cmirrord"
|
||||
|
||||
time_to_seconds() {
|
||||
local val
|
||||
val=$1
|
||||
case $val in
|
||||
*h) echo $(( $(echo $val | sed -e "s/h$//") * 3600 ));;
|
||||
*ms) echo $(( $(echo $val | sed -e "s/ms$//") / 1000 ));;
|
||||
*s) echo $val | sed -e "s/s$//";;
|
||||
*m) echo $(( $(echo $val | sed -e "s/m$//") * 60 ));;
|
||||
*) echo "$val";;
|
||||
esac
|
||||
}
|
||||
|
||||
OCF_RESKEY_daemon_timeout=$(time_to_seconds ${OCF_RESKEY_daemon_timeout})
|
||||
|
||||
status_daemon()
|
||||
{
|
||||
PID=`pidofproc "$DAEMON"`
|
||||
if [ -n "$PID" ]; then
|
||||
return $OCF_SUCCESS
|
||||
fi
|
||||
return $OCF_NOT_RUNNING
|
||||
}
|
||||
|
||||
bringup_daemon()
|
||||
{
|
||||
if [ ! -e "$DAEMON" ]; then
|
||||
ocf_log err "Required binary not found: $DAEMON"
|
||||
return $OCF_ERR_INSTALLED
|
||||
fi
|
||||
|
||||
start_daemon "$DAEMON"; rc=$?
|
||||
if [ $rc != 0 ]; then
|
||||
ocf_log err "Could not start $DAEMON"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
|
||||
sleep 1
|
||||
COUNT=0
|
||||
rc=$OCF_NOT_RUNNING
|
||||
|
||||
while [ $rc = $OCF_NOT_RUNNING ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $DAEMON` did not come up"
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
status_daemon; rc=$?
|
||||
sleep 1
|
||||
done
|
||||
|
||||
return $rc
|
||||
}
|
||||
|
||||
kill_daemon()
|
||||
{
|
||||
status_daemon; rc=$?
|
||||
if [ $rc != $OCF_SUCCESS ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
ocf_log info "Stopping `basename "$DAEMON"`"
|
||||
killproc -INT "$DAEMON"
|
||||
|
||||
sleep 1
|
||||
status_daemon; rc=$?
|
||||
|
||||
COUNT=0
|
||||
while [ $rc = $OCF_SUCCESS ]; do
|
||||
COUNT=`expr $COUNT + 1`
|
||||
if [ $COUNT -gt $OCF_RESKEY_daemon_timeout ]; then
|
||||
ocf_log err "`basename $DAEMON` shutdown emergency"
|
||||
killproc -9 "$DAEMON"
|
||||
status_daemon; rc=$?
|
||||
if [ $rc = $OCF_NOT_RUNNING ]; then
|
||||
return $OCF_SUCCESS
|
||||
else
|
||||
return $OCF_ERR_GENERIC
|
||||
fi
|
||||
fi
|
||||
killproc -INT "$DAEMON"
|
||||
sleep 1
|
||||
status_daemon; rc=$?
|
||||
done
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
cmirrord_start() {
|
||||
|
||||
cmirrord_monitor; rc=$?
|
||||
if [ $rc != $OCF_NOT_RUNNING ]; then
|
||||
return $rc
|
||||
fi
|
||||
|
||||
ocf_log info "Starting $OCF_RESOURCE_INSTANCE"
|
||||
|
||||
bringup_daemon
|
||||
return $?
|
||||
}
|
||||
|
||||
cmirrord_stop() {
|
||||
cmirrord_monitor; rc=$?
|
||||
case $rc in
|
||||
$OCF_NOT_RUNNING) return $OCF_SUCCESS;;
|
||||
esac
|
||||
|
||||
ocf_log info "Stopping $OCF_RESOURCE_INSTANCE"
|
||||
|
||||
kill_daemon
|
||||
}
|
||||
|
||||
cmirrord_monitor() {
|
||||
cmirrord_validate
|
||||
|
||||
status_daemon
|
||||
return $?
|
||||
}
|
||||
|
||||
cmirrord_usage() {
|
||||
echo "usage: $0 {start|stop|monitor|validate-all|meta-data}"
|
||||
echo " Expects to have a fully populated OCF RA-compliant environment set."
|
||||
echo " In particualr, a value for OCF_ROOT"
|
||||
}
|
||||
|
||||
cmirrord_validate() {
|
||||
: TODO: check for globally_unique=true and return OCF_ERR_CONFIGURED
|
||||
case ${OCF_RESKEY_CRM_meta_globally_unique} in
|
||||
yes|Yes|true|True|1)
|
||||
ocf_log err "$OCF_RESOURCE_INSTANCE must be configured with the globally_unique=false meta attribute"
|
||||
exit $OCF_ERR_CONFIGURED
|
||||
;;
|
||||
esac
|
||||
|
||||
return $OCF_SUCCESS
|
||||
}
|
||||
|
||||
meta_data() {
|
||||
cat <<END
|
||||
<?xml version="1.0"?>
|
||||
<!DOCTYPE resource-agent SYSTEM "ra-api-1.dtd">
|
||||
<resource-agent name="cmirrord">
|
||||
<version>1.0</version>
|
||||
<longdesc lang="en">
|
||||
This is a cmirrord Resource Agent.
|
||||
It starts cmirrord as anonymous clones.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">cmirrord resource agent</shortdesc>
|
||||
<parameters>
|
||||
|
||||
<parameter name="daemon_timeout" unique="0">
|
||||
<longdesc lang="en">
|
||||
Number of seconds to allow the control daemon to come up and down
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Daemon Timeout</shortdesc>
|
||||
<content type="string" default="80"/>
|
||||
</parameter>
|
||||
|
||||
<parameter name="daemon_options" unique="0">
|
||||
<longdesc lang="en">
|
||||
Options to cmirrord. Cmirrord actually doesn't accept any options
|
||||
for now.
|
||||
</longdesc>
|
||||
<shortdesc lang="en">Daemon Options</shortdesc>
|
||||
<content type="string" default=""/>
|
||||
</parameter>
|
||||
|
||||
</parameters>
|
||||
<actions>
|
||||
<action name="start" timeout="90"/>
|
||||
<action name="stop" timeout="100"/>
|
||||
<action name="monitor" timeout="20" depth="0"/>
|
||||
<action name="meta-data" timeout="5"/>
|
||||
<action name="validate-all" timeout="30"/>
|
||||
</actions>
|
||||
</resource-agent>
|
||||
END
|
||||
}
|
||||
|
||||
case $__OCF_ACTION in
|
||||
meta-data) meta_data
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
start) cmirrord_start
|
||||
;;
|
||||
stop) cmirrord_stop
|
||||
;;
|
||||
monitor) cmirrord_monitor
|
||||
;;
|
||||
validate-all) cmirrord_validate
|
||||
;;
|
||||
usage|help) cmirrord_usage
|
||||
exit $OCF_SUCCESS
|
||||
;;
|
||||
*) cmirrord_usage
|
||||
exit $OCF_ERR_UNIMPLEMENTED
|
||||
;;
|
||||
esac
|
||||
|
||||
exit $?
|
@ -1,161 +0,0 @@
|
||||
Index: LVM2.2.02.111/daemons/cmirrord/cluster.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.111.orig/daemons/cmirrord/cluster.c
|
||||
+++ LVM2.2.02.111/daemons/cmirrord/cluster.c
|
||||
@@ -358,6 +358,10 @@ static int handle_cluster_response(struc
|
||||
/* FIXME: Ensure memcpy cannot explode */
|
||||
memcpy(orig_rq, rq, sizeof(*rq) + rq->u_rq.data_size);
|
||||
|
||||
+ /* make sure the response of DM_ULOG_FLUSH has no payload */
|
||||
+ if (orig_rq->u_rq.request_type == DM_ULOG_FLUSH)
|
||||
+ orig_rq->u_rq.data_size = 0;
|
||||
+
|
||||
r = kernel_send(&orig_rq->u_rq);
|
||||
if (r)
|
||||
LOG_ERROR("Failed to send response to kernel");
|
||||
Index: LVM2.2.02.111/daemons/cmirrord/functions.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.111.orig/daemons/cmirrord/functions.c
|
||||
+++ LVM2.2.02.111/daemons/cmirrord/functions.c
|
||||
@@ -374,7 +374,7 @@ static int find_disk_path(char *major_mi
|
||||
// return r ? -errno : 0;
|
||||
}
|
||||
|
||||
-static int _clog_ctr(char *uuid, uint64_t luid,
|
||||
+static int _clog_ctr(char *uuid, uint64_t luid, uint32_t version,
|
||||
int argc, char **argv, uint64_t device_size)
|
||||
{
|
||||
int i;
|
||||
@@ -443,6 +443,8 @@ static int _clog_ctr(char *uuid, uint64_
|
||||
log_sync = NOSYNC;
|
||||
else if (!strcmp(argv[i], "block_on_error"))
|
||||
block_on_error = 1;
|
||||
+ else if (!strcmp(argv[i], "integrated_flush") && version > 2)
|
||||
+ LOG_PRINT("support integrated_flush");
|
||||
}
|
||||
|
||||
lc = dm_zalloc(sizeof(*lc));
|
||||
@@ -608,7 +610,7 @@ static int clog_ctr(struct dm_ulog_reque
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
- r = _clog_ctr(rq->uuid, rq->luid, argc - 1, argv + 1, device_size);
|
||||
+ r = _clog_ctr(rq->uuid, rq->luid, rq->version, argc - 1, argv + 1, device_size);
|
||||
|
||||
/* We join the CPG when we resume */
|
||||
|
||||
@@ -1053,12 +1055,14 @@ static int clog_in_sync(struct dm_ulog_r
|
||||
return 0;
|
||||
}
|
||||
|
||||
+static int _clog_mark_region(struct log_c * lc, struct dm_ulog_request *rq, uint32_t originator);
|
||||
+
|
||||
/*
|
||||
* clog_flush
|
||||
* @rq
|
||||
*
|
||||
*/
|
||||
-static int clog_flush(struct dm_ulog_request *rq, int server)
|
||||
+static int clog_flush(struct dm_ulog_request *rq, uint32_t originator, int server)
|
||||
{
|
||||
int r = 0;
|
||||
struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||
@@ -1069,6 +1073,15 @@ static int clog_flush(struct dm_ulog_req
|
||||
if (!lc->touched)
|
||||
return 0;
|
||||
|
||||
+ /* flush has payload to mark region */
|
||||
+ if(rq->data_size) {
|
||||
+ r = _clog_mark_region(lc, rq, originator);
|
||||
+ if (r) {
|
||||
+ LOG_ERROR("mark region failed in integrated flush");
|
||||
+ return r;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
/*
|
||||
* Do the actual flushing of the log only
|
||||
* if we are the server.
|
||||
@@ -1131,25 +1144,11 @@ static int mark_region(struct log_c *lc,
|
||||
return 0;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * clog_mark_region
|
||||
- * @rq
|
||||
- *
|
||||
- * rq may contain more than one mark request. We
|
||||
- * can determine the number from the 'data_size' field.
|
||||
- *
|
||||
- * Returns: 0 on success, -EXXX on failure
|
||||
- */
|
||||
-static int clog_mark_region(struct dm_ulog_request *rq, uint32_t originator)
|
||||
+static int _clog_mark_region(struct log_c * lc, struct dm_ulog_request *rq, uint32_t originator)
|
||||
{
|
||||
int r;
|
||||
int count;
|
||||
uint64_t *region;
|
||||
- struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||
-
|
||||
- if (!lc)
|
||||
- return -EINVAL;
|
||||
-
|
||||
if (rq->data_size % sizeof(uint64_t)) {
|
||||
LOG_ERROR("Bad data size given for mark_region request");
|
||||
return -EINVAL;
|
||||
@@ -1169,6 +1168,25 @@ static int clog_mark_region(struct dm_ul
|
||||
return 0;
|
||||
}
|
||||
|
||||
+/*
|
||||
+ * clog_mark_region
|
||||
+ * @rq
|
||||
+ *
|
||||
+ * rq may contain more than one mark request. We
|
||||
+ * can determine the number from the 'data_size' field.
|
||||
+ *
|
||||
+ * Returns: 0 on success, -EXXX on failure
|
||||
+ */
|
||||
+static int clog_mark_region(struct dm_ulog_request *rq, uint32_t originator)
|
||||
+{
|
||||
+ struct log_c *lc = get_log(rq->uuid, rq->luid);
|
||||
+
|
||||
+ if (!lc)
|
||||
+ return -EINVAL;
|
||||
+
|
||||
+ return _clog_mark_region(lc, rq, originator);
|
||||
+}
|
||||
+
|
||||
static int clear_region(struct log_c *lc, uint64_t region, uint32_t who)
|
||||
{
|
||||
int other_matches = 0;
|
||||
@@ -1700,7 +1718,7 @@ int do_request(struct clog_request *rq,
|
||||
r = clog_in_sync(&rq->u_rq);
|
||||
break;
|
||||
case DM_ULOG_FLUSH:
|
||||
- r = clog_flush(&rq->u_rq, server);
|
||||
+ r = clog_flush(&rq->u_rq, rq->originator, server);
|
||||
break;
|
||||
case DM_ULOG_MARK_REGION:
|
||||
r = clog_mark_region(&rq->u_rq, rq->originator);
|
||||
Index: LVM2.2.02.111/libdm/libdm-deptree.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.111.orig/libdm/libdm-deptree.c
|
||||
+++ LVM2.2.02.111/libdm/libdm-deptree.c
|
||||
@@ -2254,10 +2254,12 @@ static int _mirror_emit_segment_line(str
|
||||
return_0;
|
||||
}
|
||||
|
||||
- if (dm_log_userspace)
|
||||
- EMIT_PARAMS(pos, "userspace %u %s clustered-%s",
|
||||
- log_parm_count, seg->uuid, logtype);
|
||||
- else
|
||||
+ /* for cluster raid1, use integrated flush to improve performance */
|
||||
+ if (dm_log_userspace) {
|
||||
+ log_parm_count ++; /* for integrated_flush */
|
||||
+ EMIT_PARAMS(pos, "userspace %u %s %s clustered-%s",
|
||||
+ log_parm_count, seg->uuid, "integrated_flush", logtype);
|
||||
+ } else
|
||||
EMIT_PARAMS(pos, "%s %u", logtype, log_parm_count);
|
||||
|
||||
if (seg->log)
|
@ -1,3 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 23 07:50:33 UTC 2017 - zren@suse.com
|
||||
|
||||
- Update to LVM2.2.02.175
|
||||
- Use week dependency for lvm2-lockd on libdlm and sanlock
|
||||
- Rename/refresh patches:
|
||||
- display-dm-name-for-lv-name.diff to fate-309425_display-dm-name-for-lv-name.patch
|
||||
- fsadm-add-support-for-btrfs.patch to fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
- dmeventd-fix-dso-name-wrong-compare.patch to bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
- lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch to bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
- simplify-special-case-for-md-in-69-dm-lvm-metadata.patch to bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 14 09:51:18 UTC 2017 - zren@suse.com
|
||||
|
||||
- Drop resource agents for clvmd and cmirror (bsc#1058680)
|
||||
- clvmd.ocf
|
||||
- cmirrord.ocf
|
||||
- Drop all patches for cmirror (bsc#1058661)
|
||||
- cluster_support_mirrord_log.diff
|
||||
- cmirrord_improvment_performance.patch
|
||||
- lvconvert-cluster-mirrored-disk-failed.patch
|
||||
- improve-mirror-legs-on-different-tag-pvs.patch
|
||||
- make-mirror-legs-on-different-tag-pvs.patch
|
||||
- use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 18 09:53:39 UTC 2017 - mwilck@suse.com
|
||||
|
||||
@ -21,6 +47,7 @@ Tue Aug 1 05:59:29 UTC 2017 - zren@suse.com
|
||||
- pvcreate-enhance-the-error-message.patch
|
||||
- pvmove_support_clustered_vg.diff
|
||||
- version-plugins-in-libdir.patch
|
||||
- lvm2-testsuite.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 25 13:48:00 UTC 2017 - zren@suse.com
|
||||
|
@ -19,8 +19,8 @@
|
||||
%define libname libdevmapper1_03
|
||||
%define libname_event libdevmapper-event1_03
|
||||
### COMMON-DEF-BEGIN ###
|
||||
%define lvm2_version 2.02.173
|
||||
%define device_mapper_version 1.02.142
|
||||
%define lvm2_version 2.02.175
|
||||
%define device_mapper_version 1.02.144
|
||||
%define thin_provisioning_version 0.7.0
|
||||
### COMMON-DEF-END ###
|
||||
Name: device-mapper
|
||||
@ -52,27 +52,17 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
# Never upstream
|
||||
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
||||
#fate#309425
|
||||
Patch1002: display-dm-name-for-lv-name.diff
|
||||
#fate#312248
|
||||
Patch1003: make-mirror-legs-on-different-tag-pvs.patch
|
||||
Patch1004: improve-mirror-legs-on-different-tag-pvs.patch
|
||||
#fate#315092
|
||||
Patch1005: cmirrord_improvment_performance.patch
|
||||
#fate#314367
|
||||
Patch1006: cluster_support_mirrord_log.diff
|
||||
Patch1007: lvconvert-cluster-mirrored-disk-failed.patch
|
||||
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
|
||||
#FATE#318413
|
||||
Patch1008: fsadm-add-support-for-btrfs.patch
|
||||
#bnc#870824
|
||||
Patch1009: use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
#bsc#935623
|
||||
Patch1010: dmeventd-fix-dso-name-wrong-compare.patch
|
||||
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
#bsc#960044
|
||||
Patch1011: lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
Patch1005: bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
|
||||
#SUSE patches 2000+ for device mapper, udev rules
|
||||
#bsc#1012973
|
||||
Patch2006: simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
Patch2006: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
### COMMON-PATCH-END ###
|
||||
|
||||
%description
|
||||
@ -86,12 +76,6 @@ Programs and man pages for configuring and using the device mapper.
|
||||
%patch1003 -p1
|
||||
%patch1004 -p1
|
||||
%patch1005 -p1
|
||||
%patch1006 -p1
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%patch1009 -p1
|
||||
%patch1010 -p1
|
||||
%patch1011 -p1
|
||||
%patch2006 -p1
|
||||
### COMMON-PREP-END ###
|
||||
|
||||
@ -100,7 +84,8 @@ extra_opts=""
|
||||
|
||||
### COMMON-CONFIG-BEGIN ###
|
||||
export PATH=$PATH:/sbin:%{_prefix}/sbin
|
||||
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
|
||||
# Why this messy fix here? someone released a wrong version...
|
||||
sed -ie "s/1.02.*/1.03.01/g" VERSION_DM
|
||||
%configure \
|
||||
--enable-dmeventd \
|
||||
--enable-cmdlib \
|
||||
|
@ -1,77 +0,0 @@
|
||||
From 69092b1179f4fbd0fae7e054665ad049dffd9966 Mon Sep 17 00:00:00 2001
|
||||
From: Guangliang Zhao <gzhao@suse.com>
|
||||
Date: Wed, 5 Dec 2012 18:25:04 +0800
|
||||
Subject: [PATCH 2/2] mirror: improve mirror legs on different tag pvs
|
||||
|
||||
This patch will find the biggest eligible area every time,
|
||||
and add it to the parallel areas.
|
||||
|
||||
The previous just find the different tag pv area with all
|
||||
found ones, if the new area's tag has appeared, just throw
|
||||
it. The new will compare the length, and choose the longer
|
||||
one.
|
||||
|
||||
Signed-off-by: Guangliang Zhao <gzhao@suse.com>
|
||||
---
|
||||
lib/metadata/lv_manip.c | 34 +++++++++++++++++++++++++++++++---
|
||||
1 file changed, 31 insertions(+), 3 deletions(-)
|
||||
|
||||
Index: LVM2.2.02.139/lib/metadata/lv_manip.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.139.orig/lib/metadata/lv_manip.c
|
||||
+++ LVM2.2.02.139/lib/metadata/lv_manip.c
|
||||
@@ -2518,6 +2518,25 @@ static uint32_t _calc_required_extents(s
|
||||
return required;
|
||||
}
|
||||
|
||||
+static void _replace_required_area(struct alloc_handle *ah,
|
||||
+ uint32_t max_to_allocate,
|
||||
+ unsigned ix_pva, struct pv_area *pva,
|
||||
+ struct alloc_state *alloc_state,
|
||||
+ alloc_policy_t alloc)
|
||||
+{
|
||||
+ uint32_t required = _calc_required_extents(ah, pva, ix_pva,
|
||||
+ max_to_allocate, alloc);
|
||||
+
|
||||
+ /*
|
||||
+ * We don't worry about the area replaced, because _clear_areas() and
|
||||
+ * _reset_unreserved() called by _find_some_parallel_space() will clear
|
||||
+ * the alloc_state and reserved areas every time.
|
||||
+ */
|
||||
+ if (required > alloc_state->areas[ix_pva - 1].used)
|
||||
+ _reserve_area(ah, alloc_state, pva, required, ix_pva - 1,
|
||||
+ pva->unreserved);
|
||||
+}
|
||||
+
|
||||
static void _clear_areas(struct alloc_state *alloc_state)
|
||||
{
|
||||
uint32_t s;
|
||||
@@ -2646,6 +2665,7 @@ static int _find_some_parallel_space(str
|
||||
const struct alloc_parms *alloc_parms = alloc_state->alloc_parms;
|
||||
unsigned ix = 0;
|
||||
unsigned last_ix;
|
||||
+ int ret;
|
||||
struct pv_map *pvm;
|
||||
struct pv_area *pva;
|
||||
unsigned preferred_count = 0;
|
||||
@@ -2766,9 +2786,17 @@ static int _find_some_parallel_space(str
|
||||
continue;
|
||||
|
||||
case USE_AREA:
|
||||
- if(check_areas_separate_tags(ah, alloc_state, alloc_state->num_positional_areas,
|
||||
- ix + alloc_state->num_positional_areas, pva) >= 0)
|
||||
- goto next_pv;
|
||||
+ ret = check_areas_separate_tags(ah,
|
||||
+ alloc_state, alloc_state->num_positional_areas,
|
||||
+ ix + alloc_state->num_positional_areas, pva);
|
||||
+ if (ret >= 0) {
|
||||
+ _replace_required_area(ah,
|
||||
+ max_to_allocate,
|
||||
+ ret + 1, pva,
|
||||
+ alloc_state,
|
||||
+ alloc_parms->alloc);
|
||||
+ continue;
|
||||
+ }
|
||||
|
||||
/*
|
||||
* Except with ALLOC_ANYWHERE, replace first area with this
|
@ -1,47 +0,0 @@
|
||||
---
|
||||
daemons/clvmd/lvm-functions.c | 11 +++++++----
|
||||
1 file changed, 7 insertions(+), 4 deletions(-)
|
||||
|
||||
--- a/daemons/clvmd/lvm-functions.c
|
||||
+++ b/daemons/clvmd/lvm-functions.c
|
||||
@@ -416,16 +416,18 @@ error:
|
||||
/* Resume the LV if it was active */
|
||||
static int do_resume_lv(char *resource, unsigned char command, unsigned char lock_flags)
|
||||
{
|
||||
- int oldmode, origin_only, exclusive, revert;
|
||||
+ int oldmode, origin_only, exclusive = 0, revert;
|
||||
|
||||
+#if 0
|
||||
/* Is it open ? */
|
||||
oldmode = get_current_lock(resource);
|
||||
if (oldmode == -1 && (command & LCK_CLUSTER_VG)) {
|
||||
DEBUGLOG("do_resume_lv, lock not already held\n");
|
||||
return 0; /* We don't need to do anything */
|
||||
}
|
||||
- origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
|
||||
exclusive = (oldmode == LCK_EXCL) ? 1 : 0;
|
||||
+#endif
|
||||
+ origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
|
||||
revert = (lock_flags & LCK_REVERT_MODE) ? 1 : 0;
|
||||
|
||||
if (!lv_resume_if_active(cmd, resource, origin_only, exclusive, revert, NULL))
|
||||
@@ -439,16 +441,17 @@ static int do_suspend_lv(char *resource,
|
||||
{
|
||||
int oldmode;
|
||||
unsigned origin_only = (lock_flags & LCK_ORIGIN_ONLY_MODE) ? 1 : 0;
|
||||
- unsigned exclusive;
|
||||
+ unsigned exclusive = 0;
|
||||
|
||||
+#if 0
|
||||
/* Is it open ? */
|
||||
oldmode = get_current_lock(resource);
|
||||
if (oldmode == -1 && (command & LCK_CLUSTER_VG)) {
|
||||
DEBUGLOG("do_suspend_lv, lock not already held\n");
|
||||
return 0; /* Not active, so it's OK */
|
||||
}
|
||||
-
|
||||
exclusive = (oldmode == LCK_EXCL) ? 1 : 0;
|
||||
+#endif
|
||||
|
||||
/* Always call lv_suspend to read commited and precommited data */
|
||||
if (!lv_suspend_if_active(cmd, resource, origin_only, exclusive, NULL, NULL))
|
@ -1,3 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 23 07:50:33 UTC 2017 - zren@suse.com
|
||||
|
||||
- Update to LVM2.2.02.175
|
||||
- Use week dependency for lvm2-lockd on libdlm and sanlock
|
||||
- Rename/refresh patches:
|
||||
- display-dm-name-for-lv-name.diff to fate-309425_display-dm-name-for-lv-name.patch
|
||||
- fsadm-add-support-for-btrfs.patch to fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
- dmeventd-fix-dso-name-wrong-compare.patch to bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
- lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch to bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
- simplify-special-case-for-md-in-69-dm-lvm-metadata.patch to bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 14 09:51:18 UTC 2017 - zren@suse.com
|
||||
|
||||
- Drop resource agents for clvmd and cmirror (bsc#1058680)
|
||||
- clvmd.ocf
|
||||
- cmirrord.ocf
|
||||
- Drop all patches for cmirror (bsc#1058661)
|
||||
- cluster_support_mirrord_log.diff
|
||||
- cmirrord_improvment_performance.patch
|
||||
- lvconvert-cluster-mirrored-disk-failed.patch
|
||||
- improve-mirror-legs-on-different-tag-pvs.patch
|
||||
- make-mirror-legs-on-different-tag-pvs.patch
|
||||
- use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 18 09:53:39 UTC 2017 - mwilck@suse.com
|
||||
|
||||
@ -21,6 +47,7 @@ Tue Aug 1 05:59:29 UTC 2017 - zren@suse.com
|
||||
- pvcreate-enhance-the-error-message.patch
|
||||
- pvmove_support_clustered_vg.diff
|
||||
- version-plugins-in-libdir.patch
|
||||
- lvm2-testsuite.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 25 13:48:00 UTC 2017 - zren@suse.com
|
||||
|
@ -19,8 +19,8 @@
|
||||
%define dlm_version 3.99.1
|
||||
%define sanlock_version 3.3.0
|
||||
### COMMON-DEF-BEGIN ###
|
||||
%define lvm2_version 2.02.173
|
||||
%define device_mapper_version 1.02.142
|
||||
%define lvm2_version 2.02.175
|
||||
%define device_mapper_version 1.02.144
|
||||
%define thin_provisioning_version 0.7.0
|
||||
### COMMON-DEF-END ###
|
||||
Name: lvm2-clvm
|
||||
@ -32,8 +32,6 @@ Group: Productivity/Clustering/HA
|
||||
Url: http://sources.redhat.com/cluster/clvm/
|
||||
Source: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz
|
||||
Source1: ftp://sources.redhat.com/pub/lvm2/LVM2.%{lvm2_version}.tgz.asc
|
||||
Source2: clvmd.ocf
|
||||
Source3: cmirrord.ocf
|
||||
BuildRequires: libcorosync-devel
|
||||
BuildRequires: libdlm-devel >= %{dlm_version}
|
||||
BuildRequires: pkgconfig
|
||||
@ -55,27 +53,17 @@ Provides: cmirrord = %{version}
|
||||
# Never upstream
|
||||
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
||||
#fate#309425
|
||||
Patch1002: display-dm-name-for-lv-name.diff
|
||||
#fate#312248
|
||||
Patch1003: make-mirror-legs-on-different-tag-pvs.patch
|
||||
Patch1004: improve-mirror-legs-on-different-tag-pvs.patch
|
||||
#fate#315092
|
||||
Patch1005: cmirrord_improvment_performance.patch
|
||||
#fate#314367
|
||||
Patch1006: cluster_support_mirrord_log.diff
|
||||
Patch1007: lvconvert-cluster-mirrored-disk-failed.patch
|
||||
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
|
||||
#FATE#318413
|
||||
Patch1008: fsadm-add-support-for-btrfs.patch
|
||||
#bnc#870824
|
||||
Patch1009: use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
#bsc#935623
|
||||
Patch1010: dmeventd-fix-dso-name-wrong-compare.patch
|
||||
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
#bsc#960044
|
||||
Patch1011: lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
Patch1005: bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
|
||||
#SUSE patches 2000+ for device mapper, udev rules
|
||||
#bsc#1012973
|
||||
Patch2006: simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
Patch2006: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
### COMMON-PATCH-END ###
|
||||
|
||||
%description
|
||||
@ -90,12 +78,6 @@ A daemon for using LVM2 Logival Volumes in a clustered environment.
|
||||
%patch1003 -p1
|
||||
%patch1004 -p1
|
||||
%patch1005 -p1
|
||||
%patch1006 -p1
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%patch1009 -p1
|
||||
%patch1010 -p1
|
||||
%patch1011 -p1
|
||||
%patch2006 -p1
|
||||
### COMMON-PREP-END ###
|
||||
|
||||
@ -119,7 +101,8 @@ extra_opts="
|
||||
|
||||
### COMMON-CONFIG-BEGIN ###
|
||||
export PATH=$PATH:/sbin:%{_prefix}/sbin
|
||||
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
|
||||
# Why this messy fix here? someone released a wrong version...
|
||||
sed -ie "s/1.02.*/1.03.01/g" VERSION_DM
|
||||
%configure \
|
||||
--enable-dmeventd \
|
||||
--enable-cmdlib \
|
||||
@ -156,10 +139,6 @@ make DESTDIR=%{buildroot} install -C daemons/cmirrord
|
||||
install -m0644 -D man/lvmlockd.8 %{buildroot}%{_mandir}/man8/lvmlockd.8
|
||||
install -m0644 -D man/lvmlockctl.8 %{buildroot}%{_mandir}/man8/lvmlockctl.8
|
||||
|
||||
# ocf files
|
||||
install -m755 -D %{SOURCE2} "%{buildroot}/%{_libexecdir}/ocf/resource.d/lvm2/clvmd"
|
||||
install -m755 -D %{SOURCE3} "%{buildroot}/%{_libexecdir}/ocf/resource.d/lvm2/cmirrord"
|
||||
|
||||
# rc services symlinks
|
||||
ln -s service %{buildroot}%{_sbindir}/rclvm2-cluster-activation
|
||||
ln -s service %{buildroot}%{_sbindir}/rclvm2-clvmd
|
||||
@ -185,10 +164,6 @@ rm %{buildroot}%{_unitdir}/lvm2-pvscan@.service
|
||||
%{_sbindir}/clvmd
|
||||
%{_sbindir}/rclvm2-cluster-activation
|
||||
%{_sbindir}/rclvm2-clvmd
|
||||
%dir %{_libexecdir}/ocf
|
||||
%dir %{_libexecdir}/ocf/resource.d
|
||||
%dir %{_libexecdir}/ocf/resource.d/lvm2
|
||||
%{_libexecdir}/ocf/resource.d/lvm2/clvmd
|
||||
%{_unitdir}/lvm2-clvmd.service
|
||||
%{_unitdir}/lvm2-cluster-activation.service
|
||||
%{_libexecdir}/systemd/lvm2-cluster-activation
|
||||
@ -208,7 +183,6 @@ A daemon for using LVM2 Logival Volumes in a clustered environment.
|
||||
%files -n lvm2-cmirrord
|
||||
%defattr(-,root,root)
|
||||
%{_sbindir}/cmirrord
|
||||
%{_libexecdir}/ocf/resource.d/lvm2/cmirrord
|
||||
%{_libexecdir}/systemd/system/lvm2-cmirrord.service
|
||||
%{_sbindir}/rclvm2-cmirrord
|
||||
%{_mandir}/man8/cmirrord.8%{ext_man}
|
||||
@ -216,8 +190,8 @@ A daemon for using LVM2 Logival Volumes in a clustered environment.
|
||||
%package -n lvm2-lockd
|
||||
Summary: LVM locking daemon
|
||||
Group: Productivity/Clustering/HA
|
||||
Requires: libdlm >= %{dlm_version}
|
||||
Requires: libsanlock1 >= %{sanlock_version}
|
||||
Recommends: libdlm >= %{dlm_version}
|
||||
Recommends: libsanlock1 >= %{sanlock_version}
|
||||
Requires: lvm2 = %{version}
|
||||
%{?systemd_requires}
|
||||
|
||||
|
27
lvm2.changes
27
lvm2.changes
@ -1,3 +1,29 @@
|
||||
-------------------------------------------------------------------
|
||||
Mon Oct 23 07:50:33 UTC 2017 - zren@suse.com
|
||||
|
||||
- Update to LVM2.2.02.175
|
||||
- Use week dependency for lvm2-lockd on libdlm and sanlock
|
||||
- Rename/refresh patches:
|
||||
- display-dm-name-for-lv-name.diff to fate-309425_display-dm-name-for-lv-name.patch
|
||||
- fsadm-add-support-for-btrfs.patch to fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
- dmeventd-fix-dso-name-wrong-compare.patch to bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
- lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch to bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
- simplify-special-case-for-md-in-69-dm-lvm-metadata.patch to bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Thu Sep 14 09:51:18 UTC 2017 - zren@suse.com
|
||||
|
||||
- Drop resource agents for clvmd and cmirror (bsc#1058680)
|
||||
- clvmd.ocf
|
||||
- cmirrord.ocf
|
||||
- Drop all patches for cmirror (bsc#1058661)
|
||||
- cluster_support_mirrord_log.diff
|
||||
- cmirrord_improvment_performance.patch
|
||||
- lvconvert-cluster-mirrored-disk-failed.patch
|
||||
- improve-mirror-legs-on-different-tag-pvs.patch
|
||||
- make-mirror-legs-on-different-tag-pvs.patch
|
||||
- use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Fri Aug 18 09:53:39 UTC 2017 - mwilck@suse.com
|
||||
|
||||
@ -21,6 +47,7 @@ Tue Aug 1 05:59:29 UTC 2017 - zren@suse.com
|
||||
- pvcreate-enhance-the-error-message.patch
|
||||
- pvmove_support_clustered_vg.diff
|
||||
- version-plugins-in-libdir.patch
|
||||
- lvm2-testsuite.patch
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Tue Jul 25 13:48:00 UTC 2017 - zren@suse.com
|
||||
|
40
lvm2.spec
40
lvm2.spec
@ -21,8 +21,8 @@
|
||||
%define cmdlib liblvm2cmd2_02
|
||||
|
||||
### COMMON-DEF-BEGIN ###
|
||||
%define lvm2_version 2.02.173
|
||||
%define device_mapper_version 1.02.142
|
||||
%define lvm2_version 2.02.175
|
||||
%define device_mapper_version 1.02.144
|
||||
%define thin_provisioning_version 0.7.0
|
||||
### COMMON-DEF-END ###
|
||||
|
||||
@ -63,33 +63,22 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
||||
# Never upstream
|
||||
Patch1001: cmirrord_remove_date_time_from_compilation.patch
|
||||
#fate#309425
|
||||
Patch1002: display-dm-name-for-lv-name.diff
|
||||
#fate#312248
|
||||
Patch1003: make-mirror-legs-on-different-tag-pvs.patch
|
||||
Patch1004: improve-mirror-legs-on-different-tag-pvs.patch
|
||||
#fate#315092
|
||||
Patch1005: cmirrord_improvment_performance.patch
|
||||
#fate#314367
|
||||
Patch1006: cluster_support_mirrord_log.diff
|
||||
Patch1007: lvconvert-cluster-mirrored-disk-failed.patch
|
||||
Patch1002: fate-309425_display-dm-name-for-lv-name.patch
|
||||
#FATE#318413
|
||||
Patch1008: fsadm-add-support-for-btrfs.patch
|
||||
#bnc#870824
|
||||
Patch1009: use-mirrortype-asdefault-whenclvmdrunning.patch
|
||||
Patch1003: fate-31841_fsadm-add-support-for-btrfs.patch
|
||||
#bsc#935623
|
||||
Patch1010: dmeventd-fix-dso-name-wrong-compare.patch
|
||||
Patch1004: bug-935623_dmeventd-fix-dso-name-wrong-compare.patch
|
||||
#bsc#960044
|
||||
Patch1011: lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
Patch1005: bug-960044_lvm2-lvmetad.service-add-Also-lvm2-lvmetad.socket.patch
|
||||
|
||||
#SUSE patches 2000+ for device mapper, udev rules
|
||||
#bsc#1012973
|
||||
Patch2006: simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
Patch2006: bug-1012973_simplify-special-case-for-md-in-69-dm-lvm-metadata.patch
|
||||
### COMMON-PATCH-END ###
|
||||
|
||||
# 3000+ for test code
|
||||
#bnc#950089
|
||||
Patch3001: lvm2-testsuite.patch
|
||||
#bsc#1043040
|
||||
Patch3001: bug-950089_test-fix-lvm2-testsuite-build-error.patch
|
||||
Patch3002: bug-1043040_test-fix-read-ahead-issues-in-test-scripts.patch
|
||||
|
||||
#bsc#1037309
|
||||
@ -107,12 +96,6 @@ Volume Manager.
|
||||
%patch1003 -p1
|
||||
%patch1004 -p1
|
||||
%patch1005 -p1
|
||||
%patch1006 -p1
|
||||
%patch1007 -p1
|
||||
%patch1008 -p1
|
||||
%patch1009 -p1
|
||||
%patch1010 -p1
|
||||
%patch1011 -p1
|
||||
%patch2006 -p1
|
||||
### COMMON-PREP-END ###
|
||||
|
||||
@ -136,7 +119,8 @@ extra_opts="
|
||||
|
||||
### COMMON-CONFIG-BEGIN ###
|
||||
export PATH=$PATH:/sbin:%{_prefix}/sbin
|
||||
sed -ie "s/%{device_mapper_version}/1.03.01/g" VERSION_DM
|
||||
# Why this messy fix here? someone released a wrong version...
|
||||
sed -ie "s/1.02.*/1.03.01/g" VERSION_DM
|
||||
%configure \
|
||||
--enable-dmeventd \
|
||||
--enable-cmdlib \
|
||||
@ -201,8 +185,8 @@ rm %{buildroot}%{_unitdir}/dm-event.service
|
||||
rm %{buildroot}%{_unitdir}/lvm2-lvmlockd.service
|
||||
rm %{buildroot}%{_unitdir}/lvm2-lvmlocking.service
|
||||
rm %{buildroot}%{_includedir}/libdevmapper*.h
|
||||
rm %{buildroot}%{_libdir}/libdevmapper.so.1.03
|
||||
rm %{buildroot}%{_libdir}/libdevmapper-event.so.1.03
|
||||
rm %{buildroot}%{_libdir}/libdevmapper.so.*
|
||||
rm %{buildroot}%{_libdir}/libdevmapper-event.so.*
|
||||
rm %{buildroot}%{_libdir}/libdevmapper.so
|
||||
rm %{buildroot}%{_libdir}/libdevmapper-event.so
|
||||
rm %{buildroot}%{_libdir}/pkgconfig/devmapper*.pc
|
||||
|
@ -1,179 +0,0 @@
|
||||
From a83a3ec7292197bd870cae570ed545267899bc5e Mon Sep 17 00:00:00 2001
|
||||
From: Eric Ren <zren@suse.com>
|
||||
Date: Tue, 4 Jul 2017 19:42:14 +0800
|
||||
Subject: [PATCH 1/2] mirror: make mirror legs on different tag pvs
|
||||
|
||||
The mirror legs could be placed on the PVs(with different tags)
|
||||
from the other mirror legs with this patch.
|
||||
|
||||
The lvcreate allocates the replica "randomly" when creating
|
||||
a mirrored logical volume now, so it could happen that both
|
||||
copies end up on the same array (or on the same site), clearly
|
||||
undesired.
|
||||
|
||||
We can't control the fist allocation, because didn't restrict
|
||||
the areas into parallel space. This patch add the limit when
|
||||
finding areas for parallel space, so that mirror legs will
|
||||
always be placed on pvs with differnt tags.
|
||||
|
||||
Signed-off-by: Guangliang Zhao <gzhao@suse.com>
|
||||
Refreshed-by: Eric Ren <zren@suse.com>
|
||||
---
|
||||
conf/example.conf.in | 17 +++++++++++++++++
|
||||
lib/config/config_settings.h | 5 ++++-
|
||||
lib/config/defaults.h | 1 +
|
||||
lib/metadata/lv_manip.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
man/lvcreate.8_pregen | 7 +++++++
|
||||
5 files changed, 64 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/conf/example.conf.in b/conf/example.conf.in
|
||||
index b5b0e6a..947a3cf 100644
|
||||
--- a/conf/example.conf.in
|
||||
+++ b/conf/example.conf.in
|
||||
@@ -372,6 +372,23 @@ allocation {
|
||||
# or erased unless the --wipesignatures option is used directly.
|
||||
wipe_signatures_when_zeroing_new_lvs = 1
|
||||
|
||||
+ # Set to 1 to guarantee that mirror leg will always be placed on
|
||||
+ # different PVs(with different tags) from the other mirror legs.
|
||||
+ #
|
||||
+ # If you want to enable this feature, the following conditions
|
||||
+ # must be met:
|
||||
+ # 1) The mirror_legs_require_separate_pvs must be set to 1, the
|
||||
+ # default value is 0.
|
||||
+ # 2) The cling_tag_list must be activated.
|
||||
+ # 3) The length of all pvs with same tag must greater than or equal
|
||||
+ # to the mirror's.
|
||||
+
|
||||
+ # This feature is only for the first allocation, on the other hand
|
||||
+ # when creating new mirrored lvs.
|
||||
+ # Please note that the commond may fail if the number of all tags
|
||||
+ # on the pvs less than the mirror legs number.
|
||||
+ mirror_legs_require_separate_pvs = 0
|
||||
+
|
||||
# Configuration option allocation/mirror_logs_require_separate_pvs.
|
||||
# Mirror logs and images will always use different PVs.
|
||||
# The default setting changed in version 2.02.85.
|
||||
diff --git a/lib/config/config_settings.h b/lib/config/config_settings.h
|
||||
index 40b64ab..59eed26 100644
|
||||
--- a/lib/config/config_settings.h
|
||||
+++ b/lib/config/config_settings.h
|
||||
@@ -474,7 +474,10 @@ cfg(allocation_raid_stripe_all_devices_CFG, "raid_stripe_all_devices", allocatio
|
||||
"stripes to use.\n"
|
||||
"This was the default behaviour until release 2.02.162.\n")
|
||||
|
||||
-cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL, 0, NULL,
|
||||
+cfg(allocation_mirror_legs_require_separate_pvs_CFG, "mirror_legs_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS, vsn(2, 2, 98), NULL, 0, NULL,
|
||||
+ "Mirror legs will always use different PVs.\n")
|
||||
+
|
||||
+cfg(allocation_cache_pool_metadata_require_separate_pvs_CFG, "cache_pool_metadata_require_separate_pvs", allocation_CFG_SECTION, 0, CFG_TYPE_BOOL, DEFAULT_CACHE_POOL_METADATA_REQUIRE_SEPARATE_PVS, vsn(2, 2, 106), NULL, 0, NULL,
|
||||
"Cache pool metadata and data will always use different PVs.\n")
|
||||
|
||||
cfg(allocation_cache_pool_cachemode_CFG, "cache_pool_cachemode", allocation_CFG_SECTION, CFG_PROFILABLE | CFG_PROFILABLE_METADATA | CFG_DEFAULT_COMMENTED, CFG_TYPE_STRING, DEFAULT_CACHE_MODE, vsn(2, 2, 113), NULL, vsn(2, 2, 128),
|
||||
diff --git a/lib/config/defaults.h b/lib/config/defaults.h
|
||||
index d9e19d9..e5134e4 100644
|
||||
--- a/lib/config/defaults.h
|
||||
+++ b/lib/config/defaults.h
|
||||
@@ -161,6 +161,7 @@
|
||||
#define DEFAULT_MAX_LV 0
|
||||
#define DEFAULT_ALLOC_POLICY ALLOC_NORMAL
|
||||
#define DEFAULT_MIRROR_LOGS_REQUIRE_SEPARATE_PVS 0
|
||||
+#define DEFAULT_MIRROR_LEGS_REQUIRE_SEPARATE_PVS 0
|
||||
#define DEFAULT_MAXIMISE_CLING 1
|
||||
#define DEFAULT_CLUSTERED 0
|
||||
|
||||
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
|
||||
index f75cf51..8dc90b4 100644
|
||||
--- a/lib/metadata/lv_manip.c
|
||||
+++ b/lib/metadata/lv_manip.c
|
||||
@@ -1622,6 +1622,9 @@ struct alloc_handle {
|
||||
|
||||
unsigned maximise_cling;
|
||||
unsigned mirror_logs_separate; /* Force mirror logs on separate PVs? */
|
||||
+ unsigned mirror_legs_separate; /* Force mirror *legs* on separate PVs*/
|
||||
+
|
||||
+ const struct segment_type *segtype;
|
||||
|
||||
/*
|
||||
* RAID devices require a metadata area that accompanies each
|
||||
@@ -2736,6 +2739,32 @@ static int _limit_to_one_area_per_tag(struct alloc_handle *ah, struct alloc_stat
|
||||
}
|
||||
|
||||
/*
|
||||
+ * Return -1 if we don't need check tags, or there aren't any areas in alloc_status
|
||||
+ * have the same tag with pva, the index otherwise.
|
||||
+ */
|
||||
+static int check_areas_separate_tags(struct alloc_handle *ah,
|
||||
+ struct alloc_state *alloc_state,
|
||||
+ unsigned ix_start,
|
||||
+ unsigned ix_end,
|
||||
+ struct pv_area *pva)
|
||||
+{
|
||||
+ int i;
|
||||
+
|
||||
+ if (!segtype_is_mirrored(ah->segtype) ||
|
||||
+ alloc_state->allocated ||
|
||||
+ !ah->mirror_legs_separate ||
|
||||
+ !ah->cling_tag_list_cn)
|
||||
+ return -1;
|
||||
+
|
||||
+ for (i = ix_start; i < ix_end; i++)
|
||||
+ if(_pvs_have_matching_tag(ah->cling_tag_list_cn,
|
||||
+ alloc_state->areas[i].pva->map->pv,
|
||||
+ pva->map->pv, 0))
|
||||
+ return i;
|
||||
+ return -1;
|
||||
+}
|
||||
+
|
||||
+/*
|
||||
* Returns 1 regardless of whether any space was found, except on error.
|
||||
*/
|
||||
static int _find_some_parallel_space(struct alloc_handle *ah,
|
||||
@@ -2865,6 +2894,10 @@ static int _find_some_parallel_space(struct alloc_handle *ah,
|
||||
continue;
|
||||
|
||||
case USE_AREA:
|
||||
+ if(check_areas_separate_tags(ah, alloc_state, alloc_state->num_positional_areas,
|
||||
+ ix + alloc_state->num_positional_areas, pva) >= 0)
|
||||
+ goto next_pv;
|
||||
+
|
||||
/*
|
||||
* Except with ALLOC_ANYWHERE, replace first area with this
|
||||
* one which is smaller but still big enough.
|
||||
@@ -3355,6 +3388,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
|
||||
ah->parity_count = parity_count;
|
||||
ah->region_size = region_size;
|
||||
ah->alloc = alloc;
|
||||
+ ah->segtype = segtype;
|
||||
|
||||
/*
|
||||
* For the purposes of allocation, area_count and parity_count are
|
||||
@@ -3366,6 +3400,7 @@ static struct alloc_handle *_alloc_init(struct cmd_context *cmd,
|
||||
ah->area_multiple = _calc_area_multiple(segtype, area_count + parity_count, stripes);
|
||||
//FIXME: s/mirror_logs_separate/metadata_separate/ so it can be used by others?
|
||||
ah->mirror_logs_separate = find_config_tree_bool(cmd, allocation_mirror_logs_require_separate_pvs_CFG, NULL);
|
||||
+ ah->mirror_legs_separate = find_config_tree_bool(cmd, allocation_mirror_legs_require_separate_pvs_CFG, NULL);
|
||||
|
||||
if (mirrors || stripes)
|
||||
total_extents = new_extents;
|
||||
diff --git a/man/lvcreate.8_pregen b/man/lvcreate.8_pregen
|
||||
index 6b05147..7c1beab 100644
|
||||
--- a/man/lvcreate.8_pregen
|
||||
+++ b/man/lvcreate.8_pregen
|
||||
@@ -415,6 +415,13 @@ Create a raid10 LV.
|
||||
[ \fB-I\fP|\fB--stripesize\fP \fISize\fP[k|UNIT] ]
|
||||
.ad b
|
||||
.br
|
||||
+Every leg of the mirrored logical volume could be placed on the pvs with
|
||||
+same tag, see details(mirror_legs_require_separate_pvs) in lvm.conf.
|
||||
+
|
||||
+.br
|
||||
+Using \fBmirrored\fP will create a persistent log that is itself mirrored.
|
||||
+.
|
||||
+.HP
|
||||
.ad l
|
||||
[ \fB-R\fP|\fB--regionsize\fP \fISize\fP[m|UNIT] ]
|
||||
.ad b
|
||||
--
|
||||
2.10.2
|
||||
|
@ -1,46 +0,0 @@
|
||||
---
|
||||
tools/lvcreate.c | 28 ++++++++++++++++++++++++++--
|
||||
1 file changed, 26 insertions(+), 2 deletions(-)
|
||||
|
||||
Index: LVM2.2.02.152/tools/lvcreate.c
|
||||
===================================================================
|
||||
--- LVM2.2.02.152.orig/tools/lvcreate.c
|
||||
+++ LVM2.2.02.152/tools/lvcreate.c
|
||||
@@ -639,6 +639,28 @@ static int _read_activation_params(struc
|
||||
return 1;
|
||||
}
|
||||
|
||||
+static int clvmd_daemon_is_running(void)
|
||||
+{
|
||||
+ int fd;
|
||||
+ struct flock lock;
|
||||
+
|
||||
+ if((fd = open("/var/run/cmirrord.pid", O_RDONLY)) < 0)
|
||||
+ return 0;
|
||||
+
|
||||
+ lock.l_type = F_WRLCK;
|
||||
+ lock.l_start = 0;
|
||||
+ lock.l_whence = SEEK_SET;
|
||||
+ lock.l_len = 0;
|
||||
+ if (fcntl(fd, F_GETLK, &lock) < 0) {
|
||||
+ /* errors with fcntl */
|
||||
+ close(fd);
|
||||
+ return 0;
|
||||
+ }
|
||||
+
|
||||
+ close(fd);
|
||||
+ return (lock.l_type == F_UNLCK) ? 0 : 1;
|
||||
+}
|
||||
+
|
||||
static int _lvcreate_params(struct cmd_context *cmd,
|
||||
int argc, char **argv,
|
||||
struct lvcreate_params *lp,
|
||||
@@ -689,6 +711,8 @@ static int _lvcreate_params(struct cmd_c
|
||||
mirror_default_cfg = (arg_uint_value(cmd, stripes_ARG, 1) > 1)
|
||||
? global_raid10_segtype_default_CFG : global_mirror_segtype_default_CFG;
|
||||
segtype_str = find_config_tree_str(cmd, mirror_default_cfg, NULL);
|
||||
+ if(clvmd_daemon_is_running())
|
||||
+ segtype_str = "mirror";
|
||||
} else
|
||||
segtype_str = SEG_TYPE_NAME_STRIPED;
|
||||
|
Loading…
Reference in New Issue
Block a user