<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=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<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:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:"Intel Clear";
panose-1:2 11 6 4 2 2 3 2 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;}
span.EmailStyle17
{mso-style-type:personal-compose;
font-family:"Intel Clear",sans-serif;
color:windowtext;
font-weight:normal;
font-style:normal;
text-decoration:none none;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri",sans-serif;}
@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-family:"Intel Clear",sans-serif">Hi,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">I have met an issue when add a new plugin which called by sysinv,
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">The plugin is to execute some bash commands, such as kubectl to get information, but it seems I have tried by using:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Subprocess.Popen() and subprocess.check_output() it return failed with non-zero exit status 1.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">But I tried on my local Ubuntu environment, the result is OK.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Is there any audit or privilege or some audit in Sysinv Service?<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-family:"Intel Clear",sans-serif">Piece of code:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> execute_process = subprocess.Popen(command,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> stdout=subprocess.PIPE, stderr=sys.stderr)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> objects = yaml.safe_load(execute_process.stdout)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> if execute_process.wait() != 0:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> raise ApiError<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif;color:#0070C0"> return objects<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span style="font-family:"Intel Clear",sans-serif">Following is the output:<o:p></o:p></span></b></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">-----------------------------------------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">sysinv 2020-01-14 10:31:20.038 1172858 INFO sysinv.common.ceph [-] ceph osd crush rule ls<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">sysinv 2020-01-14 10:31:20.038 1172858 ERROR rook_client_kubeapi [-] ['/usr/bin/kubectl', 'get', '--namespace', 'kube-system', 'pod', '-l', 'app=rook-ceph-tools', '-o', 'jsonpath="{.items[0].metadata.name}"']<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">sysinv 2020-01-14 10:31:20.038 1172858 INFO rook_client_kubeapi [-] Get pod command: ['/usr/bin/kubectl', 'get', '--namespace', 'kube-system', 'pod', '-l', 'app=rook-ceph-tools', '-o',
'jsonpath="{.items[0].metadata.name}"']<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">sysinv 2020-01-14 10:31:45.026 1172858 ERROR sysinv.common.ceph [-] Exception in ls crush rule: Command '['/usr/bin/kubectl', 'get', '--namespace', 'kube-system', 'pod', '-l', 'app=rook-ceph-tools',
'-o', 'jsonpath="{.items[0].metadata.name}"']' returned non-zero exit status 1: CalledProcessError: Command '['/usr/bin/kubectl', 'get', '--namespace', 'kube-system', 'pod', '-l', 'app=rook-ceph-tools', '-o', 'jsonpath="{.items[0].metadata.name}"']' returned
non-zero exit status 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">sysinv 2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp [-] Exception during message handling: CephFailure: OSD crush rule ls failed. Command '['/usr/bin/kubectl',
'get', '--namespace', 'kube-system', 'pod', '-l', 'app=rook-ceph-tools', '-o', 'jsonpath="{.items[0].metadata.name}"']' returned non-zero exit status 1<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp Traceback (most recent call last):<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp File "/usr/lib64/python2.7/site-packages/sysinv/openstack/common/rpc/amqp.py", line 437, in _process_data<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp **args)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp File "/usr/lib64/python2.7/site-packages/sysinv/openstack/common/rpc/dispatcher.py", line 172, in dispatch<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp result = getattr(proxyobj, method)(ctxt, **kwargs)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp File "/usr/lib64/python2.7/site-packages/sysinv/conductor/manager.py", line 4405, in iplatform_update_by_ihost<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp cceph.fix_crushmap(self.dbapi)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp File "/usr/lib64/python2.7/site-packages/sysinv/common/ceph.py", line 947, in fix_crushmap<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp rule_is_present, __, __ = _operator._crush_rule_status(default_ceph_tier_name)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp File "/usr/lib64/python2.7/site-packages/sysinv/common/ceph.py", line 67, in _crush_rule_status<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">2020-01-14 10:31:45.027 1172858 ERROR sysinv.openstack.common.rpc.amqp raise exception.CephFailure("OSD crush rule ls failed. %s" %str(e))<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Tingjie<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">SSP NST Storage<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Tel: +86(21)88216699<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-family:"Intel Clear",sans-serif">Mobile: 15901876439<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>