Commit 5ce92cd3 authored by Iustin Pop's avatar Iustin Pop
Browse files

Merge branch 'master' into next

* master:
  Wait for a while in failed resyncs
  Fix two issues with exports and snapshot errors
parents f069addf fbafd7a8
......@@ -1608,6 +1608,7 @@ def _WaitForSync(lu, instance, oneshot=False, unlock=False):
lu.cfg.SetDiskID(dev, node)
retries = 0
degr_retries = 10 # in seconds, as we sleep 1 second each time
while True:
max_time = 0
done = True
......@@ -1640,6 +1641,16 @@ def _WaitForSync(lu, instance, oneshot=False, unlock=False):
rem_time = "no time estimate"
lu.proc.LogInfo("- device %s: %5.2f%% done, %s" %
(instance.disks[i].iv_name, perc_done, rem_time))
# if we're done but degraded, let's do a few small retries, to
# make sure we see a stable and not transient situation; therefore
# we force restart of the loop
if (done or oneshot) and cumul_degraded and degr_retries > 0:"Degraded disks found, %d retries left", degr_retries)
degr_retries -= 1
if done or oneshot:
......@@ -6294,12 +6305,12 @@ class LUExportInstance(LogicalUnit):
self.cfg.SetDiskID(disk, src_node)
for disk in instance.disks:
for idx, disk in enumerate(instance.disks):
# new_dev_name will be a snapshot of an lvm leaf of the one we passed
new_dev_name = self.rpc.call_blockdev_snapshot(src_node, disk)
if new_dev_name.failed or not
self.LogWarning("Could not snapshot block device %s on node %s",
disk.logical_id[1], src_node)
self.LogWarning("Could not snapshot disk/%d on node %s",
idx, src_node)
new_dev = objects.Disk(dev_type=constants.LD_LV, size=disk.size,
......@@ -6324,13 +6335,12 @@ class LUExportInstance(LogicalUnit):
result = self.rpc.call_snapshot_export(src_node, dev,,
instance, cluster_name, idx)
if result.failed or not
self.LogWarning("Could not export block device %s from node %s to"
" node %s", dev.logical_id[1], src_node,
self.LogWarning("Could not export disk/%d from node %s to"
" node %s", idx, src_node,
msg = self.rpc.call_blockdev_remove(src_node, dev).RemoteFailMsg()
if msg:
self.LogWarning("Could not remove snapshot block device %s from node"
" %s: %s", dev.logical_id[1], src_node, msg)
self.LogWarning("Could not remove snapshot for disk/%d from node"
" %s: %s", idx, src_node, msg)
result = self.rpc.call_finalize_export(, instance, snap_disks)
if result.failed or not
......@@ -959,7 +959,10 @@ class RpcRunner(object):
flat_disks = []
for disk in snap_disks:
if isinstance(disk, bool):
return self._SingleNodeCall(node, "finalize_export",
[self._InstDict(instance), flat_disks])
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