

def _get_swift_container(self, image_id):
    "Get the Swift container the image is stored in.\n\n        Code based on: https://github.com/openstack/glance_store/blob/3cd690b3\n        7dc9d935445aca0998e8aec34a3e3530/glance_store/\n        _drivers/swift/store.py#L725\n\n        Returns appropriate container name depending upon value of\n        ``swift_store_multiple_containers_seed``. In single-container mode,\n        which is a seed value of 0, simply returns ``swift_container``.\n        In multiple-container mode, returns ``swift_container`` as the\n        prefix plus a suffix determined by the multiple container seed\n\n        examples:\n            single-container mode:  'glance'\n            multiple-container mode: 'glance_3a1' for image uuid 3A1xxxxxxx...\n\n        :param image_id: UUID of image\n        :returns: The name of the swift container the image is stored in\n        "
    seed_num_chars = CONF.glance.swift_store_multiple_containers_seed
    if (seed_num_chars > 0):
        image_id = str(image_id).lower()
        num_dashes = image_id[:seed_num_chars].count('-')
        num_chars = (seed_num_chars + num_dashes)
        name_suffix = image_id[:num_chars]
        new_container_name = ((CONF.glance.swift_container + '_') + name_suffix)
        return new_container_name
    else:
        return CONF.glance.swift_container

dataset/ETHPy150Open openstack/ironic/ironic/common/glance_service/v2/image_service.py GlanceImageService._get_swift_container/original