From 847f17b1a3474fbf822b60de5adb7dc80b86943d Mon Sep 17 00:00:00 2001 From: Bogdan Dobrelya Date: Mon, 3 Aug 2015 16:08:15 +0200 Subject: [PATCH] Add cinder volume ISCSI resource Add ISCSI backend as enabled default for the cinder_volume resource. Note, cannot be decoupled as a separate resource because of the external puppet class reference hardcoded upstream. Signed-off-by: Bogdan Dobrelya --- example-puppet.py | 2 +- resources/cinder_volume_puppet/README.md | 7 ++++++- resources/cinder_volume_puppet/actions/run.pp | 15 +++++++++++++++ resources/cinder_volume_puppet/meta.yaml | 16 ++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/example-puppet.py b/example-puppet.py index 8262d403..ab9b3205 100644 --- a/example-puppet.py +++ b/example-puppet.py @@ -264,7 +264,7 @@ def deploy(): 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) + signals.connect(node1, cinder_glance_puppet) # CINDER API cinder_api_puppet = vr.create('cinder_api_puppet', 'resources/cinder_api_puppet', {})[0] diff --git a/resources/cinder_volume_puppet/README.md b/resources/cinder_volume_puppet/README.md index 59b10429..e597c2bf 100644 --- a/resources/cinder_volume_puppet/README.md +++ b/resources/cinder_volume_puppet/README.md @@ -1,3 +1,8 @@ # Cinder Volume resource for puppet handler -Setup and configure the cinder volume service +Setup and configure the cinder volume service. +Configure ISCSI volume backend for cinder volume nodes, if specified +(Default true) + +source https://github.com/openstack/puppet-cinder/blob/5.1.0/manifests/volume/iscsi.pp +source https://github.com/openstack/puppet-cinder/blob/5.1.0/manifests/volume.pp \ No newline at end of file diff --git a/resources/cinder_volume_puppet/actions/run.pp b/resources/cinder_volume_puppet/actions/run.pp index 4f66e2e8..91e9b5d3 100644 --- a/resources/cinder_volume_puppet/actions/run.pp +++ b/resources/cinder_volume_puppet/actions/run.pp @@ -1,6 +1,12 @@ $resource = hiera($::resource_name) $package_ensure = $resource['input']['package_ensure']['value'] +$use_iscsi_backend = $resource['input']['use_iscsi_backend']['value'] + +$iscsi_ip_address = $resource['input']['iscsi_ip_address']['value'] +$volume_driver = $resource['input']['volume_driver']['value'] +$volume_group = $resource['input']['volume_group']['value'] +$iscsi_helper = $resource['input']['iscsi_helper']['value'] include cinder::params @@ -14,3 +20,12 @@ class {'cinder::volume': enabled => true, manage_service => true, } + +if $use_iscsi_backend { + class {'cinder::volume::iscsi': + iscsi_ip_address => $iscsi_ip_address, + volume_driver => $volume_driver, + volume_group => $volume_group, + iscsi_helper => $iscsi_helper, + } +} \ No newline at end of file diff --git a/resources/cinder_volume_puppet/meta.yaml b/resources/cinder_volume_puppet/meta.yaml index 9146a153..f1e5e12f 100644 --- a/resources/cinder_volume_puppet/meta.yaml +++ b/resources/cinder_volume_puppet/meta.yaml @@ -6,6 +6,22 @@ input: package_ensure: schema: str value: 'present' + iscsi_ip_address: + schema: str + value: '127.0.0.1' + volume_driver: + schema: str + value: 'cinder.volume.drivers.lvm.LVMISCSIDriver' + volume_group: + schema: str + value: 'cinder-volumes' + iscsi_helper: + schema: str + value: 'tgtadm' + + use_iscsi_backend: + schema: bool + value: true git: schema: {repository: str!, branch: str!}