]> xenbits.xensource.com Git - libvirt.git/commitdiff
tools: support --remove-logs flag on destroing domain
authorNikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Mon, 14 Feb 2022 12:19:53 +0000 (15:19 +0300)
committerNikolay Shirokovskiy <nikolay.shirokovskiy@openvz.org>
Wed, 6 Apr 2022 07:48:04 +0000 (10:48 +0300)
Signed-off-by: Nikolay Shirokovskiy <nshirokovskiy@virtuozzo.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
docs/manpages/virsh.rst
tools/virsh-domain.c

index 215beabd96b8533aa2d117e563d225b49eb3e63e..588445028b0df4414e766d62ac333182982a412a 100644 (file)
@@ -1566,7 +1566,7 @@ destroy
 
 ::
 
-   destroy domain [--graceful]
+   destroy domain [--graceful] [--remove-logs]
 
 Immediately terminate the domain *domain*.  This doesn't give the domain
 OS any chance to react, and it's the equivalent of ripping the power
@@ -1585,6 +1585,11 @@ If *--graceful* is specified, don't resort to extreme measures
 (e.g. SIGKILL) when the guest doesn't stop after a reasonable timeout;
 return an error instead.
 
+If *--remove-logs* is specified, remove per *domain* log files. Not all
+deployment configuration can be supported.
+
+In case of QEMU the flag is only supported if virlogd is used to handle QEMU
+process output. Otherwise the flag is ignored.
 
 
 domblkerror
index d5fd8be7c368e83a3bd3211062645c12ba397bf4..df8df9c2f33b73053bc02248e2210f041a542903 100644 (file)
@@ -8257,6 +8257,10 @@ static const vshCmdOptDef opts_destroy[] = {
      .type = VSH_OT_BOOL,
      .help = N_("terminate gracefully")
     },
+    {.name = "remove-logs",
+     .type = VSH_OT_BOOL,
+     .help = N_("remove domain logs")
+    },
     {.name = NULL}
 };
 
@@ -8273,9 +8277,11 @@ cmdDestroy(vshControl *ctl, const vshCmd *cmd)
 
     if (vshCommandOptBool(cmd, "graceful"))
        flags |= VIR_DOMAIN_DESTROY_GRACEFUL;
+    if (vshCommandOptBool(cmd, "remove-logs"))
+       flags |= VIR_DOMAIN_DESTROY_REMOVE_LOGS;
 
     if (flags)
-       result = virDomainDestroyFlags(dom, VIR_DOMAIN_DESTROY_GRACEFUL);
+       result = virDomainDestroyFlags(dom, flags);
     else
        result = virDomainDestroy(dom);