def __init__(self, task_id, task_type, task_repo, uri):
        self.task_id = task_id
        self.task_type = task_type
        self.task_repo = task_repo
        self.uri = uri
        super(_ImportToFS,
              self).__init__(name='%s-ImportToFS-%s' % (task_type, task_id))

        if CONF.task.work_dir is None:
            msg = (_("%(task_id)s of %(task_type)s not configured "
                     "properly. Missing work dir: %(work_dir)s") % {
                         'task_id': self.task_id,
                         'task_type': self.task_type,
                         'work_dir': CONF.task.work_dir
                     })
            raise exception.BadTaskConfiguration(msg)

        self.store = self._build_store()
Exemplo n.º 2
0
    def __init__(self, task_id, task_type, image_repo, image_id, uri):
        self.task_id = task_id
        self.task_type = task_type
        self.image_repo = image_repo
        self.image_id = image_id
        self.uri = uri
        super(_WebDownload, self).__init__(
            name='%s-WebDownload-%s' % (task_type, task_id))

        if CONF.node_staging_uri is None:
            msg = (_("%(task_id)s of %(task_type)s not configured "
                     "properly. Missing node_staging_uri: %(work_dir)s") %
                   {'task_id': self.task_id,
                    'task_type': self.task_type,
                    'work_dir': CONF.node_staging_uri})
            raise exception.BadTaskConfiguration(msg)

        self.store = self._build_store()
Exemplo n.º 3
0
    def _build_store(self):
        # NOTE(flaper87): Due to the nice glance_store api (#sarcasm), we're
        # forced to build our own config object, register the required options
        # (and by required I mean *ALL* of them, even the ones we don't want),
        # and create our own store instance by calling a private function.
        # This is certainly unfortunate but it's the best we can do until the
        # glance_store refactor is done. A good thing is that glance_store is
        # under our team's management and it gates on Glance so changes to
        # this API will (should?) break task's tests.
        # TODO(abhishekk): After removal of backend module from glance_store
        # need to change this to use multi_backend module.
        conf = cfg.ConfigOpts()
        try:
            backend.register_opts(conf)
        except cfg.DuplicateOptError:
            pass

        conf.set_override('filesystem_store_datadir',
                          CONF.node_staging_uri[7:],
                          group='glance_store')

        # NOTE(flaper87): Do not even try to judge me for this... :(
        # With the glance_store refactor, this code will change, until
        # that happens, we don't have a better option and this is the
        # least worst one, IMHO.
        store = backend._load_store(conf, 'file')

        if store is None:
            msg = (_("%(task_id)s of %(task_type)s not configured "
                     "properly. Could not load the filesystem store") % {
                         'task_id': self.task_id,
                         'task_type': self.task_type
                     })
            raise exception.BadTaskConfiguration(msg)

        store.configure()
        return store
Exemplo n.º 4
0
    def __init__(self, task_id, task_type, task_repo, uri):
        self.task_id = task_id
        self.task_type = task_type
        self.task_repo = task_repo
        self.uri = uri
        super(_VerifyStaging, self).__init__(
            name='%s-ConfigureStaging-%s' % (task_type, task_id))

        # NOTE(jokke): If we want to use other than 'file' store in the
        # future, this is one thing that needs to change.
        try:
            uri.index('file:///', 0)
        except ValueError:
            msg = (_("%(task_id)s of %(task_type)s not configured "
                     "properly. Value of node_staging_uri must be "
                     " in format 'file://<absolute-path>'") %
                   {'task_id': self.task_id,
                    'task_type': self.task_type})
            raise exception.BadTaskConfiguration(msg)

        # NOTE(jokke): We really don't need the store for anything but
        # verifying that we actually can build the store will allow us to
        # fail the flow early with clear message why that happens.
        self._build_store()