XAPI Pool Join
XAPI Pool Join
This page partly describes the internal mechanism behind the pool join process. The ultimate source of truth is in the [source code]: this page simply gives a flavour of the kind of thing that goes on.
The term "candidate host" is used to refer to the host which is attempting to join the pool.
- Check that the candidate host does not have HA enabled.
- Read the non-shared SRs from the local database.
- Log in to the pool's master.
- Check that HA isn't enabled in the pool.
- Check that the candidate host is not attempting to join itself (assert_not_joining_myself).
- Check that there are no other hosts in the local database (assert_i_know_of_no_other_hosts).
- Check that there are no running or suspended VMs on the candidate host (assert_no_running_or_suspended_vms_on_me).
- Check that there are no VMs with current operations (assert_no_vms_with_current_ops).
- Check that hosts are homogeneous in terms of software version and CPU (unless the "force" option is used on the pool join operation) (assert_hosts_homogeneous).
- Check that the candidate host has no shared SRs (assert_no_shared_srs_on_me).
- Check that the management interface is (or contains) a physical NIC (assert_management_interface_is_physical).
- Check that the external authentication type and service name matches the master (assert_external_auth_matches).
- Obtain the pool's "cluster secret" (Client.Pool.initial_auth).
- Fetch a backup of the master's database (Pool_db_backup.fetch_database_backup).
Synchronise state with the master
This is done in a best-effort fashion; errors are suppressed. As much state as possible is synchronised.
- Get the record for the candidate host (or create one none already exists) (create_or_get_host_on_master).
- Create records for SR and PBD on master (SR.introduce; copy other-config over; PBD.create) (create_sr_and_pbd_on_master).
- Create records for VMs on master (create_vm_on_master).
- Remap VDIs to have SR fields matching the newly created SR records (remap_vdi).
- Create records for VDIs on master (create_vdi_on_master).
- Remap VBDs to have VDI/VM fields matching the newly created VDI records (remap_vbd).
- Create records for VBDs on master (create_vbd_on_master).
- Create physical PIFs (create_pif_and_maybe_network). Re-use the corresponding network if the master has a corresponding PIF. Otherwise create a new network.
- Remap VIFs to have network fields matching the newly created Network records (remap_vif).
- Create records for VIFs on master (create_vif_on_master).
- Set the default crashdump SR and default suspend-image SR on the candidate host's host record.
- Write the cluster secret to the Xapi_globs.pool_secret_path file.
- Set the candidate host's pool role to be a slave (Pool_role.set_role).
- Restart xapi (Xapi_fuse.light_fuse_and_run).