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: add replicator to dtree

Adding all replicator related LVs to dtree.
Start of one replicator_dev initiate start of all other related.

Signed-off-by: Zdenek Kabelac <zkabelac@redhat.com>
---
lib/activate/dev_manager.c | 49 +++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 1 deletions(-)

diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c
index 1f1d645..00f3cf3 100644
--- a/lib/activate/dev_manager.c
+++ b/lib/activate/dev_manager.c
@@ -951,6 +951,47 @@ static int _add_target_to_dtree(struct dev_manager *dm,
static int _add_new_lv_to_dtree(struct dev_manager *dm, struct dm_tree *dtree,
struct logical_volume *lv, const char *layer);

+/* Add all replicators' LVs from active segment */
+static int _add_replicator_dev_target_to_dtree(struct dev_manager *dm,
+ struct dm_tree *dtree,
+ struct lv_segment *seg)
+{
+ struct replicator_device *rdev;
+ struct replicator_site *rsite;
+
+ /* only active replicator */
+ if (lv_is_active_replicator_dev(seg->lv)) {
+ /* activation of one replicator node activate all other nodes */
+ if (!seg->replicator ||
+ !_add_new_lv_to_dtree(dm, dtree, seg->replicator, NULL))
+ return_0;
+
+ dm_list_iterate_items(rsite, &seg->replicator->rsites) {
+ dm_list_iterate_items(rdev, &rsite->rdevices) {
+ if (rdev->slog && !_add_new_lv_to_dtree(dm, dtree, rdev->slog, NULL))
+ return_0;
+ if ((rsite->state == REPLICATOR_STATE_ACTIVE) &&
+ (!rdev->lv || !_add_new_lv_to_dtree(dm, dtree, rdev->lv, NULL)))
+ return_0;
+ }
+ }
+ dm_list_iterate_items(rsite, &seg->replicator->rsites) {
+ if (rsite->state != REPLICATOR_STATE_ACTIVE)
+ continue;
+ dm_list_iterate_items(rdev, &rsite->rdevices) {
+ if (rdev->replicator_dev->lv == seg->lv)
+ continue;
+ if (!rdev->replicator_dev->lv ||
+ !_add_new_lv_to_dtree(dm, dtree, rdev->replicator_dev->lv, NULL))
+ return_0;
+ }
+ }
+ } else if (!_add_new_lv_to_dtree(dm, dtree, seg->lv->rdevice->lv, NULL))
+ return_0;
+
+ return 1;
+}
+
static int _add_segment_to_dtree(struct dev_manager *dm,
struct dm_tree *dtree,
struct dm_tree_node *dnode,
@@ -981,8 +1022,14 @@ static int _add_segment_to_dtree(struct dev_manager *dm,
!_add_new_lv_to_dtree(dm, dtree, seg->log_lv, NULL))
return_0;

+ if (seg_is_replicator_dev(seg)) {
+ if (!_add_replicator_dev_target_to_dtree(dm, dtree, seg))
+ return_0;
+ } else if (seg_is_replicator(seg) && seg->rlog_lv) {
+ if (!_add_new_lv_to_dtree(dm, dtree, seg->rlog_lv, NULL))
+ return_0;
/* If this is a snapshot origin, add real LV */
- if (lv_is_origin(seg->lv) && !layer) {
+ } else if (lv_is_origin(seg->lv) && !layer) {
if (vg_is_clustered(seg->lv->vg)) {
log_error("Clustered snapshots are not yet supported");
return 0;
--
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 07:10 PM.

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