add Storage::get_bandwidth_limit helper

Takes an operation, an optional requested bandwidth
limit override, and a list of storages involved in the
operation and lowers the requested bandwidth against global
and storage-specific limits unless the user has permissions
to change those.
This means:
 * Global limits apply to all users without Sys.Modify on /
   (as they can change datacenter.cfg options via the API).
 * Storage specific limits apply to users without
   Datastore.Allocate access on /storage/X for any involved
   storage X.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller
2018-01-30 11:46:19 +01:00
parent d2bf0b4945
commit 9edb99a5a7
15 changed files with 271 additions and 1 deletions

View File

@ -42,6 +42,7 @@ sub properties {
type => 'string',
default => 'no',
},
bwlimit => get_standard_option('bwlimit'),
};
}
@ -56,6 +57,7 @@ sub options {
format => { optional => 1 },
mkdir => { optional => 1 },
is_mountpoint => { optional => 1 },
bwlimit => { optional => 1 },
};
}