Implement Swift storage backend for Glance
Change-Id: I3ed654c669a47c28450f40d1ce369769a7221e52
This commit is contained in:
		@@ -53,6 +53,23 @@ def initConfig(controller):
 | 
				
			|||||||
         "USE_DEFAULT": False,
 | 
					         "USE_DEFAULT": False,
 | 
				
			||||||
         "NEED_CONFIRM": True,
 | 
					         "NEED_CONFIRM": True,
 | 
				
			||||||
         "CONDITION": False},
 | 
					         "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",
 | 
					    group = {"GROUP_NAME": "GLANCE",
 | 
				
			||||||
             "DESCRIPTION": "Glance Config parameters",
 | 
					             "DESCRIPTION": "Glance Config parameters",
 | 
				
			||||||
@@ -80,6 +97,14 @@ def initSequences(controller):
 | 
				
			|||||||
    controller.addSequence("Installing OpenStack Glance", [], [], glancesteps)
 | 
					    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 --------------------------
 | 
					#-------------------------- step functions --------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def create_keystone_manifest(config, messages):
 | 
					def create_keystone_manifest(config, messages):
 | 
				
			||||||
@@ -101,6 +126,9 @@ def create_manifest(config, messages):
 | 
				
			|||||||
        mq_template = get_mq(config, "glance_ceilometer")
 | 
					        mq_template = get_mq(config, "glance_ceilometer")
 | 
				
			||||||
        manifestdata += getManifestTemplate(mq_template)
 | 
					        manifestdata += getManifestTemplate(mq_template)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    manifestdata += getManifestTemplate(
 | 
				
			||||||
 | 
					        'glance_%s.pp' % config['CONFIG_GLANCE_BACKEND'])
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    config['FIREWALL_SERVICE_NAME'] = "glance"
 | 
					    config['FIREWALL_SERVICE_NAME'] = "glance"
 | 
				
			||||||
    config['FIREWALL_PORTS'] = "'9292'"
 | 
					    config['FIREWALL_PORTS'] = "'9292'"
 | 
				
			||||||
    config['FIREWALL_CHAIN'] = "INPUT"
 | 
					    config['FIREWALL_CHAIN'] = "INPUT"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -11,8 +11,6 @@ class {"glance::api":
 | 
				
			|||||||
    mysql_module => '2.2',
 | 
					    mysql_module => '2.2',
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class { 'glance::backend::file': }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class {"glance::registry":
 | 
					class {"glance::registry":
 | 
				
			||||||
    auth_host => "%(CONFIG_CONTROLLER_HOST)s",
 | 
					    auth_host => "%(CONFIG_CONTROLLER_HOST)s",
 | 
				
			||||||
    keystone_tenant => "services",
 | 
					    keystone_tenant => "services",
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										5
									
								
								packstack/puppet/templates/glance_file.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								packstack/puppet/templates/glance_file.pp
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					# TO-DO: Make this configurable
 | 
				
			||||||
 | 
					class { 'glance::backend::file':
 | 
				
			||||||
 | 
					   filesystem_store_datadir => '/var/lib/glance/images/'
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										10
									
								
								packstack/puppet/templates/glance_swift.pp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								packstack/puppet/templates/glance_swift.pp
									
									
									
									
									
										Normal 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
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user