Example #1
0
def link(config_path, debug=False):
    """
        :config_name - name of config yaml-file, example 'config.yaml'
    """
    cfg = config.load(load_yaml_config(config_path, debug))
    stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage', cfg,
                        force=True)
Example #2
0
    def take_action(self, parsed_args):
        super(EstimateMigration, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)
        pr = procedures.EstimateCopy(self.config, parsed_args.migration)
        return ('Type', 'Count', 'Size'), pr.run()
Example #3
0
    def take_action(self, parsed_args):
        super(EstimateMigration, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)
        pr = procedures.EstimateCopy(self.config, parsed_args.migration)
        return ('Type', 'Count', 'Size'), pr.run()
Example #4
0
 def test_invalidate_dependencies_on_configuration_change(
         self, execute_two, execute_one, invalidate_one):
     stage.execute_stage(fqname(StageOne), self.config1)
     stage.execute_stage(fqname(StageTwo), self.config2)
     execute_one.assert_has_calls([
         mock.call(self.config1, False),
         mock.call(self.config2, True),
     ])
     execute_two.assert_called_once_with(self.config2, False)
     invalidate_one.assert_called_once_with(self.config1, self.config2)
Example #5
0
 def test_invalidate_dependencies_on_configuration_change(
         self, execute_two, execute_one, invalidate_one):
     stage.execute_stage(fqname(StageOne), self.config1)
     stage.execute_stage(fqname(StageTwo), self.config2)
     execute_one.assert_has_calls([
         mock.call(self.config1, False),
         mock.call(self.config2, True),
     ])
     execute_two.assert_called_once_with(self.config2, False)
     invalidate_one.assert_called_once_with(self.config1, self.config2)
Example #6
0
    def take_action(self, parsed_args):
        super(ShowObjects, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)

        pr = procedures.ShowObjects(self.config, parsed_args.migration,
                                    parsed_args.filters,
                                    parsed_args.show_unused, parsed_args.limit)
        data = pr.run()
        return ('Type', 'ID', 'Name', 'Size'), data
Example #7
0
    def take_action(self, parsed_args):
        super(ShowObjects, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)

        pr = procedures.ShowObjects(
            self.config, parsed_args.migration, parsed_args.filters,
            parsed_args.show_unused, parsed_args.limit)
        data = pr.run()
        return ('Type', 'ID', 'Name', 'Size'), data
Example #8
0
def estimate_migration(config_path, migration, debug=False):
    cfg = config.load(load_yaml_config(config_path, debug))
    if migration not in cfg.migrations:
        print 'No such migration:', migration
        print '\nPlease choose one of this:'
        for name in sorted(cfg.migrations.keys()):
            print '  -', name
        return -1

    stage.execute_stage('cloudferry.lib.os.discovery.stages.DiscoverStage',
                        cfg)
    procedures.estimate_copy(cfg, migration)
    procedures.show_largest_servers(cfg, 10, migration)
Example #9
0
    def take_action(self, parsed_args):
        super(Migrate, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)

        with model.Session() as session:
            migration = self.config.migrations[parsed_args.migration]
            src_cloud = self.config.clouds[migration.source]
            objects = migration.query.search(session, src_cloud)
            graph = taskflow_utils.create_graph_flow(
                parsed_args.migration, objects,
                migrate_base.create_migration_flow, self.config, migration)

        taskflow_utils.execute_flow(graph)
Example #10
0
    def take_action(self, parsed_args):
        super(Migrate, self).take_action(parsed_args)

        stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                            self.config)

        with model.Session() as session:
            migration = self.config.migrations[parsed_args.migration]
            src_cloud = self.config.clouds[migration.source]
            objects = migration.query.search(session, src_cloud)
            graph = taskflow_utils.create_graph_flow(
                parsed_args.migration, objects,
                migrate_base.create_migration_flow,
                self.config, migration)

        taskflow_utils.execute_flow(graph)
Example #11
0
def show_unused_resources(config_path, cloud, count=100, tenant=None,
                          debug=False):
    cfg = config.load(load_yaml_config(config_path, debug))
    stage.execute_stage('cloudferry.lib.os.discovery.stages.DiscoverStage',
                        cfg)
    procedures.show_largest_unused_resources(int(count), cloud, tenant)
Example #12
0
 def take_action(self, parsed_args):
     stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                         self.config,
                         force=True)
Example #13
0
 def test_dependencies_execute(self, execute):
     stage.execute_stage(fqname(StageOne), self.config1)
     execute.assert_called_once_with(self.config1, False)
Example #14
0
 def take_action(self, parsed_args):
     stage.execute_stage('cloudferry.lib.os.discovery.stages.LinkStage',
                         self.config, force=True)
Example #15
0
 def test_dependencies_execute_deps(self, execute_two, execute_one):
     stage.execute_stage(fqname(StageTwo), self.config1)
     execute_one.assert_called_once_with(self.config1, False)
     execute_two.assert_called_once_with(self.config1, False)
Example #16
0
 def test_dependencies_execute_deps(self, execute_two, execute_one):
     stage.execute_stage(fqname(StageTwo), self.config1)
     execute_one.assert_called_once_with(self.config1, False)
     execute_two.assert_called_once_with(self.config1, False)
Example #17
0
 def test_dependencies_execute(self, execute):
     stage.execute_stage(fqname(StageOne), self.config1)
     execute.assert_called_once_with(self.config1, False)