6
6
from ocs_ci .framework .testlib import E2ETest , tier2
7
7
from ocs_ci .helpers import helpers
8
8
from ocs_ci .ocs import cluster , constants
9
- from ocs_ci .ocs .monitoring import get_prometheus_response
10
9
from ocs_ci .utility import prometheus
11
10
from ocs_ci .utility .utils import ceph_health_check_base
12
- from ocs_ci .framework import config
13
- from ocs_ci .ocs .ocp import OCP
14
11
15
12
log = logging .getLogger (__name__ )
16
13
@@ -30,18 +27,12 @@ def run_file_creator_io_with_cephfs(dc_pod_factory):
30
27
interface = constants .CEPHFILESYSTEM
31
28
log .info ("Checking for Ceph Health OK" )
32
29
ceph_health_check_base ()
33
- ocp_project = OCP (
34
- kind = constants .NAMESPACE , namespace = config .ENV_DATA ["cluster_namespace" ]
35
- )
36
30
37
31
for dc_pod in range (10 ):
38
32
log .info (f"Creating { interface } based PVC" )
39
33
log .info ("Creating fedora dc pod" )
40
34
pod_obj = dc_pod_factory (
41
- size = "15" ,
42
- access_mode = access_mode ,
43
- interface = interface ,
44
- project = ocp_project ,
35
+ size = "15" , access_mode = access_mode , interface = interface
45
36
)
46
37
log .info ("Copying file_creator_io.py to fedora pod " )
47
38
cmd = f"oc cp { file } { pod_obj .namespace } /{ pod_obj .name } :/"
@@ -54,19 +45,6 @@ def run_file_creator_io_with_cephfs(dc_pod_factory):
54
45
)
55
46
56
47
57
- def get_scaling_type (threading_lock ):
58
- api = prometheus .PrometheusAPI (threading_lock = threading_lock )
59
- ceph_mds_request = get_prometheus_response (api , query = "rate(ceph_mds_request[6h])" )
60
- result = ceph_mds_request ["data" ]["result" ]
61
- for item in result :
62
- rate_ceph_mds_request = item ["value" ]
63
- rate_ceph_mds_request = float (rate_ceph_mds_request [1 ])
64
- if rate_ceph_mds_request >= 1000 :
65
- return "Horizontal"
66
- else :
67
- return "Vertical"
68
-
69
-
70
48
def active_mds_alert_values (threading_lock ):
71
49
"""
72
50
This function validates the mds alerts using prometheus api
@@ -78,22 +56,15 @@ def active_mds_alert_values(threading_lock):
78
56
api = prometheus .PrometheusAPI (threading_lock = threading_lock )
79
57
alert_list = api .wait_for_alert (name = cpu_alert , state = "pending" )
80
58
message = f"Ceph metadata server pod ({ active_mds_pod } ) has high cpu usage"
81
-
82
- scaling_type = get_scaling_type (threading_lock )
83
- if scaling_type == "Horizontal" :
84
- description_part = (
85
- " and cannot cope up with the current rate of mds requests."
86
- "\n Please consider Horizontal scaling, by adding another MDS pod"
87
- )
88
- else :
89
- description_part = ". Please consider Vertical scaling, by adding more resources to the existing MDS pod"
90
59
description = (
91
- f"Ceph metadata server pod ({ active_mds_pod } ) has high cpu usage { description_part } ."
92
- "\n Please see 'runbook_url' for more details."
60
+ f"Ceph metadata server pod ({ active_mds_pod } ) has high cpu usage"
61
+ f"\n . Please consider Vertical "
62
+ f"\n scaling, by adding more resources to the existing MDS pod."
63
+ f"\n Please see 'runbook_url' for more details."
93
64
)
94
65
runbook = (
95
- "https://github.com/openshift/runbooks/blob/master/alerts/openshift-container-storage-operator "
96
- f"/CephMdsCPUUsageHighNeeds { scaling_type } Scaling .md"
66
+ "https://github.com/openshift/runbooks/blob/master/alerts/"
67
+ "openshift-container-storage-operator/CephMdsCPUUsageHighNeedsVerticalScaling .md"
97
68
)
98
69
severity = "warning"
99
70
state = ["pending" ]
@@ -139,5 +110,4 @@ def test_alert_triggered(self, run_file_creator_io_with_cephfs, threading_lock):
139
110
"File creation IO started in the background."
140
111
" Script will look for MDSCPUUsageHigh alert"
141
112
)
142
-
143
113
assert active_mds_alert_values (threading_lock )
0 commit comments