本文整理汇总了Python中OpenIPMI类的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI类的具体用法?Python OpenIPMI怎么用?Python OpenIPMI使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了OpenIPMI类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: quit
def quit(self):
del self.mc
OpenIPMI.set_log_handler(DummyLogHandler())
OpenIPMI.shutdown_everything()
print "done"
sys.exit(0)
return
示例2: RestoreDomains
def RestoreDomains(mainhandler):
for i in defaultDomains:
name = i[0]
attrhashes = i[1]
other = i[2]
connects = [ ]
for attrhash in attrhashes:
if ("contype" not in attrhash):
continue
args = OpenIPMI.alloc_empty_args(str(attrhash["contype"]))
if (args == None):
continue
for attr in attrhash.items():
vname = str(attr[0])
if (vname == "contype"):
continue
value = str(attr[1])
args.set_val(0, vname, value)
pass
connects.append(args)
pass
domain_id = OpenIPMI.open_domain3(name, [], connects, None, None)
if (domain_id != None):
DomainInfoSetup(other, domain_id)
pass
else:
_oi_logging.error("Error making domain connection for " + name)
pass
pass
return
示例3: add_info
def add_info(self, ch, oinfo):
info = oinfo.info
item = self.Append(ch, "Info", [])
v = [ 0 ]
rv = info.get_medium(v)
if (not rv):
self.add_data(item, "Medium",
[OpenIPMI.channel_medium_string(v[0])])
pass
rv = info.get_protocol_type(v)
if (not rv):
self.add_data(item, "Protocol Type",
[OpenIPMI.channel_protocol_string(v[0])])
pass
rv = info.get_session_support(v)
if (not rv):
self.add_data(item, "Session Support",
[OpenIPMI.channel_session_support_string(v[0])])
pass
v = info.get_vendor_id()
if (v):
self.add_data(item, "Vendor ID", [v])
pass
v = info.get_aux_info()
if (v):
self.add_data(item, "Aux Info", [v])
pass
return
示例4: add_access
def add_access(self, ch, oinfo):
info = oinfo.access
item = self.Append(ch, "User Access (" + oinfo.tstr + ")", [], oinfo)
v = [ 0 ]
rv = info.get_alerting_enabled(v)
if (not rv):
mitem = self.add_data(item, "Alerting Enabled", [str(v[0] != 0)],
BoolSetter(self, info.set_alerting_enabled))
pass
rv = info.get_per_msg_auth(v)
if (not rv):
mitem = self.add_data(item, "Per Msg Auth", [str(v[0] != 0)],
BoolSetter(self, info.set_per_msg_auth))
pass
rv = info.get_user_auth(v)
if (not rv):
mitem = self.add_data(item, "User Auth", [str(v[0] != 0)],
BoolSetter(self, info.set_user_auth))
pass
rv = info.get_access_mode(v)
if (not rv):
mitem = self.add_data(item, "Access Mode",
[OpenIPMI.channel_access_mode_string(v[0])],
AccessSetter(self, info.set_access_mode))
pass
rv = info.get_privilege_limit(v)
if (not rv):
mitem = self.add_data(item, "Privilege Limit",
[OpenIPMI.privilege_string(v[0])],
PrivSetter(self, info.set_privilege_limit))
pass
return
示例5: __init__
def __init__(self, parent, ui):
global init_history
Tix.ScrolledText.__init__(self, parent)
self.ui = ui
self.currow = 0
self.max_lines = 1000
self.max_history = 100
self.text.bind("<Key>", self.HandleChar)
self.text.bind("<Control-Key>", self.HandleCtrlChar)
self.text.insert("end", "> ")
self.history = [ ]
self.lasthist = 0
for cmd in init_history:
self.history.append(cmd[1])
self.lasthist += 1
pass
self.history.append("")
init_history = None
self.currhist = self.lasthist
self.cmdlang = OpenIPMI.alloc_cmdlang(self)
self.indent = 0;
self.cmd_in_progress = False
self.bind("<Destroy>", self.OnDestroy)
OpenIPMI.set_cmdlang_global_err_handler(self)
return
示例6: ok
def ok(self, vals):
rv = self.node.set_field(self.aidx, self.ptype, str(vals[0]))
if (rv != 0):
self.glist.SetError("Invalid data value: "
+ OpenIPMI.get_error_string(rv))
return
try:
if (self.reiniter != None):
if self.reiniter.reinit(self, self.currval, vals[0]):
return
pass
pass
except:
pass
name_s = [ "" ]
type_s = [ "" ]
value_s = [ "" ]
node_s = [ None ]
rv = self.node.get_field(self.aidx, name_s, type_s, value_s, node_s)
if (rv != 0):
self.glist.SetError("Could not re-get field: "
+ OpenIPMI.get_error_string(rv))
return
self.glist.cleanup_field(type_s[0], value_s)
self.currval = value_s[0]
self.glist.SetColumn(self.item, self.currval, 1)
return
示例7: got_pef_cb
def got_pef_cb(self, pef, err):
if err:
self.ui.ReportError("Error fetching PEF: " + OpenIPMI.get_error_string(err))
return
rv = pef.get_config(self)
if rv:
self.ui.ReportError("Error starting PEF config fetch: " + OpenIPMI.get_error_string(rv))
pass
return
示例8: setval
def setval(self, val):
rv = self.setter(val)
if (rv):
mcchan.SetError("Could not set value: "
+ OpenIPMI.get_error_string(rv))
return
self.mcchanSetColumn(self.item,
OpenIPMI.privilege_string(val),
1)
return
示例9: setenum
def setenum(self, val):
rv = self.solc.set_val(self.parm, self.aidx, "integer", str(val))
if (rv != 0):
self.glist.SetError("Could not set value to " + str(val) + ": "
+ OpenIPMI.get_error_string(rv))
return
self.currval = val
nval = [ 0 ]
sval = [ "" ]
OpenIPMI.solconfig_enum_val(self.parm, val, nval, sval)
self.glib.SetColumn(self.idx, 1, sval[0])
return
示例10: quit
def quit(self):
global shutdown_thread
shutdown_thread = True;
gui_cmdwin._HistorySave(self.histfile)
OpenIPMI.set_log_handler(DummyLogHandler())
OpenIPMI.shutdown_everything()
if (self.debug_mem):
print "OpenIPMI is shutdown, memory problems (SEGVs) after this"
print " are likely due to OpenIPMI data not being freed until"
print " after this point due to the python garbage collector"
pass
sys.exit()
return
示例11: ok
def ok(self, vals):
tlist = [ ]
if (vals[0]):
tlist.append("events")
pass
del vals[0]
if (vals[0]):
tlist.append("scanning")
pass
del vals[0]
for en in self.enables:
if vals[0]:
tlist.append(en)
pass
del vals[0]
pass
self.event_enable_str = " ".join(tlist)
self.setting = True
rv = self.s.sensor_id.to_sensor(self)
if (rv == 0):
rv = self.err
pass
if (rv != 0):
return ("Error setting sensor event enables: "
+ OpenIPMI.get_error_string(rv))
return
示例12: conn_change_cb
def conn_change_cb(self, domain, err, connum, portnum, anything_connected):
if (err):
self.ui.new_log("Connection error for " + self.name
+ "(" + str(connum) + "," + str(portnum) + "): "
+ OpenIPMI.get_error_string(err))
pass
if (not self.first_conn):
self.first_conn = True
self.ipmb_rescan_time = domain.get_ipmb_rescan_time()
self.sel_rescan_time = domain.get_sel_rescan_time()
domain.iterate_connections(self)
pass
if (connum not in self.connections):
self.ui.new_log("Got connection for invalid connection number")
return
self.connections[connum].SetPortUp(domain, portnum, err)
any_con_up = False
for c in self.connections.itervalues():
any_con_up = c.IsUp() or any_con_up
pass
if (any_con_up):
if (not self.any_con_up):
self.ui.decr_item_critical(self.treeroot)
pass
pass
else:
if (self.any_con_up):
self.ui.incr_item_critical(self.treeroot)
pass
pass
self.any_con_up = any_con_up
return
示例13: SetupArgs
def SetupArgs(self):
self.errstr.SetError("")
args = self.args
for f in self.fields:
idx = f[0]
vtype = f[2]
fw = f[3]
if (vtype == "bool"):
if (fw.get()):
val = "true"
else:
val = "false"
pass
pass
elif (vtype == "enum"):
val = str(fw.get())
pass
elif ((vtype == "str") or (vtype == "int")):
val = str(fw.get())
if (val == ""):
val = None
pass
pass
else:
continue
rv = args.set_val(idx, None, val);
if (rv != 0):
err = ("Error setting field " + f[1] + ": "
+ OpenIPMI.get_error_string(rv))
self.errstr.SetError(err)
raise Exception(err)
pass
return args
示例14: setup
def setup(self):
for i in range(0, OpenIPMI.MAX_USED_CHANNELS) + [15]:
chi = self.info[i]
if (len(chi) > 0):
cdata = MCChanData(self, i)
ch = self.Append(self.treeroot, str(i), [], cdata)
if ("info" in chi):
info = chi["info"]
v = [ 0 ]
rv = info.info.get_medium(v)
if (not rv):
cdata.medium = v[0]
s = OpenIPMI.channel_medium_string(v[0])
self.SetColumn(ch, s, 1)
pass
self.add_info(ch, info)
pass
if ("v" in chi):
self.add_access(ch, chi["v"])
pass
if ("n" in chi):
self.add_access(ch, chi["n"])
pass
pass
pass
self.AfterDone()
return
示例15: fru_written
def fru_written(self, domain, fru, err):
if (err):
self.glist.SetError("Could not write FRU: "
+ OpenIPMI.get_error_string(err))
return
self.Close()
return