mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-03 03:25:20 +00:00
virt-admin: Introduce 'daemon-timeout'
Add a simple command to drive the new 'virAdmConnectSetDaemonTimeout' API. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
8b2bf0f1d7
commit
fe69f5074a
@ -313,6 +313,18 @@ To define multiple outputs at once they need to be delimited by spaces:
|
||||
|
||||
$ virt-admin daemon-log-outputs "4:stderr 2:syslog:<msg_ident>"
|
||||
|
||||
daemon-timeout
|
||||
--------------
|
||||
|
||||
**Syntax:**
|
||||
|
||||
::
|
||||
|
||||
daemon-timeout --timeout NUM
|
||||
|
||||
Sets the daemon timeout to the value of '--timeout' argument. Use ``--timeout 0``
|
||||
to disable auto-shutdown of the daemon.
|
||||
|
||||
|
||||
SERVER COMMANDS
|
||||
===============
|
||||
|
@ -1071,6 +1071,45 @@ static const vshCmdInfo info_daemon_log_outputs[] = {
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
static const vshCmdOptDef opts_daemon_timeout[] = {
|
||||
{.name = "timeout",
|
||||
.type = VSH_OT_INT,
|
||||
.help = N_("number of seconds the daemon will run without any active connection"),
|
||||
.flags = VSH_OFLAG_REQ | VSH_OFLAG_REQ_OPT
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
static bool
|
||||
cmdDaemonTimeout(vshControl *ctl, const vshCmd *cmd)
|
||||
{
|
||||
vshAdmControl *priv = ctl->privData;
|
||||
unsigned int timeout = 0;
|
||||
|
||||
if (vshCommandOptUInt(ctl, cmd, "timeout", &timeout) < 0)
|
||||
return false;
|
||||
|
||||
if (virAdmConnectSetDaemonTimeout(priv->conn, timeout, 0) < 0)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/* --------------------------
|
||||
* Command daemon-timeout
|
||||
* --------------------------
|
||||
*/
|
||||
static const vshCmdInfo info_daemon_timeout[] = {
|
||||
{.name = "help",
|
||||
.data = N_("set the auto shutdown timeout of the daemon")
|
||||
},
|
||||
{.name = "desc",
|
||||
.data = N_("set the auto shutdown timeout of the daemon")
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
static const vshCmdOptDef opts_daemon_log_outputs[] = {
|
||||
{.name = "outputs",
|
||||
.type = VSH_OT_STRING,
|
||||
@ -1498,6 +1537,12 @@ static const vshCmdDef managementCmds[] = {
|
||||
.info = info_daemon_log_outputs,
|
||||
.flags = 0
|
||||
},
|
||||
{.name = "daemon-timeout",
|
||||
.handler = cmdDaemonTimeout,
|
||||
.opts = opts_daemon_timeout,
|
||||
.info = info_daemon_timeout,
|
||||
.flags = 0
|
||||
},
|
||||
{.name = NULL}
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user