From 9b201a0dae162a0162f39ee70090cd9b87a97eb4 Mon Sep 17 00:00:00 2001
From: Iustin Pop <iustin@google.com>
Date: Tue, 9 Jun 2009 11:41:29 +0200
Subject: [PATCH] Convert finalize_export rpc to new style results

This rpc doesn't have explicit failure modes, but once all RPCs are
converted and we can catch and convert expceptions to failure in noded,
we will have meaningfull error messages.

Signed-off-by: Iustin Pop <iustin@google.com>
Reviewed-by: Guido Trotter <ultrotter@google.com>
---
 lib/backend.py | 2 +-
 lib/cmdlib.py  | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/lib/backend.py b/lib/backend.py
index 08b65aabf..298339916 100644
--- a/lib/backend.py
+++ b/lib/backend.py
@@ -1879,7 +1879,7 @@ def FinalizeExport(instance, snap_disks):
   shutil.rmtree(finaldestdir, True)
   shutil.move(destdir, finaldestdir)
 
-  return True
+  return True, None
 
 
 def ExportInfo(dest):
diff --git a/lib/cmdlib.py b/lib/cmdlib.py
index 4d9502fab..0394126a0 100644
--- a/lib/cmdlib.py
+++ b/lib/cmdlib.py
@@ -6502,9 +6502,10 @@ class LUExportInstance(LogicalUnit):
                           " %s: %s", dev.logical_id[1], src_node, msg)
 
     result = self.rpc.call_finalize_export(dst_node.name, instance, snap_disks)
-    if result.failed or not result.data:
-      self.LogWarning("Could not finalize export for instance %s on node %s",
-                      instance.name, dst_node.name)
+    msg = result.RemoteFailMsg()
+    if msg:
+      self.LogWarning("Could not finalize export for instance %s"
+                      " on node %s: %s", instance.name, dst_node.name, msg)
 
     nodelist = self.cfg.GetNodeList()
     nodelist.remove(dst_node.name)
-- 
GitLab