mirror of
https://github.com/apache/cloudstack.git
synced 2025-12-16 02:22:52 +01:00
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:
parent
d893ba881b
commit
7fa57922a4
@ -1291,6 +1291,17 @@ SecondaryStorageResource {
|
|||||||
if (!found && f.getName().equals("template.properties")) {
|
if (!found && f.getName().equals("template.properties")) {
|
||||||
found = true;
|
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()) {
|
if (!f.delete()) {
|
||||||
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Template path "
|
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Template path "
|
||||||
+ relativeTemplatePath);
|
+ relativeTemplatePath);
|
||||||
@ -1339,6 +1350,17 @@ SecondaryStorageResource {
|
|||||||
if (!found && f.getName().equals("volume.properties")) {
|
if (!found && f.getName().equals("volume.properties")) {
|
||||||
found = true;
|
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()) {
|
if (!f.delete()) {
|
||||||
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Volume path "
|
return new Answer(cmd, false, "Unable to delete file " + f.getName() + " under Volume path "
|
||||||
+ relativeVolumePath);
|
+ relativeVolumePath);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user