[sheepdog] [PATCH v1 1/3] sheep: don't allow it to plug new disk for pure gateway

Robin Dong robin.k.dong at gmail.com
Wed Jun 18 10:48:56 CEST 2014


From: Robin Dong <sanbai at taobao.com>

A sheep daemon which is lauched as pure gateway can't (and also don't need)
to add data path.

Signed-off-by: Robin Dong <sanbai at taobao.com>
---
 sheep/md.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sheep/md.c b/sheep/md.c
index 29f263f..db9fb76 100644
--- a/sheep/md.c
+++ b/sheep/md.c
@@ -802,6 +802,11 @@ static int do_plug_unplug(char *disks, bool plug)
 	path = strtok(disks, ",");
 	do {
 		if (plug) {
+			/* Not allowed to plug disk for pure gateway */
+			if (md.nr_disks == 0 || sys->this_node.nr_vnodes == 0) {
+				ret = SD_RES_NETWORK_ERROR;
+				goto out;
+			}
 			if (!md_add_disk(path, true))
 				sd_err("failed to add %s", path);
 		} else {
-- 
1.7.12.4




More information about the sheepdog mailing list