def ctl_add_location(self, image_name, location, start_index=0, end_index=-1, sync_status=UKAI_OUT_OF_SYNC): metadata = None if image_name in self._metadata_dict: # the image is in use on this node. metadata = self._metadata_dict[image_name] else: # XXX need to check if no one is using this image. metadata_raw = self._get_metadata(image_name) if metadata_raw is None: return errno.ENOENT metadata = UKAIMetadata(image_name, self._config, metadata_raw) metadata.add_location(location, start_index, end_index, sync_status) return 0