@@ -115,6 +115,7 @@ def setUp(self):
115
115
try : self .mem_resource = conf .args .mem_resource
116
116
except AttributeError :
117
117
self .mem_resource = 2048
118
+ self .dump_server_user = conf .args .dump_server_user if 'dump_server_user' in conf .args else 'root'
118
119
self .dump_server_ip = conf .args .dump_server_ip if 'dump_server_ip' in conf .args else ''
119
120
self .dump_server_pw = conf .args .dump_server_pw if 'dump_server_pw' in conf .args else ''
120
121
self .dump_path = conf .args .dump_path if 'dump_path' in conf .args else ''
@@ -147,7 +148,7 @@ def setup_test(self, dump_place="local"):
147
148
"ls -l /var/crash | grep '^d'| awk '{print $9}'" )
148
149
if dump_place == "net" :
149
150
self .crash_content = self .c .run_command (
150
- "ssh -i %s root @%s \" ls -l %s | grep '^d'\" | awk '{print $9}'" % (self .rsa_path , self .dump_server_ip , self .dump_path ))
151
+ "ssh -i %s %s @%s \" ls -l %s | grep '^d'\" | awk '{print $9}'" % (self .rsa_path , self . dump_server_user , self .dump_server_ip , self .dump_path ))
151
152
log .debug ("crash content is %s" % (self .crash_content ))
152
153
153
154
def setup_pwdless_auth (self ):
@@ -169,13 +170,14 @@ def setup_pwdless_auth(self):
169
170
self .c .run_command (
170
171
"ssh-keygen -q -t rsa -f %s -P ''" % self .rsa_path )
171
172
self .c .run_command ("chmod 400 %s" % self .rsa_path )
172
- self .c .run_command ("sshpass -p %s ssh-copy-id -o \" StrictHostKeyChecking no\" -i %s root@%s" %
173
173
(self .dump_server_pw , self .rsa_path , self .dump_server_ip ))
174
+ self .c .run_command ("sshpass -p %s ssh-copy-id -o \" StrictHostKeyChecking no\" -i %s %s@%s" %
175
+ (self .dump_server_pw , self .rsa_path , self .dump_server_user , self .dump_server_ip ))
174
176
except CommandFailed :
175
177
self .fail (
176
178
"Failed to create/copy ssh key file" )
177
179
pwd_less = self .c .run_command (
178
- "ssh -i %s -o \" StrictHostKeyChecking no\" -o \" NumberOfPasswordPrompts=0\" %s \" echo\" " % (self .rsa_path , self .dump_server_ip ))
180
+ "ssh -i %s -o \" StrictHostKeyChecking no\" -o \" NumberOfPasswordPrompts=0\" %s@%s \" echo\" " % (self .rsa_path , self . dump_server_user , self .dump_server_ip ))
179
181
180
182
def is_fadump_param_enabled (self ):
181
183
'''
@@ -253,7 +255,7 @@ def verify_dump_file(self, boot_type=BootType.NORMAL, dump_place="local"):
253
255
"ls -l /var/crash | grep '^d'| awk '{print $9}'" )
254
256
if dump_place == "net" :
255
257
crash_content_after = self .c .run_command (
256
- "ssh root @%s -i %s \" ls -l %s | grep '^d'\" | awk '{print $9}'" % (self .dump_server_ip , self .rsa_path , self .dump_path ))
258
+ "ssh %s @%s -i %s \" ls -l %s | grep '^d'\" | awk '{print $9}'" % (self . dump_server_user , self .dump_server_ip , self .rsa_path , self .dump_path ))
257
259
self .crash_content = list (
258
260
set (crash_content_after ) - set (self .crash_content ))
259
261
if self .distro == "sles" :
@@ -262,32 +264,42 @@ def verify_dump_file(self, boot_type=BootType.NORMAL, dump_place="local"):
262
264
self .crash_content = list (filter (lambda x : re .search ('\d{4}-\d{2}-\d{2}-\d{2}:\d{2}' , x ), self .crash_content ))
263
265
if len (self .crash_content ):
264
266
if dump_place == "net" :
265
- self .c .run_command ('scp -i %s -r root@%s:/%s/%s /var/crash/' %
266
- (self .rsa_path , self .dump_server_ip , self .dump_path , self .crash_content [0 ]), timeout = 1200 )
267
+ #if user is not root, cannot copy/list vmcore files due to permission issue, because the owner of vmcore dir will be root.
268
+ if self .dump_server_user == 'root' :
269
+ self .c .run_command ('scp -i %s -r %s@%s:/%s/%s /var/crash/' %
270
+ (self .rsa_path , self .dump_server_user , self .dump_server_ip , self .dump_path , self .crash_content [0 ]), timeout = 1200 )
267
271
if self .distro == "ubuntu" :
268
272
self .c .run_command ("ls /var/crash/%s/dump*" %
269
273
self .crash_content [0 ])
270
274
else :
271
- res = self .c .run_command ("ls /var/crash/%s/vmcore*" %
272
- self .crash_content [0 ])
273
- paths = res [0 ].split ()
274
- file_names = [os .path .basename (path ) for path in paths ]
275
- # Check if vmcore-dmesg-incomplete.txt is present in file_names
276
- if "vmcore-dmesg-incomplete.txt" in file_names :
277
- raise OpTestError ("kdump failed to create vmcore file" )
275
+ if self .dump_server_user != 'root' :
276
+ res = self .c .run_command ("ssh %s@%s -i %s ls %s/%s/vmcore*" %
277
+ (self .dump_server_user , self .dump_server_ip , self .rsa_path , self .dump_path , self .crash_content [0 ]))
278
278
else :
279
- filtered_files = [f for f in file_names if f .startswith ("vmcore" ) and not f == "vmcore-dmesg.txt" ]
280
- if filtered_files :
281
- log .debug ("vmcore file %s exists in crash dir" % filtered_files )
282
- else :
279
+ res = self .c .run_command ("ls /var/crash/%s/vmcore*" %
280
+ self .crash_content [0 ])
281
+ paths = res [0 ].split ()
282
+ file_names = [os .path .basename (path ) for path in paths ]
283
+ # Check if vmcore-dmesg-incomplete.txt is present in file_names
284
+ if "vmcore-dmesg-incomplete.txt" in file_names :
283
285
raise OpTestError ("kdump failed to create vmcore file" )
286
+ else :
287
+ filtered_files = [f for f in file_names if f .startswith ("vmcore" ) and not f == "vmcore-dmesg.txt" ]
288
+ if filtered_files :
289
+ log .debug ("vmcore file %s exists in crash dir" % filtered_files )
290
+ else :
291
+ raise OpTestError ("kdump failed to create vmcore file" )
284
292
if boot_type == BootType .MPIPL :
285
293
self .c .run_command ("ls /var/crash/%s/opalcore*" %
286
294
self .crash_content [0 ])
287
295
else :
288
296
msg = "Dump directory not created"
289
297
raise OpTestError (msg )
290
- self .c .run_command ("rm -rf /var/crash/%s; sync" % self .crash_content [0 ])
298
+ if self .dump_server_user != 'root' :
299
+ #cannot delete with normal user since dump dir is owned by root
300
+ pass
301
+ else :
302
+ self .c .run_command ("rm -rf /var/crash/%s; sync" % self .crash_content [0 ])
291
303
292
304
def verify_fadump_reg (self ):
293
305
'''
0 commit comments