- return self.ssh_runner.Run(hostname=hostname, command=command, user=user,
- use_cluster_key=use_cluster_key,
- strict_host_check=strict_host_check,
- private_key=private_key, batch=batch,
- ask_key=ask_key)
+ for _ in range(max_attempts):
+ result = self.ssh_runner.Run(hostname=hostname, command=command,
+ user=user, use_cluster_key=use_cluster_key,
+ strict_host_check=strict_host_check,
+ private_key=private_key, batch=batch,
+ ask_key=ask_key)
+ if not result.failed:
+ break
+
+ return result
+
+ def _CheckRunningInstances(self):
+ """Checks if on the clusters to be merged there are running instances
+
+ @rtype: boolean
+ @return: True if there are running instances, False otherwise
+
+ """
+ for cluster in self.clusters:
+ result = self._RunCmd(cluster, "gnt-instance list -o status")
+ if self.RUNNING_STATUSES.intersection(result.output.splitlines()):
+ return True
+
+ return False