From 3f2ad566227c9654aded64443902f1feafb2464d Mon Sep 17 00:00:00 2001
From: Michael Hanselmann <hansmi@google.com>
Date: Mon, 25 Oct 2010 18:37:52 +0200
Subject: [PATCH] Allow remote imports without checked names
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

By default all names are checked (LUCreateInstance, name_check). In some
cases it can be useful to disable this check, but doing so was not
allowed for remote imports. One should be aware, however, that using
this feature can lead to rename script failures when importing a remote
instance without the proper name, e.g.:

β€œFailed to run rename script for inst1 on node node3.example.com: OS
rename script failed (exited with exit code 1), last lines in the log
file:\nCannot rename from inst2.example.com to inst1:\nInstance has a
different hostname (inst2)”

Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>
---
 lib/cmdlib.py | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index d2d7f1ca1..0ce865504 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6657,9 +6657,6 @@ class LUCreateInstance(LogicalUnit):
       self.op.instance_name = self.hostname1.name
       # used in CheckPrereq for ip ping check
       self.check_ip = self.hostname1.ip
-    elif self.op.mode == constants.INSTANCE_REMOTE_IMPORT:
-      raise errors.OpPrereqError("Remote imports require names to be checked",
-                                 errors.ECODE_INVAL)
     else:
       self.check_ip = None
 
-- 
GitLab