IaaS plugin

IaaS driver is responsible for communication with IaaS provider. To VmShepherd work, driver should implement create_vm, terminate_vms, list_vms and get_vm_info.

Initialization - consider following config:

iaas:
  driver: SomeIaaS
  auth_key: AAAA
  auth_secret: BBBB
  some_x: CCC

All params will be passed as config dict to the driver init:

class vmshepherd.iaas.abstract.AbstractIaasDriver(config=None)[source]

Bases: object

create_vm(preset_name: str, image: str, flavor: str, security_groups: List = None, userdata: Dict = None, key_name: str = None, availability_zone: str = None, subnets: List = None) → Any[source]

Create (boot) a new server.

Parameters:
  • preset_name (string) – Name of vm group where vm is created.
  • image (string) – Image name.
  • flavor (string) – Flavor (or instance_type in AWS) name.
  • security_groups (list) – A list of security group names.
  • userdata (dict) – A dict of arbitrary key/value metadata to store in grains.
  • key_name (string) – (optional extension) name of previously created keypair to inject into the instance.
  • availability_zone (string) – Name of the availability zone for instance placement.
  • subnets (string) – List of the subnets for instance placement.

Returns Any vm_id.

get_vm(vm_id: Any) → vmshepherd.iaas.vm.Vm[source]

Get vm info (with metadata and/or tags).

Parameters:vm_id (string) – Id Vm to get.

Returns list of Vm objects.

list_vms(preset_name: str) → List[vmshepherd.iaas.vm.Vm][source]

List vms.

Parameters:preset_name (string) – List VMs with name preset_name.

Returns list of Vm objects.

reconfigure(config)[source]
terminate_vm(vm_id: Any) → None[source]

Terminates/discards vm.

Parameters:vm_id (string) – Id Vm to terminate.