If this flag is set on calling virDomainDestroyFlags flags then remove per domain logs if possible. This can be used by libguestfs to delete logs for temporary domain. Otherwise such logs will stay wasting disk resources. Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@xxxxxxxxxxxxx> --- include/libvirt/libvirt-domain.h | 1 + src/libvirt-domain.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-domain.h index 5f0a9b7572..b5356ddc8d 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1236,6 +1236,7 @@ int virDomainDestroy (virDomainPtr domain); typedef enum { VIR_DOMAIN_DESTROY_DEFAULT = 0, /* Default behavior - could lead to data loss!! */ VIR_DOMAIN_DESTROY_GRACEFUL = 1 << 0, /* only SIGTERM, no SIGKILL */ + VIR_DOMAIN_DESTROY_REMOVE_LOGS = 1 << 1, /* remove VM logs on destroy */ } virDomainDestroyFlagsValues; int virDomainDestroyFlags (virDomainPtr domain, diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 5912551a49..0814d98e77 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -508,6 +508,12 @@ virDomainDestroy(virDomainPtr domain) * timeout; at that time, the management application can decide if * calling again without VIR_DOMAIN_DESTROY_GRACEFUL is appropriate. * + * If VIR_DOMAIN_DESTROY_REMOVE_LOGS flag is set then domain specific + * logs will be deleted as well if there are any. Note that not all + * deployments are be supported. For example in case of QEMU driver + * this flags is noop if virtlogd is not used for handling QEMU + * process output. + * * Another alternative which may produce cleaner results for the * guest's disks is to use virDomainShutdown() instead, but that * depends on guest support (some hypervisor/guest combinations may -- 2.31.1