diff --git a/packstack/plugins/glance_200.py b/packstack/plugins/glance_200.py index ec77e475a..3377bb245 100644 --- a/packstack/plugins/glance_200.py +++ b/packstack/plugins/glance_200.py @@ -53,6 +53,23 @@ def initConfig(controller): "USE_DEFAULT": False, "NEED_CONFIRM": True, "CONDITION": False}, + + {"CMD_OPTION": "glance-backend", + "USAGE": ("Glance storage backend controls how Glance stores disk " + "images. Supported values: file, swift. Note that Swift " + "installation have to be enabled to have swift backend " + "working. Otherwise Packstack will fallback to 'file'."), + "PROMPT": "Glance storage backend", + "OPTION_LIST": ["file", "swift"], + "VALIDATORS": [validators.validate_options], + "PROCESSORS": [process_backend], + "DEFAULT_VALUE": "file", + "MASK_INPUT": False, + "LOOSE_VALIDATION": False, + "CONF_NAME": "CONFIG_GLANCE_BACKEND", + "USE_DEFAULT": False, + "NEED_CONFIRM": False, + "CONDITION": False}, ] group = {"GROUP_NAME": "GLANCE", "DESCRIPTION": "Glance Config parameters", @@ -80,6 +97,14 @@ def initSequences(controller): controller.addSequence("Installing OpenStack Glance", [], [], glancesteps) +#------------------------- helper functions ------------------------- + +def process_backend(value, param_name, config): + if value == 'swift' and config['CONFIG_SWIFT_INSTALL'] != 'y': + return 'file' + return value + + #-------------------------- step functions -------------------------- def create_keystone_manifest(config, messages): @@ -101,6 +126,9 @@ def create_manifest(config, messages): mq_template = get_mq(config, "glance_ceilometer") manifestdata += getManifestTemplate(mq_template) + manifestdata += getManifestTemplate( + 'glance_%s.pp' % config['CONFIG_GLANCE_BACKEND']) + config['FIREWALL_SERVICE_NAME'] = "glance" config['FIREWALL_PORTS'] = "'9292'" config['FIREWALL_CHAIN'] = "INPUT" diff --git a/packstack/puppet/templates/glance.pp b/packstack/puppet/templates/glance.pp index d6220c689..f46fad32e 100644 --- a/packstack/puppet/templates/glance.pp +++ b/packstack/puppet/templates/glance.pp @@ -11,8 +11,6 @@ class {"glance::api": mysql_module => '2.2', } -class { 'glance::backend::file': } - class {"glance::registry": auth_host => "%(CONFIG_CONTROLLER_HOST)s", keystone_tenant => "services", diff --git a/packstack/puppet/templates/glance_file.pp b/packstack/puppet/templates/glance_file.pp new file mode 100644 index 000000000..4212023f2 --- /dev/null +++ b/packstack/puppet/templates/glance_file.pp @@ -0,0 +1,5 @@ + +# TO-DO: Make this configurable +class { 'glance::backend::file': + filesystem_store_datadir => '/var/lib/glance/images/' +} diff --git a/packstack/puppet/templates/glance_swift.pp b/packstack/puppet/templates/glance_swift.pp new file mode 100644 index 000000000..45f553f9c --- /dev/null +++ b/packstack/puppet/templates/glance_swift.pp @@ -0,0 +1,10 @@ + +class { 'glance::backend::swift': + swift_store_user => 'services:glance', + swift_store_key => '%(CONFIG_GLANCE_KS_PW)s', + swift_store_auth_address => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0/', + swift_store_container => 'glance', + swift_store_auth_version => '2', + swift_store_large_object_size => '5120', + swift_store_create_container_on_put => true +}