Concept

VmShepherd is an application to keep running groups of virtual machines. Keep running means that there should be no less active VMs in IaaS than defined in configuration, and if healthcheck is configured, all VMs need to pass it.

States

Virtual Machine can be in a defined state.

class vmshepherd.iaas.vm.VmState[source]

Standard states for a Virtual Machine.

Variables:
  • RUNNING – Vm is running.
  • NEARBY_SHUTDOWN – Vm is running but it’s minutes are numbered.
  • AFTER_TIME_SHUTDOWN – Vm is running but it should be dead now.
  • TERMINATED – Vm is terminated. This node can’t be started later on.
  • PENDING – Vm is pending.
  • UNKNOWN – Vm state is unknown.
  • ERROR – Vm is an error state. Usually no operations can be performed on the node once it ends up in the error state.

Main mangement flow

digraph G {
    compound=true;
    center=true;
    "list presets" -> next;
    next -> lock [label=aquire];
    lock -> manage [label=locked];
    manage -> unlock;
    unlock -> next;
    lock -> next [label="lock failed"];
    next -> end;
}

Global preset flow

Preset Driver is responsible for listing presets. Each preset is an object of a Preset class. Each preset from a list needs to be locked (via the Runtime Driver) and it can be managed after locking.

Detailed actions in one iteration (preset manage)

digraph G {
    compound=true;
    center=true;
    "list vms" -> "terminate dead vms" -> "create missing" -> healthcheck -> end;
}

Preset management flow

In one cycle VmShepherd tries to maintain up and running cluster of VMs defined in the configuration.