<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:"Bookman Old Style";
panose-1:2 5 6 4 5 5 5 2 2 4;}
@font-face
{font-family:FangSong;
panose-1:2 1 6 9 6 1 1 1 1 1;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:#0563C1;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:#954F72;
text-decoration:underline;}
p.msonormal0, li.msonormal0, div.msonormal0
{mso-style-name:msonormal;
margin:0in;
margin-bottom:.0001pt;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
span.emailstyle17
{mso-style-name:emailstyle17;
font-family:"Bookman Old Style",serif;
color:#1F4E79;
letter-spacing:0pt;
text-decoration:none none;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri",sans-serif;
color:windowtext;
font-weight:normal;
font-style:normal;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Bookman Old Style",serif;
color:#1F497D;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F497D">Thanks Bob & Ovidiu.<o:p></o:p></span></p>
<p class="MsoNormal"><a name="_MailEndCompose"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F497D"><o:p> </o:p></span></a></p>
<div>
<div style="border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><a name="_____replyseparator"></a><b>From:</b> Church, Robert [mailto:Robert.Church@windriver.com]
<br>
<b>Sent:</b> Wednesday, January 23, 2019 11:49 PM<br>
<b>To:</b> Poncea, Ovidiu <Ovidiu.Poncea@windriver.com>; Liu, Changcheng <changcheng.liu@intel.com>; Kung, John <John.Kung@windriver.com><br>
<b>Cc:</b> starlingx-discuss@lists.starlingx.io<br>
<b>Subject:</b> Re: [Starlingx-discuss] check_osds_down_up check range<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">If you run the command:<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">controller-0:~$ ceph osd tree --f json | python -c 'import json,sys;print json.load(sys.stdin)["nodes"][0]'<o:p></o:p></p>
<p class="MsoNormal">{u'children': [-2], u'type_id': 10, u'type': u'root', u'id': -1, u'name': u'storage-tier'}<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">The first entry is always the root entry, so we skip it.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">ID WEIGHT TYPE NAME UP/DOWN REWEIGHT PRIMARY-AFFINITY<o:p></o:p></p>
<p class="MsoNormal">-1 0.11620 root storage-tier<o:p></o:p></p>
<p class="MsoNormal">-2 0.11620 chassis group-0<o:p></o:p></p>
<p class="MsoNormal">-4 0.11620 host controller-0<o:p></o:p></p>
<p class="MsoNormal">0 0.11620 osd.0 up 1.00000 1.00000<o:p></o:p></p>
<p class="MsoNormal">-3 0 host controller-1<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">It’s a minor programmatic optimization.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Bob<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><span style="font-size:12.0pt;color:black">From: </span></b><span style="font-size:12.0pt;color:black">Ovidiu Poncea <<a href="mailto:Ovidiu.Poncea@windriver.com">Ovidiu.Poncea@windriver.com</a>><br>
<b>Date: </b>Wednesday, January 23, 2019 at 9:40 AM<br>
<b>To: </b>"Liu, Changcheng" <<a href="mailto:changcheng.liu@intel.com">changcheng.liu@intel.com</a>>, "Kung, John" <<a href="mailto:John.Kung@windriver.com">John.Kung@windriver.com</a>><br>
<b>Cc: </b>"<a href="mailto:starlingx-discuss@lists.starlingx.io">starlingx-discuss@lists.starlingx.io</a>" <<a href="mailto:starlingx-discuss@lists.starlingx.io">starlingx-discuss@lists.starlingx.io</a>><br>
<b>Subject: </b>Re: [Starlingx-discuss] check_osds_down_up check range<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">Hi Liu,<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">That code should work correctly as the first element in the list (index 0) is not of type 'host'.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">Two notes here:<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">1. That code in
</span><span style="font-size:10.0pt;font-family:"Courier New";color:#1F4E79">cgcs-root/stx/stx-metal/inventory</span><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"> is not executed in a normal stx install as it is part of an sysinv
in-progress refactoring. You should better look in <b>cgcs-root/stx/stx-config</b>/sysinv/sysinv/sysinv/sysinv/common/ceph.py<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">2. You shouldn't bother too much with that function (</span><span style="font-size:10.0pt;font-family:"Courier New";color:black">check_osds_down_up)</span><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">
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.<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"><o:p> </o:p></span></p>
</div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">Ovidiu<o:p></o:p></span></p>
</div>
<div>
<div class="MsoNormal" align="center" style="text-align:center"><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black">
<hr size="1" width="100%" align="center">
</span></div>
<div id="divRpF514809">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black">From:</span></b><span style="font-size:10.0pt;font-family:"Tahoma",sans-serif;color:black"> Liu, Changcheng [changcheng.liu@intel.com]<br>
<b>Sent:</b> Wednesday, January 23, 2019 7:37 AM<br>
<b>To:</b> Kung, John<br>
<b>Cc:</b> <a href="mailto:starlingx-discuss@lists.starlingx.io">starlingx-discuss@lists.starlingx.io</a><br>
<b>Subject:</b> [Starlingx-discuss] check_osds_down_up check range</span><span style="font-size:12.0pt;font-family:"Times New Roman",serif;color:black"><o:p></o:p></span></p>
</div>
<div>
<div>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79">Hi John,</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:12.0pt"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79">Could you help check whether there’s something wrong with below code?</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:#1F4E79"> File: cgcs-root/stx/stx-metal/inventory/inventory/inventory/common/ceph.py</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 96 def check_osds_down_up(self, hostname, upgrade):</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 97 # check if osds from a storage are down/up</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 98 response, body = self._ceph_api.osd_tree(body='json')</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 99 osd_tree = body['output']['nodes']</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 100
<b>size = len(osd_tree)</b></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="margin-left:12.0pt"><span style="font-size:10.0pt;font-family:"Courier New";color:black"> 101
<b>for i in range(1, size):</b></span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="text-indent:12.0pt"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79">Is there something special reason to not range from 0? i.e. range(0, size)</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79"> </span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79">B.R.</span><span style="color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:10.0pt;font-family:"Bookman Old Style",serif;color:#1F4E79">Changcheng</span><span style="color:black"><o:p></o:p></span></p>
</div>
</div>
</div>
</div>
</div>
</body>
</html>