Detail: Delete KVMHA dir contents if found when deleting templates, volumes

from Nfs Secondary storage

BUG-ID: CLOUDSTACK-2173
Bugfix-for: 4.2
Signed-off-by: Marcus Sorensen <marcus@betterservers.com> 1366838425 -0600
This commit is contained in:
Marcus Sorensen 2013-04-24 15:20:25 -06:00
parent d893ba881b
commit 7fa57922a4

View File

@ -1291,6 +1291,17 @@ SecondaryStorageResource {
if (!found && f.getName().equals("template.properties")) {
found = true;
}
// KVM HA monitor makes a mess in the templates with its heartbeat tests
// Don't let this stop us from cleaning up the template
if (f.isDirectory() && f.getName().equals("KVMHA")) {
s_logger.debug("Deleting KVMHA directory contents from template location");
File[] haFiles = f.listFiles();
for (File haFile : haFiles) {
haFile.delete();
}
}
if (!f.delete()) {
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Template path "
+ relativeTemplatePath);
@ -1339,6 +1350,17 @@ SecondaryStorageResource {
if (!found && f.getName().equals("volume.properties")) {
found = true;
}
// KVM HA monitor makes a mess in the templates with its heartbeat tests
// Don't let this stop us from cleaning up the template
if (f.isDirectory() && f.getName().equals("KVMHA")) {
s_logger.debug("Deleting KVMHA directory contents from template location");
File[] haFiles = f.listFiles();
for (File haFile : haFiles) {
haFile.delete();
}
}
if (!f.delete()) {
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Volume path "
+ relativeVolumePath);