03_sysrq_withreboot_pos.py

来自「xen 3.2.2 源码」· Python 代码 · 共 41 行

PY
41
字号
#!/usr/bin/python# Copyright (C) International Business Machines Corp., 2005# Author: Dan Smith <danms@us.ibm.com>from XmTestLib import *import timeif ENABLE_HVM_SUPPORT:    SKIP("Sysrq not supported for HVM domains")domain = XmTestDomain()try:    console = domain.start()except DomainError, e:    if verbose:        print "Failed to create domain:"    print e.extra    FAIL(str(e))status, output = traceCommand("xm reboot %s" % domain.getName())if status != 0:    FAIL("reboot %s failed with %i != 0" % (domain.getName(), status))# Wait for the reboot to finishtime.sleep(20)status, output = traceCommand("xm sysrq %s s" % domain.getName())if status != 0:    FAIL("sysrq failed with %i != 0" % status)try:    run = console.runCmd("dmesg | grep -i reboot")except ConsoleError, e:    FAIL(str(e))if run == 0:    FAIL("reboot/sysrq resulted in reboot!")

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?