%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python2.7/site-packages/salt/modules/
Upload File :
Create Path :
Current File : //usr/lib/python2.7/site-packages/salt/modules/nova.pyc

�
���^c@@sBdZddlmZmZmZddlZeje�Zidd6Z	yddl
jjj
ZeZWnek
r�ZeZnXd�ZiZdd�Zddddd	�Zddd
�Zdd�Zddddd
�Zdd�Zddd�Zdddd�Zdd�Zdd�Z dd�Z!dd�Z"dd�Z#dddddd�Z$dd�Z%dd�Z&dddd�Z'dd�Z(ddd�Z)dddd�Z*ddddd�Z+dd �Z,dd!�Z-dd"�Z.dd#�Z/dd$�Z0dd%�Z1dd&�Z2dd'�Z3dd(�Z4dS()u
	
Module for handling OpenStack Nova calls

:depends:   - novaclient Python module
:configuration: This module is not usable until the user, password, tenant, and
    auth URL are specified either in a pillar or in the minion's config file.
    For example:

    .. code-block:: yaml

        keystone.user: admin
        keystone.password: verybadpass
        keystone.tenant: admin
        keystone.auth_url: 'http://127.0.0.1:5000/v2.0/'
        # Optional
        keystone.region_name: 'RegionOne'

    If configuration for multiple OpenStack accounts is required, they can be
    set up as different configuration profiles:
    For example:

    .. code-block:: yaml

        openstack1:
          keystone.user: admin
          keystone.password: verybadpass
          keystone.tenant: admin
          keystone.auth_url: 'http://127.0.0.1:5000/v2.0/'

        openstack2:
          keystone.user: admin
          keystone.password: verybadpass
          keystone.tenant: admin
          keystone.auth_url: 'http://127.0.0.2:5000/v2.0/'

    With this configuration in place, any of the nova functions can make use of
    a configuration profile by declaring it explicitly.
    For example:

    .. code-block:: bash

        salt '*' nova.flavor_list profile=openstack1

    To use keystoneauth1 instead of keystoneclient, include the `use_keystoneauth`
    option in the pillar or minion config.

    .. note::
        This is required to use keystone v3 as for authentication.

    .. code-block:: yaml

        keystone.user: admin
        keystone.password: verybadpass
        keystone.tenant: admin
        keystone.auth_url: 'http://127.0.0.1:5000/v3/'
        keystone.use_keystoneauth: true
        keystone.verify: '/path/to/custom/certs/ca-bundle.crt'


    .. note::
        By default the nova module will attempt to verify its connection
        utilizing the system certificates. If you need to verify against
        another bundle of CA certificates or want to skip verification
        altogether you will need to specify the `verify` option. You can
        specify True or False to verify (or not) against system certificates, a
        path to a bundle or CA certs to check against, or None to allow
        keystoneauth to search for the certificates on its own. (defaults to
        True)
i(tabsolute_importtunicode_literalstprint_functionNulistulist_cC@stS(uH
    Only load this module if nova
    is installed on this minion.
    (tHAS_NOVA(((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyt__virtual__\scC@s�|r�td|�}|d}|d}|d}|d}|jdd�}|jdd�}|jdd�}|jd	t�}	|jd
