code added

This commit is contained in:
ahmadbilalkhalid 2019-07-30 18:13:05 +05:00
commit 01296e998e
13 changed files with 430 additions and 0 deletions

7
docs/Makefile Normal file
View file

@ -0,0 +1,7 @@
all: ucloud-networking.png ucloud-vm-states.png
clean:
rm -f *.png
%.png: %.dot
dot -Tpng < $< > $@

View file

@ -0,0 +1,36 @@
digraph G {
ucloud_api [shape=box];
ucloud_router [shape=box];
ucloud_nat64 [shape=box];
{
rank = same;
ucloud_api;
ucloud_router;
ucloud_nat64;
}
ucloud_api -> REQUEST_IPV6_SLASH_64 [label="Requested by user" style="dotted"];
ucloud_api -> REQUEST_IPV4_ADDRESS [label="Requested by user" style="dotted"];
ucloud_router -> HAS_IPV6_SLASH_64 [label="Adding route" style="dotted"];
ucloud_nat64 -> HAS_IPV4_ADDRESS [label="Adding NAT64" style="dotted"];
ucloud_router -> DELETE_IPV6_SLASH_64 [label="Deleting route" style="dotted"];
ucloud_nat64 -> DELETE_IPV4_ADDRESS [label="Removing NAT64" style="dotted"];
ERROR;
ERROR -> DEFAULT;
DEFAULT -> REQUEST_IPV6_SLASH_64;
REQUEST_IPV6_SLASH_64 -> HAS_IPV6_SLASH_64 [label="If another /64 can be routed"];
REQUEST_IPV6_SLASH_64 -> ERROR [label="If no /64 can be routed"];
DEFAULT -> REQUEST_IPV4_ADDRESS;
REQUEST_IPV4_ADDRESS -> HAS_IPV4_ADDRESS;
REQUEST_IPV4_ADDRESS -> ERROR [label="If IPv4 address can be added"];
HAS_IPV6_SLASH_64 -> DELETE_IPV6_SLASH_64 -> DEFAULT;
HAS_IPV4_ADDRESS -> DELETE_IPV4_ADDRESS -> DEFAULT;
}

27
docs/ucloud-vm-states.dot Normal file
View file

@ -0,0 +1,27 @@
digraph G {
ucloud_scheduler [shape=box];
ucloud_api [shape=box];
ucloud_vm [shape=box];
ucloud_scheduler -> SCHEDULED_FOR_DEPLOY [style="dotted"];
ucloud_api -> NEW [label="Requested by user" style="dotted"];
ucloud_api -> SUSPENDED [label="Requested by user" style="dotted"];
ucloud_api -> DELETED [label="Requested by user" style="dotted"];
ucloud_vm -> RUNNING [style="dotted"];
{
rank = same;
ucloud_scheduler;
ucloud_api;
ucloud_vm;
}
NEW -> SCHEDULED_FOR_DEPLOY [label="ucloud_scheduler selects hosts"];
SCHEDULED_FOR_DEPLOY -> RUNNING [label="ucloud_vm starts VM"];
RUNNING -> SUSPENDED;
SUSPENDED -> SCHEDULED_FOR_DEPLOY;
RUNNING -> DELETED;
}

39
docs/vm_states.dot Normal file
View file

@ -0,0 +1,39 @@
digraph G{
subgraph cluster_1 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
REQUESTED_NEW -> SCHEDULED_DEPLOY [label="assign_host()"];
SCHEDULED_DEPLOY -> REQUESTED_START [label="create_vm()"];
label="ucloud-scheduler";
}
subgraph cluster_2 {
style=filled;
color=lightgrey;
node [style=filled,color=white];
REQUESTED_START -> RUNNING [label="start_vm()"]
RUNNING -> SUSPENDED [label="REQUESTED_SUSPEND"]
RUNNING -> RUNNING [label="REQUESTED_RESUME"]
RUNNING -> SHUTDOWN [label="REQUESTED_SHUTDOWN"]
SUSPENDED -> RUNNING [label="REQUESTED_RESUME"]
}
subgraph cluster_3 {
style=filled;
color=lightgrey;
SCHEDULED_DEPLOY -> REQUESTED_NEW [label="Host Died"]
REQUESTED_START -> KILLED [label="Host Died"]
RUNNING -> KILLED [label="Host Died OR VM Died"]
SUSPENDED -> KILLED [label="VM Died"]
SHUTDOWN -> SHUTDOWN [label="VM Died"]
label="ucloud-vm & ucloud-scheduler";
}
}