Re: [PATCH 1/2] domain_conf: add filesystem limits to virDomainFSDef

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

 



On 04/24/2012 01:37 PM, Guido Günther wrote:
> ---
>  src/conf/domain_conf.c |   15 +++++++++++++++
>  src/conf/domain_conf.h |    4 ++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index 184ff23..2b2a1d9 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -11101,6 +11101,21 @@ virDomainFSDefFormat(virBufferPtr buf,
>      if (virDomainDeviceInfoFormat(buf, &def->info, flags) < 0)
>          return -1;
>  
> +    if (def->hard_limit)
> +        virBufferAsprintf(buf, "      <hardlimit>%llu</hardlimit>\n",

Needs a unit='...' attribute.

> +                          def->hard_limit);
> +    if (def->soft_limit)
> +        virBufferAsprintf(buf, "      <softlimit>%llu</softlimit>\n",
> +                          def->soft_limit);
> +    if (def->inodes_hard_limit)
> +        virBufferAsprintf(buf,
> +                          "      <inodes_hardlimit>%llu</inodes_hardlimit>\n",
> +                          def->inodes_hard_limit);
> +    if (def->inodes_soft_limit)
> +        virBufferAsprintf(buf,
> +                          "      <inodes_softlimit>%llu</inodes_softlimit>\n",
> +                          def->inodes_soft_limit);
> +
>      virBufferAddLit(buf, "    </filesystem>\n");
>  
>      return 0;
> diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
> index 5aa8fc1..149607e 100644
> --- a/src/conf/domain_conf.h
> +++ b/src/conf/domain_conf.h
> @@ -692,6 +692,10 @@ struct _virDomainFSDef {
>      char *dst;
>      unsigned int readonly : 1;
>      virDomainDeviceInfo info;
> +    unsigned long long hard_limit; /* in kibibytes */
> +    unsigned long long soft_limit; /* in kibibytes */

Yuck.  If the fiasco with <memory> limits taught us anything, it is that
future XML should always be in bytes on output, and allow scaling from
the user on input.  I'd rather have us convert bytes to KiB at the point
where were pass on limits to the kernel rather than lock us into a
course granularity at the XML level (after all, it might be feasible to
have a 512-byte granularity on some file systems, but using KiB prevents
us from representing that in the XML).

-- 
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]