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

Eric Blake eblake at redhat.com
Tue Apr 24 19:54:09 UTC 2012


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 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/20120424/bac19c68/attachment-0001.sig>


More information about the libvir-list mailing list