Makina States
  • Makina-States usage
    • About
    • Setup & usage
    • Projects for developers
    • Additionnal docs
  • Reference
    • Implementation design & details
    • States & modules reference
    • Formulaes & macros helpers reference
    • Misc & Obsolete
 
Makina States
  • Docs »
  • Reference »
  • Custom states modules »
  • Execution modules »
  • mc_cloud_compute_node / cloud compute node related functions
  • Edit on GitHub

mc_cloud_compute_node / cloud compute node related functions¶

mc_states.modules.mc_cloud_compute_node.cleanup_allocated_ips(target)¶

Maintenance routine to cleanup ips when ip exhaution arrises

mc_states.modules.mc_cloud_compute_node.cleanup_ports_mapping(target, kind='ssh')¶

This is a maintenance routine which can be called to cleanup ports when range exhaustion is incoming

mc_states.modules.mc_cloud_compute_node.default_settings()¶

Default compute node settings

target
target minion id
expose/expose_limited
expose configuration to other nodes, see mc_cloud.ext_pillar
all_vms

contain compute node vms on compute node contain all vms on controller A mapping indexed by vm minion ids and containing some info:

{vm name: virt type}
all_targets
a mapping indexed by target minions ids containing either only the compute node on compute node all the compute nodes on controller
vms
vms on compute node or empty dict
targets
a mapping indexed by target minions ids containing also vms and supported vt
reverse_proxies
mapping of reverse proxies info
domains
list of domains served by host
vts
a list of supported virt types (lxc)
has

global configuration toggle

firewall
global firewall toggle
port_range_start
from where we start to enable ssh NAT ports. Default to 40000.

port_range_end

from where we end to enable ssh NAT ports. Default to 60000.

Basically the compute node needs to:

  • setup reverse proxying
  • setup it’s local internal addressing dns to point to private ips
  • everything else that’s local to the compute node

The computes nodes are often created implicitly by registration of vms on specific drivers like LXC but you can get_cloud_confr some manually.

makina-states.cloud.compute_node.settings.targets.devhost11.local: {}

To add or modify a value, use the mc_utils.default habitual way of modifying the default dict.

mc_states.modules.mc_cloud_compute_node.del_conf_for_target(target, setting)¶

Register a specific setting for a specific target

mc_states.modules.mc_cloud_compute_node.ext_pillar(id_, prefixed=True, ttl=32140800, *args, **kw)¶

compute node extpillar

mc_states.modules.mc_cloud_compute_node.feed_http_reverse_proxy_for_target(target_data)¶

Get reverse proxy information mapping for a specicific target This return a useful mappings of infos to reverse proxy http and ssh services with haproxy

mc_states.modules.mc_cloud_compute_node.feed_network_mappings_for_target(target_data, kinds=None)¶

Network mappings are in the form:

This is the form of the APPCONTAINER SPEC mixin ACI/ACE:

[
    {
        'name': 'default',
        'hostPort': <int>,
        'to_addr': <Local IPV4 Address of vm>,
        'port': <int>,
        'count': <int> (opt),
        'protocol': 'tcp' / 'udp'
    }
]
mc_states.modules.mc_cloud_compute_node.find_ip_for_vm(vm, default=None, network='10.5.0.0', netmask='16', target=None)¶

Search for:

  • an ip already allocated
  • an random available ip in the range

To get and maybe allocate an ip for a vm call

find_ip_for_vm(target, vmname)

For force/set an ip use:

set_allocated_ip(target, vmname, '1.2.3.4')
mc_states.modules.mc_cloud_compute_node.find_mac_for_vm(vm, default=None, target=None)¶

Generate and assign a mac addess to a specific vm on a specific host

mc_states.modules.mc_cloud_compute_node.find_password_for_vm(vm, default=None, pwlen=32, target=None)¶

Return the vm password after creating it the first time

mc_states.modules.mc_cloud_compute_node.get_all_vts(supported=None)¶

Get makina-states.cloud VTS

  • supported=None: all
  • supported=True: supported vt
  • supported=False: unsupported vt
mc_states.modules.mc_cloud_compute_node.get_allocated_ips(target)¶

Get the allocated ips for a specific target

mc_states.modules.mc_cloud_compute_node.get_conf_for_target(target, setting, default=None)¶

get the stored specific setting for a specific target

mc_states.modules.mc_cloud_compute_node.get_conf_for_vm(vm, setting, default=None, target=None)¶

.

mc_states.modules.mc_cloud_compute_node.get_targets(vt=None, ttl=32140800)¶

Return all vms indexed by targets

mc_states.modules.mc_cloud_compute_node.get_vms(vt=None, vm=None, ttl=32140800)¶

Returns vms indexed by name

mc_states.modules.mc_cloud_compute_node.get_vms_for_target(target, vt=None)¶

Return all vms for a target

mc_states.modules.mc_cloud_compute_node.get_vms_per_type(target)¶

Return all vms indexed by vt for a special target

mc_states.modules.mc_cloud_compute_node.get_vts(supported=True)¶

Alias to get_all_vts At the difference of supported is True by default

mc_states.modules.mc_cloud_compute_node.remove_allocated_ip(target=None, ip=None, vm=None)¶

Remove any ip from the allocated IP registry. If vm is specified, it must also match a vm which is allocated to this ip.

target
target to act onto (opt if vm is given)
ip
specifically specify the ip to delete
vm
if given, delete any ip belonging to this vm name
mc_states.modules.mc_cloud_compute_node.set_allocated_ip(vm, ip, target=None)¶

Allocate an ip for a vm on a compute node for a specific vt


>>> set_allocated_ip('foo.bar.net', 'mybm.bar.net', '2.2.3.4')         
mc_states.modules.mc_cloud_compute_node.set_conf_for_target(target, setting, value)¶

Register a specific setting for a specific target

mc_states.modules.mc_cloud_compute_node.settings(ttl=120)¶

compute node related settings

mc_states.modules.mc_cloud_compute_node.target_for_vm(vm, target=None, ttl=32140800)¶

Get target for a vm

mc_states.modules.mc_cloud_compute_node.vt_for_vm(vm, target=None)¶

Get VT for a vm

Next Previous

© Copyright 2014 -> 2015, Mathieu Le Marec Pasquet, Régis Leroy & Makina Corpus folks.

Built with Sphinx using a theme provided by Read the Docs.