diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 05f26497d92c5716b9aa3dc258779a73999f6dd9..3a434f7746ffe15b2d8dab45d476f4e9e8675067 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -8409,6 +8409,10 @@ class LUSetInstanceParams(LogicalUnit):
                                    errors.ECODE_INVAL)
       _CheckInstanceDown(self, instance, "cannot change disk template")
       if self.op.disk_template in constants.DTS_NET_MIRROR:
+        if self.op.remote_node == pnode:
+          raise errors.OpPrereqError("Given new secondary node %s is the same"
+                                     " as the primary node of the instance" %
+                                     self.op.remote_node, errors.ECODE_STATE)
         _CheckNodeOnline(self, self.op.remote_node)
         _CheckNodeNotDrained(self, self.op.remote_node)
         disks = [{"size": d.size} for d in instance.disks]