Skip to content

Commit

Permalink
Additional enclosure fixes/cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
darkfiberiru committed Jun 23, 2021
1 parent fd1995d commit 30123f3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
8 changes: 8 additions & 0 deletions src/middlewared/middlewared/plugins/enclosure.py
Expand Up @@ -45,6 +45,7 @@
X_SERIES_REGEX = re.compile(r"CELESTIC (P3215-O|P3217-B)")
ES24_REGEX = re.compile(r"(ECStream|iX) 4024J")
ES24F_REGEX = re.compile(r"(ECStream|iX) 2024J([ps])")
MINI_REGEX = re.compile(r"(TRUE|FREE)NAS-MINI")


class EnclosureLabelModel(sa.Model):
Expand Down Expand Up @@ -536,6 +537,13 @@ def _set_model(self, data):
self.model = "ES24F"
elif self.encname.startswith("CELESTIC X2012"):
self.model = "ES12"
elif (
self.encname == "AHCI SGPIO Enclosure 2.00" and
MINI_REGEX.match(self.system_info["system_product"])
):
self.model = self.system_info["system_product"]
self.controller = True


def _parse_raw_value(self, value):
newvalue = 0
Expand Down
14 changes: 7 additions & 7 deletions src/middlewared/middlewared/plugins/enclosure_/map.py
Expand Up @@ -139,16 +139,11 @@ async def _map_enclosures(self, enclosures, slots):

elements.append(element)

info = await self.middleware.call("system.info")
if '-MINI-' in info["system_product"]:
model = info["system_product"]
else:
model = info["system_product"].replace("TRUENAS-", "")
return [
mapped = [
{
"id": "mapped_enclosure_0",
"name": "Drive Bays",
"model": model,
"model": enclosures[0].model,
"controller": True,
"elements": [
{
Expand All @@ -161,3 +156,8 @@ async def _map_enclosures(self, enclosures, slots):
],
}
]
#Add shelves back in
for enclosure in enclosures:
if enclosure.controller == false:
mapped.append(enclosure)
return mapped

0 comments on commit 30123f3

Please sign in to comment.