Example #1
0
    def _await_datanodes(self, cluster):
        datanodes_count = len(vu.get_datanodes(cluster))
        if datanodes_count < 1:
            return

        LOG.info(_LI("Waiting %s datanodes to start up"), datanodes_count)
        with remote.get_remote(vu.get_namenode(cluster)) as r:
            while True:
                if run.check_datanodes_count(r, datanodes_count):
                    LOG.info(_LI('Datanodes on cluster %s have been started'),
                             cluster.name)
                    return

                context.sleep(1)

                if not g.check_cluster_exists(cluster):
                    LOG.info(
                        _LI('Stop waiting datanodes on cluster %s since it has'
                            ' been deleted'), cluster.name)
                    return
Example #2
0
    def _await_datanodes(self, cluster):
        datanodes_count = len(vu.get_datanodes(cluster))
        if datanodes_count < 1:
            return

        LOG.info(_LI("Waiting %s datanodes to start up"), datanodes_count)
        with remote.get_remote(vu.get_namenode(cluster)) as r:
            while True:
                if run.check_datanodes_count(r, datanodes_count):
                    LOG.info(
                        _LI('Datanodes on cluster %s has been started'),
                        cluster.name)
                    return

                context.sleep(1)

                if not g.check_cluster_exists(cluster):
                    LOG.info(
                        _LI('Stop waiting datanodes on cluster %s since it has'
                            ' been deleted'), cluster.name)
                    return
Example #3
0
 def test_check_datanodes_count_expects_zero(self):
     remote = mock.Mock()
     self.assertTrue(run_scripts.check_datanodes_count(remote, 0))
     self.assertEqual(remote.execute_command.call_count, 0)
Example #4
0
 def test_check_datanodes_count_nonzero_exitcode(self):
     remote = mock.Mock()
     remote.execute_command.return_value = (1, "1")
     self.assertFalse(run_scripts.check_datanodes_count(remote, 1))
Example #5
0
 def test_check_datanodes_count_negative(self):
     remote = mock.Mock()
     remote.execute_command.return_value = (0, "1")
     self.assertFalse(run_scripts.check_datanodes_count(remote, 2))
Example #6
0
 def test_check_datanodes_count_expects_zero(self):
     remote = mock.Mock()
     self.assertTrue(run_scripts.check_datanodes_count(remote, 0))
     self.assertEqual(remote.execute_command.call_count, 0)
Example #7
0
 def test_check_datanodes_count_nonzero_exitcode(self):
     remote = mock.Mock()
     remote.execute_command.return_value = (1, "1")
     self.assertFalse(run_scripts.check_datanodes_count(remote, 1))
Example #8
0
 def test_check_datanodes_count_negative(self):
     remote = mock.Mock()
     remote.execute_command.return_value = (0, "1")
     self.assertFalse(run_scripts.check_datanodes_count(remote, 2))