Re: [PATCH v2] daemon: Allow overriding NOFILES ulimit for the daemon as well

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

 



On Thu, Jan 12, 2012 at 06:52:52PM +0100, Michal Privoznik wrote:
> One of my latest patches (d8db0f9690) created support for setting
> the limit for the maximum of opened files by qemu user. However,
> since libvirtd keeps one FD opened per domain (well, for qemu at least)
> it will likely hit this limit on huge scenarios.
> ---
>  daemon/libvirtd.init.in    |    7 +++++++
>  daemon/libvirtd.service.in |    2 ++
>  daemon/libvirtd.sysconf    |    3 +++
>  daemon/libvirtd.upstart    |    5 +++++
>  4 files changed, 17 insertions(+), 0 deletions(-)
> 
> diff --git a/daemon/libvirtd.init.in b/daemon/libvirtd.init.in
> index 4e610cb..3c49b1f 100644
> --- a/daemon/libvirtd.init.in
> +++ b/daemon/libvirtd.init.in
> @@ -60,6 +60,13 @@ start() {
>      echo -n $"Starting $SERVICE daemon: "
>      mkdir -p @localstatedir@/cache/libvirt
>      rm -rf @localstatedir@/cache/libvirt/*
> +
> +    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
> +    # automatically
> +    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
> +        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
> +    fi
> +
>      KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
>      RETVAL=$?
>      echo
> diff --git a/daemon/libvirtd.service.in b/daemon/libvirtd.service.in
> index 9661428..8f2458a 100644
> --- a/daemon/libvirtd.service.in
> +++ b/daemon/libvirtd.service.in
> @@ -15,6 +15,8 @@ Before=libvirt-guests.service
>  EnvironmentFile=-/etc/sysconfig/libvirtd
>  ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
>  ExecReload=/bin/kill -HUP $MAINPID
> +# Override the maximum number of opened files
> +#LimitNOFILE=2048
>  
>  [Install]
>  WantedBy=multi-user.target
> diff --git a/daemon/libvirtd.sysconf b/daemon/libvirtd.sysconf
> index ab273c8..3af1f03 100644
> --- a/daemon/libvirtd.sysconf
> +++ b/daemon/libvirtd.sysconf
> @@ -19,3 +19,6 @@
>  #QEMU_AUDIO_DRV=sdl
>  #
>  #SDL_AUDIODRIVER=pulse
> +
> +# Override the maximum number of opened files
> +#LIBVIRTD_NOFILES_LIMIT=2048
> diff --git a/daemon/libvirtd.upstart b/daemon/libvirtd.upstart
> index f51701a..e620f41 100644
> --- a/daemon/libvirtd.upstart
> +++ b/daemon/libvirtd.upstart
> @@ -31,6 +31,11 @@ script
>          ulimit -c "$DAEMON_COREFILE_LIMIT"
>      fi
>  
> +    # LIBVIRTD_NOFILES_LIMIT from /etc/sysconfig/libvirtd is not handled
> +    # automatically
> +    if [ -n "$LIBVIRTD_NOFILES_LIMIT" ]; then
> +        ulimit -n "$LIBVIRTD_NOFILES_LIMIT"
> +    fi
>      mkdir -p /var/cache/libvirt
>      rm -rf /var/cache/libvirt/*

ACK


Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

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