]> xenbits.xensource.com Git - libvirt.git/commitdiff
libvirt: introduce VIR_DOMAIN_DESTROY_REMOVE_LOGS flag
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Mon, 14 Feb 2022 12:19:51 +0000 (15:19 +0300)
committerNikolay Shirokovskiy <nikolay.shirokovskiy@openvz.org>
Wed, 6 Apr 2022 07:48:04 +0000 (10:48 +0300)
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@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
include/libvirt/libvirt-domain.h
src/libvirt-domain.c

index 2d5718301e9cc3cf3c526fcc205ed50af4259ebf..1275f4530d5caa8a5f09e5b32db1bbcc0f22880d 100644 (file)
@@ -1237,6 +1237,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,
index 53efb6040698453f3a2fd5895427a9ad0384578a..cbd7902d2d0a9152403cea020ffda4f0a79a8467 100644 (file)
@@ -524,6 +524,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