mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(quota): a snapshot revert must fit the quota
A revert gives the VM the vCPUs and memory it had when the snapshot was taken. An owner could take a snapshot, shrink the VM, give the freed share to another VM and revert, ending over the quota. The revert now checks what it adds to the VM (against the larger of its running and next-start sizes) as a resize does: on the page when it is queued, and again in the worker before it runs, as a resize may have used the quota meanwhile.
This commit is contained in:
parent
aab8dbf1df
commit
d8a184eff7
7 changed files with 231 additions and 123 deletions
|
|
@ -167,8 +167,8 @@ class RevertTests(TestCase):
|
|||
def test_the_compute_is_held_only_for_a_revert_with_host_devices(self):
|
||||
compute = f"compute:{self.instance.compute_id}"
|
||||
self.snapshot(by_model())
|
||||
self.assertEqual(self.kind.plan(None, self.params).claims[compute], "exclusive")
|
||||
self.assertEqual(self.kind.plan(MagicMock(is_superuser=True), self.params).claims[compute], "exclusive")
|
||||
self.snapshot("")
|
||||
self.assertEqual(self.kind.plan(None, self.params).claims[compute], "shared")
|
||||
self.assertEqual(self.kind.plan(MagicMock(is_superuser=True), self.params).claims[compute], "shared")
|
||||
self.precheck() # no host device: the host's devices are not read
|
||||
self.proxy.wvm.listAllDevices.assert_not_called()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue