mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
use soft shutdown/reboot in IPMI
This commit is contained in:
parent
d0de1a5b94
commit
fa0373b6e9
@ -132,7 +132,17 @@ def reboot(args):
|
||||
print "No hostname"
|
||||
return 1
|
||||
|
||||
o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "status")
|
||||
if o.ret:
|
||||
print o.stderr
|
||||
return 1
|
||||
|
||||
|
||||
if "is on" in o.stdout:
|
||||
o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "cycle")
|
||||
else:
|
||||
o = ipmitool("-H", hostname, "-U", usrname, "-P", password, "chassis", "power", "reset")
|
||||
|
||||
if o.ret:
|
||||
print o.stderr
|
||||
return 1
|
||||
@ -166,14 +176,14 @@ def boot_or_reboot(args):
|
||||
return 1
|
||||
|
||||
if "is on" in o.stdout:
|
||||
args["action"] = "reset"
|
||||
return reboot(args)
|
||||
elif "is off" in o.stdout:
|
||||
args["action"] = "on"
|
||||
return power(args)
|
||||
else:
|
||||
print "unknown power status:" + o.stdout
|
||||
return 1
|
||||
|
||||
return power(args)
|
||||
|
||||
call_table = {"ping":ping, "boot_dev":boot_dev, "reboot":reboot, "power":power, "boot_or_reboot":boot_or_reboot}
|
||||
def dispatch(args):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user