d�}
n�tdd�}tdd�}tdd�}tdd�}tdd�}tdd�}tdd�}tdd	�}	tdd
�}
|	tkr�|d}|d}i	|d
6|d6|d6|d6|d6|	d6|
d6|d6|d6}
n7i|d
6|d6|d6|d6|d6|d6|d6}
tj|
�S(u!
    Set up nova credentials
    u
config.optionu
keystone.userukeystone.passwordukeystone.tenantukeystone.auth_urlukeystone.region_nameukeystone.api_keyukeystone.os_auth_systemukeystone.use_keystoneauthukeystone.verifyukeystone.project_domain_nameukeystone.user_domain_nameuusernameupasswordu
project_iduauth_urluregion_nameuuse_keystoneauthuverifyuproject_domain_nameuuser_domain_nameuapi_keyuos_auth_pluginN(t__salt__tgettNonetFalsetTruetsuontSaltNova(tprofiletcredentialstusertpasswordttenanttauth_urltregion_nametapi_keytos_auth_systemtuse_keystoneauthtverifytproject_domain_nametuser_domain_nametkwargs((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyt_authgsT







i,cC@s"t|�}|j||||�S(u�
    Boot (create) a new instance

    name
        Name of the new instance (must be first)

    flavor_id
        Unique integer ID for the flavor

    image_id
        Unique integer ID for the image

    timeout
        How long to wait, after creating the instance, for the provider to
        return information about it (default 300 seconds).

        .. versionadded:: 2014.1.0

    CLI Example:

    .. code-block:: bash

        salt '*' nova.boot myinstance flavor_id=4596 image_id=2

    The flavor_id and image_id are obtained from nova.flavor_list and
    nova.image_list

    .. code-block:: bash

        salt '*' nova.flavor_list
        salt '*' nova.image_list
    (Rtboot(tnamet	flavor_idtimage_idRttimeouttconn((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR�s!cC@st|�}|jd|�S(u
    List storage volumes

    search_opts
        Dictionary of search options

    profile
        Profile to use

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_list search_opts='{"display_name": "myblock"}' profile=openstack

    tsearch_opts(Rtvolume_list(R!RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR"�scC@st|�}|j|�S(u�
    Create a block storage volume

    name
        Name of the volume

    profile
        Profile to use

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_show myblock profile=openstack

    (Rtvolume_show(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR#�sidcC@s"t|�}|j||||�S(uq
    Create a block storage volume

    name
        Name of the new volume (must be first)

    size
        Volume size

    snapshot
        Block storage snapshot id

    voltype
        Type of storage

    profile
        Profile to build on

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_create myblock size=300 profile=openstack

    (Rt
volume_create(RtsizetsnapshottvoltypeRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR$�scC@st|�}|j|�S(u�
    Destroy the volume

    name
        Name of the volume

    profile
        Profile to build on

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_delete myblock profile=openstack

    (Rt
volume_delete(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR(scC@st|�}|j||�S(u*
    Attach a block storage volume

    name
        Name of the new volume to attach

    server_name
        Name of the server to detach from

    profile
        Profile to build on

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_detach myblock profile=openstack

    (Rt
volume_detach(RRRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR)&su	/dev/xvdbcC@s"t|�}|j||||�S(u�
    Attach a block storage volume

    name
        Name of the new volume to attach

    server_name
        Name of the server to attach to

    device
        Name of the device on the server

    profile
        Profile to build on

    CLI Example:

    .. code-block:: bash

        salt '*' nova.volume_attach myblock slice.example.com profile=openstack
        salt '*' nova.volume_attach myblock server.example.com device=/dev/xvdb profile=openstack

    (Rt
volume_attach(Rtserver_nametdeviceRRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR*CscC@st|�}|j|�S(u�
    Suspend an instance

    instance_id
        ID of the instance to be suspended

    CLI Example:

    .. code-block:: bash

        salt '*' nova.suspend 1138

    (Rtsuspend(tinstance_idRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR-hscC@st|�}|j|�S(u�
    Resume an instance

    instance_id
        ID of the instance to be resumed

    CLI Example:

    .. code-block:: bash

        salt '*' nova.resume 1138

    (Rtresume(R.RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR/zscC@st|�}|j|�S(u�
    Lock an instance

    instance_id
        ID of the instance to be locked

    CLI Example:

    .. code-block:: bash

        salt '*' nova.lock 1138

    (Rtlock(R.RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR0�scC@st|�}|j|�S(u�
    Delete an instance

    instance_id
        ID of the instance to be deleted

    CLI Example:

    .. code-block:: bash

        salt '*' nova.delete 1138

    (Rtdelete(R.RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR1�scC@st|�}|j�S(u�
    Return a list of available flavors (nova flavor-list)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.flavor_list
    (Rtflavor_list(RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR2�s
icC@s%t|�}|j|||||�S(u�
    Add a flavor to nova (nova flavor-create). The following parameters are
    required:

    name
        Name of the new flavor (must be first)
    flavor_id
        Unique integer ID for the new flavor
    ram
        Memory size in MB
    disk
        Disk size in GB
    vcpus
        Number of vcpus

    CLI Example:

    .. code-block:: bash

        salt '*' nova.flavor_create myflavor flavor_id=6 ram=4096 disk=10 vcpus=1
    (Rt
flavor_create(RRtramtdisktvcpusRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR3�scC@st|�}|j|�S(u�
    Delete a flavor from nova by id (nova flavor-delete)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.flavor_delete 7
    (Rt
flavor_delete(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR7�s
cC@st|�}|j�S(u�
    Return a list of available keypairs (nova keypair-list)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.keypair_list
    (Rtkeypair_list(RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR8�s
cC@st|�}|j|||�S(u�
    Add a keypair to nova (nova keypair-add)

    CLI Examples:

    .. code-block:: bash

        salt '*' nova.keypair_add mykey pubfile=/home/myuser/.ssh/id_rsa.pub
        salt '*' nova.keypair_add mykey pubkey='ssh-rsa <key> myuser@mybox'
    (Rtkeypair_add(RtpubfiletpubkeyRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR9�s
cC@st|�}|j|�S(u�
    Add a keypair to nova (nova keypair-delete)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.keypair_delete mykey
    (Rtkeypair_delete(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR<s
cC@st|�}|j|�S(u
    Return a list of available images (nova images-list + nova image-show)
    If a name is provided, only that image will be displayed.

    CLI Examples:

    .. code-block:: bash

        salt '*' nova.image_list
        salt '*' nova.image_list myimage
    (Rt
image_list(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR= scK@st|�}|j|||�S(u#
    Sets a key=value pair in the metadata for an image (nova image-meta set)

    CLI Examples:

    .. code-block:: bash

        salt '*' nova.image_meta_set 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 cheese=gruyere
        salt '*' nova.image_meta_set name=myimage salad=pasta beans=baked
    (Rtimage_meta_set(RRRRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR>0s
cC@st|�}|j|||�S(u'
    Delete a key=value pair from the metadata for an image
    (nova image-meta set)

    CLI Examples:

    .. code-block:: bash

        salt '*' nova.image_meta_delete 6f52b2ff-0b31-4d84-8fd1-af45b84824f6 keys=cheese
        salt '*' nova.image_meta_delete name=myimage keys=salad,beans
    (Rtimage_meta_delete(RRtkeysRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyR?Fs
cC@s
td|�S(u�
    To maintain the feel of the nova command line, this function simply calls
    the server_list function.

    CLI Example:

    .. code-block:: bash

        salt '*' nova.list
    R(tserver_list(R((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pytlist_]scC@st|�}|j�S(uv
    Return list of active servers

    CLI Example:

    .. code-block:: bash

        salt '*' nova.server_list
    (RRA(RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRAks
cC@s
t||�S(u�
    To maintain the feel of the nova command line, this function simply calls
    the server_show function.

    CLI Example:

    .. code-block:: bash

        salt '*' nova.show
    (tserver_show(t	server_idR((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pytshowyscC@st|�}|j�S(u�
    Return detailed list of active servers

    CLI Example:

    .. code-block:: bash

        salt '*' nova.server_list_detailed
    (Rtserver_list_detailed(RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRF�s
cC@st|�}|j|�S(u�
    Return detailed information for an active server

    CLI Example:

    .. code-block:: bash

        salt '*' nova.server_show <server_id>
    (RRC(RDRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRC�s
cC@st|�}|j||�S(u�
    Add a secgroup to nova (nova secgroup-create)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.secgroup_create mygroup 'This is my security group'
    (Rtsecgroup_create(RtdescriptionRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRG�s
cC@st|�}|j|�S(u�
    Delete a secgroup to nova (nova secgroup-delete)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.secgroup_delete mygroup
    (Rtsecgroup_delete(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRI�s
cC@st|�}|j�S(u�
    Return a list of available security groups (nova items-list)

    CLI Example:

    .. code-block:: bash

        salt '*' nova.secgroup_list
    (Rt
secgroup_list(RR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRJ�s
cC@st|�}|j|�S(u�
    Return information about a server

    name
        Server Name

    CLI Example:

    .. code-block:: bash

        salt '*' nova.server_by_name myserver profile=openstack
    (Rtserver_by_name(RRR ((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyRK�s
(5t__doc__t
__future__RRRtloggingt	getLoggert__name__tlogt__func_alias__tsalt.utils.openstack.novatutilst	openstacktnovaR
R	Rt	NameErrortexcRRt__opts__RRRR"R#R$R(R)R*R-R/R0R1R2R3R7R8R9R<R=R>R?RBRARERFRCRGRIRJRK(((s5/usr/lib/python2.7/site-packages/salt/modules/nova.pyt<module>Fsn


	7%	#! 

Zerion Mini Shell 1.0