Commit 6a016df9 authored by Michael Hanselmann's avatar Michael Hanselmann
Browse files

cmdlib: Return new name from rename operations

The new name is then displayed by the clients.
Signed-off-by: default avatarMichael Hanselmann <>
Reviewed-by: default avatarManuel Franceschini <>
parent 3fe11ba3
......@@ -2583,6 +2583,8 @@ class LURenameCluster(LogicalUnit):
self.LogWarning("Could not re-enable the master role on"
" the master, please restart manually: %s", msg)
return clustername
class LUSetClusterParams(LogicalUnit):
"""Change the parameters of the cluster.
......@@ -4965,6 +4967,8 @@ class LURenameInstance(LogicalUnit):
_ShutdownInstanceDisks(self, inst)
class LURemoveInstance(LogicalUnit):
"""Remove an instance.
......@@ -162,17 +162,25 @@ def RenameCluster(opts, args):
@return: the desired exit code
name = args[0]
cl = GetClient()
(cluster_name, ) = cl.QueryConfigValues(["cluster_name"])
new_name = args[0]
if not opts.force:
usertext = ("This will rename the cluster to '%s'. If you are connected"
" over the network to the cluster name, the operation is very"
" dangerous as the IP address will be removed from the node"
" and the change may not go through. Continue?") % name
usertext = ("This will rename the cluster from '%s' to '%s'. If you are"
" connected over the network to the cluster name, the"
" operation is very dangerous as the IP address will be"
" removed from the node and the change may not go through."
" Continue?") % (cluster_name, new_name)
if not AskUser(usertext):
return 1
op = opcodes.OpRenameCluster(name=name)
SubmitOpCode(op, opts=opts)
op = opcodes.OpRenameCluster(name=new_name)
result = SubmitOpCode(op, opts=opts, cl=cl)
ToStdout("Cluster renamed from '%s' to '%s'", cluster_name, result)
return 0
......@@ -636,7 +636,10 @@ def RenameInstance(opts, args):
SubmitOrSend(op, opts)
result = SubmitOrSend(op, opts)
ToStdout("Instance '%s' renamed to '%s'", args[0], result)
return 0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment