mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-4190:[Object_store_refactor] volume should be deleted from
staging storage after successfule volume migration .
This commit is contained in:
parent
e1bd0ee039
commit
605376dc4d
|
|
@ -328,6 +328,10 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||
CopyCommand cmd = new CopyCommand(cacheData.getTO(), destData.getTO(), _copyvolumewait, _mgmtServer.getExecuteInSequence());
|
||||
EndPoint ep = selector.select(cacheData, destData);
|
||||
Answer answer = ep.sendMessage(cmd);
|
||||
// delete volume on cache store
|
||||
if (cacheData != null) {
|
||||
cacheMgr.deleteCacheObject(cacheData);
|
||||
}
|
||||
return answer;
|
||||
}
|
||||
|
||||
|
|
@ -455,7 +459,7 @@ public class AncientDataMotionStrategy implements DataMotionStrategy {
|
|||
|
||||
@Override
|
||||
public Void copyAsync(Map<VolumeInfo, DataStore> volumeMap, VirtualMachineTO vmTo, Host srcHost, Host destHost,
|
||||
AsyncCompletionCallback<CopyCommandResult> callback) {
|
||||
AsyncCompletionCallback<CopyCommandResult> callback) {
|
||||
CopyCommandResult result = new CopyCommandResult(null, null);
|
||||
result.setResult("Unsupported operation requested for copying data.");
|
||||
callback.complete(result);
|
||||
|
|
|
|||
|
|
@ -888,7 +888,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
future.complete(res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
s_logger.error("Failed to process copy volume callback", e);
|
||||
s_logger.error("Failed to process migrate volume callback", e);
|
||||
res.setResult(e.toString());
|
||||
future.complete(res);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -405,7 +405,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
hostService.invalidateServiceContext(null);
|
||||
}
|
||||
|
||||
String msg = "CreateCommand failed due to " + VmwareHelper.getExceptionMessage(e);
|
||||
String msg = "CopyCommand failed due to " + VmwareHelper.getExceptionMessage(e);
|
||||
s_logger.error(msg, e);
|
||||
return new CopyCmdAnswer(e.toString());
|
||||
}
|
||||
|
|
@ -1154,7 +1154,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
}
|
||||
else {
|
||||
morDs = HypervisorHostHelper.findDatastoreWithBackwardsCompatibility(hyperHost, isManaged ? VmwareResource.getDatastoreName(iScsiName) : primaryStore.getUuid());
|
||||
}
|
||||
}
|
||||
|
||||
if (morDs == null) {
|
||||
String msg = "Unable to find the mounted datastore to execute AttachVolumeCommand, vmName: " + vmName;
|
||||
|
|
@ -1166,30 +1166,32 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
String datastoreVolumePath;
|
||||
|
||||
if(isAttach) {
|
||||
if(!isManaged)
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dsMo.getOwnerDatacenter().first(), vmName,
|
||||
dsMo, volumeTO.getPath());
|
||||
else
|
||||
datastoreVolumePath = dsMo.getDatastorePath(dsMo.getName() + ".vmdk");
|
||||
if(!isManaged) {
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.syncVolumeToVmDefaultFolder(dsMo.getOwnerDatacenter().first(), vmName,
|
||||
dsMo, volumeTO.getPath());
|
||||
} else {
|
||||
datastoreVolumePath = dsMo.getDatastorePath(dsMo.getName() + ".vmdk");
|
||||
}
|
||||
} else {
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.getLegacyDatastorePathFromVmdkFileName(dsMo, volumeTO.getPath() + ".vmdk");
|
||||
if(!dsMo.fileExists(datastoreVolumePath))
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(dsMo, vmName, volumeTO.getPath() + ".vmdk");
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.getLegacyDatastorePathFromVmdkFileName(dsMo, volumeTO.getPath() + ".vmdk");
|
||||
if(!dsMo.fileExists(datastoreVolumePath)) {
|
||||
datastoreVolumePath = VmwareStorageLayoutHelper.getVmwareDatastorePathFromVmdkFileName(dsMo, vmName, volumeTO.getPath() + ".vmdk");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
disk.setVdiUuid(datastoreVolumePath);
|
||||
|
||||
AttachAnswer answer = new AttachAnswer(disk);
|
||||
if (isAttach) {
|
||||
vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs);
|
||||
} else {
|
||||
} else {
|
||||
vmMo.removeAllSnapshots();
|
||||
vmMo.detachDisk(datastoreVolumePath, false);
|
||||
|
||||
if (isManaged) {
|
||||
this.hostService.handleDatastoreAndVmdkDetach(iScsiName, storageHost, storagePort);
|
||||
} else {
|
||||
VmwareStorageLayoutHelper.syncVolumeToRootFolder(dsMo.getOwnerDatacenter().first(), dsMo, volumeTO.getPath());
|
||||
VmwareStorageLayoutHelper.syncVolumeToRootFolder(dsMo.getOwnerDatacenter().first(), dsMo, volumeTO.getPath());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1448,10 +1450,11 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
if (s_logger.isInfoEnabled())
|
||||
if (s_logger.isInfoEnabled()) {
|
||||
s_logger.info("Destroy volume by original name: " + vol.getPath() + ".vmdk");
|
||||
|
||||
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));
|
||||
}
|
||||
|
||||
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));
|
||||
return new Answer(cmd, true, "Success");
|
||||
}
|
||||
|
||||
|
|
@ -1471,8 +1474,8 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
|||
}
|
||||
}
|
||||
|
||||
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));
|
||||
|
||||
VmwareStorageLayoutHelper.deleteVolumeVmdkFiles(dsMo, vol.getPath(), new DatacenterMO(context, morDc));
|
||||
|
||||
return new Answer(cmd, true, "Success");
|
||||
} catch (Throwable e) {
|
||||
if (e instanceof RemoteException) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue