Commit 3eccac06 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert export_info rpc to new style result

This also removes some code from ganeti-noded and, which should
not do such processing of data (and be simply glue code). (Or
alternatively they could, if we had better infrastructure).
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 9b201a0d
......@@ -310,10 +310,7 @@ class NodeHttpServer(http.server.HttpServer):
path = params[0]
einfo = backend.ExportInfo(path)
if einfo is None:
return einfo
return einfo.Dumps()
return backend.ExportInfo(path)
def perspective_export_list(params):
......@@ -1900,9 +1900,9 @@ def ExportInfo(dest):
if (not config.has_section(constants.INISECT_EXP) or
not config.has_section(constants.INISECT_INS)):
return None
_Fail("Export info file doesn't have the required fields")
return config
return True, config.Dumps()
def ImportOSIntoInstance(instance, src_node, src_images, cluster_name):
......@@ -4688,11 +4688,12 @@ class LUCreateInstance(LogicalUnit):
_CheckNodeOnline(self, src_node)
result = self.rpc.call_export_info(src_node, src_path)
if not
raise errors.OpPrereqError("No export found in dir %s" % src_path)
msg = result.RemoteFailMsg()
if msg:
raise errors.OpPrereqError("No export or invalid export found in"
" dir %s: %s" % (src_path, msg))
export_info =
export_info = objects.SerializableConfigParser.Loads(str(result.payload))
if not export_info.has_section(constants.INISECT_EXP):
raise errors.ProgrammerError("Corrupted export config")
......@@ -974,10 +974,7 @@ class RpcRunner(object):
This is a single-node call.
result = self._SingleNodeCall(node, "export_info", [path])
if not result.failed and = objects.SerializableConfigParser.Loads(str(
return result
return self._SingleNodeCall(node, "export_info", [path])
def call_instance_os_import(self, node, inst, src_node, src_images,
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