1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-10 20:26:48 +00:00

fix(vrtManager): a failed NVRAM copy aborts its libvirt streams

libvirt requires a stream that did not finish to be aborted before it is
freed. The NVRAM download of a shut-off move and upload_volume (NVRAM
upload, cloud-init seed) freed theirs after a failed send, receive or
finish without aborting, on the shared host connection. They abort now;
upload_volume opens its stream before it makes the volume, so the
cleanup has both.
This commit is contained in:
catborise 2026-11-04 16:37:55 +03:00
parent 3911e9e238
commit d787d587bc
4 changed files with 21 additions and 4 deletions

View file

@ -427,9 +427,14 @@ class wvmInstances(wvmConnect):
return None
chunks = []
stream = conn.wvm.newStream(0)
vol.download(stream, 0, 0, 0)
stream.recvAll(lambda _stream, data, out: out.append(data), chunks)
stream.finish()
try:
vol.download(stream, 0, 0, 0)
stream.recvAll(lambda _stream, data, out: out.append(data), chunks)
stream.finish()
except Exception:
with contextlib.suppress(libvirtError):
stream.abort()
raise
self.upload_volume(target, name, b"".join(chunks))
return name