-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add region support for type creation/setting
Region support was added to the Volume type creation and setting code so that the exec call will function in an environment that uses nova regions. Change-Id: I671bb236593dfc8beae38992752524a70f538560 (cherry picked from commit 9d0b0f3)
- Loading branch information
1 parent
fb3b49f
commit 988a317
Showing
3 changed files
with
40 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,9 @@ | |
# [*os_auth_url*] | ||
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'. | ||
# | ||
# [*os_region_name*] | ||
# (optional) The keystone region name. Default is unset. | ||
# | ||
# Author: Andrew Woodward <[email protected]> | ||
|
||
define cinder::type ( | ||
|
@@ -33,28 +36,37 @@ | |
$os_tenant_name = 'admin', | ||
$os_username = 'admin', | ||
$os_auth_url = 'http://127.0.0.1:5000/v2.0/', | ||
$os_region_name = undef, | ||
) { | ||
|
||
$volume_name = $name | ||
|
||
# TODO: (xarses) This should be moved to a ruby provider so that among other | ||
# reasons, the credential discovery magic can occur like in neutron. | ||
|
||
$cinder_env = [ | ||
"OS_TENANT_NAME=${os_tenant_name}", | ||
"OS_USERNAME=${os_username}", | ||
"OS_PASSWORD=${os_password}", | ||
"OS_AUTH_URL=${os_auth_url}", | ||
] | ||
|
||
if $os_region_name { | ||
$region_env = ["OS_REGION_NAME=${os_region_name}"] | ||
} | ||
else { | ||
$region_env = [] | ||
} | ||
|
||
exec {"cinder type-create ${volume_name}": | ||
path => '/usr/bin', | ||
command => "cinder type-create ${volume_name}", | ||
unless => "cinder type-list | grep ${volume_name}", | ||
environment => [ | ||
"OS_TENANT_NAME=${os_tenant_name}", | ||
"OS_USERNAME=${os_username}", | ||
"OS_PASSWORD=${os_password}", | ||
"OS_AUTH_URL=${os_auth_url}", | ||
], | ||
environment => concat($cinder_env, $region_env), | ||
require => Package['python-cinderclient'] | ||
} | ||
|
||
if ($set_value and $set_key) { | ||
|
||
Exec["cinder type-create ${volume_name}"] -> | ||
cinder::type_set { $set_value: | ||
type => $volume_name, | ||
|
@@ -63,6 +75,7 @@ | |
os_tenant_name => $os_tenant_name, | ||
os_username => $os_username, | ||
os_auth_url => $os_auth_url, | ||
os_region_name => $os_region_name, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,9 @@ | |
# [*os_auth_url*] | ||
# (optional) The keystone auth url. Defaults to 'http://127.0.0.1:5000/v2.0/'. | ||
# | ||
# [*os_region_name*] | ||
# (optional) The keystone region name. Default is unset. | ||
# | ||
# Author: Andrew Woodward <[email protected]> | ||
|
||
|
||
|
@@ -32,20 +35,30 @@ | |
$os_tenant_name = 'admin', | ||
$os_username = 'admin', | ||
$os_auth_url = 'http://127.0.0.1:5000/v2.0/', | ||
$os_region_name = undef, | ||
) { | ||
|
||
# TODO: (xarses) This should be moved to a ruby provider so that among other | ||
# reasons, the credential discovery magic can occur like in neutron. | ||
|
||
$cinder_env = [ | ||
"OS_TENANT_NAME=${os_tenant_name}", | ||
"OS_USERNAME=${os_username}", | ||
"OS_PASSWORD=${os_password}", | ||
"OS_AUTH_URL=${os_auth_url}", | ||
] | ||
|
||
if $os_region_name { | ||
$region_env = ["OS_REGION_NAME=${os_region_name}"] | ||
} | ||
else { | ||
$region_env = [] | ||
} | ||
|
||
exec {"cinder type-key ${type} set ${key}=${name}": | ||
path => '/usr/bin', | ||
command => "cinder type-key ${type} set ${key}=${name}", | ||
environment => [ | ||
"OS_TENANT_NAME=${os_tenant_name}", | ||
"OS_USERNAME=${os_username}", | ||
"OS_PASSWORD=${os_password}", | ||
"OS_AUTH_URL=${os_auth_url}", | ||
], | ||
environment => concat($cinder_env, $region_env), | ||
require => Package['python-cinderclient'] | ||
} | ||
} |