[sheepdog] [PATCH v2 5/5] erasure: allow y >= x in x:y scheme

Liu Yuan namei.unix at gmail.com
Sat Oct 26 14:17:51 CEST 2013


There is no technically reason that we must have y < x. So better remove this
condition. One use case is for smaller cluster with 2:x scheme, where x >= 2

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 dog/vdi.c                |    5 ++--
 tests/functional/029     |   10 +++----
 tests/functional/029.out |   75 +++++++++++++++++++++++++++++++++-------------
 3 files changed, 61 insertions(+), 29 deletions(-)

diff --git a/dog/vdi.c b/dog/vdi.c
index dc3d1f1..6d00d36 100644
--- a/dog/vdi.c
+++ b/dog/vdi.c
@@ -2288,7 +2288,7 @@ static uint8_t parse_copy(const char *str, uint8_t *copy_policy)
 		return 0;
 
 	parity = strtol(n2, NULL, 10);
-	if (parity >= SD_EC_MAX_STRIP || parity >= copy || parity == 0)
+	if (parity >= SD_EC_MAX_STRIP || parity == 0)
 		return 0;
 
 	/*
@@ -2345,8 +2345,7 @@ static int vdi_parser(int ch, const char *opt)
 			       "  x(1 to %d)   - number of replicated copies\n"
 			       "To create erasure coded vdi, set -c x:y\n"
 			       "  x(2,4,8,16)  - number of data strips\n"
-			       "  y(1 to 15)   - number of parity strips\n"
-			       "and meet the condition x > y",
+			       "  y(1 to 15)   - number of parity strips",
 			       opt, SD_MAX_COPIES);
 			exit(EXIT_FAILURE);
 		}
diff --git a/tests/functional/029 b/tests/functional/029
index e0eb771..935abf4 100755
--- a/tests/functional/029
+++ b/tests/functional/029
@@ -18,10 +18,10 @@ done
 
 $DOG vdi create -c 4:2 test5 20M -P
 $DOG vdi create -c 4:3 test6 20M -P
-$DOG vdi create -c 4:4 fail 20M -P
-$DOG vdi create -c 4:5 fail 20M -P
-$DOG vdi create -c 16:7 test7 20M -P
-$DOG vdi create -c 16:8 fail 20M -P
+$DOG vdi create -c 4:4 test7 20M -P
+$DOG vdi create -c 4:5 test8 20M -P
+$DOG vdi create -c 16:7 test9 20M -P
+$DOG vdi create -c 16:16 fail 20M -P
 $DOG vdi snapshot -s tag test2
 $DOG vdi clone -s 1 test2 clone -c 3
 
@@ -40,7 +40,7 @@ $DOG vdi delete -s 1 test2
 
 _vdi_list
 
-for i in `seq 2 7`; do
+for i in `seq 2 9`; do
 	$DOG vdi object test$i -i 1;
 done
 
diff --git a/tests/functional/029.out b/tests/functional/029.out
index ea80196..af50642 100644
--- a/tests/functional/029.out
+++ b/tests/functional/029.out
@@ -1,37 +1,20 @@
 QA output created by 029
 using backend plain store
-Invalid parameter 4:4
+Invalid parameter 16:16
 To create replicated vdi, set -c x
   x(1 to 31)   - number of replicated copies
 To create erasure coded vdi, set -c x:y
   x(2,4,8,16)  - number of data strips
   y(1 to 15)   - number of parity strips
-and meet the condition x > y
-Invalid parameter 4:5
-To create replicated vdi, set -c x
-  x(1 to 31)   - number of replicated copies
-To create erasure coded vdi, set -c x:y
-  x(2,4,8,16)  - number of data strips
-  y(1 to 15)   - number of parity strips
-and meet the condition x > y
-There are not enough nodes(23) to hold the copies(24)
-Usage: dog vdi create [-P] [-c copies] [-a address] [-p port] [-h] [-r] [-v] <vdiname> <size>
-Options:
-  -P, --prealloc          preallocate all the data objects
-  -c, --copies            specify the data redundancy level
-  -a, --address           specify the daemon address (default: localhost)
-  -p, --port              specify the daemon port
-  -h, --help              display this help and exit
-  -r, --raw               raw output mode: omit headers, separate fields with
-                          single spaces and print all sizes in decimal bytes
-  -v, --verbose           print more information than default
   Name        Id    Size    Used  Shared    Creation time   VDI id  Copies  Tag
   test5        0   20 MB   20 MB  0.0 MB DATE   fd2c30     6              
   test4        0   20 MB   20 MB  0.0 MB DATE   fd2de3     4              
-  test7        0   20 MB   20 MB  0.0 MB DATE   fd2f96    23              
+  test7        0   20 MB   20 MB  0.0 MB DATE   fd2f96     8              
   test6        0   20 MB   20 MB  0.0 MB DATE   fd3149     7              
   test3        0   20 MB   20 MB  0.0 MB DATE   fd3662     3              
   test2        0   20 MB  0.0 MB   20 MB DATE   fd3816     2              
+  test9        0   20 MB   20 MB  0.0 MB DATE   fd4094    23              
+  test8        0   20 MB   20 MB  0.0 MB DATE   fd4247     9              
 Looking for the object 0xfd381500000001 (the inode vid 0xfd3816 idx 1) with 23 nodes
 
 127.0.0.1:7000 doesn't have the object
@@ -159,6 +142,56 @@ Looking for the object 0xfd314900000001 (the inode vid 0xfd3149 idx 1) with 23 n
 127.0.0.1:7024 has the object (should be 7 copies)
 Looking for the object 0xfd2f9600000001 (the inode vid 0xfd2f96 idx 1) with 23 nodes
 
+127.0.0.1:7000 doesn't have the object
+127.0.0.1:7001 has the object (should be 8 copies)
+127.0.0.1:7004 has the object (should be 8 copies)
+127.0.0.1:7005 doesn't have the object
+127.0.0.1:7006 has the object (should be 8 copies)
+127.0.0.1:7007 doesn't have the object
+127.0.0.1:7008 has the object (should be 8 copies)
+127.0.0.1:7009 doesn't have the object
+127.0.0.1:7010 doesn't have the object
+127.0.0.1:7011 doesn't have the object
+127.0.0.1:7012 has the object (should be 8 copies)
+127.0.0.1:7013 has the object (should be 8 copies)
+127.0.0.1:7014 has the object (should be 8 copies)
+127.0.0.1:7015 doesn't have the object
+127.0.0.1:7016 doesn't have the object
+127.0.0.1:7017 doesn't have the object
+127.0.0.1:7018 doesn't have the object
+127.0.0.1:7019 has the object (should be 8 copies)
+127.0.0.1:7020 doesn't have the object
+127.0.0.1:7021 doesn't have the object
+127.0.0.1:7022 doesn't have the object
+127.0.0.1:7023 doesn't have the object
+127.0.0.1:7024 doesn't have the object
+Looking for the object 0xfd424700000001 (the inode vid 0xfd4247 idx 1) with 23 nodes
+
+127.0.0.1:7000 doesn't have the object
+127.0.0.1:7001 doesn't have the object
+127.0.0.1:7004 has the object (should be 9 copies)
+127.0.0.1:7005 doesn't have the object
+127.0.0.1:7006 has the object (should be 9 copies)
+127.0.0.1:7007 doesn't have the object
+127.0.0.1:7008 doesn't have the object
+127.0.0.1:7009 doesn't have the object
+127.0.0.1:7010 has the object (should be 9 copies)
+127.0.0.1:7011 has the object (should be 9 copies)
+127.0.0.1:7012 doesn't have the object
+127.0.0.1:7013 doesn't have the object
+127.0.0.1:7014 has the object (should be 9 copies)
+127.0.0.1:7015 has the object (should be 9 copies)
+127.0.0.1:7016 doesn't have the object
+127.0.0.1:7017 doesn't have the object
+127.0.0.1:7018 doesn't have the object
+127.0.0.1:7019 doesn't have the object
+127.0.0.1:7020 doesn't have the object
+127.0.0.1:7021 doesn't have the object
+127.0.0.1:7022 has the object (should be 9 copies)
+127.0.0.1:7023 has the object (should be 9 copies)
+127.0.0.1:7024 has the object (should be 9 copies)
+Looking for the object 0xfd409400000001 (the inode vid 0xfd4094 idx 1) with 23 nodes
+
 127.0.0.1:7000 has the object (should be 23 copies)
 127.0.0.1:7001 has the object (should be 23 copies)
 127.0.0.1:7004 has the object (should be 23 copies)
-- 
1.7.9.5




More information about the sheepdog mailing list