Exemplo n.º 1
0
 def test_ceph_related(self):
     self.is_relation_made.return_value = True
     service = 'glance'
     self.service_name.return_value = service
     self.config.return_value = True
     self.assertEqual(
         contexts.CephGlanceContext()(), {
             'rbd_pool': service,
             'rbd_user': service,
             'expose_image_locations': True
         })
     self.config.assert_called_with('expose-image-locations')
Exemplo n.º 2
0
         glance_contexts.GlanceIPv6Context(),
         context.WorkerConfigContext(),
         context.OSConfigFlagContext(charm_flag='registry-config-flags',
                                     template_flag='registry_config_flags'),
         context.MemcacheContext()
     ],
     'services': ['glance-registry']
 }),
 (GLANCE_API_CONF, {
     'hook_contexts': [
         context.SharedDBContext(ssl_dir=GLANCE_CONF_DIR),
         context.AMQPContext(ssl_dir=GLANCE_CONF_DIR),
         context.IdentityServiceContext(service='glance',
                                        service_user='******'),
         glance_contexts.GlanceContext(),
         glance_contexts.CephGlanceContext(),
         glance_contexts.ObjectStoreContext(),
         glance_contexts.CinderStoreContext(),
         glance_contexts.HAProxyContext(),
         context.SyslogContext(),
         glance_contexts.LoggingConfigContext(),
         glance_contexts.GlanceIPv6Context(),
         context.WorkerConfigContext(),
         glance_contexts.MultiStoreContext(),
         context.OSConfigFlagContext(charm_flag='api-config-flags',
                                     template_flag='api_config_flags'),
         context.InternalEndpointContext('glance-common'),
         context.SubordinateConfigContext(interface=['storage-backend'],
                                          service=['glance-api'],
                                          config_file=GLANCE_API_CONF),
         context.MemcacheContext()
 def test_ceph_related(self):
     self.is_relation_made.return_value = True
     service = 'glance'
     self.service_name.return_value = service
     conf_dict = {
         'rbd-pool-name': None,
         'expose-image-locations': True,
         'pool-type': 'replicated',
     }
     self.config.side_effect = lambda x: conf_dict.get(x)
     self.assertEqual(
         contexts.CephGlanceContext()(),
         {'rbd_pool': service,
          'rbd_user': service,
          'expose_image_locations': True})
     self.config.assert_called_with('expose-image-locations')
     # Check user supplied pool name:
     conf_dict = {
         'rbd-pool-name': 'mypoolname',
         'expose-image-locations': True,
         'pool-type': 'replicated',
     }
     self.assertEqual(
         contexts.CephGlanceContext()(),
         {'rbd_pool': 'mypoolname',
          'rbd_user': service,
          'expose_image_locations': True})
     # Check erasure-coded pool type
     conf_dict = {
         'rbd-pool-name': None,
         'expose-image-locations': True,
         'pool-type': 'erasure-coded',
         'ec-rbd-metadata-pool': None,
     }
     self.assertEqual(
         contexts.CephGlanceContext()(),
         {'rbd_pool': "{}-metadata".format(service),
          'rbd_user': service,
          'expose_image_locations': True})
     # Ensure rbd-pool-name used for metadata pool name
     conf_dict = {
         'rbd-pool-name': 'foobar',
         'expose-image-locations': True,
         'pool-type': 'erasure-coded',
         'ec-rbd-metadata-pool': None,
     }
     self.assertEqual(
         contexts.CephGlanceContext()(),
         {'rbd_pool': "foobar-metadata",
          'rbd_user': service,
          'expose_image_locations': True})
     # Ensure ec-rbd-metadata-pool overrides everything
     conf_dict = {
         'rbd-pool-name': 'foobar',
         'expose-image-locations': True,
         'pool-type': 'erasure-coded',
         'ec-rbd-metadata-pool': 'another-metadata',
     }
     self.assertEqual(
         contexts.CephGlanceContext()(),
         {'rbd_pool': "another-metadata",
          'rbd_user': service,
          'expose_image_locations': True})
 def test_ceph_not_related(self):
     self.is_relation_made.return_value = False
     self.assertEqual(contexts.CephGlanceContext()(), {})