Ucloud » History » Revision 1
Revision 1/16
| Next »
Ahmed Bilal, 06/30/2019 07:56 PM
ucloud (To Be Continued)¶
ucloud-api¶
Outside world (indirect) communication with the internal systems.
Its responsibilities are- Create VM (Done) POST /vm/create
{ "name": "username", "realm": "user_realm", "seed": "user_seed", "specs": { "cpu": 16, "ram": 256, "hdd": "2TB", "sdd": "256GB" } }
- Delete VM (Done) POST /vm/delete
{ "name": "username", "realm": "user_realm", "seed": "user_seed", "vmid": "id_of_virtual_machine" }
- Status VM (Done) GET /vm/status
{ "id": "id_of_virtual_machine" }
- Create new network
- Attach network to VM
- Detach network from VM
- Delete network
ucloud-scheduler¶
It schedules/reschedules VM that are created using ucloud-api. How does it schedules? It does by watching any changes under the /v1/vm/ prefix. Basically, it deals with two ETCD entries
1. Virtual Machines Entries that looks like
/v1/vm/1
{
"owner": "ahmedbilal-admin",
"specs": {
"cpu": 20,
"ram": 2,
"hdd": 10,
"sdd": 10
},
"hostname": "",
"status": "REQUESTED_NEW"
}
2. Hosts Entries that look like
/v1/host/1
{
"cpu": 32,
"ram": 128,
"hdd": 1024,
"sdd": 0
"status": "UP"
}
It loop through list of host entries found under /v1/host/ and check whether we can run the incoming VM on that host. if we can, then it (ucloud-scheduler) sets the hostname key of incoming VM to that host. Suppose, our scheduler decides that we can run the earlier shown VM /v1/vm/1 on /v1/host/1. Then, our updated entry would look like
/v1/vm/1
{
"owner": "ahmedbilal-admin",
"specs": {
"cpu": 20,
"ram": 2,
"hdd": 10,
"sdd": 10
},
"hostname": "/v1/host/1",
"status": "REQUESTED_NEW"
}
Note the hostname key/value pair.
ucloud-vm
It is responsible for creating (running) / deleting (stopping) / monitoring virtual machines¶
It watches the /v1/vm/ prefix for any changes like (Virtual Machines with status like SCHEDULED_DEPLOY or REQUEST_DELETE.
On, SCHEDULED_DEPLOY it creates the VM and run it. On, REQUEST_DELETE it stops the VM.
It is also responsible for monitoring VM statues i.e whether they are RUNNING or KILLED (in action). If a VM is killed we put that in log file, notify system administrator and restart it.
Updated by Ahmed Bilal over 5 years ago · 1 revisions