Linux RAID subsystem development
 help / color / mirror / Atom feed
* [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
@ 2017-07-18  8:55 Xiao Ni
  2017-07-18  9:03 ` Paul Menzel
  2017-07-18 10:34 ` Zhilong Liu
  0 siblings, 2 replies; 6+ messages in thread
From: Xiao Ni @ 2017-07-18  8:55 UTC (permalink / raw)
  To: linux-raid; +Cc: jes.sorensen, zlliu

This case trys to allow raid5 reshape to use backwards direction.
It changes chunksize after reshape and stop the raid. Then start
the raid again.

Signed-off-by: Xiao Ni <xni@redhat.com>
Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
Suggested-by:  Zhilong Liu <zlliu@suse.com> 
---
 test           |  8 ++++++++
 tests/02r5grow | 16 ++++++++++++++++
 2 files changed, 24 insertions(+)

diff --git a/test b/test
index 87e2df2..51da2dc 100755
--- a/test
+++ b/test
@@ -320,6 +320,14 @@ check() {
 		grep -sq "inactive" /proc/mdstat ||
 			die "array is not inactive!"
 		;;
+	# It only can be used when there is only one raid
+	chunk )
+		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk '{print $1}' | sed s/k//g`
+		if [ $chunk_size -ne $2 ]; then
+			echo >&2 "chunksize is not right"
+			exit 1
+		fi
+		;;
 	* )
 		die "unknown check $1"
 		;;
diff --git a/tests/02r5grow b/tests/02r5grow
index 386e82e..20db4cd 100644
--- a/tests/02r5grow
+++ b/tests/02r5grow
@@ -34,3 +34,19 @@ check nosync
 sh tests/testdev $md0 3 $[size/2] 128
 
 mdadm -S $md0
+
+# create a raid5 array and change the chunk
+mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
+check wait
+check state UUU
+check chunk 32
+
+mdadm $md0 --grow --chunk=64
+check reshape
+check wait
+check chunk 64
+
+mdadm -S $md0
+mdadm -As
+check state UUU
+check chunk 64
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
  2017-07-18  8:55 [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape Xiao Ni
@ 2017-07-18  9:03 ` Paul Menzel
  2017-07-18  9:48   ` Xiao Ni
  2017-07-18 10:34 ` Zhilong Liu
  1 sibling, 1 reply; 6+ messages in thread
From: Paul Menzel @ 2017-07-18  9:03 UTC (permalink / raw)
  To: Xiao Ni; +Cc: linux-raid, Jes Sorensen, Zhilong Liu

Dear Xiao,


On 07/18/17 10:55, Xiao Ni wrote:
> This case trys to allow raid5 reshape to use backwards direction.

s/trys/tries/

> It changes chunksize after reshape and stop the raid. Then start

stop*s* and start*s*

> the raid again.
> 
> Signed-off-by: Xiao Ni <xni@redhat.com>
> Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
> Suggested-by:  Zhilong Liu <zlliu@suse.com>
> ---
>   test           |  8 ++++++++
>   tests/02r5grow | 16 ++++++++++++++++
>   2 files changed, 24 insertions(+)
> 
> diff --git a/test b/test
> index 87e2df2..51da2dc 100755
> --- a/test
> +++ b/test
> @@ -320,6 +320,14 @@ check() {
>   		grep -sq "inactive" /proc/mdstat ||
>   			die "array is not inactive!"
>   		;;
> +	# It only can be used when there is only one raid
> +	chunk )
> +		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk '{print $1}' | sed s/k//g`
> +		if [ $chunk_size -ne $2 ]; then
> +			echo >&2 "chunksize is not right"

Maybe output the two different values?

 > chunksize is not right. It should be … but is ….

> +			exit 1
> +		fi
> +		;;
>   	* )
>   		die "unknown check $1"
>   		;;
> diff --git a/tests/02r5grow b/tests/02r5grow
> index 386e82e..20db4cd 100644
> --- a/tests/02r5grow
> +++ b/tests/02r5grow
> @@ -34,3 +34,19 @@ check nosync
>   sh tests/testdev $md0 3 $[size/2] 128
>   
>   mdadm -S $md0
> +
> +# create a raid5 array and change the chunk
> +mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
> +check wait
> +check state UUU
> +check chunk 32
> +
> +mdadm $md0 --grow --chunk=64
> +check reshape
> +check wait
> +check chunk 64
> +
> +mdadm -S $md0
> +mdadm -As
> +check state UUU
> +check chunk 64

Do you need to run `mdadm -S $md0` after the assembly again?


Kind regards,

Paul

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
  2017-07-18  9:03 ` Paul Menzel
@ 2017-07-18  9:48   ` Xiao Ni
  0 siblings, 0 replies; 6+ messages in thread
From: Xiao Ni @ 2017-07-18  9:48 UTC (permalink / raw)
  To: Paul Menzel; +Cc: linux-raid, Jes Sorensen, Zhilong Liu



----- Original Message -----
> From: "Paul Menzel" <pmenzel@molgen.mpg.de>
> To: "Xiao Ni" <xni@redhat.com>
> Cc: linux-raid@vger.kernel.org, "Jes Sorensen" <jes.sorensen@gmail.com>, "Zhilong Liu" <zlliu@suse.com>
> Sent: Tuesday, July 18, 2017 5:03:11 PM
> Subject: Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
> 
> Dear Xiao,
> 
> 
> On 07/18/17 10:55, Xiao Ni wrote:
> > This case trys to allow raid5 reshape to use backwards direction.
> 
> s/trys/tries/
> 
> > It changes chunksize after reshape and stop the raid. Then start
> 
> stop*s* and start*s*

Thanks for pointing these errors. I should be more careful. 

> 
> > the raid again.
> > 
> > Signed-off-by: Xiao Ni <xni@redhat.com>
> > Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
> > Suggested-by:  Zhilong Liu <zlliu@suse.com>
> > ---
> >   test           |  8 ++++++++
> >   tests/02r5grow | 16 ++++++++++++++++
> >   2 files changed, 24 insertions(+)
> > 
> > diff --git a/test b/test
> > index 87e2df2..51da2dc 100755
> > --- a/test
> > +++ b/test
> > @@ -320,6 +320,14 @@ check() {
> >   		grep -sq "inactive" /proc/mdstat ||
> >   			die "array is not inactive!"
> >   		;;
> > +	# It only can be used when there is only one raid
> > +	chunk )
> > +		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk
> > '{print $1}' | sed s/k//g`
> > +		if [ $chunk_size -ne $2 ]; then
> > +			echo >&2 "chunksize is not right"
> 
> Maybe output the two different values?
> 
>  > chunksize is not right. It should be … but is ….

Sure, it's better to give the values. 
> 
> > +			exit 1
> > +		fi
> > +		;;
> >   	* )
> >   		die "unknown check $1"
> >   		;;
> > diff --git a/tests/02r5grow b/tests/02r5grow
> > index 386e82e..20db4cd 100644
> > --- a/tests/02r5grow
> > +++ b/tests/02r5grow
> > @@ -34,3 +34,19 @@ check nosync
> >   sh tests/testdev $md0 3 $[size/2] 128
> >   
> >   mdadm -S $md0
> > +
> > +# create a raid5 array and change the chunk
> > +mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3
> > --size $[size/2] $dev1 $dev2 $dev3
> > +check wait
> > +check state UUU
> > +check chunk 32
> > +
> > +mdadm $md0 --grow --chunk=64
> > +check reshape
> > +check wait
> > +check chunk 64
> > +
> > +mdadm -S $md0
> > +mdadm -As
> > +check state UUU
> > +check chunk 64
> 
> Do you need to run `mdadm -S $md0` after the assembly again?

Yes, it should be stopped again.

Regards
Xiao
> 
> 
> Kind regards,
> 
> Paul
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
  2017-07-18  8:55 [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape Xiao Ni
  2017-07-18  9:03 ` Paul Menzel
@ 2017-07-18 10:34 ` Zhilong Liu
  2017-07-19  5:54   ` Xiao Ni
  1 sibling, 1 reply; 6+ messages in thread
From: Zhilong Liu @ 2017-07-18 10:34 UTC (permalink / raw)
  To: Xiao Ni, linux-raid; +Cc: jes.sorensen



On 07/18/2017 04:55 PM, Xiao Ni wrote:
> This case trys to allow raid5 reshape to use backwards direction.
> It changes chunksize after reshape and stop the raid. Then start
> the raid again.
>
> Signed-off-by: Xiao Ni <xni@redhat.com>
> Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
> Suggested-by:  Zhilong Liu <zlliu@suse.com>
> ---
>   test           |  8 ++++++++
>   tests/02r5grow | 16 ++++++++++++++++
>   2 files changed, 24 insertions(+)
>
> diff --git a/test b/test
> index 87e2df2..51da2dc 100755
> --- a/test
> +++ b/test
> @@ -320,6 +320,14 @@ check() {
>   		grep -sq "inactive" /proc/mdstat ||
>   			die "array is not inactive!"
>   		;;
> +	# It only can be used when there is only one raid
> +	chunk )
> +		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk '{print $1}' | sed s/k//g`

Hi,
   only from my opinion, how about shrink the command:
# awk -F',' '/chunk/{print $2}' /proc/mdstat | awk -F'[a-z]' '{print $1}'
> +		if [ $chunk_size -ne $2 ]; then
> +			echo >&2 "chunksize is not right"
> +			exit 1
> +		fi

how about using the func die()
[  "$chunk_size" -ne "$2" ] &&
   die "chunk should be $2, but is $chunk_size"

Thanks,
-Zhilong

> +		;;
>   	* )
>   		die "unknown check $1"
>   		;;
> diff --git a/tests/02r5grow b/tests/02r5grow
> index 386e82e..20db4cd 100644
> --- a/tests/02r5grow
> +++ b/tests/02r5grow
> @@ -34,3 +34,19 @@ check nosync
>   sh tests/testdev $md0 3 $[size/2] 128
>   
>   mdadm -S $md0
> +
> +# create a raid5 array and change the chunk
> +mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3 --size $[size/2] $dev1 $dev2 $dev3
> +check wait
> +check state UUU
> +check chunk 32
> +
> +mdadm $md0 --grow --chunk=64
> +check reshape
> +check wait
> +check chunk 64
> +
> +mdadm -S $md0
> +mdadm -As
> +check state UUU
> +check chunk 64


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
  2017-07-18 10:34 ` Zhilong Liu
@ 2017-07-19  5:54   ` Xiao Ni
  2017-07-19  9:14     ` Zhilong Liu
  0 siblings, 1 reply; 6+ messages in thread
From: Xiao Ni @ 2017-07-19  5:54 UTC (permalink / raw)
  To: Zhilong Liu; +Cc: linux-raid, jes sorensen



----- Original Message -----
> From: "Zhilong Liu" <zlliu@suse.com>
> To: "Xiao Ni" <xni@redhat.com>, linux-raid@vger.kernel.org
> Cc: "jes sorensen" <jes.sorensen@gmail.com>
> Sent: Tuesday, July 18, 2017 6:34:33 PM
> Subject: Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
> 
> 
> 
> On 07/18/2017 04:55 PM, Xiao Ni wrote:
> > This case trys to allow raid5 reshape to use backwards direction.
> > It changes chunksize after reshape and stop the raid. Then start
> > the raid again.
> >
> > Signed-off-by: Xiao Ni <xni@redhat.com>
> > Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
> > Suggested-by:  Zhilong Liu <zlliu@suse.com>
> > ---
> >   test           |  8 ++++++++
> >   tests/02r5grow | 16 ++++++++++++++++
> >   2 files changed, 24 insertions(+)
> >
> > diff --git a/test b/test
> > index 87e2df2..51da2dc 100755
> > --- a/test
> > +++ b/test
> > @@ -320,6 +320,14 @@ check() {
> >   		grep -sq "inactive" /proc/mdstat ||
> >   			die "array is not inactive!"
> >   		;;
> > +	# It only can be used when there is only one raid
> > +	chunk )
> > +		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk
> > '{print $1}' | sed s/k//g`
> 
> Hi,
>    only from my opinion, how about shrink the command:
> # awk -F',' '/chunk/{print $2}' /proc/mdstat | awk -F'[a-z]' '{print $1}'
> > +		if [ $chunk_size -ne $2 ]; then
> > +			echo >&2 "chunksize is not right"
> > +			exit 1
> > +		fi

Yes, you are a shell expert :)

> 
> how about using the func die()
> [  "$chunk_size" -ne "$2" ] &&
>    die "chunk should be $2, but is $chunk_size"

