mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 23:25:24 +00:00
qemu: Move getCompressionType
A subsequent patch will adjust the 3 callers to just call from doCoreDump.
This commit is contained in:
parent
f03013c212
commit
abaa86f9ab
@ -3266,6 +3266,42 @@ qemuCompressProgramAvailable(virQEMUSaveFormat compress)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static virQEMUSaveFormat
|
||||
getCompressionType(virQEMUDriverPtr driver)
|
||||
{
|
||||
int ret = QEMU_SAVE_FORMAT_RAW;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
/*
|
||||
* We reuse "save" flag for "dump" here. Then, we can support the same
|
||||
* format in "save" and "dump".
|
||||
*/
|
||||
if (cfg->dumpImageFormat) {
|
||||
ret = qemuSaveCompressionTypeFromString(cfg->dumpImageFormat);
|
||||
/* Use "raw" as the format if the specified format is not valid,
|
||||
* or the compress program is not available.
|
||||
*/
|
||||
if (ret < 0) {
|
||||
VIR_WARN("%s", _("Invalid dump image format specified in "
|
||||
"configuration file, using raw"));
|
||||
ret = QEMU_SAVE_FORMAT_RAW;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!qemuCompressProgramAvailable(ret)) {
|
||||
VIR_WARN("%s", _("Compression program for dump image format "
|
||||
"in configuration file isn't available, "
|
||||
"using raw"));
|
||||
ret = QEMU_SAVE_FORMAT_RAW;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
cleanup:
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainSaveFlags(virDomainPtr dom, const char *path, const char *dxml,
|
||||
unsigned int flags)
|
||||
@ -3615,40 +3651,6 @@ doCoreDump(virQEMUDriverPtr driver,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static virQEMUSaveFormat
|
||||
getCompressionType(virQEMUDriverPtr driver)
|
||||
{
|
||||
int ret = QEMU_SAVE_FORMAT_RAW;
|
||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||
|
||||
/*
|
||||
* We reuse "save" flag for "dump" here. Then, we can support the same
|
||||
* format in "save" and "dump".
|
||||
*/
|
||||
if (cfg->dumpImageFormat) {
|
||||
ret = qemuSaveCompressionTypeFromString(cfg->dumpImageFormat);
|
||||
/* Use "raw" as the format if the specified format is not valid,
|
||||
* or the compress program is not available.
|
||||
*/
|
||||
if (ret < 0) {
|
||||
VIR_WARN("%s", _("Invalid dump image format specified in "
|
||||
"configuration file, using raw"));
|
||||
ret = QEMU_SAVE_FORMAT_RAW;
|
||||
goto cleanup;
|
||||
}
|
||||
if (!qemuCompressProgramAvailable(ret)) {
|
||||
VIR_WARN("%s", _("Compression program for dump image format "
|
||||
"in configuration file isn't available, "
|
||||
"using raw"));
|
||||
ret = QEMU_SAVE_FORMAT_RAW;
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
cleanup:
|
||||
virObjectUnref(cfg);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
qemuDomainCoreDumpWithFormat(virDomainPtr dom,
|
||||
|
Loading…
Reference in New Issue
Block a user