What we want to do here are: 1. When sheepdog is already running - increment epoch - write node list information to the local store 2. Otherwise - get vdi bitmap from other nodes - update cluster information in the local store Signed-off-by: MORITA Kazutaka <morita.kazutaka at lab.ntt.co.jp> --- sheep/group.c | 32 +++++++++++++++++--------------- 1 files changed, 17 insertions(+), 15 deletions(-) diff --git a/sheep/group.c b/sheep/group.c index 752baff..dbe3141 100644 --- a/sheep/group.c +++ b/sheep/group.c @@ -629,21 +629,23 @@ out: msg->header.nodeid, msg->header.pid); if (msg->cluster_status == SD_STATUS_OK) { - nr_nodes = get_ordered_sd_node_list(entry); - - dprintf("update epoch, %d, %d\n", sys->epoch + 1, nr_nodes); - ret = epoch_log_write(sys->epoch + 1, (char *)entry, - nr_nodes * sizeof(struct sheepdog_node_list_entry)); - if (ret < 0) - eprintf("can't write epoch %u\n", sys->epoch + 1); + if (sys->status == SD_STATUS_OK) { + nr_nodes = get_ordered_sd_node_list(entry); - sys->epoch++; + dprintf("update epoch, %d, %d\n", sys->epoch + 1, nr_nodes); + ret = epoch_log_write(sys->epoch + 1, (char *)entry, + nr_nodes * sizeof(struct sheepdog_node_list_entry)); + if (ret < 0) + eprintf("can't write epoch %u\n", sys->epoch + 1); - update_epoch_store(sys->epoch); + sys->epoch++; - get_vdi_bitmap_from_all(); - set_global_nr_copies(sys->nr_sobjs); - set_cluster_ctime(msg->ctime); + update_epoch_store(sys->epoch); + } else { + get_vdi_bitmap_from_all(); + set_global_nr_copies(sys->nr_sobjs); + set_cluster_ctime(msg->ctime); + } } print_node_list(&sys->sd_node_list); -- 1.5.6.5 |