CLOUDSTACK-6488 Fixed an issue where the "path" field was not being set properly in the DB when the volume had a snapshot taken of it

This commit is contained in:
Mike Tutkowski 2014-04-23 10:32:55 -06:00
parent aabe6f2baf
commit db9de2e39b
1 changed files with 17 additions and 10 deletions

View File

@ -1169,21 +1169,28 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
if (input == null) {
return null;
}
String result = input;
if (result.endsWith(".vmdk")) { // get rid of vmdk file extension
result = result.substring(0, result.length() - (".vmdk").length());
final String fileType = ".vmdk";
if (result.endsWith(fileType)) {
// get rid of fileType
result = result.substring(0, result.length() - (fileType).length());
}
if (result.split("-").length == 1) {
String[] str = result.split("-");
int length = str.length;
if (length == 1 || length == 2) {
return result;
}
if (result.split("-").length > 2) {
return result.split("-")[0] + "-" + result.split("-")[1];
}
if (result.split("-").length == 2) {
return result.split("-")[0];
} else {
return result;
if (length > 2) {
return str[0] + "-" + str[1];
}
return result;
}
@Override