コード例 #1
0
ファイル: s3.py プロジェクト: KarimAllah/nova
    def _translate_uuid_to_id(self, context, image):
        def _find_or_create(image_uuid):
            if image_uuid is None:
                return
            try:
                return self.get_image_id(context, image_uuid)
            except exception.NotFound:
                return self._create_image_id(context, image_uuid)

        image_copy = image.copy()

        try:
            image_id = image_copy['id']
        except KeyError:
            pass
        else:
            image_copy['id'] = _find_or_create(image_id)

        for prop in ['kernel_id', 'ramdisk_id']:
            try:
                image_uuid = image_copy['properties'][prop]
            except (KeyError, ValueError):
                pass
            else:
                image_copy['properties'][prop] = _find_or_create(image_uuid)

        return image_copy
コード例 #2
0
    def _translate_uuid_to_id(self, context, image):
        def _find_or_create(image_uuid):
            if image_uuid is None:
                return
            try:
                return self.get_image_id(context, image_uuid)
            except exception.NotFound:
                return self._create_image_id(context, image_uuid)

        image_copy = image.copy()

        try:
            image_id = image_copy['id']
        except KeyError:
            pass
        else:
            image_copy['id'] = _find_or_create(image_id)

        for prop in ['kernel_id', 'ramdisk_id']:
            try:
                image_uuid = image_copy['properties'][prop]
            except (KeyError, ValueError):
                pass
            else:
                image_copy['properties'][prop] = _find_or_create(image_uuid)

        return image_copy
コード例 #3
0
ファイル: s3.py プロジェクト: MirantisDellCrowbar/nova
    def _translate_id_to_uuid(self, context, image):
        image_copy = image.copy()

        try:
            image_id = image_copy['id']
        except KeyError:
            pass
        else:
            image_copy['id'] = ec2utils.id_to_glance_id(context, image_id)

        for prop in ['kernel_id', 'ramdisk_id']:
            try:
                image_id = image_copy['properties'][prop]
            except (KeyError, ValueError):
                pass
            else:
                image_uuid = ec2utils.id_to_glance_id(context, image_id)
                image_copy['properties'][prop] = image_uuid

        return image_copy
コード例 #4
0
ファイル: s3.py プロジェクト: rubiojr/nova
    def _translate_uuid_to_id(self, context, image):
        image_copy = image.copy()

        try:
            image_uuid = image_copy["id"]
        except KeyError:
            pass
        else:
            image_copy["id"] = ec2utils.glance_id_to_id(context, image_uuid)

        for prop in ["kernel_id", "ramdisk_id"]:
            try:
                image_uuid = image_copy["properties"][prop]
            except (KeyError, ValueError):
                pass
            else:
                image_id = ec2utils.glance_id_to_id(context, image_uuid)
                image_copy["properties"][prop] = image_id

        return image_copy
コード例 #5
0
ファイル: s3.py プロジェクト: altai/nova
    def _translate_id_to_uuid(self, context, image):
        image_copy = image.copy()

        try:
            image_id = image_copy['id']
        except KeyError:
            pass
        else:
            image_copy['id'] = ec2utils.id_to_glance_id(context, image_id)

        for prop in ['kernel_id', 'ramdisk_id']:
            try:
                image_id = image_copy['properties'][prop]
            except (KeyError, ValueError):
                pass
            else:
                image_uuid = ec2utils.id_to_glance_id(context, image_id)
                image_copy['properties'][prop] = image_uuid

        return image_copy