summaryrefslogtreecommitdiffstats
path: root/tests/00confnames
blob: 10823f0181cf64325fb935f37a73cefb6101ed32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
set -x -e
. tests/templates/names_template

# Test how <devname> and <name> from config are handled during Incremental assemblation.
# 1-6 <devnode> only tests (no <name> in config).
# 6-10 <devname> and <name> combinations are tested.
# 11-13 corner cases.

names_create "/dev/md/name"
local _UUID="$(mdadm -D --export /dev/md127 | grep MD_UUID | cut -d'=' -f2)"
[[ "$_UUID" == "" ]] && echo "Cannot obtain UUID for $DEVNODE_NAME" && exit 1


# 1. <devname> definition consistent with metadata name.
names_make_conf $_UUID "/dev/md/name" "empty" $config
mdadm -S "/dev/md127"
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 2. Same as 1, but use short name form of <devname>.
names_make_conf $_UUID "name" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 3. Same as 1, but use different <devname> than metadata provides.
names_make_conf $_UUID "/dev/md/other" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "other" "name"
mdadm -S "/dev/md127"

# 4. Same as 3, but use short name form of <devname>.
names_make_conf $_UUID "other" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "other" "name"
mdadm -S "/dev/md127"

# 5. Force particular node creation by setting <devname> to /dev/mdX. Link is not created in this
# case.
names_make_conf $_UUID "/dev/md4" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md4" "empty" "name"
mdadm -S "/dev/md4"

# 6. <devname> set to /dev/mdX, <name> same as in metadata.
# Metadata name and default node used - controversial. Current behavior documented.
names_make_conf $_UUID "/dev/md22" "name" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 7. <devname> set to /dev/mdX, <name> different than in metadata.
# Metadata name and default node used - controversial. Current behavior documented.
names_make_conf $_UUID "/dev/md8" "other" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 8. Both <devname> and <name> different than in metadata.
# Metadata name and default node used - controversial. Current behavior documented.
names_make_conf $_UUID "devnode" "other_name" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 9. <devname> set to metadata name, <name> different than in metadata.
# Metadata name and default node used - controversial. Current behavior documented.
names_make_conf $_UUID "name" "other_name" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 10. Bad <devname> set, no <name>.
# Metadata name and default node used - expected.
names_make_conf $_UUID "/im/bad/devname" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 11. <devname> with some special symbols and locales, no <name>.
# <devname> should be ignored.
names_make_conf $_UUID "tźż-\.,<>st+-" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 12. No <devname> and <name> set.
# Metadata name and default node used - expected.
names_make_conf $_UUID "empty" "empty" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 13. No <devname>, <name> set to /dev/mdX.
# Entry should be ignored, it is not ignored but result is good anyway.
names_make_conf $_UUID "empty" "/dev/md12" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"

# 13. No <devname>, <name> with special symbols and locales.
# Entry should be ignored, it is not ignored but result is good anyway.
names_make_conf $_UUID "empty" "./\śćń#&" $config
mdadm -I $dev0 --config=$config
names_verify "/dev/md127" "name" "name"
mdadm -S "/dev/md127"