mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
add compression support for "virsh dump"
Add dump_image_format[] to qemu.conf and support compressed dump at virsh dump. coredump compression is important for saving disk space in an environment where multiple guests run. In general, "disk space for dump" is specially allocated and will be a dead space in the system. It's used only at emergency. So, it's better to have both of save_image_format and dump_image_format. "save" is done in scheduled manner with enough calculated disk space for it. This code reuses some of save_image_format[] and supports the same format. Changelog: - modified libvirtd_qemu.aug - modified test_libvirtd_qemu.aug - fixed error handling of qemudSaveCompressionTypeFromString()
This commit is contained in:
parent
41b2cee2a8
commit
95a17abda7
@ -36,6 +36,7 @@ module Libvirtd_qemu =
|
||||
| str_array_entry "cgroup_controllers"
|
||||
| str_array_entry "cgroup_device_acl"
|
||||
| str_entry "save_image_format"
|
||||
| str_entry "dump_image_format"
|
||||
| str_entry "hugetlbfs_mount"
|
||||
| bool_entry "relaxed_acs_check"
|
||||
| bool_entry "vnc_allow_host_audio"
|
||||
|
@ -145,7 +145,11 @@
|
||||
# saving a domain in order to save disk space; the list above is in descending
|
||||
# order by performance and ascending order by compression ratio.
|
||||
#
|
||||
# save_image_format is used when you use 'virsh save' at scheduled saving.
|
||||
# dump_image_format is used when you use 'virsh dump' at emergency crashdump.
|
||||
#
|
||||
# save_image_format = "raw"
|
||||
# dump_image_format = "raw"
|
||||
|
||||
|
||||
# If provided by the host and a hugetlbfs mount point is configured,
|
||||
|
@ -325,6 +325,17 @@ int qemudLoadDriverConfig(struct qemud_driver *driver,
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "dump_image_format");
|
||||
CHECK_TYPE ("dump_image_format", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
VIR_FREE(driver->dumpImageFormat);
|
||||
if (!(driver->dumpImageFormat = strdup(p->str))) {
|
||||
virReportOOMError();
|
||||
virConfFree(conf);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
p = virConfGetValue (conf, "hugetlbfs_mount");
|
||||
CHECK_TYPE ("hugetlbfs_mount", VIR_CONF_STRING);
|
||||
if (p && p->str) {
|
||||
|
@ -164,6 +164,7 @@ struct qemud_driver {
|
||||
virSecurityDriverPtr securitySecondaryDriver;
|
||||
|
||||
char *saveImageFormat;
|
||||
char *dumpImageFormat;
|
||||
|
||||
pciDeviceList *activePciHostdevs;
|
||||
|
||||
|
@ -5909,11 +5909,22 @@ static int qemudDomainCoreDump(virDomainPtr dom,
|
||||
int resume = 0, paused = 0;
|
||||
int ret = -1, fd = -1;
|
||||
virDomainEventPtr event = NULL;
|
||||
const char *args[] = {
|
||||
"cat",
|
||||
NULL,
|
||||
};
|
||||
int compress;
|
||||
qemuDomainObjPrivatePtr priv;
|
||||
/*
|
||||
* We reuse "save" flag for "dump" here. Then, we can support the same
|
||||
* format in "save" and "dump".
|
||||
*/
|
||||
compress = QEMUD_SAVE_FORMAT_RAW;
|
||||
if (driver->dumpImageFormat) {
|
||||
compress = qemudSaveCompressionTypeFromString(driver->dumpImageFormat);
|
||||
if (compress < 0) {
|
||||
qemuReportError(VIR_ERR_OPERATION_FAILED, "%s",
|
||||
_("Invalid dump image format specified in "
|
||||
"configuration file"));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
qemuDriverLock(driver);
|
||||
vm = virDomainFindByUUID(&driver->domains, dom->uuid);
|
||||
@ -5980,9 +5991,25 @@ static int qemudDomainCoreDump(virDomainPtr dom,
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
ret = qemuMonitorMigrateToFile(priv->mon,
|
||||
QEMU_MONITOR_MIGRATE_BACKGROUND,
|
||||
args, path, 0);
|
||||
if (compress == QEMUD_SAVE_FORMAT_RAW) {
|
||||
const char *args[] = {
|
||||
"cat",
|
||||
NULL,
|
||||
};
|
||||
ret = qemuMonitorMigrateToFile(priv->mon,
|
||||
QEMU_MONITOR_MIGRATE_BACKGROUND,
|
||||
args, path, 0);
|
||||
} else {
|
||||
const char *prog = qemudSaveCompressionTypeToString(compress);
|
||||
const char *args[] = {
|
||||
prog,
|
||||
"-c",
|
||||
NULL,
|
||||
};
|
||||
ret = qemuMonitorMigrateToFile(priv->mon,
|
||||
QEMU_MONITOR_MIGRATE_BACKGROUND,
|
||||
args, path, 0);
|
||||
}
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
if (ret < 0)
|
||||
goto endjob;
|
||||
|
@ -94,6 +94,8 @@ cgroup_device_acl = [ \"/dev/null\", \"/dev/full\", \"/dev/zero\" ]
|
||||
|
||||
save_image_format = \"gzip\"
|
||||
|
||||
dump_image_format = \"gzip\"
|
||||
|
||||
hugetlbfs_mount = \"/dev/hugepages\"
|
||||
|
||||
set_process_name = 1
|
||||
@ -209,6 +211,8 @@ allow_disk_format_probing = 1
|
||||
{ "#empty" }
|
||||
{ "save_image_format" = "gzip" }
|
||||
{ "#empty" }
|
||||
{ "dump_image_format" = "gzip" }
|
||||
{ "#empty" }
|
||||
{ "hugetlbfs_mount" = "/dev/hugepages" }
|
||||
{ "#empty" }
|
||||
{ "set_process_name" = "1" }
|
||||
|
Loading…
x
Reference in New Issue
Block a user