Increase send blocksize and add total speed
It's much faster and seems to cause no issues.
This commit is contained in:
parent
fb8561cc5d
commit
75eac356d5
|
@ -1346,7 +1346,7 @@ def vm_snapshot_receive_block_full(zkhandler, pool, volume, snapshot, size, requ
|
||||||
image = rbd.Image(ioctx, volume)
|
image = rbd.Image(ioctx, volume)
|
||||||
|
|
||||||
last_chunk = 0
|
last_chunk = 0
|
||||||
chunk_size = 1024 * 1024 * 64
|
chunk_size = 1024 * 1024 * 1024
|
||||||
|
|
||||||
logger.info(f"Importing full snapshot {pool}/{volume}@{snapshot}")
|
logger.info(f"Importing full snapshot {pool}/{volume}@{snapshot}")
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -3386,6 +3386,9 @@ def vm_worker_send_snapshot(
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# Create the block devices on the remote side if this is a new VM send
|
# Create the block devices on the remote side if this is a new VM send
|
||||||
|
block_t_start = time.time()
|
||||||
|
block_total_mb = 0
|
||||||
|
|
||||||
for rbd_detail in [r for r in vm_detail["disks"] if r["type"] == "rbd"]:
|
for rbd_detail in [r for r in vm_detail["disks"] if r["type"] == "rbd"]:
|
||||||
rbd_name = rbd_detail["name"]
|
rbd_name = rbd_detail["name"]
|
||||||
pool, volume = rbd_name.split("/")
|
pool, volume = rbd_name.split("/")
|
||||||
|
@ -3449,7 +3452,7 @@ def vm_worker_send_snapshot(
|
||||||
ioctx = cluster.open_ioctx(pool)
|
ioctx = cluster.open_ioctx(pool)
|
||||||
image = rbd.Image(ioctx, name=volume, snapshot=snapshot_name, read_only=True)
|
image = rbd.Image(ioctx, name=volume, snapshot=snapshot_name, read_only=True)
|
||||||
size = image.size()
|
size = image.size()
|
||||||
chunk_size_mb = 64
|
chunk_size_mb = 1024
|
||||||
|
|
||||||
if incremental_parent is not None:
|
if incremental_parent is not None:
|
||||||
# Diff between incremental_parent and snapshot
|
# Diff between incremental_parent and snapshot
|
||||||
|
@ -3555,6 +3558,7 @@ def vm_worker_send_snapshot(
|
||||||
image.diff_iterate(
|
image.diff_iterate(
|
||||||
0, size, incremental_parent, diff_cb_count, whole_object=True
|
0, size, incremental_parent, diff_cb_count, whole_object=True
|
||||||
)
|
)
|
||||||
|
block_total_mb += total_chunks * 4
|
||||||
image.diff_iterate(
|
image.diff_iterate(
|
||||||
0, size, incremental_parent, diff_cb_send, whole_object=True
|
0, size, incremental_parent, diff_cb_send, whole_object=True
|
||||||
)
|
)
|
||||||
|
@ -3576,6 +3580,7 @@ def vm_worker_send_snapshot(
|
||||||
else:
|
else:
|
||||||
|
|
||||||
def full_chunker():
|
def full_chunker():
|
||||||
|
nonlocal block_total_mb
|
||||||
chunk_size = 1024 * 1024 * chunk_size_mb
|
chunk_size = 1024 * 1024 * chunk_size_mb
|
||||||
current_chunk = 0
|
current_chunk = 0
|
||||||
last_chunk_time = time.time()
|
last_chunk_time = time.time()
|
||||||
|
@ -3583,6 +3588,7 @@ def vm_worker_send_snapshot(
|
||||||
chunk = image.read(current_chunk, chunk_size)
|
chunk = image.read(current_chunk, chunk_size)
|
||||||
yield chunk
|
yield chunk
|
||||||
current_chunk += chunk_size
|
current_chunk += chunk_size
|
||||||
|
block_total_mb += len(chunk) / 1024 / 1024
|
||||||
current_chunk_time = time.time()
|
current_chunk_time = time.time()
|
||||||
chunk_time = current_chunk_time - last_chunk_time
|
chunk_time = current_chunk_time - last_chunk_time
|
||||||
last_chunk_time = current_chunk_time
|
last_chunk_time = current_chunk_time
|
||||||
|
@ -3643,10 +3649,13 @@ def vm_worker_send_snapshot(
|
||||||
ioctx.close()
|
ioctx.close()
|
||||||
cluster.shutdown()
|
cluster.shutdown()
|
||||||
|
|
||||||
|
block_t_end = time.time()
|
||||||
|
block_mbps = round(block_total_mb / (block_t_end - block_t_start), 1)
|
||||||
|
|
||||||
current_stage += 1
|
current_stage += 1
|
||||||
return finish(
|
return finish(
|
||||||
celery,
|
celery,
|
||||||
f"Successfully sent snapshot '{snapshot_name}' of VM '{domain}' to remote cluster '{destination_api_uri}'",
|
f"Successfully sent snapshot '{snapshot_name}' of VM '{domain}' to remote cluster '{destination_api_uri}' (average {block_mbps} MB/s)",
|
||||||
current=current_stage,
|
current=current_stage,
|
||||||
total=total_stages,
|
total=total_stages,
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue