Script cluster_merge :: Class Merger
[hide private]
[frames] | no frames]

Class Merger


Handling the merge.

Instance Methods [hide private]
 
__init__(self, clusters, pause_period, groups, restart, params, stop_instances)
Initialize object with sane defaults and infos required.
 
Setup(self)
Sets up our end so we can do the merger.
 
_PrepareAuthorizedKeys(self)
Prepare the authorized_keys on every merging node.
 
_RunCmd(self, hostname, command, user="root", use_cluster_key=False, strict_host_check=False, private_key=None, batch=True, ask_key=False, max_attempts=1)
Wrapping SshRunner.Run with default parameters.
boolean
_CheckRunningInstances(self)
Checks if on the clusters to be merged there are running instances
 
_StopMergingInstances(self)
Stop instances on merging clusters.
 
_DisableWatcher(self)
Disable watch on all merging clusters, including ourself.
 
_RemoveMasterIps(self)
Removes the master IPs from the master nodes of each cluster.
 
_StopDaemons(self)
Stop all daemons on merging nodes.
 
_FetchRemoteConfig(self)
Fetches and stores remote cluster config from the master.
 
_KillMasterDaemon(self)
Kills the local master daemon.
 
_MergeConfig(self)
Merges all foreign config into our own config.
 
_MergeClusterConfigs(self, my_config, other_config)
Checks that all relevant cluster parameters are compatible
 
_GetOsHypervisor(self, cluster, os_name, hyp)
 
_MergeNodeGroups(self, my_config, other_config)
Adds foreign node groups
 
_StartMasterDaemon(self, no_vote=False)
Starts the local master daemon.
 
_ReaddMergedNodesAndRedist(self)
Readds all merging nodes and make sure their config is up-to-date.
 
_StartupAllInstances(self)
Starts up all instances (locally).
 
_VerifyCluster(self)
Runs gnt-cluster verify to verify the health.
 
Merge(self)
Does the actual merge.
 
Cleanup(self)
Clean up our environment.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables [hide private]
  RUNNING_STATUSES = frozenset([constants.INSTST_RUNNING, consta...
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, clusters, pause_period, groups, restart, params, stop_instances)
(Constructor)

 

Initialize object with sane defaults and infos required.

Parameters:
  • clusters - The list of clusters to merge in
  • pause_period - The time watcher shall be disabled for
  • groups - How to handle group conflicts
  • restart - How to handle instance restart
  • stop_instances - Indicates whether the instances must be stopped (True) or if the Merger must only check if no instances are running on the mergee clusters (False)
Overrides: object.__init__

Setup(self)

 

Sets up our end so we can do the merger.

This method is setting us up as a preparation for the merger. It makes the initial contact and gathers information needed.

Raises:

_PrepareAuthorizedKeys(self)

 

Prepare the authorized_keys on every merging node.

This method add our public key to remotes authorized_key for further communication.

_RunCmd(self, hostname, command, user="root", use_cluster_key=False, strict_host_check=False, private_key=None, batch=True, ask_key=False, max_attempts=1)

 

Wrapping SshRunner.Run with default parameters.

For explanation of parameters see ganeti.ssh.SshRunner.Run.

_CheckRunningInstances(self)

 

Checks if on the clusters to be merged there are running instances

Returns: boolean
True if there are running instances, False otherwise

_FetchRemoteConfig(self)

 

Fetches and stores remote cluster config from the master.

This step is needed before we can merge the config.

_KillMasterDaemon(self)

 

Kills the local master daemon.

Raises:

_MergeNodeGroups(self, my_config, other_config)

 

Adds foreign node groups

ConfigWriter.AddNodeGroup takes care of making sure there are no conflicts.

_StartMasterDaemon(self, no_vote=False)

 

Starts the local master daemon.

Parameters:
  • no_vote - Should the masterd started without voting? default: False
Raises:

_ReaddMergedNodesAndRedist(self)

 

Readds all merging nodes and make sure their config is up-to-date.

Raises:

_StartupAllInstances(self)

 

Starts up all instances (locally).

Raises:

_VerifyCluster(self)

 

Runs gnt-cluster verify to verify the health.

Raises:
  • errors.ProgrammError - If cluster fails on verification

Merge(self)

 

Does the actual merge.

It runs all the steps in the right order and updates the user about steps taken. Also it keeps track of rollback_steps to undo everything.

Cleanup(self)

 

Clean up our environment.

This cleans up remote private keys and configs and after that deletes the temporary directory.


Class Variable Details [hide private]

RUNNING_STATUSES

Value:
frozenset([constants.INSTST_RUNNING, constants.INSTST_ERRORUP,])