Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Modified nova-volume:

  * Tried to refactor to allow other nova-volume drivers to easily be added.
  * As well, allow other iscsi implementations to be configured in iscsi.pp
  * Added iscsi_helper and iscsi_ip_address as a parameter for nova::volume::iscsi
  * Added tests for volume manifests
  * Added example configs.
  • Loading branch information...
commit eb59187c6976d7ff831e4bc9dc1dc7a1c75f1efa 1 parent 15fccc5
@jtopjian jtopjian authored
View
2  examples/all.pp
@@ -178,6 +178,8 @@
enabled => true
}
+class { 'nova::volume::iscsi': }
+
class { 'nova::cert':
enabled => true
}
View
6 examples/multi.pp
@@ -197,6 +197,12 @@
enabled => true
}
+ class { 'nova::volume':
+ enabled => true,
+ }
+
+ class { 'nova::volume::iscsi': }
+
######## Horizon ########
class { 'memcached':
View
29 manifests/volume.pp
@@ -1,34 +1,13 @@
class nova::volume(
- $enabled = false,
- $ensure_package = 'present'
+ $enabled = false
) {
include 'nova::params'
- exec { 'volumes':
- command => 'dd if=/dev/zero of=/tmp/nova-volumes.img bs=1M seek=20k count=0 && /sbin/vgcreate nova-volumes `/sbin/losetup --show -f /tmp/nova-volumes.img`',
- onlyif => 'test ! -e /tmp/nova-volumes.img',
- path => ["/usr/bin", "/bin", "/usr/local/bin"],
- before => Service['nova-volume'],
- }
-
nova::generic_service { 'volume':
- enabled => $enabled,
- package_name => $::nova::params::volume_package_name,
- service_name => $::nova::params::volume_service_name,
- ensure_package => $ensure_package,
+ enabled => $enabled,
+ package_name => $::nova::params::volume_package_name,
+ service_name => $::nova::params::volume_service_name,
}
- package { 'tgt':
- name => $::nova::params::tgt_package_name,
- ensure => present,
- }
- # TODO is this fedora specific?
- service {'tgtd':
- name => $::nova::params::tgt_service_name,
- provider => $::nova::params::special_service_provider,
- ensure => $service_ensure,
- enable => $enabled,
- require => [Nova::Generic_service['volume'], Package['tgt']],
- }
}
View
57 manifests/volume/iscsi.pp
@@ -0,0 +1,57 @@
+# Class: nova::volume::iscsi
+#
+# iscsi is the default volume driver for OpenStack.
+#
+# [*Parameters*]
+#
+# [volume_group] Name of the volume group to use.
+# Optional. Defaults to 'nova-volumes' - the OpenStack default.
+#
+# [iscsi_helper] Name of the iscsi helper to use.
+# Optional. Defaults to 'tgtadm' - the OpenStack default.
+#
+# [iscsi_ip_address] IP address on the nova-volume server where
+# compute nodes will connect to for volumes.
+# Optional. Defaults to undef. OpenStack defaults to server IP.
+#
+# This class assumes that you have already configured your
+# volume group - either by another module or during the server
+# provisioning
+#
+
+class nova::volume::iscsi (
+ $volume_group = 'nova-volumes',
+ $iscsi_helper = 'tgtadm',
+ $iscsi_ip_address = undef,
+) {
+
+ include 'nova::params'
+
+ nova_config { 'volume_group': value => $volume_group }
+
+ if $iscsi_ip_address {
+ nova_config { 'iscsi_ip_address': value => $iscsi_ip_address }
+ }
+
+ case $iscsi_helper {
+ 'tgtadm': {
+ package { 'tgt':
+ name => $::nova::params::tgt_package_name,
+ ensure => present,
+ }
+ service { 'tgtd':
+ name => $::nova::params::tgt_service_name,
+ provider => $::nova::params::special_service_provider,
+ ensure => running,
+ enable => true,
+ require => [Nova::Generic_service['volume'], Package['tgt']],
+ }
+ # This is the default, but might as well be verbose
+ nova_config { 'iscsi_helper': value => 'tgtadm' }
+ }
+
+ default: {
+ fail("Unsupported iscsi helper: ${iscsi_helper}. The supported iscsi helper is tgtadm.")
+ }
+ }
+}
View
5 tests/volume.pp
@@ -0,0 +1,5 @@
+class { 'nova': }
+
+class { 'nova::volume':
+ enabled => true,
+}
View
5 tests/volume/iscsi.pp
@@ -0,0 +1,5 @@
+class { 'nova': }
+class { 'nova::volume':
+ enabled => true,
+}
+class {'nova::volume::iscsi': }
Please sign in to comment.
Something went wrong with that request. Please try again.