Commit c0cbdc67 authored by Guido Trotter's avatar Guido Trotter
Browse files

LUCreateInstance: handle import without src_node

If we get called with no source node we'll thread src_path as an
instance name exported in EXPORT_DIR in one of the nodes and look for
it with the export_list rpc call.

Reviewed-by: iustinp
parent 9c8971d7
......@@ -3746,6 +3746,21 @@ class LUCreateInstance(LogicalUnit):
src_node = self.op.src_node
src_path = self.op.src_path
if src_node is None:
exp_list = self.rpc.call_export_list(
self.acquired_locks[locking.LEVEL_NODE])
found = False
for node in exp_list:
if src_path in exp_list[node]:
found = True
self.op.src_node = src_node = node
self.op.src_path = src_path = os.path.join(constants.EXPORT_DIR,
src_path)
break
if not found:
raise errors.OpPrereqError("No export found for relative path %s" %
src_path)
export_info = self.rpc.call_export_info(src_node, src_path)
if not export_info:
......
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