Ejemplo n.º 1
0
 def serialize(self):
     for file_path in self.task['parameters']['files']:
         file_path['src'] = file_path['src'].format(
             CLUSTER_ID=self.cluster.id)
     uids = self.get_uids()
     yield templates.make_generic_task(
         uids, self.task)
Ejemplo n.º 2
0
 def serialize(self):
     for file_path in self.task['parameters']['files']:
         file_path['src'] = file_path['src'].format(
             CLUSTER_ID=self.cluster.id)
     uids = self.get_uids()
     yield templates.make_generic_task(
         uids, self.task)
Ejemplo n.º 3
0
    def test_configuration_execute(self, mocked_rpc):
        task_manager = OpenstackConfigTaskManager(self.cluster.id)
        task = task_manager.execute({'cluster_id': self.cluster.id})

        self.assertEqual(task.status, consts.TASK_STATUSES.pending)

        all_node_ids = [n.id for n in self.env.nodes[:3]]
        self.assertItemsEqual(task.cache['nodes'], all_node_ids)

        tasks = mocked_rpc.call_args[0][1]['args']['tasks']
        # 3 tasks for all ready nodes with cluster config
        # 1 task for node[0] with node specific config
        # 2 tasks (1 per each compute node)
        # 1 deployment task
        self.assertEqual(len(tasks), 7)

        cluster_uids = []
        role_uids = []
        node_uids = []
        deployment_tasks = []
        for task in tasks:
            if task['type'] == 'upload_file':
                if '/cluster' in task['parameters']['path']:
                    cluster_uids.extend(task['uids'])
                if '/role' in task['parameters']['path']:
                    role_uids.extend(task['uids'])
                if '/node' in task['parameters']['path']:
                    node_uids.extend(task['uids'])
            else:
                deployment_tasks.append(task)

        self.assertItemsEqual(cluster_uids, map(str, all_node_ids))
        self.assertItemsEqual(role_uids,
                              [self.nodes[1].uid, self.nodes[2].uid])
        self.assertItemsEqual([self.nodes[0].uid], node_uids)
        self.assertItemsEqual(
            deployment_tasks,
            [make_generic_task([self.nodes[0].uid], self.refreshable_task)])
    def test_configuration_execute(self, mocked_rpc):
        task_manager = OpenstackConfigTaskManager(self.cluster.id)
        task = task_manager.execute({'cluster_id': self.cluster.id})

        self.assertEqual(task.status, consts.TASK_STATUSES.pending)

        all_node_ids = [n.id for n in self.env.nodes[:3]]
        self.assertItemsEqual(task.cache['nodes'], all_node_ids)

        tasks = mocked_rpc.call_args[0][1]['args']['tasks']
        # 3 tasks for all ready nodes with cluster config
        # 1 task for node[0] with node specific config
        # 2 tasks (1 per each compute node)
        # 1 deployment task
        self.assertEqual(len(tasks), 7)

        cluster_uids = []
        role_uids = []
        node_uids = []
        deployment_tasks = []
        for task in tasks:
            if task['type'] == 'upload_file':
                if '/cluster' in task['parameters']['path']:
                    cluster_uids.extend(task['uids'])
                if '/role' in task['parameters']['path']:
                    role_uids.extend(task['uids'])
                if '/node' in task['parameters']['path']:
                    node_uids.extend(task['uids'])
            else:
                deployment_tasks.append(task)

        self.assertItemsEqual(cluster_uids, map(str, all_node_ids))
        self.assertItemsEqual(role_uids,
                              [self.nodes[1].uid, self.nodes[2].uid])
        self.assertItemsEqual([self.nodes[0].uid], node_uids)
        self.assertItemsEqual(deployment_tasks, [
            make_generic_task([self.nodes[0].uid], self.refreshable_task)])
Ejemplo n.º 5
0
 def serialize(self):
     uids = self.get_uids()
     if uids:
         yield templates.make_generic_task(uids, self.task)
Ejemplo n.º 6
0
 def serialize(self):
     uids = self.get_uids()
     if uids:
         yield templates.make_generic_task(uids, self.task)