[sheepdog] [PATCH] dog: check correct number of required nodes for newly created VDIs
Hitoshi Mitake
mitake.hitoshi at lab.ntt.co.jp
Tue Jan 21 13:43:11 CET 2014
Current dog compares a number of copies of newly created VDIs and a
number of nodes. But the number of copies should be compared to a
number of zones when the VDIs are replicated disks.
Signed-off-by: Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>
---
dog/vdi.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/dog/vdi.c b/dog/vdi.c
index ec2c0b3..18d7f37 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -580,6 +580,7 @@ static int vdi_create(int argc, char **argv)
uint64_t oid;
uint32_t idx, max_idx, ret, nr_copies = vdi_cmd_data.nr_copies;
struct sd_inode *inode = NULL;
+ int nr_required_nodes;
if (!argv[optind]) {
sd_err("Please specify the VDI size");
@@ -602,9 +603,11 @@ static int vdi_create(int argc, char **argv)
return EXIT_USAGE;
}
- if (nr_copies > sd_nodes_nr) {
+ nr_required_nodes = 0 < vdi_cmd_data.copy_policy ?
+ sd_nodes_nr : sd_zones_nr;
+ if (nr_required_nodes < nr_copies) {
sd_err("There are not enough nodes(%d) to hold the copies(%d)",
- sd_nodes_nr, nr_copies);
+ sd_nodes_nr, nr_required_nodes);
return EXIT_USAGE;
}
--
1.7.10.4
More information about the sheepdog
mailing list