FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 11-02-2009, 01:20 PM
Zdenek Kabelac
 
Default Replicator: vg validation

Validate replicator segments

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/metadata/metadata.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 64 insertions(+), 0 deletions(-)

diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c
index 67ba551..ebb2f16 100644
--- a/lib/metadata/metadata.c
+++ b/lib/metadata/metadata.c
@@ -2088,6 +2088,67 @@ void lv_calculate_readahead(const struct logical_volume *lv, uint32_t *read_ahea
}
}

+/*
+ * Check for duplicate
+ * site name
+ * site index
+ * device name
+ * device index
+ */
+static int _replicator_validate(const struct logical_volume *lv)
+{
+ struct replicator_site *rsite, *rsiteb;
+ struct replicator_device *rdev, *rdevb;
+ int r = 1;
+
+ dm_list_iterate_items(rsite, &lv->rsites) {
+ dm_list_iterate_items(rsiteb, &lv->rsites) {
+ if (rsite == rsiteb)
+ break;
+ if (strcasecmp(rsite->name, rsiteb->name) == 0) {
+ log_error("Internal error: Duplicate site name "
+ "%s detected for replicator %s",
+ rsite->name, lv->name);
+ r = 0;
+ }
+ if (rsite->site_index == rsiteb->site_index) {
+ log_error("Internal error: Duplicate site index "
+ "%d detected for replicator %s/%s",
+ rsite->site_index, lv->name, rsite->name);
+ r = 0;
+ }
+ }
+
+ dm_list_iterate_items(rdev, &rsite->rdevices) {
+ dm_list_iterate_items(rdevb, &rsite->rdevices) {
+ if (rdev == rdevb)
+ break;
+ log_error("devs: lv:%s %s", rdev->name, rdevb->name);
+ if (rdev->slog && (rdev->slog == rdevb->slog)) {
+ log_error("Internal error: Duplicate sync log "
+ "%s detected for replicator %s",
+ rdev->slog->name, lv->name);
+ r = 0;
+ }
+ if (strcasecmp(rdev->name, rdevb->name) == 0) {
+ log_error("Internal error: Duplicate device name "
+ "%s detected for replicator %s",
+ rdev->name, lv->name);
+ r = 0;
+ }
+ if (rdev->device_index == rdevb->device_index) {
+ log_error("Internal error: Duplicate device index %"
+ PRId64 " detected for replicator %s/%s",
+ rdev->device_index, lv->name, rsite->name);
+ r = 0;
+ }
+ }
+ }
+ }
+
+ return r;
+}
+
int vg_validate(struct volume_group *vg)
{
struct pv_list *pvl, *pvl2;
@@ -2188,6 +2249,9 @@ int vg_validate(struct volume_group *vg)
r = 0;
}
}
+
+ if (lv_is_replicator(lvl->lv) && !_replicator_validate(lvl->lv))
+ r = 0;
}

dm_list_iterate_items(lvl, &vg->lvs) {
--
1.6.5.1

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 06:10 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org