2010/2/25 René Nussbaumer <[email protected]>:
> --- /dev/null
> +++ b/tools/cluster-merge
> +LOG_CLUSTER_MERGE = constants.LOG_DIR + "/cluster-merge.log"

This is not used.

> +PAUSE_PERIOD_OPT = cli.cli_option("-p", "--watcher-pause-period", 
> default=1800,
> +                                  action="store", type="int",
> +                                  dest="pause_period",
> +                                  help=("Period of time watcher should be"

s/Period of time/Amount of time in seconds/

> +                                        " suspended from running"))

> +class MergerData(object):
> +  """Container class to hold data used for merger.
> +
> +  """
> +  #W0621: Redefining name 'config' from outer scope
> +  def __init__(self, cluster, key, instances, nodes, # pylint: 
> disable-msg=W0621

Don't redefine names unless there's a really, really good reason for
it (like interface compatibility with a third-party library).

> +class Merger(object):
> +  """Handling the merge.
> +
> +  """
> +  def __init__(self, clusters, pause_period=1800):

Why make pause_period optional?

> +    self.work_dir = tempfile.mkdtemp(suffix="cluster-merger")
> +    self.ssh_runner = ssh.SshRunner("faked-cluster-merger-cluster")

Shouldn't this use the local cluster name?

> +  def _StopMergingInstances(self):
> +    """Stop instances on merging clusters.
> +
> +    """
> +    for cluster in self.clusters:
> +      result = self._RunCmd(cluster, "gnt-instance shutdown --all"
> +                                     " --force-multiple")
> +
> +      if result.failed:
> +        raise errors.RemoteError("Unable to stop instances on %s. "
> +                                 "Fail reason: %s; output: %s" %
> +                                 (cluster, result.fail_reason, 
> result.output))

When wrapping strings, whitespace must be on the following line (see
http://code.google.com/p/ganeti/wiki/StyleGuide). Here and in at least
one other place.

> +  def _DisableWatcher(self):
> +    """Disable watch on all merging clusters, including ourself.
> +
> +    """
> +    for cluster in ["localhost"] + self.clusters:
> +      result = self._RunCmd(cluster, "gnt-cluster watcher pause %d" %
> +                                     self.pause_period)
> +
> +      if result.failed:
> +        raise errors.RemoteError("Unable to pause watcher on %s. "
> +                                 "Fail reason: %s; output: %s" %
> +                                 (cluster, result.fail_reason, 
> result.output))

See above.

The code will soon be ready!

Regards,
Michael

Reply via email to