def register_storage_use(storage_path, hostname):

    LOCK_PATH = os.path.join(CONF.instances_path, 'locks')

    @utils.synchronized('storage-registry-lock', external=True,
                        lock_path=LOCK_PATH)
    def do_register_storage_use(storage_path, hostname):
        # NOTE(mikal): this is required to determine if the instance storage is
        # shared, which is something that the image cache manager needs to
        # know. I can imagine other uses as well though.

        d = {}
        id_path = os.path.join(storage_path, 'compute_nodes')
        if os.path.exists(id_path):
            with open(id_path) as f:
                try:
                    d = jsonutils.loads(f.read())
                except ValueError:
                    LOG.warning(_LW("Cannot decode JSON from %(id_path)s"),
                                {"id_path": id_path})

        d[hostname] = time.time()

        with open(id_path, 'w') as f:
            f.write(jsonutils.dumps(d))

    return do_register_storage_use(storage_path, hostname)
Identify the id of this instance storage.
dataset/ETHPy150Open BU-NU-CLOUD-SP16/Trusted-Platform-Module-nova/nova/virt/storage_users.py/register_storage_use