提交 d7320e79 编写于 作者: M Michal Privoznik

daemon: Allow overriding NOFILES ulimit for the daemon as well

One of my latest patches (d8db0f96) 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.
上级 7bceae0f
...@@ -60,6 +60,13 @@ start() { ...@@ -60,6 +60,13 @@ start() {
echo -n $"Starting $SERVICE daemon: " echo -n $"Starting $SERVICE daemon: "
mkdir -p @localstatedir@/cache/libvirt mkdir -p @localstatedir@/cache/libvirt
rm -rf @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 KRB5_KTNAME=$KRB5_KTNAME daemon --pidfile $PIDFILE --check $SERVICE $PROCESS --daemon $LIBVIRTD_CONFIG_ARGS $LIBVIRTD_ARGS
RETVAL=$? RETVAL=$?
echo echo
......
...@@ -15,6 +15,8 @@ Before=libvirt-guests.service ...@@ -15,6 +15,8 @@ Before=libvirt-guests.service
EnvironmentFile=-/etc/sysconfig/libvirtd EnvironmentFile=-/etc/sysconfig/libvirtd
ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS ExecStart=@sbindir@/libvirtd $LIBVIRTD_ARGS
ExecReload=/bin/kill -HUP $MAINPID ExecReload=/bin/kill -HUP $MAINPID
# Override the maximum number of opened files
#LimitNOFILE=2048
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
...@@ -19,3 +19,6 @@ ...@@ -19,3 +19,6 @@
#QEMU_AUDIO_DRV=sdl #QEMU_AUDIO_DRV=sdl
# #
#SDL_AUDIODRIVER=pulse #SDL_AUDIODRIVER=pulse
# Override the maximum number of opened files
#LIBVIRTD_NOFILES_LIMIT=2048
...@@ -31,6 +31,11 @@ script ...@@ -31,6 +31,11 @@ script
ulimit -c "$DAEMON_COREFILE_LIMIT" ulimit -c "$DAEMON_COREFILE_LIMIT"
fi 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 mkdir -p /var/cache/libvirt
rm -rf /var/cache/libvirt/* rm -rf /var/cache/libvirt/*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册