Current File : //lib/python2.7/site-packages/cloudinit/config/cc_lxd.pyc |
�
oB�]c @ s� d Z d d l m Z d d l m Z d d l Z d g Z e j e � Z d Z
d � Z d � Z d � Z
d
� Z d d d
� Z d S( s�
LXD
---
**Summary:** configure lxd with ``lxd init`` and optionally lxd-bridge
This module configures lxd with user specified options using ``lxd init``.
If lxd is not present on the system but lxd configuration is provided, then
lxd will be installed. If the selected storage backend is zfs, then zfs will
be installed if missing. If network bridge configuration is provided, then
lxd-bridge will be configured accordingly.
**Internal name:** ``cc_lxd``
**Module frequency:** per instance
**Supported distros:** ubuntu
**Config keys**::
lxd:
init:
network_address: <ip addr>
network_port: <port>
storage_backend: <zfs/dir>
storage_create_device: <dev>
storage_create_loop: <size>
storage_pool: <name>
trust_password: <password>
bridge:
mode: <new, existing or none>
name: <name>
ipv4_address: <ip addr>
ipv4_netmask: <cidr>
ipv4_dhcp_first: <ip addr>
ipv4_dhcp_last: <ip addr>
ipv4_dhcp_leases: <size>
ipv4_nat: <bool>
ipv6_address: <ip addr>
ipv6_netmask: <cidr>
ipv6_nat: <bool>
domain: <domain>
i����( t log( t utilNt ubuntut lxdbr0c C s� | j d � } | s) | j d | � d St | t � sR | j d t | � � d S| j d � } t | t � s� | j d t | � � i } n | j d i � } t | t � s� | j d t | � � i } n g } t j d � s� | j d � n | j d � d k r)t j d � r)| j d
� n t | � ryy | j
j | � Wqyt j k
ru} | j d | | � d SXn | r
d* }
t j
d d d g � d d d g } xP |
D]H } | j | � r�| j d | j d d � t | | � f g � q�q�Wt j
| � n d }
| r�| j d t � } t j j d � rt j |
� rt | � } yd | j d |
� d j g | j � D] \ } } d | | f ^ q� d } t j
d g | � Wn% t k
r�t j | d |
� n Xt j d � | j d � t j
d d d! g � q�t | � \ } } t d"