Commit 1b7bfbb7 authored by Iustin Pop's avatar Iustin Pop
Browse files

Convert export_list rpc to new style result

This is used in multiple places, so it has a little more changes than
the previous ones.
Signed-off-by: default avatarIustin Pop <>
Reviewed-by: default avatarGuido Trotter <>
parent 3eccac06
......@@ -1963,9 +1963,9 @@ def ListExports():
if os.path.isdir(constants.EXPORT_DIR):
return utils.ListVisibleFiles(constants.EXPORT_DIR)
return True, utils.ListVisibleFiles(constants.EXPORT_DIR)
return []
return False, "No exports directory"
def RemoveExport(export):
......@@ -4672,11 +4672,13 @@ class LUCreateInstance(LogicalUnit):
src_path = self.op.src_path
if src_node is None:
exp_list = self.rpc.call_export_list(
locked_nodes = self.acquired_locks[locking.LEVEL_NODE]
exp_list = self.rpc.call_export_list(locked_nodes)
found = False
for node in exp_list:
if not exp_list[node].failed and src_path in exp_list[node].data:
if exp_list[node].RemoteFailMsg():
if src_path in exp_list[node].payload:
found = True
self.op.src_node = src_node = node
self.op.src_path = src_path = os.path.join(constants.EXPORT_DIR,
......@@ -6361,10 +6363,10 @@ class LUQueryExports(NoHooksLU):
rpcresult = self.rpc.call_export_list(self.nodes)
result = {}
for node in rpcresult:
if rpcresult[node].failed:
if rpcresult[node].RemoteFailMsg():
result[node] = False
result[node] = rpcresult[node].data
result[node] = rpcresult[node].payload
return result
......@@ -6517,9 +6519,9 @@ class LUExportInstance(LogicalUnit):
if nodelist:
exportlist = self.rpc.call_export_list(nodelist)
for node in exportlist:
if exportlist[node].failed:
if exportlist[node].RemoteFailMsg():
if in exportlist[node].data:
if in exportlist[node].payload:
if not self.rpc.call_export_remove(node,
self.LogWarning("Could not remove older export for instance %s"
" on node %s",, node)
......@@ -6556,14 +6558,15 @@ class LURemoveExport(NoHooksLU):
fqdn_warn = True
instance_name = self.op.instance_name
exportlist = self.rpc.call_export_list(self.acquired_locks[
locked_nodes = self.acquired_locks[locking.LEVEL_NODE]
exportlist = self.rpc.call_export_list(locked_nodes)
found = False
for node in exportlist:
if exportlist[node].failed:
self.LogWarning("Failed to query node %s, continuing" % node)
msg = exportlist[node].RemoteFailMsg()
if msg:
self.LogWarning("Failed to query node %s (continuing): %s", node, msg)
if instance_name in exportlist[node].data:
if instance_name in exportlist[node].payload:
found = True
result = self.rpc.call_export_remove(node, instance_name)
if result.failed or not
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