

digraph OpenNebula {
    graph [
        nodesep=0.5,
        ratio=1,
        pad=0.5,
    ];

    node [fontname="Helvetica"];
    edge [fontname="Menlo"];

    user [
        fillcolor="black",
        style="filled", shape="box",
        fontcolor="white", fontsize= "24.0"];

    ANY [ shape="box" ];
    "ANY \\ {suspended,poweroff,done}" [ shape="box" ];

    subgraph { rank = min; user}
    subgraph { rank = same; boot; boot_stopped; boot_undeploy; boot_suspended; boot_unknown; boot_poweroff; unknown; color="white"}
    subgraph { rank = same; pending; hold; color="white"}
    subgraph { rank = same; prolog; prolog_resume; prolog_migrate; color="white" }
//    subgraph { rank = same; prolog; prolog_resume; prolog_migrate; save_migrate; color="white" }

    subgraph { rank = max; suspended; done; failure;
    stopped; undeployed; poweroff; ANY; color="white" }

#   create
    user -> pending [label="create"];

#   deploy
    pending     -> prolog_resume [label="deploy\n(from stopped)"];
    prolog_resume -> boot_stopped [style="dashed"];

    pending         -> prolog_undeploy [label="deploy\n(from undeployed)"];
    prolog_undeploy -> boot_undeploy [style="dashed"];

    pending     -> prolog [label="deploy"];
    prolog      -> boot [style="dashed"];
    boot        -> running [style="dashed"];

#   shutdown
    running     -> shutdown [label="shutdown"];
    shutdown    -> epilog [style="dashed"];
    epilog      -> done [style="dashed"];

    shutdown    -> running [style="dotted"];

#   shutdown --hard
    running     -> cancel [label="shutdown --hard"];
    cancel      -> epilog [style="dashed"];
    cancel      -> running [style="dotted"];
    unknown     -> epilog [label="shutdown --hard"];

#   poweroff
    running             -> shutdown_poweroff [label="poweroff [--hard]"];
    shutdown_poweroff   -> poweroff [style="dashed"];

    shutdown_poweroff   -> running [style="dotted"];

#   livemigrate
    running     -> migrate [label="migrate --live"];
    migrate     -> running [style="dashed"];

#   migrate
    running         -> save_migrate [label="migrate"];
    save_migrate    -> prolog_migrate [style="dashed"];
    save_migrate    -> running [style="dotted"];
    prolog_migrate  -> boot [style="dashed"];

#   hold
    pending     -> hold [label="hold"];

#   release
    hold        -> pending [label="release"];

#   stop
    running     -> save_stop [label="stop"];
    save_stop   -> epilog_stop [style="dashed"];
    save_stop   -> running [style="dotted"];
    epilog_stop -> stopped [style="dashed"];

#   undeploy
    running             -> shutdown_undeploy [label="undeploy [--hard]"];
    shutdown_undeploy   -> epilog_undeploy [style="dashed"];
    shutdown_undeploy   -> running [style="dotted"];
    epilog_undeploy     -> undeployed [style="dashed"];

#   suspend
    running         -> save_suspend [label="suspend"];
    save_suspend    -> suspended [style="dashed"];
    save_suspend    -> running [style="dotted"];

#   resume
    stopped         -> pending [label="resume"];
    boot_stopped    -> running [style="dashed"];

    undeployed      -> pending [label="resume"];
    boot_undeploy   -> running [style="dashed"];

    suspended       -> boot_suspended [label="resume"];
    boot_suspended  -> running [style="dashed"];

    poweroff        -> boot_poweroff [label="resume"];
    boot_poweroff   -> running [style="dashed"];

#   delete
    ANY         -> done [label="delete"];

#   resubmit
    "ANY \\ {suspended,poweroff,done}" -> pending [label="delete --recreate"];

#   boot
    boot            -> boot [label="boot"];
    boot_suspended  -> boot_suspended [label="boot"];
    boot_stopped    -> boot_stopped [label="boot"];
    boot_poweroff   -> boot_poweroff [label="boot"];
    boot_undeploy   -> boot_undeploy [label="boot"];

    unknown         -> boot_unknown [label="boot"];
    boot_unknown    -> boot_unknown [label="boot"];
    boot_unknown    -> running [style="dashed"];

#   reboot
    running     -> running [label="reboot"];

#   disk-attach
    running     -> hotplug [label="disk-attach /\n-detach"]
    hotplug     -> running [style="dashed"];

#   nic-attach
    running     -> hotplug_nic [label="nic-attach /\n-detach"]
    hotplug_nic -> running [style="dashed"];

#   snapshot
    running             -> hotplug_snapshot [label="snapshot-create /\n-revert /\n-delete"]
    hotplug_snapshot    -> running [style="dashed"];

#   disk-snapshot
    running         -> hotplug_saveas [label="disk-snapshot"]
    hotplug_saveas  -> running [style="dashed"];

    poweroff                -> hotplug_saveas_poweroff [label="disk-snapshot"]
    hotplug_saveas_poweroff -> poweroff [style="dashed"];

    suspended                -> hotplug_saveas_suspended [label="disk-snapshot"]
    hotplug_saveas_suspended -> suspended [style="dashed"];

#   failures and misc.
    epilog_stop     -> failure [style="dotted"];
    epilog          -> failure [style="dotted"];
    epilog_undeploy -> failure [style="dotted"];

    prolog          -> failure [style="dotted"];
    prolog_migrate  -> failure [style="dotted"];
    prolog_resume   -> stopped [style="dotted"];
    prolog_undeploy -> undeployed [style="dotted"];

    boot            -> failure [style="dotted"];
    boot_poweroff   -> poweroff [style="dotted"];
    boot_unknown    -> unknown [style="dotted"];
    boot_suspended  -> suspended [style="dotted"];
    boot_stopped    -> epilog_stop [style="dotted"];
    boot_undeploy   -> epilog_undeploy [style="dotted"];

    running -> failure [style="dotted"];
    unknown -> failure [style="dotted"];

    running -> save_suspend [style="dotted"];
    unknown -> save_suspend [style="dotted"];

    running -> unknown [style="dotted"];
    unknown -> running [style="dashed"];
}
