

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_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; poweroff; ANY; color="white" }
//    stopped; poweroff; color="white" }

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

#   deploy
    pending     -> prolog_resume [label="deploy\n(from stopped)"];
    prolog_resume -> boot_stopped [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"];

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

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

#   livemigrate
    running     -> migrate [label="livemigrate"];
    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"];

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

#   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"];

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

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

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

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

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

#   reboot, reset
    running     -> running [label="reboot / reset"];

#   attachdisk
    running     -> hotplug [label="attachdisk /\ndetachdisk"]
    hotplug     -> running [style="dashed"];

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

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

    prolog          -> failure [style="dotted"];
    prolog_migrate  -> failure [style="dotted"];
    prolog_resume   -> stopped [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"];

    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"];
}
