[libvirt] [PATCHv3 3/4] openvz: support file system quota reporting

Eric Blake eblake at redhat.com
Wed May 23 19:56:45 UTC 2012


On 05/23/2012 09:10 AM, Guido Günther wrote:
> ---
>  src/conf/domain_conf.c                          |    4 ++--
>  src/openvz/openvz_conf.c                        |   24 +++++++++++++++++++++++
>  tests/domainschemadata/domain-openvz-simple.xml |    2 ++
>  3 files changed, 28 insertions(+), 2 deletions(-)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index a75e7e8..357929b 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11337,10 +11337,10 @@ virDomainFSDefFormat(virBufferPtr buf,
>  
>  
>      if (def->space_hard_limit)
> -        virBufferAsprintf(buf, "      <space_hard_limit unit='B'>"
> +        virBufferAsprintf(buf, "      <space_hard_limit unit='bytes'>"
>                            "%llu</space_hard_limit>\n", def->space_hard_limit);
>      if (def->space_soft_limit) {
> -        virBufferAsprintf(buf, "      <space_soft_limit unit='B'>"
> +        virBufferAsprintf(buf, "      <space_soft_limit unit='bytes'>"
>                            "%llu</space_soft_limit>\n", def->space_soft_limit);

Move this hunk to 2/4.

> +        if (openvzParseBarrierLimit(temp, &barrier, &limit)) {
> +            openvzError(VIR_ERR_INTERNAL_ERROR,
> +                        _("Could not read '%s' from config for container %d"),
> +                        param, veid);

Good, this really shouldn't happen in common practice.

> +            goto error;
> +        } else {
> +            /* Ensure that we can multiply by 1024 without overflowing. */
> +            if (barrier > ULONG_LONG_MAX / 1024 ||
> +                limit > ULONG_LONG_MAX / 1024 ) {
> +                virReportSystemError(EINVAL,
> +                                     _("%s"),
> +                                     "Unable to parse quota");

Here, I'd go with openvzError(VIR_ERR_OVERFLOW), not
virReportSystemError(EINVAL), because we are not reporting a failed syscall.

ACK with that change.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120523/da99012e/attachment-0001.sig>


More information about the libvir-list mailing list