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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]