mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-08-24 09:49:59 +03:00
util: Have virCommand remember whether limits are set
Currently this only happens for the core size, but we want the behavior to be consistent for other limits as well. Signed-off-by: Andrea Bolognani <abologna@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
@ -132,8 +132,11 @@ struct _virCommand {
|
|||||||
bool reap;
|
bool reap;
|
||||||
bool rawStatus;
|
bool rawStatus;
|
||||||
|
|
||||||
|
bool setMaxMemLock;
|
||||||
unsigned long long maxMemLock;
|
unsigned long long maxMemLock;
|
||||||
|
bool setMaxProcesses;
|
||||||
unsigned int maxProcesses;
|
unsigned int maxProcesses;
|
||||||
|
bool setMaxFiles;
|
||||||
unsigned int maxFiles;
|
unsigned int maxFiles;
|
||||||
bool setMaxCore;
|
bool setMaxCore;
|
||||||
unsigned long long maxCore;
|
unsigned long long maxCore;
|
||||||
@ -819,11 +822,14 @@ virExec(virCommandPtr cmd)
|
|||||||
/* pidfilefd is intentionally leaked. */
|
/* pidfilefd is intentionally leaked. */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (virProcessSetMaxMemLock(pid, cmd->maxMemLock) < 0)
|
if (cmd->setMaxMemLock &&
|
||||||
|
virProcessSetMaxMemLock(pid, cmd->maxMemLock) < 0)
|
||||||
goto fork_error;
|
goto fork_error;
|
||||||
if (virProcessSetMaxProcesses(pid, cmd->maxProcesses) < 0)
|
if (cmd->setMaxProcesses &&
|
||||||
|
virProcessSetMaxProcesses(pid, cmd->maxProcesses) < 0)
|
||||||
goto fork_error;
|
goto fork_error;
|
||||||
if (virProcessSetMaxFiles(pid, cmd->maxFiles) < 0)
|
if (cmd->setMaxFiles &&
|
||||||
|
virProcessSetMaxFiles(pid, cmd->maxFiles) < 0)
|
||||||
goto fork_error;
|
goto fork_error;
|
||||||
if (cmd->setMaxCore &&
|
if (cmd->setMaxCore &&
|
||||||
virProcessSetMaxCoreSize(pid, cmd->maxCore) < 0)
|
virProcessSetMaxCoreSize(pid, cmd->maxCore) < 0)
|
||||||
@ -1154,6 +1160,7 @@ virCommandSetMaxMemLock(virCommandPtr cmd, unsigned long long bytes)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
cmd->maxMemLock = bytes;
|
cmd->maxMemLock = bytes;
|
||||||
|
cmd->setMaxMemLock = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1163,6 +1170,7 @@ virCommandSetMaxProcesses(virCommandPtr cmd, unsigned int procs)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
cmd->maxProcesses = procs;
|
cmd->maxProcesses = procs;
|
||||||
|
cmd->setMaxProcesses = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1172,6 +1180,7 @@ virCommandSetMaxFiles(virCommandPtr cmd, unsigned int files)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
cmd->maxFiles = files;
|
cmd->maxFiles = files;
|
||||||
|
cmd->setMaxFiles = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void virCommandSetMaxCoreSize(virCommandPtr cmd, unsigned long long bytes)
|
void virCommandSetMaxCoreSize(virCommandPtr cmd, unsigned long long bytes)
|
||||||
|
Reference in New Issue
Block a user