mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 17:34:18 +03:00
openvz: support file system quota reporting
This commit is contained in:
parent
41f1db6a0c
commit
680ac813a5
@ -407,6 +407,8 @@ openvzReadFSConf(virDomainDefPtr def,
|
|||||||
virDomainFSDefPtr fs = NULL;
|
virDomainFSDefPtr fs = NULL;
|
||||||
char *veid_str = NULL;
|
char *veid_str = NULL;
|
||||||
char *temp = NULL;
|
char *temp = NULL;
|
||||||
|
const char *param;
|
||||||
|
unsigned long long barrier, limit;
|
||||||
|
|
||||||
ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", &temp);
|
ret = openvzReadVPSConfigParam(veid, "OSTEMPLATE", &temp);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
@ -444,6 +446,28 @@ openvzReadFSConf(virDomainDefPtr def,
|
|||||||
|
|
||||||
fs->dst = strdup("/");
|
fs->dst = strdup("/");
|
||||||
|
|
||||||
|
param = "DISKSPACE";
|
||||||
|
ret = openvzReadVPSConfigParam(veid, param, &temp);
|
||||||
|
if (ret > 0) {
|
||||||
|
if (openvzParseBarrierLimit(temp, &barrier, &limit)) {
|
||||||
|
openvzError(VIR_ERR_INTERNAL_ERROR,
|
||||||
|
_("Could not read '%s' from config for container %d"),
|
||||||
|
param, veid);
|
||||||
|
goto error;
|
||||||
|
} else {
|
||||||
|
/* Ensure that we can multiply by 1024 without overflowing. */
|
||||||
|
if (barrier > ULONG_LONG_MAX / 1024 ||
|
||||||
|
limit > ULONG_LONG_MAX / 1024 ) {
|
||||||
|
virReportSystemError(VIR_ERR_OVERFLOW,
|
||||||
|
_("%s"),
|
||||||
|
"Unable to parse quota");
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
fs->space_soft_limit = barrier * 1024; /* unit is bytes */
|
||||||
|
fs->space_hard_limit = limit * 1024; /* unit is bytes */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (fs->src == NULL || fs->dst == NULL)
|
if (fs->src == NULL || fs->dst == NULL)
|
||||||
goto no_memory;
|
goto no_memory;
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@
|
|||||||
<filesystem type='template' accessmode='passthrough'>
|
<filesystem type='template' accessmode='passthrough'>
|
||||||
<source name='debian'/>
|
<source name='debian'/>
|
||||||
<target dir='/'/>
|
<target dir='/'/>
|
||||||
|
<space_hard_limit>1153024</space_hard_limit>
|
||||||
|
<space_soft_limit>1048576</space_soft_limit>
|
||||||
</filesystem>
|
</filesystem>
|
||||||
</devices>
|
</devices>
|
||||||
</domain>
|
</domain>
|
||||||
|
Loading…
Reference in New Issue
Block a user