summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorspisarski <s.pisarski@cablelabs.com>2017-10-26 14:18:54 -0600
committerspisarski <s.pisarski@cablelabs.com>2017-10-27 09:31:28 -0600
commit08ebe69c1d2e29aa02efd59f58dbbc0be4f9cd37 (patch)
tree3f1bdf310c917152646765e4a699486c5cea9293
parentb5822ef2be374cd6bf53a60a84f1c8449a90b35a (diff)
Updated application to support volumes.
Updated VirEnvDeploy documents to reflect newly supported object type. JIRA: SNAPS-208 Change-Id: Icc0d435d9b2d780d31a15ebc9a1ebd539c58e407 Signed-off-by: spisarski <s.pisarski@cablelabs.com>
-rw-r--r--docs/how-to-use/VirtEnvDeploy.rst62
-rw-r--r--examples/inst-w-volume/deploy-env.yaml44
-rw-r--r--examples/inst-w-volume/deploy-vm-with-volume.yaml141
-rw-r--r--examples/launch.py26
4 files changed, 266 insertions, 7 deletions
diff --git a/docs/how-to-use/VirtEnvDeploy.rst b/docs/how-to-use/VirtEnvDeploy.rst
index 3b14842..6c99992 100644
--- a/docs/how-to-use/VirtEnvDeploy.rst
+++ b/docs/how-to-use/VirtEnvDeploy.rst
@@ -3,9 +3,10 @@ Try an example
Use launcher.py to deploy and clean up example environments. These examples are described in YAML files.
-#. Add your OpenStack connection information to the deploy-complex-network.yaml.
+#. Add your OpenStack connection information.
- Edit <path to repo>/examples/complex-network/deploy-complex-network.yaml
+ Edit <path to repo>/examples/inst-w-volume/deploy-env.yaml with your OpenStack
+ credentials and authorization URL
- openstack: the top level tag that denotes configuration for the OpenStack components
@@ -16,8 +17,7 @@ Use launcher.py to deploy and clean up example environments. These examples are
- auth\_url: - the URL to the OpenStack APIs (required)
- project\_name: - the name of the OpenStack project for the user
(required)
- - http\_proxy: - the {{ host }}:{{ port }} of the proxy server the
- HTTPPhotoman01(optional)
+ - http\_proxy: - the {{ host }}:{{ port }} of the proxy server (optional)
#. Go to the examples directory.
@@ -29,13 +29,13 @@ Use launcher.py to deploy and clean up example environments. These examples are
::
- python launch.py -t ./complex-network/deploy-complex-network.yaml -d
+ python launch.py -t ./inst-w-volume/deploy-vm-with-volume.yaml -e ./inst-w-volume/deploy-env.yaml -d
#. Clean the deployment.
::
- python launch.py -t ./complex-network/deploy-complex-network.yaml -c
+ python launch.py -t ./complex-network/deploy-complex-network.yaml -e ./inst-w-volume/deploy-env.yaml -c
#. Customize the deployment by changing the yaml file.
@@ -123,7 +123,57 @@ Use launcher.py to deploy and clean up example environments. These examples are
- is\_public: denotes whether or not the flavor is public (default = True)
- metadata: freeform dict() for special metadata (optional)
+ - qos_specs: the QoS Specs to create
+
+ - qos_spec: a QoS Spec to create (admin user credentials required)
+
+ - os\_creds\_name: the connection name (default = 'default'
+ required or use "os\_user" below instead)
+ - name: the name (required)
+ - consumer: enumerations: 'front-end', 'back-end', 'both' (required)
+ - specs: dict of custom values (optional)
+
+ - volume_types: the Volume Type to create
+
+ - volume_type: a Volume Type to create (admin user credentials required)
+
+ - os\_creds\_name: the connection name (default = 'default'
+ required or use "os\_user" below instead)
+ - name: the name (required)
+ - description: the description (optional)
+ - qos_spec_name: the name of the associate QoS Spec (optional)
+ - public: visibility (default - False)
+ - encryption: the encryption settings (optional)
+
+ - name: the name (required)
+ - provider_class: the provider class (required i.e. LuksEncryptor)
+ - control_location: enumerations: 'front-end', 'back-end' (required)
+ - cipher: the encryption algorithm/mode to use (optional)
+ - key_size: the size of the encryption key, in bits (optional)
+
+ - volumes: the Volume to create
+
+ - volume: a Volume to create
+
+ - os\_creds\_name: the connection name (default = 'default'
+ required or use "os\_user" below instead)
+ - os\_user: the connection from a new user defined in template
+ (required or use "os\_creds\_name" above
+
+ - name: the user's name (required)
+ - project\_name: the project name to use
+
+ - name: the name (required)
+ - description: the description (optional)
+ - size: the volume size in GB (default = 1)
+ - image_name: the image name to leverage (optional)
+ - type_name: the volume type name to associate (optional)
+ - availability_zone: the zone name on which to deploy (optional)
+ - multi_attach: when true, volume can be attached to more than one VM
+ (default = False)
+
- images: describes each image to create
+
- image:
- os\_creds\_name: the connection name (default = 'default'
diff --git a/examples/inst-w-volume/deploy-env.yaml b/examples/inst-w-volume/deploy-env.yaml
new file mode 100644
index 0000000..7baf8a2
--- /dev/null
+++ b/examples/inst-w-volume/deploy-env.yaml
@@ -0,0 +1,44 @@
+---
+admin_user: admin
+admin_pass: ChangeMe
+admin_proj: admin
+auth_url: http://10.197.103.31:5000/
+proxy_host:
+proxy_port:
+id_api_version: 3
+
+ext_net: public1
+
+username: test_user
+pass: test_user
+proj: example-volume
+
+flavor_name: example.m1.small
+flavor_ram: 2048
+flavor_disk: 10
+flavor_cpus: 1
+
+qos_name: example_qos
+vol_type_name: example-vol-type
+vol_type_encryption_name: example_vol-type-encryption
+volume_name: example-volume
+
+image_name: example-image
+image_format: qcow2
+image_url: http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img
+image_file:
+image_user: cirros
+
+net_name: example-net
+subnet_name: example-subnet
+cidr: 10.0.8.0/24
+router_name: example-router
+
+kp_name: example-kp
+kp_pub_path: ~/tmp/example-kp.pub
+kp_priv_path: ~/tmp/example-kp
+
+sg_name: example-sg
+
+port_name: example-port
+inst_name: example-inst
diff --git a/examples/inst-w-volume/deploy-vm-with-volume.yaml b/examples/inst-w-volume/deploy-vm-with-volume.yaml
new file mode 100644
index 0000000..30dbcc0
--- /dev/null
+++ b/examples/inst-w-volume/deploy-vm-with-volume.yaml
@@ -0,0 +1,141 @@
+# Copyright (c) 2016 Cable Television Laboratories, Inc. ("CableLabs")
+# and others. All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at:
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+---
+openstack:
+ connections:
+ # Note - when http_proxy is set, you must also configure ssh for proxy tunneling on your host.
+ - connection:
+ name: admin-creds
+ username: {{ admin_user }}
+ project_name: {{ admin_proj }}
+ password: {{ admin_pass }}
+ auth_url: {{ auth_url }}
+ identity_api_version: {{ id_api_version }}
+ projects:
+ - project:
+ os_creds_name: admin-creds
+ name: {{ proj }}
+ description: Project for Orchestrators
+ users:
+ - {{ username }}
+ - {{ admin_user }}
+ users:
+ - user:
+ os_creds_name: admin-creds
+ name: {{ username }}
+ password: {{ pass }}
+ project_name: {{ proj }}
+ roles: {admin: {{ proj }}}
+ flavors:
+ - flavor:
+ os_creds_name: admin-creds
+ name: {{ flavor_name }}
+ ram: {{ flavor_ram }}
+ disk: {{ flavor_disk }}
+ vcpus: {{ flavor_cpus }}
+ qos_specs:
+ - qos_spec:
+ os_creds_name: admin-creds
+ name: {{ qos_name }}
+ consumer: both
+ volume_types:
+ - volume_type:
+ os_creds_name: admin-creds
+ name: {{ vol_type_name }}
+ encryption:
+ name: {{ vol_type_encryption_name }}
+ provider_class: LuksEncryptor
+ control_location: front-end
+ volumes:
+ - volume:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ volume_name }}
+ size: 10
+ images:
+ - image:
+ os_creds_name: admin-creds
+ name: {{ image_name }}
+ format: {{ image_format }}
+ image_user: {{ image_user }}
+ download_url: {{ image_url }}
+ image_file: {{ image_file }}
+ public: True
+ networks:
+ - network:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ net_name }}
+ project_name: {{ proj }}
+ subnets:
+ - subnet:
+ name: {{ subnet_name }}
+ project_name: {{ proj }}
+ cidr: {{ cidr }}
+ dns_nameservers: [8.8.8.8]
+ routers:
+ - router:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ router_name }}
+ external_gateway: {{ ext_net }}
+ internal_subnets:
+ - {{ subnet_name }}
+ keypairs:
+ - keypair:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ kp_name }}
+ public_filepath: {{ kp_pub_path }}
+ private_filepath: {{ kp_priv_path }}
+ delete_on_clean: True
+ security_groups:
+ - security_group:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ sg_name }}
+ rules:
+ - direction: ingress
+ protocol: icmp
+ - direction: ingress
+ protocol: tcp
+ port_range_min: 22
+ port_range_max: 22
+ instances:
+ - instance:
+ os_user:
+ name: {{ username }}
+ project_name: {{ proj }}
+ name: {{ inst_name }}
+ flavor: {{ flavor_name }}
+ imageName: {{ image_name }}
+ keypair_name: {{ kp_name }}
+ security_group_names: [{{ sg_name }}]
+ volume_names:
+ - {{ volume_name }}
+ ports:
+ - port:
+ name: {{ port_name_prfx }}-1a
+ network_name: {{ net_name }}
+ floating_ips:
+ - floating_ip:
+ name: fip1
+ port_name: {{ port_name }}
+ router_name: {{ router_name }}
diff --git a/examples/launch.py b/examples/launch.py
index 76353a2..72eccf0 100644
--- a/examples/launch.py
+++ b/examples/launch.py
@@ -33,10 +33,14 @@ from snaps.openstack.create_keypairs import KeypairSettings, OpenStackKeypair
from snaps.openstack.create_network import (
PortSettings, NetworkSettings, OpenStackNetwork)
from snaps.openstack.create_project import OpenStackProject, ProjectSettings
+from snaps.openstack.create_qos import QoSSettings, OpenStackQoS
from snaps.openstack.create_router import RouterSettings, OpenStackRouter
from snaps.openstack.create_security_group import (
OpenStackSecurityGroup, SecurityGroupSettings)
from snaps.openstack.create_user import OpenStackUser, UserSettings
+from snaps.openstack.create_volume import OpenStackVolume, VolumeSettings
+from snaps.openstack.create_volume_type import (
+ OpenStackVolumeType, VolumeTypeSettings)
from snaps.openstack.os_credentials import OSCreds, ProxySettings
from snaps.openstack.utils import deploy_utils
from snaps.provisioning import ansible_utils
@@ -126,7 +130,8 @@ def __get_os_credentials(os_conn_config):
if proxy_settings:
config['proxy_settings'] = proxy_settings
else:
- del config['proxy_settings']
+ if config.get('proxy_settings'):
+ del config['proxy_settings']
return OSCreds(**config)
@@ -632,6 +637,25 @@ def main(arguments):
os_config.get('flavors'), 'flavor', clean, users_dict)
creators.append(flavors_dict)
+ # Create QoS specs
+ qos_dict = __create_instances(
+ os_creds_dict, OpenStackQoS, QoSSettings,
+ os_config.get('qos_specs'), 'qos_spec', clean, users_dict)
+ creators.append(qos_dict)
+
+ # Create volume types
+ vol_type_dict = __create_instances(
+ os_creds_dict, OpenStackVolumeType, VolumeTypeSettings,
+ os_config.get('volume_types'), 'volume_type', clean,
+ users_dict)
+ creators.append(vol_type_dict)
+
+ # Create volume types
+ vol_dict = __create_instances(
+ os_creds_dict, OpenStackVolume, VolumeSettings,
+ os_config.get('volumes'), 'volume', clean, users_dict)
+ creators.append(vol_dict)
+
# Create images
images_dict = __create_instances(
os_creds_dict, OpenStackImage, ImageSettings,