pyghmi 1.5.60__py3-none-any.whl → 1.5.61__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -31,7 +31,9 @@ class EnergyManager(object):
31
31
  try:
32
32
  rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0])
33
33
  if len(rsp['data']) >= 8:
34
- self.supportedmeters = ('DC Energy',)
34
+ self.supportedmeters = ('DC Energy',) # 'GPU Power',
35
+ # 'Node Power', 'Total Power')
36
+ self._mypowermeters = ('node power', 'total power', 'gpu power', 'riser 1 power', 'riser 2 power')
35
37
  self._usefapm = True
36
38
  return
37
39
  except pygexc.IpmiException:
@@ -57,6 +59,23 @@ class EnergyManager(object):
57
59
  else:
58
60
  self.supportedmeters = ('DC Energy',)
59
61
 
62
+ def supports(self, name):
63
+ if name.lower() in self._mypowermeters:
64
+ return True
65
+ return False
66
+
67
+ def get_sensor(self, name, ipmicmd):
68
+ if name.lower() not in self._mypowermeters:
69
+ raise pygexc.UnsupportedFunctionality('Unrecogcized sensor')
70
+ rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 8, 0, 0, 0])
71
+ npow, gpupow, r1pow, r2pow = struct.unpack('<HHHH', rsp['data'][6:10])
72
+ if name.lower().startswith('node'):
73
+ return npow, 'W'
74
+ elif name.lower().startswith('gpu'):
75
+ return gpupow, 'W'
76
+ elif name.lower().startswith('total'):
77
+ return npow + gpupow, 'W'
78
+
60
79
  def get_fapm_energy(self, ipmicmd):
61
80
  rsp = ipmicmd.xraw_command(netfn=0x3a, command=0x32, data=[4, 2, 0, 0, 0])
62
81
  j, mj = struct.unpack('<IH', rsp['data'][2:8])
@@ -718,27 +718,28 @@ class OEMHandler(generic.OEMHandler):
718
718
  fru['FRU Number'] = bextra[0]
719
719
  fru['Revision'] = bextra[4]
720
720
  macs = bextra[6]
721
- macprefix = None
722
- idx = 0
723
- endidx = len(macs) - 5
724
- macprefix = None
725
- while idx < endidx:
726
- currmac = macs[idx:idx + 6]
727
- if not isinstance(currmac, bytearray):
728
- # invalid vpd format, abort attempts to extract
729
- # mac in this way
730
- break
731
- if currmac == b'\x00\x00\x00\x00\x00\x00':
732
- break
733
- # VPD may veer off, detect and break off
734
- if macprefix is None:
735
- macprefix = currmac[:3]
736
- elif currmac[:3] != macprefix:
737
- break
738
- ms = mac_format.format(*currmac)
739
- ifidx = idx / 6 + 1
740
- fru['MAC Address {0}'.format(ifidx)] = ms
741
- idx = idx + 6
721
+ if macs:
722
+ macprefix = None
723
+ idx = 0
724
+ endidx = len(macs) - 5
725
+ macprefix = None
726
+ while idx < endidx:
727
+ currmac = macs[idx:idx + 6]
728
+ if not isinstance(currmac, bytearray):
729
+ # invalid vpd format, abort attempts to extract
730
+ # mac in this way
731
+ break
732
+ if currmac == b'\x00\x00\x00\x00\x00\x00':
733
+ break
734
+ # VPD may veer off, detect and break off
735
+ if macprefix is None:
736
+ macprefix = currmac[:3]
737
+ elif currmac[:3] != macprefix:
738
+ break
739
+ ms = mac_format.format(*currmac)
740
+ ifidx = idx / 6 + 1
741
+ fru['MAC Address {0}'.format(ifidx)] = ms
742
+ idx = idx + 6
742
743
  except (AttributeError, KeyError, IndexError):
743
744
  pass
744
745
  if self.has_xcc and name and name.startswith('PSU '):
@@ -684,8 +684,13 @@ class IMMClient(object):
684
684
  return ()
685
685
 
686
686
  def get_oem_sensor_descriptions(self, ipmicmd):
687
- return [{'name': x, 'type': 'Energy'
688
- } for x in self.get_oem_sensor_names(ipmicmd)]
687
+ desc = []
688
+ for x in self.get_oem_sensor_names(ipmicmd):
689
+ desc.append({
690
+ 'name': x,
691
+ 'type': 'Power' if 'Power' in x else 'Energy'
692
+ })
693
+ return desc
689
694
 
690
695
  def get_oem_sensor_reading(self, name, ipmicmd):
691
696
  if self._energymanager is None:
@@ -694,8 +699,15 @@ class IMMClient(object):
694
699
  kwh = self._energymanager.get_ac_energy(ipmicmd)
695
700
  elif name == 'DC Energy':
696
701
  kwh = self._energymanager.get_dc_energy(ipmicmd)
702
+ elif self._energymanager.supports(name):
703
+ value, units = self._energymanager.get_sensor(name, ipmicmd)
704
+ return sdr.SensorReading({
705
+ 'name': name, 'imprecision': None,
706
+ 'value': value,
707
+ 'states': [], 'state_ids': [], 'health': pygconst.Health.Ok,
708
+ 'type': 'Power'}, units)
697
709
  else:
698
- raise pygexc.UnsupportedFunctionality('No sunch sensor ' + name)
710
+ raise pygexc.UnsupportedFunctionality('No such sensor ' + name)
699
711
  return sdr.SensorReading({'name': name, 'imprecision': None,
700
712
  'value': kwh, 'states': [],
701
713
  'state_ids': [],
@@ -1626,32 +1638,6 @@ class XCCClient(IMMClient):
1626
1638
  # oemsensornames = oemsensornames + (name,)
1627
1639
  # return oemsensornames
1628
1640
 
1629
- def get_oem_sensor_descriptions(self, ipmicmd):
1630
- oemdesc = [{'name': x, 'type': 'Energy'} for x in super(
1631
- XCCClient, self).get_oem_sensor_names(ipmicmd)]
1632
- return oemdesc
1633
- # therminfo = self.grab_cacheable_json(
1634
- # '/api/dataset/pwrmgmt?params=GetThermalRealTimeData', 1)
1635
- # if therminfo:
1636
- # for name in sorted(therminfo['items'][0]):
1637
- # if 'DIMM' in name and 'Temp' in name:
1638
- # oemdesc.append({'name': name, 'type': 'Temperature'})
1639
- # return oemdesc
1640
-
1641
- def get_oem_sensor_reading(self, name, ipmicmd):
1642
- if 'Energy' in name:
1643
- return super(XCCClient, self).get_oem_sensor_reading(name, ipmicmd)
1644
- therminfo = self.grab_cacheable_json(
1645
- '/api/dataset/pwrmgmt?params=GetThermalRealTimeData', 1)
1646
- temp = therminfo.get('items', [{}])[0].get(name, None)
1647
- if temp is None:
1648
- raise pygexc.UnsupportedFunctionality('No sunch sensor ' + name)
1649
- return sdr.SensorReading({'name': name, 'imprecision': None,
1650
- 'value': temp, 'states': [],
1651
- 'state_ids': [],
1652
- 'health': pygconst.Health.Ok,
1653
- 'type': 'Temperature'}, '°C')
1654
-
1655
1641
  def get_storage_configuration(self, logout=True):
1656
1642
  rsp = self.wc.grab_json_response(
1657
1643
  '/api/function/raid_alldevices?params=storage_GetAllDevices,0')
@@ -2032,8 +2018,10 @@ class XCCClient(IMMClient):
2032
2018
  raise Exception(uploadthread.rsp)
2033
2019
  raise Exception(errmsg)
2034
2020
  rsp = json.loads(uploadthread.rsp)
2035
- monitorurl = rsp['TaskMonitor']
2021
+ monitorurl = rsp['@odata.id']
2036
2022
  complete = False
2023
+ phase = "apply"
2024
+ statetype = 'TaskState'
2037
2025
  while not complete:
2038
2026
  pgress, status = self.grab_redfish_response_with_status(
2039
2027
  monitorurl)
@@ -2044,14 +2032,21 @@ class XCCClient(IMMClient):
2044
2032
  for msg in pgress.get('Messages', []):
2045
2033
  if 'Verify failed' in msg.get('Message', ''):
2046
2034
  raise Exception(msg['Message'])
2047
- state = pgress['TaskState']
2035
+ state = pgress[statetype]
2048
2036
  if state in ('Cancelled', 'Exception',
2049
2037
  'Interrupted', 'Suspended'):
2050
2038
  raise Exception(json.dumps(pgress['Messages']))
2051
2039
  pct = float(pgress['PercentComplete'])
2052
2040
  complete = state == 'Completed'
2053
- progress({'phase': 'apply', 'progress': pct})
2054
- if not complete:
2041
+ progress({'phase': phase, 'progress': pct})
2042
+ if complete:
2043
+ if 'OperationTransitionedToJob' in pgress['Messages'][0]['MessageId']:
2044
+ monitorurl = pgress['Messages'][0]['MessageArgs'][0]
2045
+ phase = 'validating'
2046
+ statetype = 'JobState'
2047
+ complete = False
2048
+ ipmisession.Session.pause(3)
2049
+ else:
2055
2050
  ipmisession.Session.pause(3)
2056
2051
  if bank == 'backup':
2057
2052
  return 'complete'
@@ -1156,8 +1156,10 @@ class OEMHandler(generic.OEMHandler):
1156
1156
  raise Exception(uploadthread.rsp)
1157
1157
  raise Exception(errmsg)
1158
1158
  rsp = json.loads(uploadthread.rsp)
1159
- monitorurl = rsp['TaskMonitor']
1159
+ monitorurl = rsp['@odata.id']
1160
1160
  complete = False
1161
+ phase = "apply"
1162
+ statetype = 'TaskState'
1161
1163
  while not complete:
1162
1164
  pgress = self._do_web_request(monitorurl, cache=False)
1163
1165
  if not pgress:
@@ -1165,15 +1167,22 @@ class OEMHandler(generic.OEMHandler):
1165
1167
  for msg in pgress.get('Messages', []):
1166
1168
  if 'Verify failed' in msg.get('Message', ''):
1167
1169
  raise Exception(msg['Message'])
1168
- state = pgress['TaskState']
1170
+ state = pgress[statetype]
1169
1171
  if state in ('Cancelled', 'Exception', 'Interrupted',
1170
1172
  'Suspended'):
1171
1173
  raise Exception(
1172
1174
  json.dumps(json.dumps(pgress['Messages'])))
1173
1175
  pct = float(pgress['PercentComplete'])
1174
1176
  complete = state == 'Completed'
1175
- progress({'phase': 'apply', 'progress': pct})
1176
- if not complete:
1177
+ progress({'phase': phase, 'progress': pct})
1178
+ if complete:
1179
+ if 'OperationTransitionedToJob' in pgress['Messages'][0]['MessageId']:
1180
+ monitorurl = pgress['Messages'][0]['MessageArgs'][0]
1181
+ phase = 'validating'
1182
+ statetype = 'JobState'
1183
+ complete = False
1184
+ time.sleep(3)
1185
+ else:
1177
1186
  time.sleep(3)
1178
1187
  if bank == 'backup':
1179
1188
  return 'complete'
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: pyghmi
3
- Version: 1.5.60
3
+ Version: 1.5.61
4
4
  Summary: Python General Hardware Management Initiative (IPMI and others)
5
5
  Home-page: http://github.com/openstack/pyghmi/
6
6
  Author: Jarrod Johnson
@@ -24,10 +24,10 @@ pyghmi/ipmi/oem/lenovo/config.py,sha256=X2N9e31IFTxk0w_m8kutaRZgV_9OnoczpneQQ6mV
24
24
  pyghmi/ipmi/oem/lenovo/cpu.py,sha256=POZMP9n2S1v6r8iNStkCOVEiQYs3ut3RqL_9x-kgOFw,1651
25
25
  pyghmi/ipmi/oem/lenovo/dimm.py,sha256=L8k1aBgtvxqyubDBNKdDkz80pDE8Sck1eMLcMz1GhFI,1875
26
26
  pyghmi/ipmi/oem/lenovo/drive.py,sha256=MmVgaosEwJXcwi1kKYGnY-dbrx4Zp55941qWMvprUMA,2055
27
- pyghmi/ipmi/oem/lenovo/energy.py,sha256=1AhpCFBXvlHtDIU8gGYPX6Wd-AjCzSTRxhgusgeXpmE,4980
27
+ pyghmi/ipmi/oem/lenovo/energy.py,sha256=nMT8M82lbHSU31ei3iFwFKUxKf-BdX0t9zO0yKezC6s,5869
28
28
  pyghmi/ipmi/oem/lenovo/firmware.py,sha256=KS9uUBjFUzvdMw_e-kpr5sYIvFUaeg0yqyo69T94IVc,3747
29
- pyghmi/ipmi/oem/lenovo/handler.py,sha256=ALXoa0kLEdgA5_9UmOEuluR-jIHcZHRGNwW3lfWv2ss,56379
30
- pyghmi/ipmi/oem/lenovo/imm.py,sha256=ZN5S4s8MXF9pb5-fgjIa2XTHfEYmlaF2i8R4OcsgSe0,109294
29
+ pyghmi/ipmi/oem/lenovo/handler.py,sha256=VyUv7n3-kswXXRyCl-0Ua-fGHjjg1gzStwJBW1fE7Lc,56488
30
+ pyghmi/ipmi/oem/lenovo/imm.py,sha256=z29v32OULFs7XfOcpT0YMX5kKjPXbBwPzdW7LJEgslc,108884
31
31
  pyghmi/ipmi/oem/lenovo/inventory.py,sha256=FLJJinw-ibdHtf3KmrTzhWXbQrpxq3TSycVf96Hg7cw,5911
32
32
  pyghmi/ipmi/oem/lenovo/nextscale.py,sha256=c5eX8fCQdvgZ6_f7k3GYxcJMAc2I0Je6d8M3o_tOSJQ,43041
33
33
  pyghmi/ipmi/oem/lenovo/pci.py,sha256=S7p-5Q2qu2YhlffN-LEmIvjfXim6OlfYL7Q6r6VZqJ4,2020
@@ -53,7 +53,7 @@ pyghmi/redfish/oem/dell/main.py,sha256=g8773SShUpbYxXB9zVx2pD5z1xP04wB_sXAxcAs6_
53
53
  pyghmi/redfish/oem/lenovo/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  pyghmi/redfish/oem/lenovo/main.py,sha256=eaCoePPXAw78BjKj9Ht7cqiXVGlj26Effy5_ybCnVDY,1622
55
55
  pyghmi/redfish/oem/lenovo/tsma.py,sha256=puSj0fO5Dt5VpDoEMVTRY95CP9q18eXcAqq7TDK350E,34633
56
- pyghmi/redfish/oem/lenovo/xcc.py,sha256=yEfdv91bvbcuulmlCAltQ2WhO8CnH-jfzWgISnTikS0,76229
56
+ pyghmi/redfish/oem/lenovo/xcc.py,sha256=3ksHgrm_gf53b1ZYdxQfYZ7kwBQTfiY8cHN_Kie5VHs,76644
57
57
  pyghmi/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
58
58
  pyghmi/tests/unit/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
59
59
  pyghmi/tests/unit/base.py,sha256=xWImA7zPRgfrEe2xAdRZ6w_dLwExGRBJ5CBybssUQGg,744
@@ -62,11 +62,11 @@ pyghmi/tests/unit/ipmi/test_sdr.py,sha256=vb3iLY0cnHJ2K_m4xgYUjEcbPd_ZYhYx-uBowB
62
62
  pyghmi/util/__init__.py,sha256=GZLBWJiun2Plb_VE9dDSh4_PQMCha3gA7QLUqx3oSYI,25
63
63
  pyghmi/util/parse.py,sha256=6VlyBCEcE8gy8PJWmEDdtCyWATaKwPaTswCdioPCWOE,2120
64
64
  pyghmi/util/webclient.py,sha256=i3ZVQEO68Bq4EqkmN8jysXPGQjTvDzVl2-hZxq4zBWQ,14150
65
- pyghmi-1.5.60.dist-info/AUTHORS,sha256=Y5fQrIX2SnPK6llV0RjxLtWUQk4PCaAnsGHXU74foik,2007
66
- pyghmi-1.5.60.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
67
- pyghmi-1.5.60.dist-info/METADATA,sha256=DOxNUHbD68zv-_6XBJHC5XFGaArAXWBUIkgESALHggs,1119
68
- pyghmi-1.5.60.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
69
- pyghmi-1.5.60.dist-info/entry_points.txt,sha256=WkbeJkEZzG9MOILxkaEPSEQ109YP9euntH9kcxbysuk,169
70
- pyghmi-1.5.60.dist-info/pbr.json,sha256=TWeoCrKqtAI3uE3HiYRdHkejnC6F4JIglclQVsn2d2k,46
71
- pyghmi-1.5.60.dist-info/top_level.txt,sha256=aDtt6S9eVu6-tNdaUs4Pz9PbdUd69bziZZMhNvk9Ulc,7
72
- pyghmi-1.5.60.dist-info/RECORD,,
65
+ pyghmi-1.5.61.dist-info/AUTHORS,sha256=Y5fQrIX2SnPK6llV0RjxLtWUQk4PCaAnsGHXU74foik,2007
66
+ pyghmi-1.5.61.dist-info/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
67
+ pyghmi-1.5.61.dist-info/METADATA,sha256=2ZD16qxl5BW8ya9JqS_UxAcoRVZblw3CCpAriaS_Ssw,1119
68
+ pyghmi-1.5.61.dist-info/WHEEL,sha256=g4nMs7d-Xl9-xC9XovUrsDHGXt-FT0E17Yqo92DEfvY,92
69
+ pyghmi-1.5.61.dist-info/entry_points.txt,sha256=WkbeJkEZzG9MOILxkaEPSEQ109YP9euntH9kcxbysuk,169
70
+ pyghmi-1.5.61.dist-info/pbr.json,sha256=OjMf3Uu2lYgQdRPWc_5aWPmvm55LCA7rlpt8Gp_BprQ,46
71
+ pyghmi-1.5.61.dist-info/top_level.txt,sha256=aDtt6S9eVu6-tNdaUs4Pz9PbdUd69bziZZMhNvk9Ulc,7
72
+ pyghmi-1.5.61.dist-info/RECORD,,
@@ -0,0 +1 @@
1
+ {"git_version": "537fccb", "is_release": true}
@@ -1 +0,0 @@
1
- {"git_version": "bcfbd8f", "is_release": true}