From e265d5401de6c595dbad215d4fe419be0327ff52 Mon Sep 17 00:00:00 2001 From: Mark Gurevich Date: Fri, 10 Mar 2017 14:33:55 -0500 Subject: [PATCH] Handle purging block or raw VM disks when removing a VM --- xCAT-server/lib/xcat/plugins/kvm.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/xCAT-server/lib/xcat/plugins/kvm.pm b/xCAT-server/lib/xcat/plugins/kvm.pm index 7e83f850f..17d1a66b0 100755 --- a/xCAT-server/lib/xcat/plugins/kvm.pm +++ b/xCAT-server/lib/xcat/plugins/kvm.pm @@ -1775,6 +1775,14 @@ sub rmvm { foreach $disk (@purgedisks) { my $disktype = $disk->parentNode()->getAttribute("device"); if ($disktype eq "cdrom") { next; } + + my @driver = $disk->parentNode()->findnodes("driver"); + my $drivertype = $driver[0]->getAttribute("type"); + if (($drivertype eq "raw") || ($disktype eq "block")) { + #For raw or block devices, do not remove, even if purge was specified. Log info message. + xCAT::MsgUtils->trace(0, "i", "Not purging raw or block storage device: $disk"); + next; + } my $file = $disk->getAttribute("file"); # try to check the existence first, if cannot find, do nothing.