mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-22 13:45:38 +00:00
virsh: Use VIR_ENUM_* for --format argument in doDump
Signed-off-by: Lin Ma <lma@suse.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
e878c7a9ec
commit
84cc4543be
@ -5410,6 +5410,14 @@ static const vshCmdOptDef opts_dump[] = {
|
|||||||
{.name = NULL}
|
{.name = NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
VIR_ENUM_IMPL(virDomainCoreDumpFormat,
|
||||||
|
VIR_DOMAIN_CORE_DUMP_FORMAT_LAST,
|
||||||
|
"kdump-zlib",
|
||||||
|
"kdump-lzo",
|
||||||
|
"kdump-snappy",
|
||||||
|
"elf",
|
||||||
|
"win-dmp");
|
||||||
|
|
||||||
static void
|
static void
|
||||||
doDump(void *opaque)
|
doDump(void *opaque)
|
||||||
{
|
{
|
||||||
@ -5421,7 +5429,7 @@ doDump(void *opaque)
|
|||||||
const char *to = NULL;
|
const char *to = NULL;
|
||||||
unsigned int flags = 0;
|
unsigned int flags = 0;
|
||||||
const char *format = NULL;
|
const char *format = NULL;
|
||||||
unsigned int dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_RAW;
|
int dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_RAW;
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
sigset_t sigmask, oldsigmask;
|
sigset_t sigmask, oldsigmask;
|
||||||
|
|
||||||
@ -5455,20 +5463,10 @@ doDump(void *opaque)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (vshCommandOptStringQuiet(ctl, cmd, "format", &format) > 0) {
|
if (vshCommandOptStringQuiet(ctl, cmd, "format", &format) > 0) {
|
||||||
if (STREQ(format, "kdump-zlib")) {
|
if ((dumpformat = virDomainCoreDumpFormatTypeFromString(format)) < 0) {
|
||||||
dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_ZLIB;
|
|
||||||
} else if (STREQ(format, "kdump-lzo")) {
|
|
||||||
dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_LZO;
|
|
||||||
} else if (STREQ(format, "kdump-snappy")) {
|
|
||||||
dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_KDUMP_SNAPPY;
|
|
||||||
} else if (STREQ(format, "elf")) {
|
|
||||||
dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_RAW;
|
|
||||||
} else if (STREQ(format, "win-dmp")) {
|
|
||||||
dumpformat = VIR_DOMAIN_CORE_DUMP_FORMAT_WIN_DMP;
|
|
||||||
} else {
|
|
||||||
vshError(ctl, _("format '%s' is not supported, expecting "
|
vshError(ctl, _("format '%s' is not supported, expecting "
|
||||||
"'kdump-zlib', 'kdump-lzo', 'kdump-snappy' "
|
"'kdump-zlib', 'kdump-lzo', 'kdump-snappy', "
|
||||||
"or 'elf'"), format);
|
"'win-dmp' or 'elf'"), format);
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,3 +43,4 @@ extern const vshCmdDef domManagementCmds[];
|
|||||||
VIR_ENUM_DECL(virDomainProcessSignal);
|
VIR_ENUM_DECL(virDomainProcessSignal);
|
||||||
VIR_ENUM_DECL(virDomainLifecycle);
|
VIR_ENUM_DECL(virDomainLifecycle);
|
||||||
VIR_ENUM_DECL(virDomainLifecycleAction);
|
VIR_ENUM_DECL(virDomainLifecycleAction);
|
||||||
|
VIR_ENUM_DECL(virDomainCoreDumpFormat);
|
||||||
|
Loading…
Reference in New Issue
Block a user