[libvirt] [PATCH 1/4] Add support for limiting guest coredump
Michal Privoznik
mprivozn at redhat.com
Tue Aug 21 13:33:42 UTC 2012
On 15.08.2012 11:25, Martin Kletzander wrote:
> Sometimes when guest machine crashes, coredump can get huge due to the
> guest memory. This can be limited using madvise(2) system call and is
> being used in QEMU hypervisor. This patch adds an option for configuring
> that in the domain XML.
> ---
> docs/schemas/domaincommon.rng | 8 ++++++++
> src/conf/domain_conf.c | 19 ++++++++++++++++++-
> src/conf/domain_conf.h | 10 ++++++++++
> src/libvirt_private.syms | 2 ++
> 4 files changed, 38 insertions(+), 1 deletions(-)
Even though I'd like to see XML extension and it's documentation in one
patch, I am okay with that being a separate one.
> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
> index f8fe8b5..4944d0f 100644
> --- a/src/conf/domain_conf.c
> +++ b/src/conf/domain_conf.c
> @@ -376,6 +376,11 @@ VIR_ENUM_IMPL(virDomainSoundModel, VIR_DOMAIN_SOUND_MODEL_LAST,
> "ac97",
> "ich6")
>
> +VIR_ENUM_IMPL(virDomainMemDump, VIR_DOMAIN_MEM_DUMP_LAST,
> + "default",
> + "on",
> + "off")
> +
> VIR_ENUM_IMPL(virDomainMemballoonModel, VIR_DOMAIN_MEMBALLOON_MODEL_LAST,
> "virtio",
> "xen",
> @@ -8081,6 +8086,13 @@ static virDomainDefPtr virDomainDefParseXML(virCapsPtr caps,
> &def->mem.cur_balloon, false) < 0)
> goto error;
>
> + /* and info about it */
> + tmp = virXPathString("string(./memory[1]/@dump-core)", ctxt);
> + if (tmp) {
> + def->mem.dump_core = virDomainMemDumpTypeFromString(tmp);
should we silently ignore unknown values?
> + VIR_FREE(tmp);
> + }
> +
> if (def->mem.cur_balloon > def->mem.max_balloon) {
> /* Older libvirt could get into this situation due to
> * rounding; if the discrepancy is less than 1MiB, we silently
ACK modulo silent ignoring.
Michal
More information about the libvir-list
mailing list