mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
fix(quota): a disk whose size is unknown is not counted as 0 GiB
A disk of the user's VMs whose size could not be read (its volume not in a pool, the pool stopped) counted as 0 GiB, so a disk-limited user's increase could pass over the limit. A disk no pool holds now has the size libvirt reads from the file or device (blockInfo, also for a shut-off VM); one whose size is still unknown makes the usage unverified and the increase is refused, as when a host cannot be reached. Users without a disk limit are not affected.
This commit is contained in:
parent
d8a184eff7
commit
0b4a601ecb
9 changed files with 215 additions and 184 deletions
|
|
@ -25,6 +25,9 @@ class FakeDomain:
|
|||
self.reads.append(flags)
|
||||
return f"<domain flags='{flags}' read='{len(self.reads)}'/>"
|
||||
|
||||
def blockInfo(self, dev): # a disk no pool holds that libvirt cannot read either
|
||||
raise libvirtError("cannot read")
|
||||
|
||||
|
||||
class FakeConn:
|
||||
def __init__(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue