| bool_entry "allow_disk_format_probing"
| bool_entry "set_process_name"
| int_entry "max_processes"
+ | int_entry "max_files"
| str_entry "lock_manager"
| int_entry "max_queued"
| int_entry "keepalive_interval"
# set_process_name = 1
-# If max_processes is set to a positive integer, libvirt will use it to set
-# maximum number of processes that can be run by qemu user. This can be used to
-# override default value set by host OS.
+# If max_processes is set to a positive integer, libvirt will use
+# it to set the maximum number of processes that can be run by qemu
+# user. This can be used to override default value set by host OS.
+# The same applies to max_files which sets the limit on the maximum
+# number of opened files.
#
# max_processes = 0
+# max_files = 0
# To enable 'Sanlock' project based locking of the file
# content (to prevent two VMs writing to the same
CHECK_TYPE("max_processes", VIR_CONF_LONG);
if (p) driver->maxProcesses = p->l;
+ p = virConfGetValue(conf, "max_files");
+ CHECK_TYPE("max_files", VIR_CONF_LONG);
+ if (p) driver->maxFiles = p->l;
+
p = virConfGetValue (conf, "lock_manager");
CHECK_TYPE ("lock_manager", VIR_CONF_STRING);
if (p && p->str) {
unsigned int setProcessName : 1;
int maxProcesses;
+ int maxFiles;
int max_queued;
static int
qemuProcessLimits(struct qemud_driver *driver)
{
- if (driver->maxProcesses > 0) {
- struct rlimit rlim;
+ struct rlimit rlim;
+ if (driver->maxProcesses > 0) {
rlim.rlim_cur = rlim.rlim_max = driver->maxProcesses;
if (setrlimit(RLIMIT_NPROC, &rlim) < 0) {
virReportSystemError(errno,
}
}
+ if (driver->maxFiles > 0) {
+ /* Max number of opened files is one greater than
+ * actual limit. See man setrlimit */
+ rlim.rlim_cur = rlim.rlim_max = driver->maxFiles + 1;
+ if (setrlimit(RLIMIT_NOFILE, &rlim) < 0) {
+ virReportSystemError(errno,
+ _("cannot set max opened files to %d"),
+ driver->maxFiles);
+ return -1;
+ }
+ }
+
return 0;
}
max_processes = 12345
+max_files = 67890
+
lock_manager = \"fcntl\"
keepalive_interval = 1
{ "#empty" }
{ "max_processes" = "12345" }
{ "#empty" }
+{ "max_files" = "67890" }
+{ "#empty" }
{ "lock_manager" = "fcntl" }
{ "#empty" }
{ "keepalive_interval" = "1" }