def test_storage_backend_multi_backend(self): self.relation_ids.return_value = ['cinder-ceph:0', 'cinder-vmware:0'] self.related_units.side_effect = [['cinder-ceph/0'], ['cinder-vmware/0']] self.relation_get.side_effect = ['cinder-ceph', 'cinder-vmware'] self.assertEquals(contexts.StorageBackendContext()(), {'backends': 'cinder-ceph,cinder-vmware'})
def test_storage_backend_no_backends(self): self.config.return_value = None self.relation_ids.return_value = [] self.os_release.return_value = 'havana' self.assertEqual(contexts.StorageBackendContext()(), { 'active_backends': ['LVM'], 'backends': 'LVM' })
def test_storage_backend_no_backends(self): self.config.return_value = None self.relation_ids.return_value = [] self.os_release.return_value = 'havana' self.assertEqual( contexts.StorageBackendContext()(), {'active_backends': [], 'backends': '', 'default_volume_type': None})
def test_storage_backend_single_backend(self): rel_dict = {'storage-backend': ['cinder-ceph:0'], 'ceph': []} self.config.return_value = None self.relation_ids.side_effect = lambda x: rel_dict[x] self.related_units.return_value = ['cinder-ceph/0'] self.relation_get.return_value = 'cinder-ceph' self.assertEquals(contexts.StorageBackendContext()(), { 'backends': 'cinder-ceph', 'active_backends': ['cinder-ceph'] })
def test_storage_backend_multi_backend_with_default_type(self): self.config.return_value = 'my-preferred-volume-type' self.os_release.return_value = 'havana' rel_dict = { 'storage-backend': ['cinder-ceph:0', 'cinder-vmware:0'], 'ceph': []} self.relation_ids.side_effect = lambda x: rel_dict[x] self.related_units.side_effect = [['cinder-ceph/0'], ['cinder-vmware/0']] self.relation_get.side_effect = ['cinder-ceph', 'cinder-vmware'] self.assertEqual( contexts.StorageBackendContext()(), {'backends': 'cinder-ceph,cinder-vmware', 'active_backends': ['cinder-ceph', 'cinder-vmware'], 'default_volume_type': 'my-preferred-volume-type'})
def test_storage_backend_multi_backend(self): self.config.return_value = None rel_dict = { 'storage-backend': ['cinder-ceph:0', 'cinder-vmware:0'], 'ceph': [] } self.relation_ids.side_effect = lambda x: rel_dict[x] self.related_units.side_effect = [['cinder-ceph/0'], ['cinder-vmware/0']] self.relation_get.side_effect = ['cinder-ceph', 'cinder-vmware'] self.assertEquals( contexts.StorageBackendContext()(), { 'backends': 'cinder-ceph,cinder-vmware', 'active_backends': ['cinder-ceph', 'cinder-vmware'] })
BASE_RESOURCE_MAP = OrderedDict([ (CINDER_CONF, { 'contexts': [ context.SharedDBContext(ssl_dir=CINDER_CONF_DIR), context.AMQPContext(ssl_dir=CINDER_CONF_DIR), context.ImageServiceContext(), context.OSConfigFlagContext(), context.SyslogContext(), cinder_contexts.CephContext(), cinder_contexts.HAProxyContext(), cinder_contexts.ImageServiceContext(), cinder_contexts.CinderSubordinateConfigContext( interface=['storage-backend', 'backup-backend'], service='cinder', config_file=CINDER_CONF), cinder_contexts.StorageBackendContext(), cinder_contexts.LoggingConfigContext(), context.IdentityServiceContext(service='cinder', service_user='******'), context.BindHostContext(), context.WorkerConfigContext(), cinder_contexts.RegionContext(), context.InternalEndpointContext(), cinder_contexts.VolumeUsageAuditContext(), context.MemcacheContext(), cinder_contexts.SectionalConfigContext(), cinder_contexts.LVMContext() ], 'services': ['cinder-api', 'cinder-volume', 'cinder-scheduler', 'haproxy'] }),
def test_storage_backend_single_backend(self): self.relation_ids.return_value = ['cinder-ceph:0'] self.related_units.return_value = ['cinder-ceph/0'] self.relation_get.return_value = 'cinder-ceph' self.assertEquals(contexts.StorageBackendContext()(), {'backends': 'cinder-ceph'})
def test_storage_backend_no_backends(self): self.relation_ids.return_value = [] self.assertEquals(contexts.StorageBackendContext()(), {})