mirror of https://github.com/apache/cloudstack.git
parent
15a6844784
commit
e8ea6b1abd
|
|
@ -74,6 +74,7 @@ import com.cloud.utils.Pair;
|
|||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.Ternary;
|
||||
import com.cloud.utils.script.Script;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.snapshot.VMSnapshot;
|
||||
import com.vmware.vim25.ManagedObjectReference;
|
||||
|
|
@ -1090,6 +1091,9 @@ public class VmwareStorageManagerImpl implements VmwareStorageManager {
|
|||
private String getVolumePathInDatastore(DatastoreMO dsMo, String volumeFileName) throws Exception {
|
||||
String datastoreVolumePath = dsMo.searchFileInSubFolders(volumeFileName, true);
|
||||
assert (datastoreVolumePath != null) : "Virtual disk file missing from datastore.";
|
||||
if (datastoreVolumePath == null) {
|
||||
throw new CloudRuntimeException("Unable to find file " + volumeFileName + " in datastore " + dsMo.getName());
|
||||
}
|
||||
return datastoreVolumePath;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3984,7 +3984,9 @@ public class VmwareResource implements StoragePoolResource, ServerResource, Vmwa
|
|||
DatastoreMO dsMo = new DatastoreMO(getServiceContext(), morDs);
|
||||
String datastoreVolumePath = dsMo.searchFileInSubFolders(cmd.getVolumePath() + ".vmdk", true);
|
||||
assert (datastoreVolumePath != null) : "Virtual disk file must exist in specified datastore for attach/detach operations.";
|
||||
|
||||
if (datastoreVolumePath == null) {
|
||||
throw new CloudRuntimeException("Unable to find file " + cmd.getVolumePath() + ".vmdk in datastore " + dsMo.getName());
|
||||
}
|
||||
AttachVolumeAnswer answer = new AttachVolumeAnswer(cmd, cmd.getDeviceId(), datastoreVolumePath);
|
||||
if (cmd.getAttach()) {
|
||||
vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);
|
||||
|
|
|
|||
|
|
@ -335,7 +335,7 @@ public class DatastoreMO extends BaseMO {
|
|||
|
||||
HostDatastoreBrowserMO browserMo = getHostDatastoreBrowserMO();
|
||||
ArrayList<HostDatastoreBrowserSearchResults> results = browserMo.searchDatastoreSubFolders("[" + getName() + "]", fileName, caseInsensitive);
|
||||
if (results.size() > 1) {
|
||||
if (results != null && results.size() > 1) {
|
||||
s_logger.warn("Multiple files with name " + fileName + " exists in datastore " + datastorePath + ". Trying to choose first file found in search attempt.");
|
||||
}
|
||||
for (HostDatastoreBrowserSearchResults result : results) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue