[PATCH] sysprep: remove crash data generated by kexec-tools
Remove the kdump generated kernel crash data. Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com> --- sysprep/Makefile.am | 1 + sysprep/sysprep_operation_crash_data.ml | 47 +++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 sysprep/sysprep_operation_crash_data.ml diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index a747929..fafb929 100644 --- a/sysprep/Makefile.am +++ b/sysprep/Makefile.am @@ -43,6 +43,7 @@ operations = \ bash_history \ blkid_tab \ ca_certificates \ + crash_data \ cron_spool \ dhcp_client_state \ dhcp_server_state \ diff --git a/sysprep/sysprep_operation_crash_data.ml b/sysprep/sysprep_operation_crash_data.ml new file mode 100644 index 0000000..2150e52 --- /dev/null +++ b/sysprep/sysprep_operation_crash_data.ml @@ -0,0 +1,47 @@ +(* virt-sysprep + * Copyright (C) 2012 Fujitsu Limited. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + *) + +open Sysprep_operation +open Sysprep_gettext.Gettext + +module G = Guestfs + +let crash_data_perform g root = + let typ = g#inspect_get_type root in + if typ <> "windows" then ( + let paths = g#glob_expand "/var/crash/*" in + Array.iter ( + fun path -> g#rm_rf path; + ) paths; + [] + ) + else [] + +let crash_data_op = { + name = "crash-data"; + enabled_by_default = true; + heading = s_"Remove the crash data generated by kexec-tools"; + pod_description = Some (s_"\ +Remove the automatically generated kdump kernel crash data in +C</var/crash/>."); + extra_args = []; + perform_on_filesystems = Some crash_data_perform; + perform_on_devices = None; +} + +let () = register_operation crash_data_op -- 1.8.0
On Wed, Nov 21, Wanlong Gao wrote:
+ heading = s_"Remove the crash data generated by kexec-tools"; + pod_description = Some (s_"\ +Remove the automatically generated kdump kernel crash data in +C</var/crash/>.");
Is that the standard location? At least in SLES its /var/log/dump/ Olaf
On 11/21/2012 05:57 PM, Olaf Hering wrote:
On Wed, Nov 21, Wanlong Gao wrote:
+ heading = s_"Remove the crash data generated by kexec-tools"; + pod_description = Some (s_"\ +Remove the automatically generated kdump kernel crash data in +C</var/crash/>.");
Is that the standard location? At least in SLES its /var/log/dump/
I'm not sure, I just see that in Fedora and RHEL the location is /var/crash. Thanks, Wanlong Gao
Olaf
On Wed, Nov 21, 2012 at 07:39:15PM +0800, Wanlong Gao wrote:
On 11/21/2012 05:57 PM, Olaf Hering wrote:
On Wed, Nov 21, Wanlong Gao wrote:
+ heading = s_"Remove the crash data generated by kexec-tools"; + pod_description = Some (s_"\ +Remove the automatically generated kdump kernel crash data in +C</var/crash/>.");
Is that the standard location? At least in SLES its /var/log/dump/
I'm not sure, I just see that in Fedora and RHEL the location is /var/crash.
Thanks - I've pushed a patch which also removes /var/log/dump/*. (commit 9fb5a3ceaffd88aaf37b5253e540626457319d24) Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
participants (3)
-
Olaf Hering -
Richard W.M. Jones -
Wanlong Gao