示例#1
0
    def run(self, **kwargs):

        if self.cfg.migrate.migrate_whole_cloud:
            LOG.info("Whole cloud migration is enabled. Ignore filtering...")
            return

        filter_path = self.cfg.migrate.filter_path

        if not utils.check_file(filter_path):
            raise exception.AbortMigrationError(
                "Filter file '%s' has not been found. Please check filter file"
                " path in the CloudFerry configuration file." % filter_path)

        if not utils.read_yaml_file(filter_path):
            raise exception.AbortMigrationError("Filter file '%s' is empty." %
                                                filter_path)

        try:
            tenant_opts = kwargs['search_opts_tenant']
            instance_opts = kwargs['search_opts']
            volume_opts = kwargs['search_opts_vol']
            image_opts = kwargs['search_opts_img']
        except KeyError:
            raise exception.AbortMigrationError(
                "Action 'act_get_filter' should be specified prior this action"
                " in the scenario file. Aborting migration...")

        tenant = Tenant(self.cloud, tenant_opts)
        instance = Instance(self.cloud, instance_opts)
        volume = Volume(self.cloud, volume_opts)
        image = Image(self.cloud, image_opts)

        invalid_data = {}
        for filter_object in [tenant, instance, volume, image]:
            invalid_data.update(filter_object.check())

        # Filter only non-empty values
        invalid_data = {k: v for k, v in invalid_data.iteritems() if v}

        if invalid_data:
            msg = "\n\nInvalid Filter Data:\n\n%s" % yaml.dump(invalid_data)
            LOG.critical(msg)
            raise exception.AbortMigrationError(
                "There is a number of invalid data specified in the filter "
                "file '%s', so migration process can not be continued. Please "
                "update your filter config file and try again. %s" %
                (filter_path, msg))
示例#2
0
    def run(self, **kwargs):

        if self.cfg.migrate.migrate_whole_cloud:
            LOG.info("Whole cloud migration is enabled. Ignore filtering...")
            return

        filter_path = self.cfg.migrate.filter_path

        if not utils.check_file(filter_path):
            raise exception.AbortMigrationError(
                "Filter file '%s' has not been found. Please check filter file"
                " path in the CloudFerry configuration file." % filter_path)

        if not utils.read_yaml_file(filter_path):
            raise exception.AbortMigrationError("Filter file '%s' is empty." %
                                                filter_path)

        try:
            tenant_opts = kwargs['search_opts_tenant']
            instance_opts = kwargs['search_opts']
            volume_opts = kwargs['search_opts_vol']
            image_opts = kwargs['search_opts_img']
        except KeyError:
            raise exception.AbortMigrationError(
                "Action 'act_get_filter' should be specified prior this action"
                " in the scenario file. Aborting migration...")

        tenant = Tenant(self.cloud, tenant_opts)
        instance = Instance(self.cloud, instance_opts)
        volume = Volume(self.cloud, volume_opts)
        image = Image(self.cloud, image_opts)

        invalid_data = {}
        for filter_object in [tenant, instance, volume, image]:
            invalid_data.update(filter_object.check())

        # Filter only non-empty values
        invalid_data = {k: v for k, v in invalid_data.iteritems() if v}

        if invalid_data:
            msg = "\n\nInvalid Filter Data:\n\n%s" % yaml.dump(invalid_data)
            LOG.critical(msg)
            raise exception.AbortMigrationError(
                "There is a number of invalid data specified in the filter "
                "file '%s', so migration process can not be continued. Please "
                "update your filter config file and try again. %s" %
                (filter_path, msg))
示例#3
0
 def tearDown(self):
     super(GroupingTestCase, self).tearDown()
     os.remove(FILE_NAME)
     if utils.check_file(RESULT_FILE):
         os.remove(RESULT_FILE)
示例#4
0
 def tearDown(self):
     super(GroupingTestCase, self).tearDown()
     os.remove(FILE_NAME)
     if utils.check_file(RESULT_FILE):
         os.remove(RESULT_FILE)