当前位置: 首页>>代码示例>>Python>>正文


Python TaskHelper.nodes_to_deploy方法代码示例

本文整理汇总了Python中nailgun.task.helpers.TaskHelper.nodes_to_deploy方法的典型用法代码示例。如果您正苦于以下问题:Python TaskHelper.nodes_to_deploy方法的具体用法?Python TaskHelper.nodes_to_deploy怎么用?Python TaskHelper.nodes_to_deploy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nailgun.task.helpers.TaskHelper的用法示例。


在下文中一共展示了TaskHelper.nodes_to_deploy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_deploy_grow_controllers

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_deploy_grow_controllers(self):
        cluster = self.create_env(
            nodes_kwargs=[
                {"roles": ["controller"]},
                {"roles": ["controller"], "pending_addition": True},
                {"roles": ["controller"], "pending_addition": True},
            ]
        )

        # We have to build 2 new controllers
        n_nodes = TaskHelper.nodes_to_provision(cluster)
        self.assertEqual(len(n_nodes), 2)

        # All controllers must re-deploy (run puppet)
        r_nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEqual(len(r_nodes), 3)

        supertask = self.env.launch_deployment()
        self.assertEqual(supertask.name, "deploy")

        self.env.wait_ready(supertask)
        self.assertEqual(supertask.status, "ready")

        controllers = self.filter_by_role(cluster.nodes, "controller")
        self.assertEqual(len(controllers), 3)
开发者ID:mba811,项目名称:fuel-web,代码行数:27,代码来源:test_cluster_scaling.py

示例2: message

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def message(cls, task):
        logger.debug("DeploymentTask.message(task=%s)" % task.uuid)

        task.cluster.prepare_for_deployment()
        nodes = TaskHelper.nodes_to_deploy(task.cluster)
        nodes_ids = [n.id for n in nodes]
        for n in db().query(Node).filter_by(
                cluster=task.cluster).order_by(Node.id):
            # However, we must not pass nodes which are set to be deleted.
            if n.pending_deletion:
                continue

            if n.id in nodes_ids:  # It's node which we need to redeploy
                n.pending_addition = False
                if n.pending_roles:
                    n.roles += n.pending_roles
                    n.pending_roles = []
                if n.status in ('deploying'):
                    n.status = 'provisioned'
                n.progress = 0
                db().add(n)
                db().commit()

        # here we replace provisioning data if user redefined them
        serialized_cluster = task.cluster.replaced_deployment_info or \
            deployment_serializers.serialize(task.cluster)

        return {
            'method': 'deploy',
            'respond_to': 'deploy_resp',
            'args': {
                'task_uuid': task.uuid,
                'deployment_info': serialized_cluster}}
开发者ID:mrasskazov,项目名称:fuelweb,代码行数:35,代码来源:task.py

示例3: test_redeploy_all_controller_if_single_controller_failed

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_redeploy_all_controller_if_single_controller_failed(self):
        cluster = self.create_env([
            {'roles': ['controller'], 'status': 'error'},
            {'roles': ['controller']},
            {'roles': ['controller', 'cinder']},
            {'roles': ['compute', 'cinder']},
            {'roles': ['compute']},
            {'roles': ['cinder']}])

        nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEquals(len(nodes), 3)

        controllers = self.filter_by_role(nodes, 'controller')
        self.assertEquals(len(controllers), 3)
开发者ID:Mellanox,项目名称:fuel-web,代码行数:16,代码来源:test_task_helpers.py

示例4: prepare_for_deployment

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def prepare_for_deployment(self):
        from nailgun.network.manager import NetworkManager
        from nailgun.task.helpers import TaskHelper

        nodes = set(TaskHelper.nodes_to_deploy(self) +
                    TaskHelper.nodes_in_provisioning(self))

        TaskHelper.update_slave_nodes_fqdn(nodes)

        nodes_ids = sorted([n.id for n in nodes])
        netmanager = NetworkManager()
        if nodes_ids:
            netmanager.assign_ips(nodes_ids, 'management')
            netmanager.assign_ips(nodes_ids, 'public')
            netmanager.assign_ips(nodes_ids, 'storage')
开发者ID:rustyrobot,项目名称:fuelweb,代码行数:17,代码来源:models.py

示例5: test_redeploy_only_compute_cinder

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_redeploy_only_compute_cinder(self):
        cluster = self.create_env([
            {'roles': ['controller']},
            {'roles': ['controller']},
            {'roles': ['controller', 'cinder']},
            {'roles': ['compute', 'cinder']},
            {'roles': ['compute'], 'status': 'error'},
            {'roles': ['cinder'], 'status': 'error'}])

        nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEquals(len(nodes), 2)

        cinders = self.filter_by_role(nodes, 'cinder')
        self.assertEquals(len(cinders), 1)

        computes = self.filter_by_role(nodes, 'compute')
        self.assertEquals(len(computes), 1)
开发者ID:Mellanox,项目名称:fuel-web,代码行数:19,代码来源:test_task_helpers.py

示例6: prepare_for_deployment

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def prepare_for_deployment(self):
        from nailgun.network.manager import NetworkManager
        from nailgun.task.helpers import TaskHelper

        nodes = sorted(
            set(TaskHelper.nodes_to_deploy(self) + TaskHelper.nodes_in_provisioning(self)), key=lambda node: node.id
        )

        TaskHelper.update_slave_nodes_fqdn(nodes)

        nodes_ids = [n.id for n in nodes]
        netmanager = NetworkManager()
        if nodes_ids:
            netmanager.assign_ips(nodes_ids, "management")
            netmanager.assign_ips(nodes_ids, "public")
            netmanager.assign_ips(nodes_ids, "storage")

            for node in nodes:
                netmanager.assign_admin_ips(node.id, len(node.meta.get("interfaces", [])))
开发者ID:rsokolkov,项目名称:fuel-web,代码行数:21,代码来源:cluster.py

示例7: test_redeploy_with_critial_roles

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_redeploy_with_critial_roles(self):
        cluster = self.create_env([
            {'roles': ['controller'], 'status': 'error'},
            {'roles': ['controller'], 'status': 'provisioned'},
            {'roles': ['controller'], 'status': 'provisioned'},
            {'roles': ['compute', 'cinder'], 'status': 'provisioned'},
            {'roles': ['compute'], 'status': 'provisioned'},
            {'roles': ['cinder'], 'status': 'provisioned'}])

        nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEqual(len(nodes), 6)

        controllers = self.filter_by_role(nodes, 'controller')
        self.assertEqual(len(controllers), 3)

        cinders = self.filter_by_role(nodes, 'cinder')
        self.assertEqual(len(cinders), 2)

        computes = self.filter_by_role(nodes, 'compute')
        self.assertEqual(len(computes), 2)
开发者ID:MoArif,项目名称:fuel-web,代码行数:22,代码来源:test_task_helpers.py

示例8: test_deploy_grow_controllers

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_deploy_grow_controllers(self):
        cluster = self.create_env(
            nodes_kwargs=[
                {'roles': ['controller']},
                {'roles': ['controller'], 'pending_addition': True},
                {'roles': ['controller'], 'pending_addition': True}])

        # We have to build 2 new controllers
        n_nodes = TaskHelper.nodes_to_provision(cluster)
        self.assertEqual(len(n_nodes), 2)

        # All controllers must re-deploy
        r_nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEqual(len(r_nodes), 3)

        supertask = self.env.launch_deployment()
        self.assertEqual(supertask.name, consts.TASK_NAMES.deploy)
        self.assertNotEqual(supertask.status, consts.TASK_STATUSES.error)

        controllers = self.filter_by_role(cluster.nodes, 'controller')
        self.assertEqual(len(controllers), 3)
开发者ID:ekorekin,项目名称:fuel-web,代码行数:23,代码来源:test_cluster_scaling.py

示例9: _check_nodes_are_online

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def _check_nodes_are_online(cls, task):
        offline_nodes = db().query(Node).\
            filter(Node.cluster == task.cluster).\
            filter_by(online=False).\
            filter_by(pending_deletion=False)

        offline_nodes_not_ready = [n for n in offline_nodes
                                   if n.status != consts.NODE_STATUSES.ready]
        nodes_to_deploy = TaskHelper.nodes_to_deploy(task.cluster)
        offline_nodes_to_redeploy = [
            n for n in offline_nodes
            if n.status == consts.NODE_STATUSES.ready and n in nodes_to_deploy]

        if offline_nodes_not_ready or offline_nodes_to_redeploy:
            node_names = ','.join(
                map(lambda n: n.full_name,
                    offline_nodes_not_ready + offline_nodes_to_redeploy))
            raise errors.NodeOffline(
                u'Nodes "{0}" are offline.'
                ' Remove them from environment '
                'and try again.'.format(node_names))
开发者ID:anbangr,项目名称:fuel-web,代码行数:23,代码来源:task.py

示例10: test_redeploy_with_stopped_nodes

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_redeploy_with_stopped_nodes(self):
        cluster = self.create_env([
            {'roles': ['controller'], 'status': 'error'},
            {'roles': ['controller'], 'status': 'stopped'},
            {'roles': ['controller'], 'status': 'stopped'},
            {'roles': ['compute', 'cinder'], 'status': 'stopped'},
            {'roles': ['compute'], 'status': 'error',
             'error_type': 'stop_deployment'},
            {'roles': ['cinder'], 'status': 'error',
             'error_type': 'deploy'}])

        nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEqual(len(nodes), 6)

        controllers = self.filter_by_role(nodes, 'controller')
        self.assertEqual(len(controllers), 3)

        cinders = self.filter_by_role(nodes, 'cinder')
        self.assertEqual(len(cinders), 2)

        computes = self.filter_by_role(nodes, 'compute')
        self.assertEqual(len(computes), 2)
开发者ID:ogelbukh,项目名称:fuel-web,代码行数:24,代码来源:test_task_helpers.py

示例11: message

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def message(cls, task):
        logger.debug("DeploymentTask.message(task=%s)" % task.uuid)

        task.cluster.prepare_for_deployment()
        nodes = TaskHelper.nodes_to_deploy(task.cluster)
        nodes_ids = [n.id for n in nodes]
        for n in db().query(Node).filter_by(cluster=task.cluster).order_by(Node.id):
            # However, we must not pass nodes which are set to be deleted.
            if n.pending_deletion:
                continue

            if n.id in nodes_ids:
                if n.pending_roles:
                    n.roles += n.pending_roles
                    n.pending_roles = []

                # If reciever for some reasons didn't update
                # node's status to provisioned when deployment
                # started, we should do it in nailgun
                if n.status in ("deploying"):
                    n.status = "provisioned"
                n.progress = 0
                db().add(n)
                db().commit()

        # here we replace provisioning data if user redefined them
        serialized_cluster = task.cluster.replaced_deployment_info or deployment_serializers.serialize(task.cluster)

        # After searilization set pending_addition to False
        for node in db().query(Node).filter(Node.id.in_(nodes_ids)):
            node.pending_addition = False
        db().commit()

        return {
            "method": "deploy",
            "respond_to": "deploy_resp",
            "args": {"task_uuid": task.uuid, "deployment_info": serialized_cluster},
        }
开发者ID:rsokolkov,项目名称:fuel-web,代码行数:40,代码来源:task.py

示例12: test_deploy_grow_controllers

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_deploy_grow_controllers(self):
        cluster = self.create_env(
            nodes_kwargs=[
                {'roles': ['controller']},
                {'roles': ['controller'], 'pending_addition': True},
                {'roles': ['controller'], 'pending_addition': True}])

        # We have to build 2 new controllers
        n_nodes = TaskHelper.nodes_to_provision(cluster)
        self.assertEquals(len(n_nodes), 2)

        # All controllers must re-deploy (run puppet)
        r_nodes = TaskHelper.nodes_to_deploy(cluster)
        self.assertEquals(len(r_nodes), 3)

        supertask = self.env.launch_deployment()
        self.assertEquals(supertask.name, 'deploy')

        self.env.wait_ready(supertask)
        self.assertEquals(supertask.status, 'ready')

        controllers = self.filter_by_role(cluster.nodes, 'controller')
        self.assertEquals(len(controllers), 3)
开发者ID:Mellanox,项目名称:fuel-web,代码行数:25,代码来源:test_cluster_scaling.py

示例13: message

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def message(cls, task):
        logger.debug("DeploymentTask.message(task=%s)" % task.uuid)

        task.cluster.prepare_for_deployment()
        nodes = TaskHelper.nodes_to_deploy(task.cluster)
        nodes_ids = [n.id for n in nodes]
        for n in db().query(Node).filter_by(
                cluster=task.cluster).order_by(Node.id):
            # However, we must not pass nodes which are set to be deleted.
            if n.pending_deletion:
                continue

            if n.id in nodes_ids:  # It's node which we need to redeploy
                n.pending_addition = False
                if n.pending_roles:
                    n.roles += n.pending_roles
                    n.pending_roles = []
                if n.status in ('deploying'):
                    n.status = 'provisioned'
                n.progress = 0
                db().add(n)
                db().commit()

        message = {
            'method': 'deploy',
            'respond_to': 'deploy_resp',
            'args': {
                'task_uuid': task.uuid,
                # if task.cluster.facts not empty dict, it will be used
                # instead of computing cluster facts through serialize
                'deployment_info': task.cluster.facts
                or serialize(task.cluster)
            }
        }

        return message
开发者ID:monroid,项目名称:fuelweb,代码行数:38,代码来源:task.py

示例14: test_nodes_to_deploy_if_lcm

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
    def test_nodes_to_deploy_if_lcm(self):
        cluster = self.env.create(
            nodes_kwargs=[
                {'status': consts.NODE_STATUSES.ready},
                {'status': consts.NODE_STATUSES.discover},
                {'status': consts.NODE_STATUSES.provisioning},
                {'status': consts.NODE_STATUSES.provisioned},
                {'status': consts.NODE_STATUSES.deploying},
                {'status': consts.NODE_STATUSES.error,
                 'error_type': consts.NODE_ERRORS.deploy},
                {'status': consts.NODE_STATUSES.error,
                 'error_type': consts.NODE_ERRORS.provision},
                {'status': consts.NODE_STATUSES.stopped},
                {'status': consts.NODE_STATUSES.removing},
                {'status': consts.NODE_STATUSES.ready,
                 'pending_deletion': True},
            ],
            release_kwargs={
                'version': 'mitaka-9.0',
                'operating_system': consts.RELEASE_OS.ubuntu
            }
        )
        nodes_to_deploy = TaskHelper.nodes_to_deploy(cluster)
        self.assertEqual(5, len(nodes_to_deploy))

        expected_status = [
            consts.NODE_STATUSES.provisioned,
            consts.NODE_STATUSES.stopped,
            consts.NODE_STATUSES.ready,
            consts.NODE_STATUSES.error,
            consts.NODE_STATUSES.deploying
        ]
        for node in nodes_to_deploy:
            self.assertIn(node.status, expected_status)
            self.assertIn(node.error_type, [None, consts.NODE_ERRORS.deploy])
            self.assertFalse(node.pending_deletion)
开发者ID:ogelbukh,项目名称:fuel-web,代码行数:38,代码来源:test_task_helpers.py

示例15: get_default_nodes

# 需要导入模块: from nailgun.task.helpers import TaskHelper [as 别名]
# 或者: from nailgun.task.helpers.TaskHelper import nodes_to_deploy [as 别名]
 def get_default_nodes(self, cluster):
     if objects.Release.is_lcm_supported(cluster.release):
         return objects.Cluster.get_nodes_not_for_deletion(cluster).all()
     return TaskHelper.nodes_to_deploy(cluster)
开发者ID:mmalchuk,项目名称:openstack-fuel-web,代码行数:6,代码来源:orchestrator.py


注:本文中的nailgun.task.helpers.TaskHelper.nodes_to_deploy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。