[Starlingx-discuss] check_osds_down_up check range
Church, Robert
Robert.Church at windriver.com
Wed Jan 23 15:49:04 UTC 2019
If you run the command:
controller-0:~$ ceph osd tree --f json | python -c 'import json,sys;print json.load(sys.stdin)["nodes"][0]'
{u'children': [-2], u'type_id': 10, u'type': u'root', u'id': -1, u'name': u'storage-tier'}
The first entry is always the root entry, so we skip it.
ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY
-1 0.11620 root storage-tier
-2 0.11620 chassis group-0
-4 0.11620 host controller-0
0 0.11620 osd.0 up 1.00000 1.00000
-3 0 host controller-1
It’s a minor programmatic optimization.
Bob
From: Ovidiu Poncea <Ovidiu.Poncea at windriver.com>
Date: Wednesday, January 23, 2019 at 9:40 AM
To: "Liu, Changcheng" <changcheng.liu at intel.com>, "Kung, John" <John.Kung at windriver.com>
Cc: "starlingx-discuss at lists.starlingx.io" <starlingx-discuss at lists.starlingx.io>
Subject: Re: [Starlingx-discuss] check_osds_down_up check range
Hi Liu,
That code should work correctly as the first element in the list (index 0) is not of type 'host'.
Two notes here:
1. That code in cgcs-root/stx/stx-metal/inventory is not executed in a normal stx install as it is part of an sysinv in-progress refactoring. You should better look in cgcs-root/stx/stx-config/sysinv/sysinv/sysinv/sysinv/common/ceph.py
2. You shouldn't bother too much with that function (check_osds_down_up) as it was used at upgrades and we don't support upgrades in stx - it may get removed. Testing its output in small script (or even the python interpreter) should be enough at this stage.
Ovidiu
________________________________
From: Liu, Changcheng [changcheng.liu at intel.com]
Sent: Wednesday, January 23, 2019 7:37 AM
To: Kung, John
Cc: starlingx-discuss at lists.starlingx.io
Subject: [Starlingx-discuss] check_osds_down_up check range
Hi John,
Could you help check whether there’s something wrong with below code?
File: cgcs-root/stx/stx-metal/inventory/inventory/inventory/common/ceph.py
96 def check_osds_down_up(self, hostname, upgrade):
97 # check if osds from a storage are down/up
98 response, body = self._ceph_api.osd_tree(body='json')
99 osd_tree = body['output']['nodes']
100 size = len(osd_tree)
101 for i in range(1, size):
Is there something special reason to not range from 0? i.e. range(0, size)
B.R.
Changcheng
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.starlingx.io/pipermail/starlingx-discuss/attachments/20190123/132c0cf3/attachment-0001.html>
More information about the Starlingx-discuss
mailing list