I tried this and did a simple test. It gave a error:
[root@dell-per210-01 mdadm]# ./test --tests=02r5grow
Testing on linux-3.10.0-685.el7.x86_64 kernel
tests/02r5grow... FAILED - see /var/tmp/02r5grow.log and /var/tmp/fail02r5grow.log for details
./test: line 80: [: too many arguments

It was introduced by this 20d10b4b. It looks like the check have errors:
if [ ! -z ${array[@]} -a ${#array[@]} -ge 1 ]


Regards
Xiao
> 
> Thanks,
> -Zhilong
> 
> > +		;;
> >   	* )
> >   		die "unknown check $1"
> >   		;;
> > diff --git a/tests/02r5grow b/tests/02r5grow
> > index 386e82e..20db4cd 100644
> > --- a/tests/02r5grow
> > +++ b/tests/02r5grow
> > @@ -34,3 +34,19 @@ check nosync
> >   sh tests/testdev $md0 3 $[size/2] 128
> >   
> >   mdadm -S $md0
> > +
> > +# create a raid5 array and change the chunk
> > +mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3
> > --size $[size/2] $dev1 $dev2 $dev3
> > +check wait
> > +check state UUU
> > +check chunk 32
> > +
> > +mdadm $md0 --grow --chunk=64
> > +check reshape
> > +check wait
> > +check chunk 64
> > +
> > +mdadm -S $md0
> > +mdadm -As
> > +check state UUU
> > +check chunk 64
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
  2017-07-19  5:54   ` Xiao Ni
@ 2017-07-19  9:14     ` Zhilong Liu
  0 siblings, 0 replies; 6+ messages in thread
From: Zhilong Liu @ 2017-07-19  9:14 UTC (permalink / raw)
  To: Xiao Ni; +Cc: linux-raid, jes sorensen



On 07/19/2017 01:54 PM, Xiao Ni wrote:
>
> ----- Original Message -----
>> From: "Zhilong Liu" <zlliu@suse.com>
>> To: "Xiao Ni" <xni@redhat.com>, linux-raid@vger.kernel.org
>> Cc: "jes sorensen" <jes.sorensen@gmail.com>
>> Sent: Tuesday, July 18, 2017 6:34:33 PM
>> Subject: Re: [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape
>>
>>
>>
>> On 07/18/2017 04:55 PM, Xiao Ni wrote:
>>> This case trys to allow raid5 reshape to use backwards direction.
>>> It changes chunksize after reshape and stop the raid. Then start
>>> the raid again.
>>>
>>> Signed-off-by: Xiao Ni <xni@redhat.com>
>>> Suggested-by:  Jes Sorensen <jes.sorensen@gmail.com>
>>> Suggested-by:  Zhilong Liu <zlliu@suse.com>
>>> ---
>>>    test           |  8 ++++++++
>>>    tests/02r5grow | 16 ++++++++++++++++
>>>    2 files changed, 24 insertions(+)
>>>
>>> diff --git a/test b/test
>>> index 87e2df2..51da2dc 100755
>>> --- a/test
>>> +++ b/test
>>> @@ -320,6 +320,14 @@ check() {
>>>    		grep -sq "inactive" /proc/mdstat ||
>>>    			die "array is not inactive!"
>>>    		;;
>>> +	# It only can be used when there is only one raid
>>> +	chunk )
>>> +		chunk_size=`cat /proc/mdstat  | awk -F',' '/chunk/{print $2}' | awk
>>> '{print $1}' | sed s/k//g`
>> Hi,
>>     only from my opinion, how about shrink the command:
>> # awk -F',' '/chunk/{print $2}' /proc/mdstat | awk -F'[a-z]' '{print $1}'
>>> +		if [ $chunk_size -ne $2 ]; then
>>> +			echo >&2 "chunksize is not right"
>>> +			exit 1
>>> +		fi
> Yes, you are a shell expert :)
>
>> how about using the func die()
>> [  "$chunk_size" -ne "$2" ] &&
>>     die "chunk should be $2, but is $chunk_size"
> I tried this and did a simple test. It gave a error:
> [root@dell-per210-01 mdadm]# ./test --tests=02r5grow
> Testing on linux-3.10.0-685.el7.x86_64 kernel
> tests/02r5grow... FAILED - see /var/tmp/02r5grow.log and /var/tmp/fail02r5grow.log for details
> ./test: line 80: [: too many arguments
>
> It was introduced by this 20d10b4b. It looks like the check have errors:
> if [ ! -z ${array[@]} -a ${#array[@]} -ge 1 ]

Yes, thanks for catching this, this condition would get parsing
error when array[] has few members. it should correct as:

[ ! -z "$array" -a ${#array[@]}] -ge 1 ]

check the array[index](first member) is enough, I should fix it.

Thanks,
-Zhilong

>
> Regards
> Xiao
>> Thanks,
>> -Zhilong
>>
>>> +		;;
>>>    	* )
>>>    		die "unknown check $1"
>>>    		;;
>>> diff --git a/tests/02r5grow b/tests/02r5grow
>>> index 386e82e..20db4cd 100644
>>> --- a/tests/02r5grow
>>> +++ b/tests/02r5grow
>>> @@ -34,3 +34,19 @@ check nosync
>>>    sh tests/testdev $md0 3 $[size/2] 128
>>>    
>>>    mdadm -S $md0
>>> +
>>> +# create a raid5 array and change the chunk
>>> +mdadm -CR $md0 --level raid5 --metadata=1.1 --chunk=32 --raid-disks 3
>>> --size $[size/2] $dev1 $dev2 $dev3
>>> +check wait
>>> +check state UUU
>>> +check chunk 32
>>> +
>>> +mdadm $md0 --grow --chunk=64
>>> +check reshape
>>> +check wait
>>> +check chunk 64
>>> +
>>> +mdadm -S $md0
>>> +mdadm -As
>>> +check state UUU
>>> +check chunk 64
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-raid" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2017-07-19  9:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-18  8:55 [PATCH -v3 1/1] mdadm/test: Add one test case for raid5 reshape Xiao Ni
2017-07-18  9:03 ` Paul Menzel
2017-07-18  9:48   ` Xiao Ni
2017-07-18 10:34 ` Zhilong Liu
2017-07-19  5:54   ` Xiao Ni
2017-07-19  9:14     ` Zhilong Liu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox