Code refactoring. Simplified plugin configuration from UI.

Change-Id: I74a7e0f7fea3e19658ed58a66d0e7cc72c072ae8
This commit is contained in:
Adrian Moreno 2015-11-26 14:51:31 +01:00
parent e9768080bf
commit 7902f8d75f
4 changed files with 36 additions and 80 deletions

View File

@ -2,6 +2,11 @@ $scaleio = hiera('scaleio')
if $scaleio['metadata']['enabled'] {
notify{'ScaleIO plugin enabled': }
if $::osfamily != 'RedHat' {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat")
}
#TODO: Check that Storage pool has enough space
} else {

View File

@ -1,18 +1,14 @@
class scaleio_fuel::params
{
if $::osfamily != 'RedHat' {
fail("Unsupported osfamily: ${::osfamily} operatingsystem: ${::operatingsystem}, module ${module_name} currently only supports osfamily RedHat")
}
# Get input parameters from the web UI
# ScaleIO config parameters
$scaleio = $::fuel_settings['scaleio']
$admin_password = $scaleio['password']
$gw_password = $scaleio['gw_password']
$version = $scaleio['version']
$cluster_name = $scaleio['cluster_name']
$protection_domain = $scaleio['protection_domain']
$storage_pool = $scaleio['storage_pool']
$pool_size = $scaleio['pool_size']
$version = 'latest'
$cluster_name = 'cluster1'
$protection_domain = 'pd1'
$storage_pool = 'sp1'
$pool_size = "${scaleio['pool_size']}GB"
$device = '/var/sio_device1'
$nodes_hash = $::fuel_settings['nodes']
@ -20,9 +16,8 @@ class scaleio_fuel::params
$controller_hashes = nodes_to_hash($controller_nodes,'name','internal_address')
$controller_ips = ipsort(values($controller_hashes))
notice("controller_nodes: ${controller_nodes}")
notice("controller_hashes: ${controller_hashes}")
notice("controller_ips: ${controller_ips}")
notify {"Controller Nodes: ${controller_nodes}": }
notify {"Controller IPs: ${controller_ips}": }
if size($controller_nodes) < 3 {
fail('ScaleIO plugin needs at least 3 controller nodes')
@ -35,29 +30,22 @@ class scaleio_fuel::params
$node_ip = join(values(
nodes_to_hash($current_node,'name','internal_address')))
notice("Current Node: ${current_node}")
notify {"Current Node: ${current_node}": }
#TODO: refactor needed
if $node_ip == $mdm_ip[0] {
$role = 'mdm'
}
elsif $node_ip == $mdm_ip[1] {
$role = 'mdm'
}
elsif $node_ip == $tb_ip {
$role = 'tb'
}
else {
$role = 'sds'
case $node_ip {
$mdm_ip[0]: { $role = 'mdm' }
$mdm_ip[1]: { $role = 'mdm' }
$tb_ip: { $role = 'tb' }
default: { $role = 'sds' }
}
notice("Node role: ${role}, IP: ${node_ip}, FQDN: ${::fqdn}")
notify {"Node role: ${role}, IP: ${node_ip}, FQDN: ${::fqdn}": }
$sio_sds_device = get_sds_devices(
$nodes_hash, $device, $protection_domain,
$pool_size, $storage_pool)
notice("sio_sds_device: ${sio_sds_device}")
notify {"SDS devices: ${sio_sds_device}": }
#TODO: Get callhome information from UI
$callhome_cfg = {

View File

@ -7,15 +7,8 @@ attributes:
label: "Admin password"
description: "Type ScaleIO Admin password"
regex:
source: '^[\S]{4,}$'
error: "You must provide a password with at least 4 characters"
version:
type: "text"
weight: 20
value: "latest"
label: "Version"
description: "ScaleIO version"
source: '^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,15}$'
error: "You must provide a password with between 8 and 15 characters, one uppercase, and one number"
gw_password:
type: "password"
@ -24,45 +17,15 @@ attributes:
label: "Gateway password"
description: "Type a password for the gateway"
regex:
source: '^[\S]{4,}$'
error: "You must provide a password with at least 4 characters"
cluster_name:
type: "text"
weight: 40
value: "cluster1"
label: "Cluster name"
description: "Name of the ScaleIO cluster"
regex:
source: '\S'
error: "Cluster name cannot be empty"
protection_domain:
type: "text"
value: "pd1"
label: "ScaleIO protection domain"
description: "Protection domain for ScaleIO"
weight: 45
regex:
source: '\S'
error: "Protection Domain cannot be empty"
storage_pool:
type: "text"
value: "sp1"
label: "ScaleIO storage pool"
description: "First storage pool for ScaleIO"
weight: 50
regex:
source: '\S'
error: "Storage Pool cannot be empty"
source: '^(?=.*[a-z])(?=.*[A-Z])(?=.*\d).{8,15}$'
error: "You must provide a password with between 8 and 15 characters, one uppercase, and one number"
pool_size:
type: "text"
value: "100GB"
label: "Storage pool size"
description: "Size of the Storage Pool."
value: "100"
label: "Storage pool size (in GB)"
description: "Amount in GB that each node will contribute to the storage pool. Please make sure all nodes have enough disk space to allocate the provided amount."
weight: 55
# regex:
# source: '(?<sizevalue>\p{N}+)(?:\s*)(?<sizetype>(?:MB|KB|GB|B)\b)'
# error: 'You must provide a valid size unit (B, KB, MB, GB). E.g.: 100GB'
regex:
source: '^([1-9]\d\d|[1-9]\d{3,})$'
error: 'You must provide a number greater than 100'

View File

@ -1,22 +1,22 @@
# Plugin name
name: scaleio
# Human-readable name for your plugin
title: Fuel plugin for ScaleIO
title: ScaleIO plugin
# Plugin version
version: '0.2.7'
version: '0.2.8'
# Description
description: Enable ScaleIO as a storage backend
description: Deploy and enable EMC ScaleIO as the block storage backend
# Required fuel version
fuel_version: ['6.1']
# Specify license of your plugin
licenses: ['Apache License Version 2.0']
# Specify author or company name
authors: ['EMC Code']
authors: ['Adrian Moreno Martinez, EMC', 'Magdy Salem, EMC']
# A link to the plugin's page
homepage: 'https://github.com/openstack/fuel-plugin-scaleio'
# Specify a group which your plugin implements, possible options:
# network, storage, storage::cinder, storage::glance, hypervisor
groups: []
groups: ['storage']
# The plugin is compatible with releases in the list
releases: