From cb4e838782a1cf8c741a5c7a5f5936cc5a922916 Mon Sep 17 00:00:00 2001 From: Iustin Pop Date: Tue, 11 Nov 2008 10:58:00 +0000 Subject: [PATCH] Fix instance rename As can be seen from the patch, we remove from the locking manager inst.name. However, we do this right after cfg.RenameInstance, which changes inst.name to the new name. So we need to remove old_name not the new name. The real question is why does the glm allow me to remove a not-existing instance name... The symptom before the patch was: run rename, then: $ gnt-instance list Unhandled protocol error while talking to the master daemon: Caught exception: 'NoneType' object has no attribute 'primary_node' Reviewed-by: imsnah --- lib/cmdlib.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/cmdlib.py b/lib/cmdlib.py index 399cc64..5f1517b 100644 --- a/lib/cmdlib.py +++ b/lib/cmdlib.py @@ -2558,7 +2558,7 @@ class LURenameInstance(LogicalUnit): self.cfg.RenameInstance(inst.name, self.op.new_name) # Change the instance lock. This is definitely safe while we hold the BGL - self.context.glm.remove(locking.LEVEL_INSTANCE, inst.name) + self.context.glm.remove(locking.LEVEL_INSTANCE, old_name) self.context.glm.add(locking.LEVEL_INSTANCE, self.op.new_name) # re-read the instance from the configuration after rename -- 1.7.10.4