Naudit / pystorcli2

Python library provides wrapper around storcli tool to manage and control LSI MegaRAID controllers.
BSD 3-Clause "New" or "Revised" License
2 stars 7 forks source link

has_foreign_configurations raises on failure #15

Closed ulmitov closed 1 year ago

ulmitov commented 1 year ago

The following exception is being raised if command's rc is non zero:

In [4]: c['/c0'].has_foreign_configurations()
ERROR:root:RC=59 returned from /usr/sbin/storcli64 /c0 /fall show J
---------------------------------------------------------------------------
CalledProcessError                        Traceback (most recent call last)
File ~/Desktop/venvs/dev/lib/python3.9/site-packages/pystorcli/storcli.py:225, in StorCLI.run(self, args, stdout, stderr, allow_error_codes, **kwargs)
    224 if ret.returncode != 0:
--> 225     raise subprocess.CalledProcessError(
    226         ret.returncode, cmd, ret.stdout, ret.stderr)
    227 if self.cache_enable:

CalledProcessError: Command '['/usr/sbin/storcli64', '/c0', '/fall', 'show', 'J']' returned non-zero exit status 59.

During handling of the above exception, another exception occurred:

StorCliRunTimeError                       Traceback (most recent call last)
Cell In[4], line 1
----> 1 c['/c0'].has_foreign_configurations()

File ~/Desktop/venvs/dev/lib/python3.9/site-packages/pystorcli/controller/__init__.py:435, in Controller.has_foreign_configurations(self, securitykey)
    432     args.append(f'securitykey={securitykey}')
    434 try:
--> 435     fc_data = common.response_data(self._run(args))
    436     fcs = 0
    438     if 'Total foreign Drive Groups' in fc_data:

File ~/Desktop/venvs/dev/lib/python3.9/site-packages/pystorcli/controller/__init__.py:83, in Controller._run(self, args, allow_error_codes, **kwargs)
     81 args = args[:]
     82 args.insert(0, self._name)
---> 83 return self._storcli.run(args, allow_error_codes=allow_error_codes, **kwargs)

File ~/Desktop/venvs/dev/lib/python3.9/site-packages/pystorcli/storcli.py:252, in StorCLI.run(self, args, stdout, stderr, allow_error_codes, **kwargs)
    250     raise exc.StorCliRunTimeout(err)
    251 except subprocess.SubprocessError as err:
--> 252     raise exc.StorCliRunTimeError(err)

StorCliRunTimeError: Command '/usr/sbin/storcli64 /c0 /fall show J' returned with non-zero exit status 59: 

This was the output:

12:28:52 [ERROR] RC=59 returned from /usr/sbin/storcli64 /c0 /fall show J
12:28:52 [ERROR] STDERR:
STDOUT:{
"Controllers":[
{
    "Command Status" : {
        "CLI Version" : "007.2309.0000.0000 Sep 16, 2022",
        "Operating system" : "Linux 5.4.0-99-generic",
        "Controller" : 0,
        "Status" : "Failure",
        "Description" : "Incomplete foreign configuration"
    },
    "Response Data" : {
        "Total Foreign PDs" : 16,
        "Total Locked Foreign PDs" : 0
    }
}
]
}
ralequi commented 1 year ago

Have you a way to generate this error on your card? (just to replicate it)

ralequi commented 1 year ago

It seems to be fixed now

ralequi commented 1 year ago

could you confirm fix? @ulmitov

ulmitov commented 1 year ago

not yet, will take me a couple of weeks i think

ulmitov commented 1 year ago

this one looks like fixed, did not reproduce for me