Esempio n. 1
0
File: env.py Progetto: junaruga/pcs
 def _push_corosync_conf_live(
     self, target_list, corosync_conf_data, need_stopped_cluster,
     need_qdevice_reload, skip_offline_nodes
 ):
     if need_stopped_cluster:
         com_cmd = CheckCorosyncOffline(
             self.report_processor, skip_offline_nodes
         )
         com_cmd.set_targets(target_list)
         run_and_raise(self.get_node_communicator(), com_cmd)
     com_cmd = DistributeCorosyncConf(
         self.report_processor, corosync_conf_data, skip_offline_nodes
     )
     com_cmd.set_targets(target_list)
     run_and_raise(self.get_node_communicator(), com_cmd)
     if is_service_running(self.cmd_runner(), "corosync"):
         reload_corosync_config(self.cmd_runner())
         self.report_processor.process(
             reports.corosync_config_reloaded()
         )
     if need_qdevice_reload:
         self.report_processor.process(
             reports.qdevice_client_reload_started()
         )
         com_cmd = qdevice.Stop(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list = com_cmd.error_list
         com_cmd = qdevice.Start(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list += com_cmd.error_list
         if report_list:
             raise LibraryError()
Esempio n. 2
0
def qdevice_reload_on_nodes(
    node_communicator, reporter, node_addr_list, skip_offline_nodes=False
):
    """
    Reload corosync-qdevice configuration on cluster nodes
    NodeAddressesList node_addr_list nodes to reload config on
    bool skip_offline_nodes don't raise an error on node communication errors
    """
    reporter.process(reports.qdevice_client_reload_started())
    parallel_params = [
        [(reporter, node_communicator, node), {}]
        for node in node_addr_list
    ]
    # catch an exception so we try to start qdevice on nodes where we stopped it
    report_items = []
    try:
        parallel_nodes_communication_helper(
            qdevice_client.remote_client_stop,
            parallel_params,
            reporter,
            skip_offline_nodes
        )
    except LibraryError as e:
        report_items.extend(e.args)
    try:
        parallel_nodes_communication_helper(
            qdevice_client.remote_client_start,
            parallel_params,
            reporter,
            skip_offline_nodes
        )
    except LibraryError as e:
        report_items.extend(e.args)
    reporter.process_list(report_items)
Esempio n. 3
0
 def _push_corosync_conf_live(
     self, target_list, corosync_conf_data, need_stopped_cluster,
     need_qdevice_reload, skip_offline_nodes
 ):
     # Check if the cluster is stopped when needed
     if need_stopped_cluster:
         com_cmd = CheckCorosyncOffline(
             self.report_processor, skip_offline_nodes
         )
         com_cmd.set_targets(target_list)
         run_and_raise(self.get_node_communicator(), com_cmd)
     # Distribute corosync.conf
     com_cmd = DistributeCorosyncConf(
         self.report_processor, corosync_conf_data, skip_offline_nodes
     )
     com_cmd.set_targets(target_list)
     run_and_raise(self.get_node_communicator(), com_cmd)
     # Reload corosync
     if not need_stopped_cluster:
         # If cluster must be stopped then we cannot reload corosync because
         # the cluster is stopped. If it is not stopped, we do not even get
         # here.
         com_cmd = ReloadCorosyncConf(self.report_processor)
         com_cmd.set_targets(target_list)
         run_and_raise(self.get_node_communicator(), com_cmd)
     # Reload qdevice if needed
     if need_qdevice_reload:
         self.report_processor.process(
             reports.qdevice_client_reload_started()
         )
         com_cmd = qdevice.Stop(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list = com_cmd.error_list
         com_cmd = qdevice.Start(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list += com_cmd.error_list
         if report_list:
             raise LibraryError()
Esempio n. 4
0
 def _push_corosync_conf_live(self, target_list, corosync_conf_data,
                              need_stopped_cluster, need_qdevice_reload,
                              skip_offline_nodes):
     # Check if the cluster is stopped when needed
     if need_stopped_cluster:
         com_cmd = CheckCorosyncOffline(self.report_processor,
                                        skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run_and_raise(self.get_node_communicator(), com_cmd)
     # Distribute corosync.conf
     com_cmd = DistributeCorosyncConf(self.report_processor,
                                      corosync_conf_data,
                                      skip_offline_nodes)
     com_cmd.set_targets(target_list)
     run_and_raise(self.get_node_communicator(), com_cmd)
     # Reload corosync
     if not need_stopped_cluster:
         # If cluster must be stopped then we cannot reload corosync because
         # the cluster is stopped. If it is not stopped, we do not even get
         # here.
         com_cmd = ReloadCorosyncConf(self.report_processor)
         com_cmd.set_targets(target_list)
         run_and_raise(self.get_node_communicator(), com_cmd)
     # Reload qdevice if needed
     if need_qdevice_reload:
         self.report_processor.process(
             reports.qdevice_client_reload_started())
         com_cmd = qdevice.Stop(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list = com_cmd.error_list
         com_cmd = qdevice.Start(self.report_processor, skip_offline_nodes)
         com_cmd.set_targets(target_list)
         run(self.get_node_communicator(), com_cmd)
         report_list += com_cmd.error_list
         if report_list:
             raise LibraryError()