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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
|
"""testcases for cli/volume/replace_brick
"""
import os
import sys
import time
import glusterutils
import clientutils
import hostutils
import atfutils
import serverutils
import managerutils
import parser
from atfglobals import GlobalObj
filename = os.path.abspath(__file__)
dir_path = os.path.dirname(filename)
operation_success_messages = {
'start' : "started successfully",
'commit' : "commit successful",
'status' : "Migration complete",
}
def initialize():
"""
"""
logger = GlobalObj.getLoggerObj()
return_status = 1
testenv_file = GlobalObj.testenv_file
testenv_abspath = os.path.join(dir_path, testenv_file)
if not (os.path.isfile(testenv_abspath)):
logger.error("%s not found in %s" % (testenv_file, dir_path))
if parser.parse_testenv_configfile(testenv_abspath):
return return_status
if managerutils.ssh_connect_allhosts():
return return_status
return 0
def setup():
"""
"""
return_status = 1
if atfutils.set_active_volume("volume1"):
return return_status
return 0
def reset_testenv():
return_status = 1
if clientutils.umountall():
return return_status
glusterutils.volume_stop("server1", force=True)
glusterutils.volume_delete("server1")
glusterutils.glusterd_stop_allservers()
glusterutils.glusterd_remove_dir_allservers()
glusterutils.glusterd_remove_logs_allservers()
return 0
def setup_testenv():
"""
"""
return_status = 1
if glusterutils.glusterd_start_allservers(force=True):
return return_status
if glusterutils.peer_probe("server1"):
return return_status
if glusterutils.create_brick_allservers():
return return_status
if glusterutils.volume_create("server1"):
return return_status
if glusterutils.volume_start("server1"):
return return_status
return 0
def bug2909():
"""
Note: for replace-brick , we need the fuse module on the servers.
The replace-brick 'start' operation shows successful.
But the replace-brick 'status' operation fails.
"""
return_status = 1
if initialize():
return return_status
if setup():
return return_status
if reset_testenv():
return return_status
if setup_testenv():
return return_status
expect_message = "Number of files migrated = 0 Migration complete"
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "start")
if atfutils.validate_output(output, 0, "started successfully"):
return return_status
time.sleep(30)
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "status")
if atfutils.validate_output(output, 0, expect_message):
return return_status
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "commit")
if atfutils.validate_output(output, 0, "commit successful"):
return return_status
return 0
def bug3033():
"""
"""
return_status = 1
if initialize():
return return_status
if setup():
return return_status
if reset_testenv():
return return_status
if setup_testenv():
return return_status
if clientutils.mount("mount1"):
return 1
base_command = "mkdir -p "
for x in range(1, 50):
command = base_command + str(x)
output = clientutils.execute_on_mount("mount1", command)
if output["exitstatus"]:
return return_status
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "start")
if atfutils.validate_output(output, 0, "started successfully"):
return return_status
sleep_time = 10
timeout = 12
while timeout:
time.sleep(sleep_time)
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "status")
if atfutils.validate_output(output, 0, "migration complete"):
timeout -= 1
continue
else:
break
output = glusterutils.volume_replacebrick("server1", "brick1",
"brick3", "commit")
if atfutils.validate_output(output, 0, "commit successful"):
return return_status
bricks = ['brick2', 'brick3']
commands = ['getfattr -n trusted.glusterfs.pump-source-complete ',
'getfattr -n trusted.glusterfs.pump-sink-complete ',
'getfattr -n trusted.glusterfs.pump-path ']
for brick in bricks:
for command in commands:
command = command + "<" + brick + ".path>"
output = serverutils.execute_on_brick(brick, command)
if atfutils.validate_output(output, 0, "No such attribute", stream="stderr"):
return return_status
return 0
|