mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-18 10:35:20 +00:00
virDomainCoreDump: Introduce VIR_DUMP_RESET flag
This flag is intended to allow user to do so called system reset after dump, instead of sending ACPI reboot event.
This commit is contained in:
parent
f319b553c1
commit
4dadfe59d5
@ -748,6 +748,7 @@ typedef enum {
|
||||
VIR_DUMP_CRASH = (1 << 0), /* crash after dump */
|
||||
VIR_DUMP_LIVE = (1 << 1), /* live dump */
|
||||
VIR_DUMP_BYPASS_CACHE = (1 << 2), /* avoid file system cache pollution */
|
||||
VIR_DUMP_RESET = (1 << 3), /* reset domain after dump finishes */
|
||||
} virDomainCoreDumpFlags;
|
||||
|
||||
/* Domain migration flags. */
|
||||
|
@ -2784,7 +2784,8 @@ error:
|
||||
* a crashed state after the dump completes. If @flags includes
|
||||
* VIR_DUMP_LIVE, then make the core dump while continuing to allow
|
||||
* the guest to run; otherwise, the guest is suspended during the dump.
|
||||
* The above two flags are mutually exclusive.
|
||||
* VIR_DUMP_RESET flag forces reset of the quest after dump.
|
||||
* The above three flags are mutually exclusive.
|
||||
*
|
||||
* Additionally, if @flags includes VIR_DUMP_BYPASS_CACHE, then libvirt
|
||||
* will attempt to bypass the file system cache while creating the file,
|
||||
@ -2823,6 +2824,18 @@ virDomainCoreDump(virDomainPtr domain, const char *to, unsigned int flags)
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((flags & VIR_DUMP_CRASH) && (flags & VIR_DUMP_RESET)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG,
|
||||
_("crash and reset flags are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if ((flags & VIR_DUMP_LIVE) && (flags & VIR_DUMP_RESET)) {
|
||||
virLibDomainError(VIR_ERR_INVALID_ARG,
|
||||
_("live and reset flags are mutually exclusive"));
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (conn->driver->domainCoreDump) {
|
||||
int ret;
|
||||
char *absolute_to;
|
||||
|
@ -2888,6 +2888,7 @@ static const vshCmdOptDef opts_dump[] = {
|
||||
{"crash", VSH_OT_BOOL, 0, N_("crash the domain after core dump")},
|
||||
{"bypass-cache", VSH_OT_BOOL, 0,
|
||||
N_("avoid file system cache when saving")},
|
||||
{"reset", VSH_OT_BOOL, 0, N_("reset the domain after core dump")},
|
||||
{"domain", VSH_OT_DATA, VSH_OFLAG_REQ, N_("domain name, id or uuid")},
|
||||
{"file", VSH_OT_DATA, VSH_OFLAG_REQ, N_("where to dump the core")},
|
||||
{NULL, 0, 0, NULL}
|
||||
@ -2917,6 +2918,8 @@ cmdDump(vshControl *ctl, const vshCmd *cmd)
|
||||
flags |= VIR_DUMP_CRASH;
|
||||
if (vshCommandOptBool(cmd, "bypass-cache"))
|
||||
flags |= VIR_DUMP_BYPASS_CACHE;
|
||||
if (vshCommandOptBool(cmd, "reset"))
|
||||
flags |= VIR_DUMP_RESET;
|
||||
|
||||
if (virDomainCoreDump(dom, to, flags) < 0) {
|
||||
vshError(ctl, _("Failed to core dump domain %s to %s"), name, to);
|
||||
|
@ -628,14 +628,16 @@ named by I<format> to a domain XML format.
|
||||
Convert the file I<xml> in domain XML format to the native guest
|
||||
configuration format named by I<format>.
|
||||
|
||||
=item B<dump> I<domain-id> I<corefilepath> [I<--live>] [I<--crash>]
|
||||
[I<--bypass-cache>]
|
||||
=item B<dump> I<domain-id> I<corefilepath> [I<--bypass-cache>]
|
||||
{ [I<--live>] | [I<--crash>] | [I<--reset>] }
|
||||
|
||||
Dumps the core of a domain to a file for analysis.
|
||||
If I<--live> is specified, the domain continues to run until the core
|
||||
dump is complete, rather than pausing up front.
|
||||
If I<--crash> is specified, the domain is halted with a crashed status,
|
||||
rather than merely left in a paused state.
|
||||
If I<--reset> is specified, the domain is reset after successful dump.
|
||||
Note, these three switches are mutually exclusive.
|
||||
If I<--bypass-cache> is specified, the save will avoid the file system
|
||||
cache, although this may slow down the operation.
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user