From 8db73414b347fb2664c8f07883fb5c730fb75432 Mon Sep 17 00:00:00 2001 From: linggao Date: Fri, 1 Mar 2013 19:12:27 +0000 Subject: [PATCH] fixed SF bug #3392 rmimage removes tftpboot kernel file that may be used by other images git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15349 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT-server/lib/xcat/plugins/rmimage.pm | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/xCAT-server/lib/xcat/plugins/rmimage.pm b/xCAT-server/lib/xcat/plugins/rmimage.pm index 92e2aabca..23cab1d46 100644 --- a/xCAT-server/lib/xcat/plugins/rmimage.pm +++ b/xCAT-server/lib/xcat/plugins/rmimage.pm @@ -156,8 +156,8 @@ sub process_request { return; } - my $tftpdir = "$tftproot/xcat/netboot/$osver/$arch/$profile"; - my @filestoremove = ("$imagedir/rootimg.gz", "$imagedir/kernel", "$imagedir/initrd.gz", "$tftpdir/initrd.gz", "$tftpdir/kernel"); + + my @filestoremove = ("$imagedir/rootimg.gz", "$imagedir/kernel", "$imagedir/initrd-stateless.gz", "$imagedir/initrd-statelite.gz"); #some rpms like atftp mount the rootimg/proc to /proc, we need to make sure rootimg/proc is free of junk `umount -l $imagedir/rootimg/proc 2>&1 1>/dev/null`; @@ -177,6 +177,16 @@ sub process_request { } } + #remove image files under tftpdir + my $tftpdir = "$tftproot/xcat/netboot/$osver/$arch/$profile"; + if ($imagename) { + $tftpdir = "$tftproot/xcat/osimage/$imagename"; + } + if (-d "$tftpdir") { + $callback->({info=>["Removing directory $tftpdir"]}); + rmtree "$tftpdir"; + } + $callback->({info=>["Image files have been removed successfully from this management node."]}); if (!$imagename || ($method eq "statelite")) {