Skip to content

Commit 7fa5792

Browse files
author
Marcus Sorensen
committed
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
1 parent d893ba8 commit 7fa5792

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

services/secondary-storage/src/org/apache/cloudstack/storage/resource/NfsSecondaryStorageResource.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,17 @@ protected Answer execute(final DeleteTemplateCommand cmd) {
12911291
if (!found && f.getName().equals("template.properties")) {
12921292
found = true;
12931293
}
1294+
1295+
// KVM HA monitor makes a mess in the templates with its heartbeat tests
1296+
// Don't let this stop us from cleaning up the template
1297+
if (f.isDirectory() && f.getName().equals("KVMHA")) {
1298+
s_logger.debug("Deleting KVMHA directory contents from template location");
1299+
File[] haFiles = f.listFiles();
1300+
for (File haFile : haFiles) {
1301+
haFile.delete();
1302+
}
1303+
}
1304+
12941305
if (!f.delete()) {
12951306
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Template path "
12961307
+ relativeTemplatePath);
@@ -1339,6 +1350,17 @@ protected Answer execute(final DeleteVolumeCommand cmd) {
13391350
if (!found && f.getName().equals("volume.properties")) {
13401351
found = true;
13411352
}
1353+
1354+
// KVM HA monitor makes a mess in the templates with its heartbeat tests
1355+
// Don't let this stop us from cleaning up the template
1356+
if (f.isDirectory() && f.getName().equals("KVMHA")) {
1357+
s_logger.debug("Deleting KVMHA directory contents from template location");
1358+
File[] haFiles = f.listFiles();
1359+
for (File haFile : haFiles) {
1360+
haFile.delete();
1361+
}
1362+
}
1363+
13421364
if (!f.delete()) {
13431365
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Volume path "
13441366
+ relativeVolumePath);

0 commit comments

Comments
 (0)