def METHOD_NAME(vm, cmd, args):
    test.log.debug("[qmp cmd %s] %s", cmd, args)
    reply = vm.monitor.cmd_qmp(cmd, args)
    test.log.debug("[qmp reply] %s", reply)
    if "error" in reply:
        if reply["error"]["class"] == "CommandNotFound":
            test.cancel("qmp command %s not supported" % cmd)
        else:
            test.fail("qmp error: %s" % reply["error"]["desc"])
    return reply