Выдели коротко статусы ошибок, что они означают и добавь в вывод основное сообщение msg. Представь вывод в виде json на русском языке.
  {
    "state":
    "when":
    "meaning":
    "message_example":
  }

===
from JumpScale import j
from pprint import pprint
from cloudbrokerlib.compute_to_disk import get_attached_disks

descr = """
Check nodes migrate potential
"""

organization = "digitalenergy"
version = "1.0"
category = "monitor.healthcheck"

enable = True
async_exec = True
period = "30 1/4 * * *"     # At minute 30 past every 4th hour from 1 through 23
roles = ["controller"]
queue = "process"
log = False
timeout = 60 * 59


def action():
    from cloudbrokerlib import cloudbroker, resourcestatus
    from cloudbrokerlib.physnode import PhysNode
    from CloudscalerLibcloud.utils.gridconfig import GridConfig
    from CloudscalerLibcloud import DSF2 as dsf2

    from copy import deepcopy

    cb = cloudbroker.CloudBroker()
    ccl = j.clients.osis.getNamespace("cloudbroker")
    scl = j.clients.osis.getNamespace("system")
    pcl = j.clients.portal.getByInstance("main")

    gid = j.application.whoAmI.gid

    # Get all enabled stacks
    stacks = ccl.stack.search({
        "$query": {"gid": gid, "status": "ENABLED"},
        "$fields": ["id", "gid", "referenceId", "images", "drivers"]
    }, size=0)[1:]

    stacks_by_nid = {int(stack["referenceId"]): stack for stack in stacks}
    nids = []
    for candidate in stacks:
        candidate["referenceId"] = int(candidate["referenceId"])
        nids.append(candidate["referenceId"])

    query = {
        "$query": {
            "status": resourcestatus.Node.ENABLED,
            "id": {
                "$in": nids
            }
        },
        "$fields": ["id", "gid", "memory", "pgpus"]
    }
    # Get all enabled nodes
    enabled_nodes = scl.node.search(query)[1:]

    active_sessions = cb.getActiveSessionsKeys()
    active_nodes = []

    results = list()

    def result_append(_state, _msg):
        results.append({
            "state": _state,
            "category": "Node Status",
            "message": _msg,
            "uid": "nodes_migration"
        })

    # Filter enabled nodes
    for node in enabled_nodes:
        if (node["gid"], node["id"]) in active_sessions:

            pn = PhysNode()
            rc, msg = pn.load(node["id"])
            if not rc:
                continue

            node["disks_seps"] = dict()

            # Get all computes on node
            computes_ids = pn.computes_ids()
            node["computes"] = ccl.compute.search({
                "$query": {"id": {"$in": computes_ids}},
                "$fields": ["id", "ram", "driver", "imageId", "vgpus"]
            }, size=0)[1:]

            # Get all disks from nodes computes
            for compute in node["computes"]:
                disks = get_attached_disks(compute["id"])
                for disk_ in disks:
                    disk = dsf2.Disk(lock=False)
                    _, rc, _ = disk.load(disk_["disk_id"])
                    if rc:
                        node["disks_seps"][disk_["disk_id"]] = disk.sep.specs.consumedBy

            # Get all vnf devices on node
            vnfdevs_ids = pn.vnfdevs_ids()
            node["vnfdevs"] = ccl.vnfdev.search({
                "$query": {"id": {"$in": vnfdevs_ids}},
                "$fields": ["id", "config"]
            }, size=0)[1:]

            # Get used memory to count free memory
            usedmemory = sum(compute["ram"] for compute in node["computes"]) + sum(
                vnfdev["config"]["resources"]["ram"] for vnfdev in node["vnfdevs"])
            reservedmemory = GridConfig(scl.grid.get(node["gid"])).get("reserved_mem") or 0

            node["used_ram"] = usedmemory
            node["free_ram"] = node["memory"] - usedmemory - reservedmemory

            node["stack"] = stacks_by_nid.get(node["id"])

            query = {
                "nid": node["id"],
                "status": "ENABLED",
                "enabledModes": {
                    "$in": [0, 2]
                },
                "currentProfileId": -1
            }

            query["type"] = "NVIDIA"
            node["NVIDIA"] = scl.pgpu.count(query)
            query["type"] = "DUMMY"
            node["DUMMY"] = scl.pgpu.count(query)

            active_nodes.append(node)

    if len(active_nodes) == 1:
        result_append("WARNING", f"Node ID {active_nodes[0]['id']} has no candidates to migrate resources to")
        return results

    elif not active_nodes:
        result_append("OK", "No active nodes - no problems")
        return results

    def check_disks(disks_ids, imageId, _check_node, _node):
        """
        Disk validation
        """
        for _disk_id in disks_ids:
            if isinstance(_disk_id, dict):
                if _check_node["id"] not in _node["disks_seps"].get(_disk_id["id"], list()):
                    return False, "seps"
            else:
                if _check_node["id"] not in _node["disks_seps"].get(_disk_id, list()):
                    return False, "seps"

        if imageId > 0 and imageId not in _check_node["stack"]["images"]:
            return False, "images"

        return True, ""

    def check_vgpus(vgpus, _check_node):
        """
        Vgpu validation
        """
        _vgpu = ccl.vgpu.get(vgpus[0])

        if _vgpu.type not in ["NVIDIA", "DUMMY"]:
            return False, f"invalid vgpu type {_vgpu.type}"

        if _vgpu.mode not in ["PASSTHROUGH"]:
            return False, f"invalid vgpu mode {_vgpu.mode}"

        if len(vgpus) < 1:
            return False, "vgpus less than 1"

        if len(vgpus) > _check_node[_vgpu.type]:
            return False, "not enough pgpus on node"

        return _vgpu, ""

    def add_error(_type, _msg):
        """
        Add error (sep, ram, image, gpu) to list of error for one of types (vms, computes, vnfdevs, vfws
        """
        if _msg not in node_migrate_errors[_type]:
            node_migrate_errors[_type].append(_msg)

    def errors_by_type(_type, _non_migrated):
        """
        Create msg for type: vms, computes, vnfdevs or vfws
        """
        obj_errors = list()
        if _non_migrated:
            obj_errors += ["potentially {} IDs '{}' cannot migrate, because of {}".format(
                _type[:-1],
                ", ".join(map(str, _non_migrated)),
                ", ".join(node_migrate_errors[_type])
            )]
        return obj_errors

    for node in active_nodes:
        tmp_active_nodes = deepcopy(active_nodes)
        migrated_computes = list()
        total_computes = [compute["id"] for compute in node["computes"]]
        migrated_vnfdevs = list()
        total_vnfdevs = [vnfdev["id"] for vnfdev in node["vnfdevs"]]
        node_migrate_errors = {
            "computes": list(),
            "vnfdevs": list(),
        }

        for check_node in tmp_active_nodes:
            if check_node["id"] == node["id"]:
                continue

            # check computes
            for compute in node["computes"]:
                if compute in migrated_computes:
                    continue

                if compute["driver"] not in check_node["stack"]["drivers"]:
                    add_error("computes", "driver")
                    continue

                disks = get_attached_disks(compute["id"])
                for disk in disks:
                    disk["id"] = disk["disk_id"]
                rc, msg = check_disks(disks, compute["imageId"], check_node, node)
                if not rc:
                    add_error("computes", msg)
                    continue

                if compute["vgpus"]:
                    vgpu, msg = check_vgpus(compute["vgpus"], check_node)
                    if not vgpu:
                        add_error("computes", "pgpus")
                        continue

                if compute["ram"] > check_node["free_ram"]:
                    add_error("computes", "ram")
                    continue

                migrated_computes.append(compute["id"])
                if compute["vgpus"]:
                    check_node[vgpu.type] -= len(compute["vgpus"])
                check_node["free_ram"] -= compute["ram"]

            # check vnf devices (ViNSes and External Networks)
            for vnfdev in node["vnfdevs"]:
                if vnfdev in migrated_vnfdevs:
                    continue

                if "KVM_X86" not in check_node["stack"]["drivers"]:
                    add_error("vnfdevs", "driver")
                    continue

                vnfdev_ram = vnfdev.get("config", {}).get("resources", {}).get("ram", 0)
                if vnfdev_ram > check_node["free_ram"]:
                    add_error("vnfdevs", "ram")
                    continue

                migrated_vnfdevs.append(vnfdev["id"])
                check_node["free_ram"] -= vnfdev_ram

        non_migrated_computes = set(total_computes) - set(migrated_computes)
        non_migrated_vnfdevs = set(total_vnfdevs) - set(migrated_vnfdevs)

        msg_list = list()

        msg_list += errors_by_type("computes", non_migrated_computes)
        msg_list += errors_by_type("vnfdevs", non_migrated_vnfdevs)

        try:
            pcl.actors.cloudbroker.node.applyIpmiAction(nid=node["id"], action="is_powered")
        except:
            result_append(
                "ERROR",
                f"Node ID {node['id']} not available by IPMI"
            )

        if msg_list:
            result_append(
                "WARNING",
                f"Node ID {node['id']} resources cannot migrate to other nodes: {'; '.join(msg_list)}"
            )
        else:
            result_append("OK", f"Node ID {node['id']} resources can migrate to other nodes")

    return results


if __name__ == "__main__":
    pprint(action())