Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ocaml/xapi/xapi_clustering.ml
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,19 @@ module Daemon = struct

let service = "xapi-clusterd"
let enable ~__context =
let port = (string_of_int !Xapi_globs.xapi_clusterd_port) in
debug "Enabling and starting the clustering daemon";
maybe_call_script ~__context !Xapi_globs.firewall_port_config_script ["open"; port];
maybe_call_script ~__context "/usr/bin/systemctl" [ "enable"; service ];
maybe_call_script ~__context "/usr/bin/systemctl" [ "start"; service ];
debug "Cluster daemon: enabled & started"

let disable ~__context =
let port = (string_of_int !Xapi_globs.xapi_clusterd_port) in
debug "Disabling and stopping the clustering daemon";
maybe_call_script ~__context "/usr/bin/systemctl" [ "disable"; service ];
maybe_call_script ~__context "/usr/bin/systemctl" [ "stop"; service ];
maybe_call_script ~__context !Xapi_globs.firewall_port_config_script ["close"; port];
debug "Cluster daemon: disabled & stopped"
end

Expand Down
7 changes: 7 additions & 0 deletions ocaml/xapi/xapi_globs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,9 @@ let last_blob_sync_time = "last_blob_sync_time"
(* Port on which to send network heartbeats *)
let xha_udp_port = 694 (* same as linux-ha *)

(* Port which xapi-clusterd uses to communicate *)
let xapi_clusterd_port = ref 8896

(* When a host is known to be shutting down or rebooting, we add it's reference in here.
This can be used to force the Host_metrics.live flag to false. *)
let hosts_which_are_shutting_down : API.ref_host list ref = ref []
Expand Down Expand Up @@ -819,6 +822,8 @@ let kill_process_script = ref "killall"

let nbd_firewall_config_script = ref "/opt/xensource/libexec/nbd-firewall-config.sh"

let firewall_port_config_script = ref "/etc/xapi.d/plugins/firewall-port"

let disable_logging_for= ref []

let nvidia_whitelist = ref "/usr/share/nvidia/vgpu/vgpuConfig.xml"
Expand Down Expand Up @@ -899,6 +904,7 @@ let xapi_globs_spec =
"default-vbd3-polling-duration", Int default_vbd3_polling_duration;
"default-vbd3-polling-idle-threshold", Int default_vbd3_polling_idle_threshold;
"vm_call_plugin_interval", Float vm_call_plugin_interval;
"xapi_clusterd_port", Int xapi_clusterd_port;
]

let options_of_xapi_globs_spec =
Expand Down Expand Up @@ -1103,6 +1109,7 @@ module Resources = struct
"update-issue", update_issue_script, "Running update-service when configuring the management interface";
"killall", kill_process_script, "Executed to kill process";
"nbd-firewall-config", nbd_firewall_config_script, "Executed after NBD-related networking changes to configure the firewall for NBD";
"firewall-port-config", firewall_port_config_script, "Executed when starting/stopping xapi-clusterd to configure firewall port";
]
let essential_files = [
"pool_config_file", pool_config_file, "Pool configuration file";
Expand Down
6 changes: 6 additions & 0 deletions scripts/xapi.conf
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,12 @@ sm-plugins=ext nfs iscsi lvmoiscsi dummy file hba rawhba udev iso lvm lvmohba lv
# the vbd ring buffer
# default-vbd3-polling-idle-threshold = 50

# The communication port used by xapi-clusterd
# xapi_clusterd_port = 8896

# Path for the firewall-port-config script
# firewall_port_config_script = /etc/xapi.d/plugins/firewall-port

# The file to check if host reboot required
reboot_required_hfxs = /run/reboot-required.hfxs

Expand Down