forked from molecul/fuel-coverage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start-coverage.sh
executable file
·716 lines (653 loc) · 25.1 KB
/
start-coverage.sh
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
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
#!/bin/bash -xe
coverage_sleep="20"
#List enable components
components_enable="nova neutron heat murano keystone glance cinder sahara ceilometer oslo.messaging"
function coverage_init {
rm -rf "/etc/fuel/client/config.yaml"
echo "LogLevel=quiet" >> ~/.ssh/config
for id in $(fuel nodes | grep -e '[0-9]' | awk ' {print $1} ')
do
ssh root@node-$id """
if [[ -f "/etc/centos-release" ]];
then
yum install -y python-pip python-devel gcc;
else
apt-get update;
apt-get install -y --force-yes python-pip python-dev gcc;
fi;
pip install --upgrade setuptools coverage==4.0a5;
rm -rf /coverage;
mkdir -p /coverage/rc;
chmod 777 /coverage;
"""
done
}
function coverage_start {
if [ "${1}" == "cinder" ];
then
for id in $(fuel nodes | grep cinder | grep -v "compute" | grep -v "controller" | awk ' {print $1} ')
do
ssh root@node-$id "rm -rf /coverage/$1; mkdir -p /coverage/$1"
eval "cinder_cinder_start $id";
done
fi;
for id in $(fuel nodes | grep compute | awk ' {print $1} ')
do
ssh root@node-$id "rm -rf /coverage/$1; mkdir -p /coverage/$1"
eval "${1}_compute_start $id"
done
for id in $(fuel nodes | grep controller | awk ' {print $1} ')
do
ssh root@node-$id "rm -rf /coverage/$1; mkdir -p /coverage/$1"
rabbit_restart $id
eval "${1}_controller_start $id"
done
}
function coverage_stop {
gen_ctrl=`fuel nodes | grep controller | awk ' {print $1; exit;} '`
ssh root@node-$gen_ctrl "rm -rf /coverage/report/$1; mkdir -p /coverage/report/$1"
mkdir -p /tmp/coverage/report/$2/
if [ "${1}" == "cinder" ];
then
for id in $(fuel nodes | grep cinder | grep -v "compute" | grep -v "controller" | awk ' {print $1} ')
do
eval "cinder_cinder_stop $id";
sleep $coverage_sleep
scp -r root@node-$id:/coverage/$1 /tmp/coverage/report/
done
fi;
for id in $(fuel nodes | grep compute | awk ' {print $1} ')
do
eval "${1}_compute_stop $id"
sleep $coverage_sleep
scp -r root@node-$id:/coverage/$1 /tmp/coverage/report/
done
for id in $(fuel nodes | grep controller | awk ' {print $1} ')
do
eval "${1}_controller_stop $id"
sleep $coverage_sleep
scp -r root@node-$id:/coverage/$1 /tmp/coverage/report/
rabbit_restart $id
done
scp -r /tmp/coverage/report/$1 root@node-$gen_ctrl:/coverage/report
rm -rf /tmp/coverage
ssh root@node-$gen_ctrl """
cd /coverage/report/$1/;
coverage combine;
coverage report --omit=\`python -c \"import os; from $1 import openstack; print os.path.dirname(os.path.abspath(openstack.__file__))\"\`/* -m >> report_$1
"""
scp root@node-$gen_ctrl:/coverage/report/$1/report_$1 ~/report_$1_$(date +"%d-%m-%Y_%T")
}
function nova_controller_start {
ssh root@node-$1 '''
for i in api novncproxy objectstore consoleauth scheduler conductor cert;
do if [[ -f "/etc/centos-release" ]];
then
service openstack-nova-$i stop;
else
service nova-$i stop;
fi;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=nova\r\n" > /coverage/rc/.coveragerc-nova;
cd /coverage/nova;
if [[ -f "/etc/centos-release" ]];
then
screen -S novncproxy -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-novncproxy) --web /usr/share/novnc/;
else
screen -S novncproxy -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-novncproxy) --config-file=/etc/nova/nova.conf;
fi;
for i in api objectstore consoleauth scheduler conductor cert;
do if [[ -f "/etc/centos-release" ]];
then
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-${i}) --logfile /var/log/nova/${i}.log;
else
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-${i}) --config-file=/etc/nova/nova.conf;
fi;
done;
'''
}
function nova_controller_stop {
ssh root@node-$1 '''
for i in api novncproxy objectstore consoleauth scheduler conductor cert;
do
echo "nova-${i}";
kill $(ps hf -C python | grep "nova-${i}" | awk "{print \$1;exit}");
done;
for i in api novncproxy objectstore consoleauth scheduler conductor cert;
do if [[ -f "/etc/centos-release" ]];
then
service openstack-nova-${i} start;
else
service nova-${i} start;
fi;
done;
'''
}
function nova_compute_start {
ssh root@node-$1 '''
for i in compute;
do if [[ -f "/etc/centos-release" ]];
then
service openstack-nova-$i stop;
else
service nova-$i stop;
fi;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=nova\r\n" > /coverage/rc/.coveragerc-nova;
cd /coverage/nova;
if [[ -f "/etc/centos-release" ]];
then
screen -S nova-compute -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-compute) --logfile /var/log/nova/compute.log;
else
screen -S nova-compute -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-nova $(which nova-compute) --config-file=/etc/nova/nova.conf --config-file=/etc/nova/nova-compute.conf;
fi;
'''
}
function nova_compute_stop {
ssh root@node-$1 '''
for i in compute;
do
echo "nova-${i}";
kill $(ps hf -C python | grep "nova-${i}" | awk "{print \$1;exit}");
done;
for i in compute;
do if [[ -f "/etc/centos-release" ]];
then
service openstack-nova-${i} start;
else
service nova-${i} start;
fi;
done;
'''
}
function neutron_controller_start {
ssh root@node-$1 '''
for i in p_neutron-dhcp-agent p_neutron-metadata-agent p_neutron-l3-agent;
do pcs resource disable ${i};
done;
if [[ -f "/etc/centos-release" ]];
then
pcs resource disable p_neutron-openvswitch-agent;
else
pcs resource disable p_neutron-plugin-openvswitch-agent;
fi;
for i in server;
do service neutron-$i stop;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=neutron\r\n" > /coverage/rc/.coveragerc-neutron;
cd /coverage/neutron;
if [[ -f "/etc/centos-release" ]];
then
screen -S neutron-server -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-server) --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugin.ini --log-file /var/log/neutron/server.log;
else
screen -S neutron-server -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-server) --config-file /etc/neutron/neutron.conf --log-file /var/log/neutron/server.log --config-file /etc/neutron/plugin.ini;
fi;
screen -S neutron-openvswitch-agent -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-openvswitch-agent) --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugin.ini --log-file=/var/log/neutron/openvswitch-agent.log;
for i in dhcp l3 metadata;
do screen -S neutron-${i}-agent -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-${i}-agent) --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/${i}_agent.ini --log-file=/var/log/neutron/${i}-agent.log;
done;
'''
}
function neutron_controller_stop {
ssh root@node-$1 '''
for i in neutron-server openvswitch-agent dhcp-agent l3-agent metadata-agent;
do
echo "${i}";
kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in dhcp-agent metadata-agent l3-agent;
do pcs resource enable p_neutron-${i};
done;
if [[ -f "/etc/centos-release" ]];
then
pcs resource enable p_neutron-openvswitch-agent;
else
pcs resource enable p_neutron-plugin-openvswitch-agent;
fi;
service neutron-server start;
'''
}
function neutron_compute_start {
ssh root@node-$1 '''
for i in openvswitch-agent;
do if [[ -f "/etc/centos-release" ]];
then
service neutron-${i} stop;
else
service neutron-plugin-${i} stop;
fi;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=neutron\r\n" > /coverage/rc/.coveragerc-neutron;
cd /coverage/neutron;
if [[ -f "/etc/centos-release" ]];
then
screen -S neutron-plugin-openvswitch-agent -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-openvswitch-agent) --log-file /var/log/neutron/openvswitch-agent.log --config-file /usr/share/neutron/neutron-dist.conf --config-file /etc/neutron/neutron.conf --config-file /etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini;
else
screen -S neutron-openvswitch-agent -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-neutron $(which neutron-openvswitch-agent) --config-file=/etc/neutron/neutron.conf --config-file=/etc/neutron/plugin.ini --log-file=/var/log/neutron/ovs-agent.log;
fi;
'''
}
function neutron_compute_stop {
ssh root@node-$1 '''
for i in openvswitch-agent;
do if [[ -f "/etc/centos-release" ]];
then
echo "neutron-${i}";
kill $(ps hf -C python | grep "neutron-${i}" | awk "{print \$1;exit}");
service neutron-${i} start;
else
echo "neutron-plugin-${i}";
kill $(ps hf -C python | grep "neutron-${i}" | awk "{print \$1;exit}");
service neutron-${i} start;
fi;
done;
'''
}
function heat_controller_start {
ssh root@node-$1 '''
for i in heat-api-cfn heat-api-cloudwatch heat-api;
do if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} stop;
else
service ${i} stop;
fi;
done;
if [[ -f "/etc/centos-release" ]];
then
pcs resource disable p_openstack-heat-engine;
else
pcs resource disable p_heat-engine;
fi;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=heat\r\n" >> /coverage/rc/.coveragerc-heat;
cd "/coverage/heat";
for i in heat-api-cfn heat-engine heat-api-cloudwatch heat-api;
do
if [[ -f "/etc/centos-release" ]];
then
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-heat $(which ${i}) --config-file /etc/heat/heat.conf;
else
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-heat $(which ${i});
fi;
done;
'''
}
function heat_controller_stop {
ssh root@node-$1 '''
for i in heat-api-cfn heat-engine heat-api-cloudwatch heat-api;
do kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in heat-api-cfn heat-api-cloudwatch heat-api;
do
if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} start;
else
service ${i} start;
fi;
done;
if [[ -f "/etc/centos-release" ]];
then
pcs resource enable p_openstack-heat-engine;
else
pcs resource enable p_heat-engine;
fi;
'''
}
function heat_compute_start {
true
}
function heat_compute_stop {
true
}
function keystone_controller_start {
ssh root@node-$1 '''
if [[ -f "/etc/centos-release" ]];
then
service openstack-keystone stop;
else
service keystone stop;
fi;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=keystone\r\n" >> /coverage/rc/.coveragerc-keystone;
cd "/coverage/keystone";
screen -S keystone-all -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-keystone $(which keystone-all);
'''
}
function keystone_controller_stop {
ssh root@node-$1 '''
kill $(ps hf -C python | grep "keystone-all" | awk "{print \$1;exit}");
if [[ -f "/etc/centos-release" ]];
then
service openstack-keystone start;
else
service keystone start;
fi;
'''
}
function keystone_compute_start {
true
}
function keystone_compute_stop {
true
}
function murano_controller_start {
ssh root@node-$1 '''
for i in murano-api murano-engine;
do
service openstack-${i} stop;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=murano\r\n" >> /coverage/rc/.coveragerc-murano;
cd "/coverage/murano";
for i in murano-api murano-engine;
do
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-murano $(which ${i}) --config-file=/etc/murano/murano.conf;
done;
'''
}
function murano_controller_stop {
ssh root@node-$1 '''
for i in murano-api murano-engine;
do
kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in murano-api murano-engine;
do
service openstack-${i} start;
done;
'''
}
function murano_compute_start {
true
}
function murano_compute_stop {
true
}
function glance_controller_start {
ssh root@node-$1 '''
for i in glance-api glance-registry;
do
if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} stop;
else
service ${i} stop;
fi;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=glance\r\n" >> /coverage/rc/.coveragerc-glance;
cd "/coverage/glance";
for i in glance-api glance-registry;
do
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-glance $(which ${i});
done;
'''
}
function glance_controller_stop {
ssh root@node-$1 '''
for i in glance-api glance-registry;
do
kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in glance-api glance-registry;
do
if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} start;
else
service ${i} start;
fi;
done;
'''
}
function glance_compute_start {
true
}
function glance_compute_stop {
true
}
function cinder_controller_start {
ssh root@node-$1 '''
for i in cinder-api cinder-scheduler cinder-backup cinder-volume;
do
if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} stop;
else
service ${i} stop;
fi;
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=cinder\r\n" >> /coverage/rc/.coveragerc-cinder;
cd "/coverage/cinder";
for i in api scheduler backup volume;
do
if [[ -f "/etc/centos-release" ]];
then
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-cinder $(which cinder-${i}) --config-file /usr/share/cinder/cinder-dist.conf --config-file /etc/cinder/cinder.conf --logfile /var/log/cinder/${i}.log;
else
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-cinder $(which cinder-${i}) --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-${i}.log;
fi;
done;
'''
}
function cinder_controller_stop {
ssh root@node-$1 '''
for i in cinder-api cinder-scheduler cinder-backup cinder-volume;
do
kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in cinder-api cinder-scheduler cinder-backup cinder-volume;
do
if [[ -f "/etc/centos-release" ]];
then
service openstack-${i} start;
else
service ${i} start;
fi;
done;
'''
}
function cinder_compute_start {
true
}
function cinder_compute_stop {
true
}
function cinder_cinder_start {
ssh root@node-$1 '''
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=cinder\r\n" >> /coverage/rc/.coveragerc-cinder;
cd "/coverage/cinder";
if [[ -f "/etc/centos-release" ]];
then
service openstack-cinder-volume stop;
screen -S cinder-volume -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-cinder $(which cinder-volume) --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-volume.log;
else
service cinder-volume stop;
screen -S cinder-volume -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-cinder $(which cinder-volume) --config-file=/etc/cinder/cinder.conf --log-file=/var/log/cinder/cinder-volume.log;
fi;
'''
}
function cinder_cinder_stop {
ssh root@node-$1 '''
kill $(ps hf -C python | grep "cinder-volume" | awk "{print \$1;exit}");
if [[ -f "/etc/centos-release" ]];
then
service openstack-cinder-volume start;
else
service cinder-volume start;
fi;
'''
}
function sahara_controller_start {
ssh root@node-$1 '''
service sahara-all stop;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=sahara\r\n" >> /coverage/rc/.coveragerc-sahara;
cd "/coverage/sahara";
screen -S sahara-all -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-sahara $(which sahara-all) --config-file /etc/sahara/sahara.conf;
'''
}
function sahara_controller_stop {
ssh root@node-$1 '''
kill -2 $(ps hf -C python | grep "sahara-all" | awk "{print \$1;exit}");
service sahara-all stop;
'''
}
function sahara_compute_start {
true
}
function sahara_compute_stop {
true
}
function ceilometer_controller_start {
ssh root@node-$1 '''
for i in openstack-ceilometer-api openstack-ceilometer-collector openstack-ceilometer-alarm-notifier openstack-ceilometer-notification;
do
service $i stop;
done;
for i in p_openstack-ceilometer-central p_openstack-ceilometer-alarm-evaluator;
do
pcs resource disable ${i};
done;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=ceilometer\r\n" >> /coverage/rc/.coveragerc-ceilometer;
cd /coverage/ceilometer;
for i in ceilometer-agent-central ceilometer-api ceilometer-collector ceilometer-alarm-evaluator ceilometer-alarm-notifier ceilometer-agent-notification;
do
if [[ -f "/etc/centos-release" ]];
then
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-ceilometer $(which ${i}) --config-file=/etc/ceilometer/ceilometer.conf --logfile /var/log/ceilometer/${i};
else
screen -S ${i} -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-ceilometer $(which ${i}) --config-file=/etc/ceilometer/ceilometer.conf;
fi;
done;
'''
}
function ceilometer_controller_stop {
ssh root@node-$1 '''
for i in ceilometer-agent-central ceilometer-api ceilometer-collector ceilometer-alarm-evaluator ceilometer-alarm-notifier ceilometer-agent-notification;
do
kill $(ps hf -C python | grep "${i}" | awk "{print \$1;exit}");
done;
for i in openstack-ceilometer-api openstack-ceilometer-collector openstack-ceilometer-alarm-notifier openstack-ceilometer-notification;
do
service ${i} start;
done;
for i in p_openstack-ceilometer-central p_openstack-ceilometer-alarm-evaluator;
do
pcs resource enable ${i};
done;
'''
}
function ceilometer_compute_start {
ssh root@node-$1 '''
service openstack-ceilometer-compute stop;
echo -e "[run]\r\ndata_file=.coverage\r\nparallel=True\r\nsource=ceilometer\r\n" >> /coverage/rc/.coveragerc-ceilometer;
cd /coverage/ceilometer;
if [[ -f "/etc/centos-release" ]];
then
screen -S openstack-ceilometer-compute -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-ceilometer $(which ceilometer-agent-compute) --logfile /var/log/ceilometer/compute.log;
else
screen -S openstack-ceilometer-compute -d -m $(which python) $(which coverage) run --rcfile /coverage/rc/.coveragerc-ceilometer $(which ceilometer-agent-compute) --config-file=/etc/ceilometer/ceilometer.conf;
fi;
'''
}
function ceilometer_compute_stop {
ssh root@node-$1 '''
kill $(ps hf -C python | grep "ceilometer-agent-compute" | awk "{print \$1;exit}");
service openstack-ceilometer-compute start;
'''
}
function oslo.messaging_controller_start {
ssh root@node-$1 '''
OSLO_MESSAGING_INIT=`python -c "import oslo.messaging; print oslo.messaging.__file__" | sed s/.pyc$/.py/`
OSLO_MESSAGING_PATH=`python -c "import oslo.messaging; print oslo.messaging.__path__[0]"`
cp ${OSLO_MESSAGING_INIT} ${OSLO_MESSAGING_INIT}.bkp
sed -i "1 i\import coverage\n\ncov = coverage.coverage(\n auto_data=True,\n data_file=\".coverage\",\n config_file=False,\n source=[\"${OSLO_MESSAGING_PATH}\"],\n omit=[\"${OSLO_MESSAGING_PATH}/tests/*\"])\n\ncov.start()\n\n" ${OSLO_MESSAGING_INIT}
sudo reboot
'''
}
function oslo.messaging_controller_stop {
ssh root@node-$1 '''
OSLO_MESSAGING_INIT=`python -c "import oslo.messaging; print oslo.messaging.__file__" | sed s/.pyc$/.py/`
mv ${OSLO_MESSAGING_INIT}.bkp ${OSLO_MESSAGING_INIT}
rm ${OSLO_MESSAGING_INIT}c # remove .pyc file
sudo reboot
'''
# Check, that node is up and receive ssh connection
ssh root@node-$1 exit
while [ $? -gt 0 ]; do
sleep 3
ssh root@node-$1 exit
done
}
function oslo.messaging_compute_start {
ssh root@node-$1 '''
OSLO_MESSAGING_INIT=`python -c "import oslo.messaging; print oslo.messaging.__file__" | sed s/.pyc$/.py/`
OSLO_MESSAGING_PATH=`python -c "import oslo.messaging; print oslo.messaging.__path__[0]"`
cp ${OSLO_MESSAGING_INIT} ${OSLO_MESSAGING_INIT}.bkp
sed -i "1 i\import coverage\n\ncov = coverage.coverage(\n auto_data=True,\n data_file=\".coverage\",\n config_file=False,\n source=[\"${OSLO_MESSAGING_PATH}\"],\n omit=[\"${OSLO_MESSAGING_PATH}/tests/*\"])\n\ncov.start()\n\n" ${OSLO_MESSAGING_INIT}
sudo reboot
'''
}
function oslo.messaging_compute_stop {
ssh root@node-$1 '''
OSLO_MESSAGING_INIT=`python -c "import oslo.messaging; print oslo.messaging.__file__" | sed s/.pyc$/.py/`
mv ${OSLO_MESSAGING_INIT}.bkp ${OSLO_MESSAGING_INIT}
rm ${OSLO_MESSAGING_INIT}c # remove .pyc file
sudo reboot
'''
# Check, that node is up and receive ssh connection
ssh root@node-$1 exit
while [ $? -gt 0 ]; do
sleep 3
ssh root@node-$1 exit
done
}
function swift_controller_start {
true
}
function swift_controller_stop {
true
}
function swift_compute_start {
true
}
function swift_compute_stop {
true
}
function rabbit_restart {
ssh root@node-$1 '''
if [[ -f "/etc/centos-release" ]];
then
echo "Restart RabbitMQ"
pcs resource disable master_p_rabbitmq-server;
pcs resource enable master_p_rabbitmq-server;
else
echo "Restart RabbitMQ"
pcs resource disable master_p_rabbitmq-server;
pcs resource enable master_p_rabbitmq-server;
fi;
'''
}
case $1 in
init)
coverage_$1
;;
start)
[[ $components_enable =~ (^| )$2($| ) ]] && coverage_$1 $2 || echo -e '\033[31mUnknown component\033[0m'
;;
stop)
[[ $components_enable =~ (^| )$2($| ) ]] && coverage_$1 $2 || echo -e '\033[31mUnknown component\033[0m'
;;
help)
echo """
Usage: $0 <command> <component>
<command>
init - Initialize coverage framework
start - Start counting coverage
stop - Stop counting coverage and generate report
<component>
List of supported components: $components_enable
"""
;;
*)
echo -e "Invalid command.\r\nType $0 to get help."
exit
esac