linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [MDADM PATCH] A sanity check for missing device
@ 2018-02-02  3:57 Xiao Ni
  2018-02-07 19:53 ` Jes Sorensen
  0 siblings, 1 reply; 3+ messages in thread
From: Xiao Ni @ 2018-02-02  3:57 UTC (permalink / raw)
  To: linux-raid; +Cc: jes.sorensen

If we don't check the number of missing devices and create raid device
with all missing devices, it gives the error message:
[root@storageqe-15 mdadm]# ./test --tests=00raid1
Testing on linux-3.10.0-830.el7.x86_64 kernel
tests/00raid1...
ERROR: dmesg prints errors when testing 00raid1!

FAILED - see /var/tmp/00raid1.log and /var/tmp/fail00raid1.log for details

After checking the missing devices number, the test case can pass. And it
gives a error log in log file:
++ /root/mdadm/mdadm --quiet -CR /dev/md0 -l 1 -n2 missing missing --auto=yes
++ rv=1
++ case  in
++ cat /var/tmp/stderr
mdadm: Subdevs can't be all missing

Signed-off-by: Xiao Ni <xni@redhat.com>
---
 tests/00raid1 | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tests/00raid1 b/tests/00raid1
index c93465d..752bbbf 100644
--- a/tests/00raid1
+++ b/tests/00raid1
@@ -3,6 +3,9 @@
 # test version0, version1, and no super
 # test resync and recovery.
 
+# It's just a sanity check. This command shouldn't run successfully
+mdadm -CR $md0 -l 1 -n2 missing missing
+
 mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
 check resync
 check raid1
-- 
2.7.4


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

* Re: [MDADM PATCH] A sanity check for missing device
  2018-02-02  3:57 [MDADM PATCH] A sanity check for missing device Xiao Ni
@ 2018-02-07 19:53 ` Jes Sorensen
  2018-02-08  7:20   ` Xiao Ni
  0 siblings, 1 reply; 3+ messages in thread
From: Jes Sorensen @ 2018-02-07 19:53 UTC (permalink / raw)
  To: Xiao Ni, linux-raid

On 02/01/2018 10:57 PM, Xiao Ni wrote:
> If we don't check the number of missing devices and create raid device
> with all missing devices, it gives the error message:
> [root@storageqe-15 mdadm]# ./test --tests=00raid1
> Testing on linux-3.10.0-830.el7.x86_64 kernel
> tests/00raid1...
> ERROR: dmesg prints errors when testing 00raid1!
> 
> FAILED - see /var/tmp/00raid1.log and /var/tmp/fail00raid1.log for details
> 
> After checking the missing devices number, the test case can pass. And it
> gives a error log in log file:
> ++ /root/mdadm/mdadm --quiet -CR /dev/md0 -l 1 -n2 missing missing --auto=yes
> ++ rv=1
> ++ case  in
> ++ cat /var/tmp/stderr
> mdadm: Subdevs can't be all missing
> 
> Signed-off-by: Xiao Ni <xni@redhat.com>
> ---
>  tests/00raid1 | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/tests/00raid1 b/tests/00raid1
> index c93465d..752bbbf 100644
> --- a/tests/00raid1
> +++ b/tests/00raid1
> @@ -3,6 +3,9 @@
>  # test version0, version1, and no super
>  # test resync and recovery.
>  
> +# It's just a sanity check. This command shouldn't run successfully
> +mdadm -CR $md0 -l 1 -n2 missing missing
> +
>  mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
>  check resync
>  check raid1

I think we need to test the opposite here - the test shouldn't report an
error in the log, but rather success if this sanity test passes.

Cheers,
Jes




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

* Re: [MDADM PATCH] A sanity check for missing device
  2018-02-07 19:53 ` Jes Sorensen
@ 2018-02-08  7:20   ` Xiao Ni
  0 siblings, 0 replies; 3+ messages in thread
From: Xiao Ni @ 2018-02-08  7:20 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: linux-raid



----- Original Message -----
> From: "Jes Sorensen" <jes.sorensen@gmail.com>
> To: "Xiao Ni" <xni@redhat.com>, linux-raid@vger.kernel.org
> Sent: Thursday, February 8, 2018 3:53:15 AM
> Subject: Re: [MDADM PATCH] A sanity check for missing device
> 
> On 02/01/2018 10:57 PM, Xiao Ni wrote:
> > If we don't check the number of missing devices and create raid device
> > with all missing devices, it gives the error message:
> > [root@storageqe-15 mdadm]# ./test --tests=00raid1
> > Testing on linux-3.10.0-830.el7.x86_64 kernel
> > tests/00raid1...
> > ERROR: dmesg prints errors when testing 00raid1!
> > 
> > FAILED - see /var/tmp/00raid1.log and /var/tmp/fail00raid1.log for details
> > 
> > After checking the missing devices number, the test case can pass. And it
> > gives a error log in log file:
> > ++ /root/mdadm/mdadm --quiet -CR /dev/md0 -l 1 -n2 missing missing
> > --auto=yes
> > ++ rv=1
> > ++ case  in
> > ++ cat /var/tmp/stderr
> > mdadm: Subdevs can't be all missing
> > 
> > Signed-off-by: Xiao Ni <xni@redhat.com>
> > ---
> >  tests/00raid1 | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/tests/00raid1 b/tests/00raid1
> > index c93465d..752bbbf 100644
> > --- a/tests/00raid1
> > +++ b/tests/00raid1
> > @@ -3,6 +3,9 @@
> >  # test version0, version1, and no super
> >  # test resync and recovery.
> >  
> > +# It's just a sanity check. This command shouldn't run successfully
> > +mdadm -CR $md0 -l 1 -n2 missing missing
> > +
> >  mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
> >  check resync
> >  check raid1
> 
> I think we need to test the opposite here - the test shouldn't report an
> error in the log, but rather success if this sanity test passes.

Hi Jes

Is it ok like this:

diff --git a/tests/00raid1 b/tests/00raid1
index c93465d..f6b8be1 100644
--- a/tests/00raid1
+++ b/tests/00raid1
@@ -3,6 +3,10 @@
 # test version0, version1, and no super
 # test resync and recovery.
 
+# It's just a sanity check. This command shouldn't run successfully
+mdadm -CR $md0 -l 1 -n2 missing missing
+check opposite_result
+
 mdadm -CR $md0 -l 1 -n2 $dev0 $dev1
 check resync
 check raid1
diff --git a/tests/func.sh b/tests/func.sh
index 40c6026..af08b60 100644
--- a/tests/func.sh
+++ b/tests/func.sh
@@ -219,6 +219,10 @@ do_setup() {
 # check various things
 check() {
        case $1 in
+       opposite_result )
+               if [ $? -eq 0 ]; then
+                       die "This command shouldn't run successfully"
+               fi
        spares )
                spares=$(tr '] ' '\012\012' < /proc/mdstat | grep -c '(S)' || exit 0)
                [ $spares -ne $2 ] &&

Regards
Xiao

> 
> Cheers,
> Jes
> 
> 
> 
> --
> 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 related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-02-08  7:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-02  3:57 [MDADM PATCH] A sanity check for missing device Xiao Ni
2018-02-07 19:53 ` Jes Sorensen
2018-02-08  7:20   ` Xiao Ni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).