def main():
    timeout_start = time.time()
    qemu = qmp.QEMUMonitorProtocol("../qmp-vinput-sock")
    while True:
        try:
            qemu.connect(negotiate=True)
            break
        except qmp.QMPConnectError:
            print('Didn\'t get QMP greeting message from QEMU QMP server')
        except qmp.QMPCapabilitiesError:
            print('Could not negotiate capabilities with QEMU QMP server')
        except qemu.error:
            print

        if time.time() >= con_timeout + timeout_start:
            print("connection timeout error")
            return

    qemu.cmd('system_wakeup')
Exemple #2
0
def main():
    timeout_start = time.time()
    qemu = qmp.QEMUMonitorProtocol("/tmp/qmp-vinput-sock")
    while True:
        try:
            qemu.connect(negotiate=True)
            break
        except qmp.QMPConnectError:
            print('Didn\'t get QMP greeting message from QEMU QMP server')
        except qmp.QMPCapabilitiesError:
            print('Could not negotiate capabilities with QEMU QMP server')

        if time.time() >= timeout + timeout_start:
            print("connection timeout error")
            return
    resp = qemu.cmd('query-status')
    if resp != None:
        for val in resp.values():
            if val['status'] == "suspended":
                qemu.cmd('system_wakeup')
Exemple #3
0
        "avx512vl",
    ],
]

# Assumes externally launched process such as
#
#   qemu-system-x86_64 -qmp unix:/tmp/qmp,server,nowait -display none -accel kvm
#
# Note different results will be obtained with TCG, as
# TCG masks out certain features otherwise present in
# the CPU model definitions, as does KVM.


sock = sys.argv[1]
cmd = sys.argv[2]
shell = qmp.QEMUMonitorProtocol(sock)
shell.connect()

models = shell.cmd("query-cpu-definitions")

# These QMP props don't correspond to CPUID fatures
# so ignore them
skip = [
    "family",
    "min-level",
    "min-xlevel",
    "vendor",
    "model",
    "model-id",
    "stepping",
]