Implement Swift storage backend for Glance

Change-Id: I3ed654c669a47c28450f40d1ce369769a7221e52
This commit is contained in:
Martin Mágr
2014-10-15 18:00:52 +02:00
parent b9cf4bf7e5
commit 3e2bb3d5c9
4 changed files with 43 additions and 2 deletions

View File

@@ -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"

View File

@@ -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",

View File

@@ -0,0 +1,5 @@
# TO-DO: Make this configurable
class { 'glance::backend::file':
filesystem_store_datadir => '/var/lib/glance/images/'
}

View File

@@ -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
}