Functions to bootstrap a new cluster.
Function |
|
Execute the last steps of cluster destroy |
Function |
|
Updates the cluster certificates, keys and secrets. |
Function |
|
Writes a new HMAC key. |
Function |
|
Returns the current master node. |
Function |
|
Initialise the cluster. |
Function |
|
Create the initial cluster configuration. |
Function |
|
Check if the majority of nodes is healthy |
Function |
|
Failover the master node. |
Function |
|
Add a node to the cluster. |
Function | _ |
Check the agreement on who is the master. |
Function | _ |
Checks the DRBD usermode helper. |
Function | _ |
Checks the sanity of the enabled disk templates. |
Function | _ |
Initialize if needed the file storage. |
Function | _ |
Setup the necessary configuration for the initial node daemon. |
Function | _ |
Checks if a file-base storage type is enabled and inits the dir. |
Function | _ |
Checks if file storage is enabled and inits the dir. |
Function | _ |
Checks if gluster storage is enabled and inits the dir. |
Function | _ |
Checks if shared file storage is enabled and inits the dir. |
Function | _ |
Restricts the ipolicy's disk templates to the enabled ones. |
Function | _ |
Wait for master daemon to become responsive. |
Function | _ |
Wait for node daemon to become responsive. |
Function | _ |
Wait for SSH daemon to become responsive. |
Constant | _DAEMON |
Undocumented |
Constant | _INITCONF |
Undocumented |
Execute the last steps of cluster destroy
This function shuts down all the daemons, completing the destroy begun in cmdlib.LUDestroyOpcode.
Updates the cluster certificates, keys and secrets.
Parameters | |
new | Whether to generate a new cluster certificate |
new | Whether to generate a new RAPI certificate |
new | Whether to generate a new SPICE certificate |
new | Whether to generate a new HMAC key |
new | Whether to generate a new cluster domain secret |
new | Whether to generate a new client certificate |
master | FQDN of the master node |
rapi | New RAPI certificate in PEM format |
spice | New SPICE certificate in PEM format |
spice | Certificate of the CA that signed the SPICE certificate, in PEM format |
cds:string | New cluster domain secret |
nodecert | optional override of the node cert file path |
clientcert | Undocumented |
rapicert | optional override of the rapi cert file path |
spicecert | optional override of the spice cert file path |
spicecacert | optional override of the spice CA cert file path |
hmackey | optional override of the hmac key file path |
cds | Undocumented |
Returns the current master node.
This is a separate function in bootstrap since it's needed by gnt-cluster, and instead of importing directly ssconf, it's better to abstract it in bootstrap, where we do use ssconf in other functions too.
Initialise the cluster.
Parameters | |
cluster | Undocumented |
mac | Undocumented |
master | Undocumented |
master | Undocumented |
file | Undocumented |
shared | Undocumented |
gluster | Undocumented |
candidate | master candidate pool size |
ssh | Undocumented |
ssh | Undocumented |
secondary | Undocumented |
vg | Undocumented |
beparams | Undocumented |
nicparams | Undocumented |
ndparams | Undocumented |
hvparams | Undocumented |
diskparams | Undocumented |
enabled | Undocumented |
modify | Undocumented |
modify | Undocumented |
maintain | Undocumented |
drbd | Undocumented |
uid | Undocumented |
default | Undocumented |
default | Undocumented |
primary | Undocumented |
ipolicy | Undocumented |
prealloc | Undocumented |
use | Undocumented |
hv | Undocumented |
disk | Undocumented |
enabled | list of disk_templates to be used in this cluster |
install | Undocumented |
zeroing | Undocumented |
compression | Undocumented |
enabled | whether user shutdown is enabled cluster wide |
Create the initial cluster configuration.
It will contain the current node, which will also be the master node, and no instances.
Parameters | |
version:int | configuration version |
clusterobjects.Cluster | cluster configuration |
masterobjects.Node | master node configuration |
cfg | configuration file path |
Check if the majority of nodes is healthy
Gather master votes from all nodes known to this node; return True if a strict majority of nodes is reachable and has some opinion on which node is master. Note that this will not guarantee any node to win an election but it ensures that a standard master-failover is still possible.
Returns | |
tuple of (boolean, [str]); the first is if a majority of nodes are healthy, the second is a list of the node names that are not considered healthy. |
Failover the master node.
This checks that we are not already the master, and will cause the current master to cease being master, and the non-master to become new master.
Note: The call to MasterFailover from lib/client/gnt_cluster.py checks that a majority of nodes are healthy and responding before calling this. If this function is called from somewhere else, the caller should also verify that a majority of nodes are healthy.
Parameters | |
no | force the operation without remote nodes agreement (dangerous) |
Returns | |
the pair of an exit code and warnings to display |
Add a node to the cluster.
This function must be called before the actual opcode, and will ssh to the remote node, copy the needed files, and start ganeti-noded, allowing the master to do the rest via normal rpc calls.
Parameters | |
opts | Undocumented |
cluster | the cluster name |
node | the name of the new node |
ssh | the SSH port of the new node |
Check the agreement on who is the master.
This function will return a list of (node, number of votes), ordered by the number of votes.
Note that the sum of votes is the number of nodes this machine knows, whereas the number of entries in the list could be different (if some nodes vote for another master).
Parameters | |
node | the list of nodes to query for master info |
Returns | |
list | list of (node, votes) |
Checks the DRBD usermode helper.
Parameters | |
drbd | name of the DRBD usermode helper that the system should use |
drbd | Undocumented |
Initialize if needed the file storage.
Parameters | |
file | the user-supplied value |
Returns | |
either empty string (if file storage was disabled at build time) or the normalized path to the storage directory |
Setup the necessary configuration for the initial node daemon.
This creates the nodepass file containing the shared password for the cluster, generates the SSL certificate and starts the node daemon.
Parameters | |
master | Name of the master node |
cfg:ConfigWriter | the configuration writer |
Checks if a file-base storage type is enabled and inits the dir.
Parameters | |
enabled | list of enabled disk templates |
file | the file storage directory |
default | default file storage directory when file_storage_dir is 'None' |
file | a disk template whose storage type is 'ST_FILE', 'ST_SHARED_FILE' or 'ST_GLUSTER' |
_storage | checks whether the given file-based storage directory is acceptable |
init | Undocumented |
acceptance | Undocumented |
Returns | |
string | the name of the actual file storage directory |
See Also | |
cluster.CheckFileBasedStoragePathVsEnabledDiskTemplates for details |
Checks if file storage is enabled and inits the dir.
See Also | |
_PrepareFileBasedStorage |
Checks if gluster storage is enabled and inits the dir.
See Also | |
_PrepareFileBasedStorage |
Checks if shared file storage is enabled and inits the dir.
See Also | |
_PrepareFileBasedStorage |
Restricts the ipolicy's disk templates to the enabled ones.
This function clears the ipolicy's list of allowed disk templates from the ones that are not enabled by the cluster.
Parameters | |
ipolicy:dict | the instance policy |
enabled | the list of cluster-wide enabled disk templates |