def get_cinder_implementation_catalog(dmd):
    device_class = dmd.getObjByPath('Devices/OpenStack/Infrastructure')
    catalog_name = 'cinder_implementation'

    try:
        catalog = getattr(device_class, catalog_name)
    except AttributeError:
        if not hasattr(device_class, catalog_name):
            log.info("Creating cinder integration catalog '%s'", catalog_name)
            manage_addZCatalog(device_class, catalog_name, catalog_name)

        zcatalog = device_class._getOb(catalog_name)
        catalog = zcatalog._catalog

        try:
            log.info('Adding integration key index to %s', catalog_name)
            index = makeKeywordIndex('getCinderIntegrationKeys')

            # Make the index explicitly case sensitive.
            index.PrenormalizeTerm = ''

            catalog.addIndex('getCinderIntegrationKeys', index)

        except CatalogError:
            # Index already exists.
            pass

        else:
            # index everything.
            for plugin_name, plugin in zope.component.getUtilitiesFor(ICinderImplementationPlugin):
                plugin.reindex_implementation_components(dmd)

    return catalog
Example #2
0
def get_cinder_implementation_catalog(dmd):
    device_class = dmd.getObjByPath('Devices/OpenStack/Infrastructure')
    catalog_name = 'cinder_implementation'

    try:
        catalog = getattr(device_class, catalog_name)
    except AttributeError:
        if not hasattr(device_class, catalog_name):
            log.info("Creating cinder integration catalog '%s'", catalog_name)
            manage_addZCatalog(device_class, catalog_name, catalog_name)

        zcatalog = device_class._getOb(catalog_name)
        catalog = zcatalog._catalog

        try:
            log.info('Adding integration key index to %s', catalog_name)
            index = makeKeywordIndex('getCinderIntegrationKeys')

            # Make the index explicitly case sensitive.
            index.PrenormalizeTerm = ''

            catalog.addIndex('getCinderIntegrationKeys', index)

        except CatalogError:
            # Index already exists.
            pass

        else:
            # index everything.
            for plugin_name, plugin in zope.component.getUtilitiesFor(
                    ICinderImplementationPlugin):
                plugin.reindex_implementation_components(dmd)

    return catalog
def get_neutron_core_catalog(dmd):
    device_class = dmd.getObjByPath('Devices/OpenStack/Infrastructure')
    catalog_name = 'neutron_core'

    try:
        catalog = getattr(device_class, catalog_name)
    except AttributeError:
        if not hasattr(device_class, catalog_name):
            log.info("Creating neutron core catalog '%s'", catalog_name)
            manage_addZCatalog(device_class, catalog_name, catalog_name)

        zcatalog = device_class._getOb(catalog_name)
        catalog = zcatalog._catalog

        try:
            log.info('Adding integration key index to %s', catalog_name)
            index = makeKeywordIndex('getNeutronIntegrationKeys')

            # Make the index explicitly case sensitive.
            index.PrenormalizeTerm = ''

            catalog.addIndex('getNeutronIntegrationKeys', index)

        except CatalogError:
            # Index already exists.
            pass

        else:
            from .NeutronIntegrationComponent import all_core_components

            for obj in all_core_components(dmd):
                catalog.catalog_object(obj, obj.getPrimaryId())

    return catalog
Example #4
0
def get_neutron_core_catalog(dmd):
    device_class = dmd.getObjByPath('Devices/OpenStack/Infrastructure')
    catalog_name = 'neutron_core'

    try:
        catalog = getattr(device_class, catalog_name)
    except AttributeError:
        if not hasattr(device_class, catalog_name):
            log.info("Creating neutron core catalog '%s'", catalog_name)
            manage_addZCatalog(device_class, catalog_name, catalog_name)

        zcatalog = device_class._getOb(catalog_name)
        catalog = zcatalog._catalog

        try:
            log.info('Adding integration key index to %s', catalog_name)
            index = makeKeywordIndex('getNeutronIntegrationKeys')

            # Make the index explicitly case sensitive.
            index.PrenormalizeTerm = ''

            catalog.addIndex('getNeutronIntegrationKeys', index)

        except CatalogError:
            # Index already exists.
            pass

        else:
            from .NeutronIntegrationComponent import all_core_components

            for obj in all_core_components(dmd):
                catalog.catalog_object(obj, obj.getPrimaryId())

    return catalog