Merge ~jneo8/charm-openstack-service-checks:bug/1963549 into charm-openstack-service-checks:master

Proposed by JamesLin
Status: Merged
Approved by: Paul Goins
Approved revision: be96fbb47d68fe9090bc3c26c63083b0288ba6bc
Merged at revision: 5ccf0981e512be8fb0685f3b207c3a6deba116df
Proposed branch: ~jneo8/charm-openstack-service-checks:bug/1963549
Merge into: charm-openstack-service-checks:master
Diff against target: 245 lines (+142/-4)
8 files modified
src/config.yaml (+1/-1)
src/lib/lib_openstack_service_checks.py (+2/-1)
src/templates/nagios.novarc (+1/-0)
src/tests/functional/tests/bundles/focal-yoga.yaml (+125/-0)
src/tests/functional/tests/test_deploy.py (+7/-0)
src/tests/functional/tests/tests.yaml (+1/-0)
src/tests/unit/test_lib.py (+4/-2)
src/tox.ini (+1/-0)
Reviewer Review Type Date Requested Status
Paul Goins Approve
Rodrigo Barbieri (community) Needs Fixing
Eric Chen mr tracking Approve
Alvaro Uria (community) Needs Information
BootStack Reviewers mr tracking; do not claim Pending
Review via email: mp+423828@code.launchpad.net

Commit message

Add OS_VOLUME_API_VERSION to nagios.novarc

Description of the change

This merge make volume_api_version as required in os-credentials.

Reference:

https://docs.openstack.org/python-cinderclient/latest/user/shell.html

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Alvaro Uria (aluria) wrote :

Is the nagios_plugin3.py lib needed in this project? Tox will import it from charm-nrpe, which holds the original version.

review: Needs Information
Revision history for this message
JamesLin (jneo8) wrote :

Sorry about that, nagios_plugin3.py is a error when git commit.
Removed.

Revision history for this message
Alvaro Uria (aluria) wrote :

LGTM. Please provide some info about the check working in non-xena/non-yoga openstack versions as well as any of those versions and it will be +1 from me. Thanks.

Possibly, functests should include one of the versions (xena or yoga).

Revision history for this message
Alvaro Uria (aluria) wrote :

Status of the MP marked as "Work in progress". Please change it manually to "Ready for review" when the feedback is addressed. Thanks!

Revision history for this message
JamesLin (jneo8) wrote :

Deploy cinder with channel wallaby/edge && ussuri/edge.

Manual execute the python script, and get the response from cinder success.

Do I need to provide the functional testing from those version?

Revision history for this message
Eric Chen (eric-chen) :
review: Approve (mr tracking)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Failed to merge change (unable to merge source repository due to conflicts), setting status to needs review.

Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

Hello,

I reproduced the issue on charmhub latest/stable rev11 version and attempted to test this fix.

There is a trivial merge conflict on master but the master code is broken at the moment due to a "nagios_plugin3" dependency error. I applied the fix on top of 22.04 tag then and tested it successfully.

So right now master needs to be fixed so this fix can be tested against master.

Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :
review: Approve
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

Dependency [1] has merged, this patch needs to be rebased.

@jneo8, could you please rebase this?

[1] https://code.launchpad.net/~bootstack-charmers/charm-openstack-service-checks/+git/charm-openstack-service-checks/+merge/426423

review: Needs Fixing
Revision history for this message
JamesLin (jneo8) wrote :

> Dependency [1] has merged, this patch needs to be rebased.
>
> @jneo8, could you please rebase this?
>
> [1] https://code.launchpad.net/~bootstack-charmers/charm-openstack-service-
> checks/+git/charm-openstack-service-checks/+merge/426423

rebased

Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

Thanks James Lin, I code reviewed, the rebase looks good (thanks for removing that comma btw, I just spotted it) but just a nitpick that "test_09_openstack_check_cinder_service" should now be "test_10_openstack_check_cinder_service". I'm fine with it and approve it anyway, but it would be great if you can fix it.

review: Approve
Revision history for this message
Paul Goins (vultaire) wrote :

Please see diff comment; thanks.

review: Needs Fixing
Revision history for this message
Rodrigo Barbieri (rodrigo-barbieri2010) wrote :

Hi James Lin, do you have some spare cycles to perform the updates suggested by Paul Goins?

review: Needs Fixing
Revision history for this message
JamesLin (jneo8) wrote :

> Please see diff comment; thanks.

Updated.

Revision history for this message
JamesLin (jneo8) wrote :

> Hi James Lin, do you have some spare cycles to perform the updates suggested
> by Paul Goins?

Hi Rodrigo, thanks for the patience. I switch to another task last week. I updated it in the last commit.

Revision history for this message
Paul Goins (vultaire) :
review: Needs Fixing
Revision history for this message
JamesLin (jneo8) wrote :

Updated

Revision history for this message
Paul Goins (vultaire) :
review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 5ccf0981e512be8fb0685f3b207c3a6deba116df

Revision history for this message
JamesLin (jneo8) wrote :

Thanks @vultaire

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/config.yaml b/src/config.yaml
2index 20efe3b..045e0f4 100644
3--- a/src/config.yaml
4+++ b/src/config.yaml
5@@ -94,7 +94,7 @@ options:
6 Comma separated OpenStack credentials to be used by nagios.
7 It is strongly recommended this be a user with a dedicated role,
8 and not a full admin. Takes the format of
9- username=foo, password=bar, credentials_project=baz, region_name=Region1, auth_url=http://127.0.0.1:35357
10+ username=foo, password=bar, credentials_project=baz, region_name=Region1, auth_url=http://127.0.0.1:35357, volume_api_version=3
11 nova_warn:
12 default: 2
13 type: int
14diff --git a/src/lib/lib_openstack_service_checks.py b/src/lib/lib_openstack_service_checks.py
15index 81db325..2a12a7b 100644
16--- a/src/lib/lib_openstack_service_checks.py
17+++ b/src/lib/lib_openstack_service_checks.py
18@@ -207,7 +207,8 @@ class OSCHelper:
19 creds = {}
20
21 common_attrs = (
22- "username password region_name auth_url credentials_project"
23+ "username password region_name auth_url"
24+ " credentials_project volume_api_version"
25 ).split()
26 all_attrs = common_attrs + extra_attrs
27 missing = [k for k in all_attrs if k not in ident_creds]
28diff --git a/src/templates/nagios.novarc b/src/templates/nagios.novarc
29index 27f1c2a..a6e6be8 100644
30--- a/src/templates/nagios.novarc
31+++ b/src/templates/nagios.novarc
32@@ -4,6 +4,7 @@ export OS_PROJECT_NAME={{ project_name }}
33 export OS_PASSWORD={{ password }}
34 export OS_REGION_NAME={{ region }}
35 export OS_AUTH_URL={{ auth_url }}
36+export OS_VOLUME_API_VERSION={{ volume_api_version }}
37 {%- if cacert %}
38 export OS_CACERT={{ cacert }}
39 export REQUESTS_CA_BUNDLE=$OS_CACERT
40diff --git a/src/tests/functional/tests/bundles/focal-yoga.yaml b/src/tests/functional/tests/bundles/focal-yoga.yaml
41new file mode 100644
42index 0000000..57d12d3
43--- /dev/null
44+++ b/src/tests/functional/tests/bundles/focal-yoga.yaml
45@@ -0,0 +1,125 @@
46+variables:
47+ openstack-origin: &openstack-origin cloud:focal-yoga
48+
49+series: focal
50+
51+applications:
52+ rabbitmq-server:
53+ charm: ch:rabbitmq-server
54+ channel: latest/edge
55+ num_units: 1
56+ options:
57+ source: *openstack-origin
58+ keystone-mysql-router:
59+ charm: ch:mysql-router
60+ channel: latest/edge
61+ nova-mysql-router:
62+ charm: ch:mysql-router
63+ channel: latest/edge
64+ neutron-mysql-router:
65+ charm: ch:mysql-router
66+ channel: latest/edge
67+ mysql-innodb-cluster:
68+ charm: ch:mysql-innodb-cluster
69+ num_units: 3
70+ channel: latest/edge
71+ constraints: mem=3072M
72+ options:
73+ source: *openstack-origin
74+ nova-cloud-controller:
75+ charm: ch:nova-cloud-controller
76+ channel: latest/edge
77+ num_units: 1
78+ options:
79+ network-manager: Neutron
80+ openstack-origin: *openstack-origin
81+ neutron-api:
82+ charm: ch:neutron-api
83+ channel: latest/edge
84+ num_units: 1
85+ options:
86+ manage-neutron-plugin-legacy-mode: True
87+ flat-network-providers: physnet1
88+ neutron-security-groups: true
89+ openstack-origin: *openstack-origin
90+ keystone:
91+ charm: ch:keystone
92+ channel: latest/edge
93+ num_units: 1
94+ options:
95+ openstack-origin: *openstack-origin
96+ nagios:
97+ charm: ch:nagios
98+ num_units: 1
99+ series: bionic # Does not support Focal
100+ nrpe:
101+ charm: ch:nrpe
102+ openstack-service-checks:
103+ num_units: 1
104+ ceph-radosgw:
105+ charm: ch:ceph-radosgw
106+ num_units: 1
107+ options:
108+ namespace-tenants: True
109+ source: *openstack-origin
110+ cinder:
111+ charm: ch:cinder
112+ num_units: 1
113+ storage:
114+ block-devices: '40G'
115+ options:
116+ openstack-origin: *openstack-origin
117+ block-device: None
118+ overwrite: "true"
119+ cinder-lvm:
120+ charm: ch:cinder-lvm
121+ options:
122+ block-device: "/mnt/cinder-lvm-block|20G"
123+ config-flags: "target_helper=lioadm"
124+ cinder-mysql-router:
125+ charm: ch:mysql-router
126+ channel: latest/edge
127+
128+relations:
129+ - - nova-cloud-controller:shared-db
130+ - nova-mysql-router:shared-db
131+ - - nova-cloud-controller:identity-service
132+ - keystone:identity-service
133+ - - nova-cloud-controller:amqp
134+ - rabbitmq-server:amqp
135+ - - keystone:shared-db
136+ - keystone-mysql-router:shared-db
137+ - - neutron-api:shared-db
138+ - neutron-mysql-router:shared-db
139+ - - neutron-api:amqp
140+ - rabbitmq-server:amqp
141+ - - neutron-api:neutron-api
142+ - nova-cloud-controller:neutron-api
143+ - - neutron-api:identity-service
144+ - keystone:identity-service
145+ - - nrpe:monitors
146+ - nagios:monitors
147+ - - nrpe:nrpe-external-master
148+ - openstack-service-checks:nrpe-external-master
149+ - - openstack-service-checks:identity-credentials
150+ - keystone:identity-credentials
151+ - - openstack-service-checks:identity-notifications
152+ - keystone:identity-notifications
153+ - - keystone-mysql-router:db-router
154+ - mysql-innodb-cluster:db-router
155+ - - neutron-mysql-router:db-router
156+ - mysql-innodb-cluster:db-router
157+ - - nova-mysql-router:db-router
158+ - mysql-innodb-cluster:db-router
159+ - - ceph-radosgw:identity-service
160+ - keystone:identity-service
161+ - - cinder:identity-service
162+ - keystone:identity-service
163+ - - cinder-mysql-router:shared-db
164+ - cinder:shared-db
165+ - - rabbitmq-server:amqp
166+ - cinder:amqp
167+ - - cinder-mysql-router:db-router
168+ - mysql-innodb-cluster:db-router
169+ - - cinder:storage-backend
170+ - cinder-lvm:storage-backend
171diff --git a/src/tests/functional/tests/test_deploy.py b/src/tests/functional/tests/test_deploy.py
172index a9b610c..827f172 100755
173--- a/src/tests/functional/tests/test_deploy.py
174+++ b/src/tests/functional/tests/test_deploy.py
175@@ -247,3 +247,10 @@ class TestOpenStackServiceChecks(TestBase):
176 assert status_msg == expected_msg
177 # NOTE (rgildein): This last test will break the keystone unit, and you need to
178 # run `juju resolve`.
179+
180+ def test_10_openstack_check_cinder_service(self):
181+ """Verify cinder service.""",
182+ model.block_until_all_units_idle()
183+ cmd = "python3 /usr/local/lib/nagios/plugins/check_cinder_services.py"
184+ result = model.run_on_unit(self.lead_unit_name, cmd)
185+ self.assertEquals(result.get("Code"), "0") # Get response from cinder
186diff --git a/src/tests/functional/tests/tests.yaml b/src/tests/functional/tests/tests.yaml
187index 4ba93d5..1d726c8 100644
188--- a/src/tests/functional/tests/tests.yaml
189+++ b/src/tests/functional/tests/tests.yaml
190@@ -6,6 +6,7 @@ smoke_bundles:
191 - base: bionic
192 dev_bundles:
193 - compute: bionic
194+ - compute: focal-yoga
195 target_deploy_status:
196 nova-cloud-controller:
197 workload-status: blocked
198diff --git a/src/tests/unit/test_lib.py b/src/tests/unit/test_lib.py
199index 3217837..0cf4808 100644
200--- a/src/tests/unit/test_lib.py
201+++ b/src/tests/unit/test_lib.py
202@@ -53,7 +53,7 @@ def test_openstackservicechecks_get_keystone_credentials_unitdata(
203 (
204 (
205 'username=nagios, password=password, region_name=RegionOne, auth_url="http://XX.XX.XX.XX:5000/v3",' # noqa:E501
206- "credentials_project=services, domain=service_domain"
207+ "credentials_project=services, domain=service_domain, volume_api_version=3" # noqa:E501
208 ),
209 {
210 "username": "nagios",
211@@ -64,12 +64,13 @@ def test_openstackservicechecks_get_keystone_credentials_unitdata(
212 "project_domain_name": "service_domain",
213 "region_name": "RegionOne",
214 "auth_url": "http://XX.XX.XX.XX:5000/v3",
215+ "volume_api_version": "3",
216 },
217 ),
218 (
219 (
220 'username=nagios, password=password, region_name=RegionOne, auth_url="http://XX.XX.XX.XX:5000/v2.0",' # noqa:E501
221- "credentials_project=services"
222+ "credentials_project=services, volume_api_version=3"
223 ),
224 {
225 "username": "nagios",
226@@ -77,6 +78,7 @@ def test_openstackservicechecks_get_keystone_credentials_unitdata(
227 "tenant_name": "services",
228 "region_name": "RegionOne",
229 "auth_url": "http://XX.XX.XX.XX:5000/v2.0",
230+ "volume_api_version": "3",
231 },
232 ),
233 ],
234diff --git a/src/tox.ini b/src/tox.ini
235index 8cff956..69cfe81 100644
236--- a/src/tox.ini
237+++ b/src/tox.ini
238@@ -31,6 +31,7 @@ passenv =
239 OS_USER_DOMAIN_NAME
240 OS_PROJECT_NAME
241 OS_IDENTITY_API_VERSION
242+ OS_VOLUME_API_VERSION
243
244 [testenv:lint]
245 commands =

Subscribers

People subscribed via source and target branches

to all changes: