mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-10 20:26:48 +00:00
fix(vrtManager): a volume upload aborts its stream when the volume cannot be made
upload_volume opens the libvirt stream before it creates the volume, but created the volume outside the block that aborts the stream: a pool that refused the volume (full, a name taken) left an unfinished stream to be freed. The creation is now inside that block.
This commit is contained in:
parent
297f9a8a53
commit
d4b9edc3e5
2 changed files with 18 additions and 6 deletions
|
|
@ -81,6 +81,16 @@ class UploadVolumeTestCase(unittest.TestCase):
|
|||
conn.wvm.newStream.return_value.abort.assert_called_once_with()
|
||||
|
||||
|
||||
def test_a_volume_that_cannot_be_made_aborts_the_stream(self):
|
||||
conn = wvmConnect.__new__(wvmConnect)
|
||||
conn.wvm = MagicMock()
|
||||
pool = MagicMock()
|
||||
pool.createXML.side_effect = libvirtError("pool is full")
|
||||
with self.assertRaises(libvirtError):
|
||||
conn.upload_volume(pool, "a.iso", b"data")
|
||||
conn.wvm.newStream.return_value.abort.assert_called_once_with()
|
||||
|
||||
|
||||
class DeleteWithDisksTestCase(unittest.TestCase):
|
||||
def vm(self, seed_in_pool=True):
|
||||
from vrtManager.instance import wvmInstance
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue