[Starlingx-discuss] check_osds_down_up check range

Poncea, Ovidiu Ovidiu.Poncea at windriver.com
Wed Jan 23 15:38:50 UTC 2019


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/47537e78/attachment.html>


More information about the Starlingx-discuss mailing list