def do_timesync(self): if not self.params.node_name: nodes = [node.name for node in self.env.get_nodes() if node.driver.node_active(node)] else: nodes = [self.params.node_name] cur_time = sync_time(self.env, nodes, skip_sync=True) for name in sorted(cur_time): print("Current time on '{0}' = {1}".format(name, cur_time[name])) print("Please wait for a few minutes while time is synchronized...") new_time = sync_time(self.env, nodes, skip_sync=False) for name in sorted(new_time): print("New time on '{0}' = {1}".format(name, new_time[name]))
def do_timesync(self): if not self.params.node_name: nodes = [ node.name for node in self.env.get_nodes() if node.driver.node_active(node) ] else: nodes = [self.params.node_name] cur_time = sync_time(self.env, nodes, skip_sync=True) for name in sorted(cur_time): print("Current time on '{0}' = {1}".format(name, cur_time[name])) print("Please wait for a few minutes while time is synchronized...") new_time = sync_time(self.env, nodes, skip_sync=False) for name in sorted(new_time): print("New time on '{0}' = {1}".format(name, new_time[name]))
def sync_time(self, nodes_names=None, skip_sync=False): if nodes_names is None: roles = ['fuel_master', 'fuel_slave'] nodes_names = [node.name for node in self.d_env.get_nodes() if node.role in roles and node.driver.node_active(node)] logger.info("Please wait while time on nodes: {0} " "will be synchronized" .format(', '.join(sorted(nodes_names)))) new_time = sync_time(self.d_env, nodes_names, skip_sync) for name in sorted(new_time): logger.info("New time on '{0}' = {1}".format(name, new_time[name]))