bugfix: kill process do not accurately kill "nova-api" 93/47793/6
authorrexlee8776 <limingjiang@huawei.com>
Sat, 25 Nov 2017 06:44:33 +0000 (06:44 +0000)
committerRex Lee <limingjiang@huawei.com>
Fri, 15 Dec 2017 01:50:50 +0000 (01:50 +0000)
JIRA: YARDSTICK-849

1. update the kill process RegEx pattern to be more accurate
2. make attack_process to be parameter so it can be customized if
the SUT is using a different name of attack_process

Change-Id: I569730ced6c24aafbffcf2fc5752d3560d0adac5
Signed-off-by: rexlee8776 <limingjiang@huawei.com>
tests/opnfv/test_cases/opnfv_yardstick_tc019.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc045.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc046.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc047.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc048.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc049.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc053.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc056.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc057.yaml
tests/opnfv/test_cases/opnfv_yardstick_tc058.yaml
yardstick/benchmark/scenarios/availability/ha_tools/fault_process_kill.bash

index d729169..08037d9 100644 (file)
@@ -16,6 +16,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "nova-api" %}
 
 scenarios:
 -
@@ -23,7 +24,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "nova-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     wait_time: 10
@@ -35,7 +36,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "nova-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index 6a3465c..bc7cd3d 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "neutron-server" %}
 
 scenarios:
 -
@@ -22,7 +23,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "neutron-server"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -33,7 +34,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "neutron-server"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index 200bdfc..3b04cc4 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "keystone" %}
 
 scenarios:
 -
@@ -22,7 +23,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "keystone"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -33,7 +34,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "keystone"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index d7c69c0..d199e51 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "glance-api" %}
 
 scenarios:
 -
@@ -22,7 +23,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "glance-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -33,7 +34,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "glance-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index ddc62bb..2bca1fb 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "cinder-api" %}
 
 scenarios:
 -
@@ -22,7 +23,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "cinder-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -33,7 +34,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "cinder-api"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index b23bb33..a3df57c 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "swift-proxy" %}
 
 scenarios:
 -
@@ -22,7 +23,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "swift-proxy"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -33,7 +34,7 @@ scenarios:
       sla:
         max_outage_time: 5
     - monitor_type: "process"
-      process_name: "swift-proxy"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       monitor_number: 3
index bcf5902..c2a4f9e 100644 (file)
@@ -15,6 +15,7 @@ description: >
 
 {% set file = file or '/etc/yardstick/pod.yaml' %}
 {% set attack_host = attack_host or "node1" %}
+{% set attack_process = attack_process or "haproxy" %}
 
 scenarios:
   -
@@ -25,13 +26,13 @@ scenarios:
           fault_type: "kill-process"
           host: {{attack_host}}
           key: "kill-process"
-          process_name: "haproxy"
+          process_name: "{{ attack_process }}"
 
       monitors:
         -
           monitor_type: "process"
           key: "service-status"
-          process_name: "haproxy"
+          process_name: "{{ attack_process }}"
           host: {{attack_host}}
           monitor_time: 30
           monitor_number: 3
index 0035a1f..9194d9d 100644 (file)
@@ -17,6 +17,7 @@ description: >
 {% set attack_host = attack_host or 'node1' %}
 {% set monitor_time = monitor_time or 10 %}
 {% set monitor_number = monitor_number or 3 %}
+{% set attack_process = attack_process or "rabbitmq-server" %}
 
 scenarios:
 -
@@ -24,7 +25,7 @@ scenarios:
   options:
     attackers:
     - fault_type: "kill-process"
-      process_name: "rabbitmq-server"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
 
     monitors:
@@ -57,7 +58,7 @@ scenarios:
         max_outage_time: 5
 
     - monitor_type: "process"
-      process_name: "rabbitmq-server"
+      process_name: "{{ attack_process }}"
       host: {{attack_host}}
       monitor_time: 30
       sla:
index 6d71091..f6a35e9 100644 (file)
@@ -20,6 +20,7 @@ description: >
 {% set check_host = check_host or 'node2' %}
 {% set monitor_time = monitor_time or 10 %}
 {% set monitor_number = monitor_number or 3 %}
+{% set attack_process = attack_process or "corosync" %}
 
 scenarios:
   -
@@ -32,7 +33,7 @@ scenarios:
           key: "kill-process"
           attack_key: "kill-corosync"
           action_parameter:
-            process_name: "corosync"
+            process_name: "{{ attack_process }}"
 
       monitors:
         -
index 77b9172..06d4600 100644 (file)
@@ -17,6 +17,7 @@ description: >
 {% set image = image or 'yardstick-image' %}
 {% set flavor = flavor or 'yardstick-flavor' %}
 {% set attack_host = attack_host or 'node1' %}
+{% set attack_process = attack_process or "neutron-l3-agent" %}
 
 scenarios:
   -
@@ -27,12 +28,12 @@ scenarios:
           fault_type: "kill-process"
           host: {{attack_host}}
           key: "kill-process"
-          process_name: "neutron-l3-agent"
+          process_name: "{{ attack_process }}"
 
       monitors:
         -
           monitor_type: "process"
-          process_name: "neutron-l3-agent"
+          process_name: "{{ attack_process }}"
           host: {{attack_host}}
           key: "monitor-recovery"
           monitor_time: 30
index eec86e1..d34ce93 100755 (executable)
@@ -26,7 +26,7 @@ elif [ "$process_name" = "haproxy" ]; then
             kill -9 "${pid}"
         done
 else
-    for pid in $(pgrep -f "/usr/.*/${process_name}");
+    for pid in $(pgrep -fa [^-_a-zA-Z0-9]${process_name} | grep -iv heartbeat | awk '{print $1}');
         do
             kill -9 "${pid}"
         done