diff --git a/example-puppet.py b/example-puppet.py index 4b22e188..8262d403 100644 --- a/example-puppet.py +++ b/example-puppet.py @@ -259,6 +259,13 @@ def deploy(): signals.connect(keystone_puppet, cinder_keystone_service_endpoint, { 'admin_port': 'keystone_admin_port', 'admin_token': 'admin_token'}) + # CINDER GLANCE + # Deploy chain: cinder_puppet -> cinder_glance -> ( cinder_api, cinder_scheduler, cinder_volume ) + cinder_glance_puppet = vr.create('cinder_glance_puppet', 'resources/cinder_glance_puppet', { + 'glance_api_servers': '{{glance_api_servers_host}}:{{glance_api_servers_port}}' + })[0] + signals.connect(node1, cinder_glance_puppet) + # CINDER API cinder_api_puppet = vr.create('cinder_api_puppet', 'resources/cinder_api_puppet', {})[0] signals.connect(node1, cinder_api_puppet) @@ -457,6 +464,11 @@ def deploy(): 'pipeline': 'keystone', }) + # Update glance_api_service for cinder + signals.connect(glance_api_puppet, cinder_glance_puppet, { + 'ip': 'glance_api_servers_host', + 'bind_port': 'glance_api_servers_port' + }) # Update glance_api_service for nova compute signals.connect(glance_api_puppet, nova_puppet2, { 'ip': 'glance_api_servers_host', @@ -508,6 +520,7 @@ def deploy(): actions.resource_action(cinder_keystone_role, 'run') actions.resource_action(cinder_puppet, 'run') actions.resource_action(cinder_keystone_service_endpoint, 'run') + actions.resource_action(cinder_glance, 'run') actions.resource_action(cinder_api_puppet, 'run') actions.resource_action(cinder_scheduler_puppet, 'run') actions.resource_action(cinder_volume_puppet, 'run') @@ -562,6 +575,7 @@ def undeploy(): 'cinder_volume_puppet', 'cinder_scheduler_puppet', 'cinder_api_puppet', + 'cinder_glance', 'cinder_keystone_service_endpoint', 'cinder_puppet', 'cinder_keystone_role', diff --git a/resources/cinder_glance_puppet/README.md b/resources/cinder_glance_puppet/README.md new file mode 100644 index 00000000..71d30df6 --- /dev/null +++ b/resources/cinder_glance_puppet/README.md @@ -0,0 +1,37 @@ +# Cinder Volume resource for puppet handler + +Glance drive Cinder as a block storage backend to store image data. + +# Parameters + +source https://github.com/openstack/puppet-cinder/blob/5.1.0/manifests/glance.pp + + ``glance_api_servers`` + (optional) A list of the glance api servers available to cinder. + Should be an array with [hostname|ip]:port + Defaults to undef + + ``glance_api_version`` + (optional) Glance API version. + Should be 1 or 2 + Defaults to 2 (current version) + + ``glance_num_retries`` + (optional) Number retries when downloading an image from glance. + Defaults to 0 + + ``glance_api_insecure`` + (optional) Allow to perform insecure SSL (https) requests to glance. + Defaults to false + + ``glance_api_ssl_compression`` + (optional) Whether to attempt to negotiate SSL layer compression when + using SSL (https) requests. Set to False to disable SSL + layer compression. In some cases disabling this may improve + data throughput, eg when high network bandwidth is available + and you are using already compressed image formats such as qcow2. + Defaults to false + + ``glance_request_timeout`` + (optional) http/https timeout value for glance operations. + Defaults to undef \ No newline at end of file diff --git a/resources/cinder_glance_puppet/actions/remove.pp b/resources/cinder_glance_puppet/actions/remove.pp new file mode 100644 index 00000000..53c89edb --- /dev/null +++ b/resources/cinder_glance_puppet/actions/remove.pp @@ -0,0 +1 @@ +notify { "Nothing to remove here:" } diff --git a/resources/cinder_glance_puppet/actions/run.pp b/resources/cinder_glance_puppet/actions/run.pp new file mode 100644 index 00000000..eec668b5 --- /dev/null +++ b/resources/cinder_glance_puppet/actions/run.pp @@ -0,0 +1,19 @@ +$resource = hiera($::resource_name) + +$glance_api_servers = $resource['input']['glance_api_servers']['value'] +$glance_api_version = $resource['input']['glance_api_version']['value'] +$glance_num_retries = $resource['input']['glance_num_retries']['value'] +$glance_api_insecure = $resource['input']['glance_api_insecure']['value'] +$glance_api_ssl_compression = $resource['input']['glance_api_ssl_compression']['value'] +$glance_request_timeout = $resource['input']['glance_request_timeout']['value'] +$glance_api_servers_host = $resource['input']['glance_api_servers_host']['value'] +$glance_api_servers_port = $resource['input']['glance_api_servers_port']['value'] + +class {'cinder::glance': + glance_api_servers => "${glance_api_servers_host}:${glance_api_servers_port}", + glance_api_version => $glance_api_version, + glance_num_retries => $glance_num_retries, + glance_api_insecure => $glance_api_insecure, + glance_api_ssl_compression => $glance_api_ssl_compression, + glance_request_timeout => $glance_request_timeout, +} diff --git a/resources/cinder_glance_puppet/meta.yaml b/resources/cinder_glance_puppet/meta.yaml new file mode 100644 index 00000000..8457e7bf --- /dev/null +++ b/resources/cinder_glance_puppet/meta.yaml @@ -0,0 +1,46 @@ +id: cinder_glance_puppet +handler: puppet +puppet_module: cinder +version: 1.0.0 +input: + glance_api_servers: + schema: str + value: '' + glance_api_version: + schema: int + value: 2 + glance_num_retries: + schema: int + value: 0 + glance_api_insecure: + schema: bool + value: false + glance_api_ssl_compression: + schema: bool + value: false + glance_request_timeout: + schema: str + value: '' + + git: + schema: {repository: str!, branch: str!} + value: {repository: 'https://github.com/openstack/puppet-cinder', branch: '5.1.0'} + + ip: + schema: str! + value: + ssh_key: + schema: str! + value: + ssh_user: + schema: str! + value: + + glance_api_servers_port: + schema: int + value: 9292 + glance_api_servers_host: + schema: 'str' + value: 'localhost' + +tags: [resource/cinder_glance_service, resources/cinder_glance, resources/cinder]