'Ages cached images.'

def _age_cached_images(self, context, datastore, dc_info, ds_path):

    age_seconds = CONF.remove_unused_original_minimum_age_seconds
    unused_images = (self.originals - self.used_images)
    ds_browser = self._get_ds_browser(datastore.ref)
    for image in unused_images:
        path = self.timestamp_folder_get(ds_path, image)
        with lockutils.lock(str(path), lock_file_prefix='nova-vmware-ts', external=True):
            ts = self._get_timestamp(ds_browser, path)
            if (not ts):
                ts_path = path.join(self._get_timestamp_filename())
                try:
                    ds_util.mkdir(self._session, ts_path, dc_info.ref)
                except vexc.FileAlreadyExistsException:
                    LOG.debug('Timestamp    already    exists.')
                LOG.info('Image    %s    is    no    longer    used    by    this    node.    Pending    deletion!', image)
            else:
                dt = self._get_datetime_from_filename(str(ts))
                if timeutils.is_older_than(dt, age_seconds):
                    LOG.info('Image    %s    is    no    longer    used.    Deleting!', path)
                    self._folder_delete(path, dc_info.ref)
    for image in self.used_images:
        path = self.timestamp_folder_get(ds_path, image)
        with lockutils.lock(str(path), lock_file_prefix='nova-vmware-ts', external=True):
            self.timestamp_cleanup(dc_info.ref, ds_browser, path)
