def _build_block_mapping(self, req, obj):
        mappings = []
        for l in obj.get("links", {}).values():
            if l["rel"] == storage.StorageResource.kind.type_id:
                _, vol_id = ooi.api.helpers.get_id_with_kind(
                    req,
                    l.get("occi.core.target"),
                    storage.StorageResource.kind)
                mapping = {
                    "source_type": "volume",
                    "uuid": vol_id,
                    "delete_on_termination": False,
                }
                try:
                    mapping['device_name'] = l['occi.storagelink.deviceid']
                except __HOLE__:
                    pass
                mappings.append(mapping)
        # this needs to be there if we have a mapping
        if mappings:
            image = obj["schemes"][templates.OpenStackOSTemplate.scheme][0]
            mappings.insert(0, {
                "source_type": "image",
                "destination_type": "local",
                "boot_index": 0,
                "delete_on_termination": True,
                "uuid": image,
            })
        return mappings
dataset/ETHPy150Open openstack/ooi/ooi/api/compute.py/Controller._build_block_mapping