Skip to content

Commit 56b94a2

Browse files
committed
fix(api): retry setting quota/refquota upon failure
This makes setting quotas/reservations work in one step.
1 parent f5000fd commit 56b94a2

File tree

1 file changed

+6
-3
lines changed
  • src/middlewared/middlewared/plugins

1 file changed

+6
-3
lines changed

src/middlewared/middlewared/plugins/zfs.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -768,10 +768,13 @@ def do_update(self, id, data):
768768

769769
if 'properties' in data:
770770
properties = data['properties'].copy()
771-
# Set these after reservations
771+
# Try setting these first, and retry last again if failed
772772
for k in ['quota', 'refquota']:
773-
if k in properties:
774-
properties[k] = properties.pop(k) # Set them last
773+
if value := properties.pop(k, None):
774+
try:
775+
dataset.properties[k].value = value['value']
776+
except libzfs.ZFSException:
777+
properties[k] = value # Set them last
775778
for k, v in properties.items():
776779

777780
# If prop already exists we just update it,

0 commit comments

Comments
 (0)