MCPcopy Create free account
hub / github.com/ceph/ceph / update_devstack_config_files

Function update_devstack_config_files

qa/tasks/devstack.py:194–254  ·  view source on GitHub ↗
(devstack_node, secret_uuid)

Source from the content-addressed store, hash-verified

192
193
194def update_devstack_config_files(devstack_node, secret_uuid):
195 log.info("Updating DevStack config files to use Ceph...")
196
197 def backup_config(node, file_name, backup_ext='.orig.teuth'):
198 node.run(args=['cp', '-f', file_name, file_name + backup_ext])
199
200 def update_config(config_name, config_stream, update_dict,
201 section='DEFAULT'):
202 parser = ConfigParser()
203 parser.read_file(config_stream)
204 for (key, value) in update_dict.items():
205 parser.set(section, key, value)
206 out_stream = StringIO()
207 parser.write(out_stream)
208 out_stream.seek(0)
209 return out_stream
210
211 updates = [
212 dict(name='/etc/glance/glance-api.conf', options=dict(
213 default_store='rbd',
214 rbd_store_user='glance',
215 rbd_store_pool='images',
216 show_image_direct_url='True',)),
217 dict(name='/etc/cinder/cinder.conf', options=dict(
218 volume_driver='cinder.volume.drivers.rbd.RBDDriver',
219 rbd_pool='volumes',
220 rbd_ceph_conf='/etc/ceph/ceph.conf',
221 rbd_flatten_volume_from_snapshot='false',
222 rbd_max_clone_depth='5',
223 glance_api_version='2',
224 rbd_user='cinder',
225 rbd_secret_uuid=secret_uuid,
226 backup_driver='cinder.backup.drivers.ceph',
227 backup_ceph_conf='/etc/ceph/ceph.conf',
228 backup_ceph_user='cinder-backup',
229 backup_ceph_chunk_size='134217728',
230 backup_ceph_pool='backups',
231 backup_ceph_stripe_unit='0',
232 backup_ceph_stripe_count='0',
233 restore_discard_excess_bytes='true',
234 )),
235 dict(name='/etc/nova/nova.conf', options=dict(
236 libvirt_images_type='rbd',
237 libvirt_images_rbd_pool='volumes',
238 libvirt_images_rbd_ceph_conf='/etc/ceph/ceph.conf',
239 rbd_user='cinder',
240 rbd_secret_uuid=secret_uuid,
241 libvirt_inject_password='false',
242 libvirt_inject_key='false',
243 libvirt_inject_partition='-2',
244 )),
245 ]
246
247 for update in updates:
248 file_name = update['name']
249 options = update['options']
250 config_data = devstack_node.read_file(file_name, sudo=True)
251 config_stream = StringIO(config_data)

Callers 1

Calls 5

backup_configFunction · 0.85
update_configFunction · 0.85
infoMethod · 0.45
read_fileMethod · 0.45
write_fileMethod · 0.45

Tested by

no test coverage detected