Commit 944bf548 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert instance_os_import rpc to new style result



This changes from a list of booleans to «status, error messages». This
means that instead knowing which disk has failed (position based), we
get a list of all failures (with details how they failed).
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 35c0c8da
......@@ -1948,13 +1948,12 @@ def ImportOSIntoInstance(instance, src_node, src_images, cluster_name):
logging.error("Disk import command '%s' returned error: %s"
" output: %s", command, result.fail_reason,
result.output)
final_result.append(False)
else:
final_result.append(True)
else:
final_result.append(True)
final_result.append("error importing disk %d: %s, %s" %
(idx, result.fail_reason, result.output[-100]))
return final_result
if final_result:
return False, "; ".join(final_result)
return True, None
def ListExports():
......
......@@ -4947,12 +4947,10 @@ class LUCreateInstance(LogicalUnit):
import_result = self.rpc.call_instance_os_import(pnode_name, iobj,
src_node, src_images,
cluster_name)
import_result.Raise()
for idx, result in enumerate(import_result.data):
if not result:
self.LogWarning("Could not import the image %s for instance"
" %s, disk %d, on node %s" %
(src_images[idx], instance, idx, pnode_name))
msg = import_result.RemoteFailMsg()
if msg:
self.LogWarning("Error while importing the disk images for instance"
" %s on node %s: %s" % (instance, pnode_name, msg))
else:
# also checked in the prereq part
raise errors.ProgrammerError("Unknown OS initialization mode '%s'"
......
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