mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
fix: cleanup directory if empty after removal of snapshot (#8002)
Co-authored-by: Daniel Augusto Veronezi Salvador <38945620+GutoVeronezi@users.noreply.github.com>
This commit is contained in:
parent
221f863939
commit
f2c1775657
@ -2050,6 +2050,13 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
|
||||
s_logger.warn(details);
|
||||
return new Answer(cmd, false, details);
|
||||
}
|
||||
|
||||
// delete the directory if it is empty
|
||||
if (snapshotDir.isDirectory() && snapshotDir.list().length == 0 && !snapshotDir.delete()) {
|
||||
details = String.format("Unable to delete directory [%s] at path [%s].", snapshotDir.getName(), snapshotPath);
|
||||
s_logger.debug(details);
|
||||
return new Answer(cmd, false, details);
|
||||
}
|
||||
return new Answer(cmd, true, null);
|
||||
} else if (dstore instanceof S3TO) {
|
||||
final S3TO s3 = (S3TO)dstore;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user