diff options
author | Wanlong Gao <gaowanlong@cn.fujitsu.com> | 2012-11-21 17:50:58 +0800 |
---|---|---|
committer | Richard W.M. Jones <rjones@redhat.com> | 2012-11-22 08:30:21 +0000 |
commit | 9fb5a3ceaffd88aaf37b5253e540626457319d24 (patch) | |
tree | cad19415063144e090178c62d0919a41c2619485 | |
parent | 30f202da4388a801fbe17314fd22fcf04431d10f (diff) | |
download | libguestfs-9fb5a3ceaffd88aaf37b5253e540626457319d24.tar.gz libguestfs-9fb5a3ceaffd88aaf37b5253e540626457319d24.tar.xz libguestfs-9fb5a3ceaffd88aaf37b5253e540626457319d24.zip |
sysprep: remove crash data generated by kexec-tools
Remove the kdump generated kernel crash data.
Signed-off-by: Wanlong Gao <gaowanlong@cn.fujitsu.com>
RWMJ:
- Added /var/log/dump/* path for SLES (thanks Olaf Hering).
- Update po/POTFILES-ml.
-rw-r--r-- | po/POTFILES-ml | 1 | ||||
-rw-r--r-- | sysprep/Makefile.am | 1 | ||||
-rw-r--r-- | sysprep/sysprep_operation_crash_data.ml | 47 |
3 files changed, 49 insertions, 0 deletions
diff --git a/po/POTFILES-ml b/po/POTFILES-ml index fe63e8a8..0f48659f 100644 --- a/po/POTFILES-ml +++ b/po/POTFILES-ml @@ -14,6 +14,7 @@ sysprep/sysprep_operation_abrt_data.ml sysprep/sysprep_operation_bash_history.ml sysprep/sysprep_operation_blkid_tab.ml sysprep/sysprep_operation_ca_certificates.ml +sysprep/sysprep_operation_crash_data.ml sysprep/sysprep_operation_cron_spool.ml sysprep/sysprep_operation_dhcp_client_state.ml sysprep/sysprep_operation_dhcp_server_state.ml diff --git a/sysprep/Makefile.am b/sysprep/Makefile.am index a7479291..fafb929d 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 00000000..679747da --- /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 globs = [ + "/var/crash/*"; + "/var/log/dump/*"; +] + +let crash_data_perform g root = + let typ = g#inspect_get_type root in + if typ = "linux" then ( + List.iter (fun glob -> Array.iter g#rm_rf (g#glob_expand glob)) globs + ); + [] + +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."); + extra_args = []; + perform_on_filesystems = Some crash_data_perform; + perform_on_devices = None; +} + +let () = register_operation crash_data_op |