Skip to content

Commit 3e2bb3d

Browse files
committed
Implement Swift storage backend for Glance
Change-Id: I3ed654c669a47c28450f40d1ce369769a7221e52
1 parent b9cf4bf commit 3e2bb3d

4 files changed

Lines changed: 43 additions & 2 deletions

File tree

packstack/plugins/glance_200.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,23 @@ def initConfig(controller):
5353
"USE_DEFAULT": False,
5454
"NEED_CONFIRM": True,
5555
"CONDITION": False},
56+
57+
{"CMD_OPTION": "glance-backend",
58+
"USAGE": ("Glance storage backend controls how Glance stores disk "
59+
"images. Supported values: file, swift. Note that Swift "
60+
"installation have to be enabled to have swift backend "
61+
"working. Otherwise Packstack will fallback to 'file'."),
62+
"PROMPT": "Glance storage backend",
63+
"OPTION_LIST": ["file", "swift"],
64+
"VALIDATORS": [validators.validate_options],
65+
"PROCESSORS": [process_backend],
66+
"DEFAULT_VALUE": "file",
67+
"MASK_INPUT": False,
68+
"LOOSE_VALIDATION": False,
69+
"CONF_NAME": "CONFIG_GLANCE_BACKEND",
70+
"USE_DEFAULT": False,
71+
"NEED_CONFIRM": False,
72+
"CONDITION": False},
5673
]
5774
group = {"GROUP_NAME": "GLANCE",
5875
"DESCRIPTION": "Glance Config parameters",
@@ -80,6 +97,14 @@ def initSequences(controller):
8097
controller.addSequence("Installing OpenStack Glance", [], [], glancesteps)
8198

8299

100+
#------------------------- helper functions -------------------------
101+
102+
def process_backend(value, param_name, config):
103+
if value == 'swift' and config['CONFIG_SWIFT_INSTALL'] != 'y':
104+
return 'file'
105+
return value
106+
107+
83108
#-------------------------- step functions --------------------------
84109

85110
def create_keystone_manifest(config, messages):
@@ -101,6 +126,9 @@ def create_manifest(config, messages):
101126
mq_template = get_mq(config, "glance_ceilometer")
102127
manifestdata += getManifestTemplate(mq_template)
103128

129+
manifestdata += getManifestTemplate(
130+
'glance_%s.pp' % config['CONFIG_GLANCE_BACKEND'])
131+
104132
config['FIREWALL_SERVICE_NAME'] = "glance"
105133
config['FIREWALL_PORTS'] = "'9292'"
106134
config['FIREWALL_CHAIN'] = "INPUT"

packstack/puppet/templates/glance.pp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
mysql_module => '2.2',
1212
}
1313

14-
class { 'glance::backend::file': }
15-
1614
class {"glance::registry":
1715
auth_host => "%(CONFIG_CONTROLLER_HOST)s",
1816
keystone_tenant => "services",
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
# TO-DO: Make this configurable
3+
class { 'glance::backend::file':
4+
filesystem_store_datadir => '/var/lib/glance/images/'
5+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
2+
class { 'glance::backend::swift':
3+
swift_store_user => 'services:glance',
4+
swift_store_key => '%(CONFIG_GLANCE_KS_PW)s',
5+
swift_store_auth_address => 'http://%(CONFIG_CONTROLLER_HOST)s:35357/v2.0/',
6+
swift_store_container => 'glance',
7+
swift_store_auth_version => '2',
8+
swift_store_large_object_size => '5120',
9+
swift_store_create_container_on_put => true
10+
}

0 commit comments

Comments
 (0)