mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Reconcile chaininfo after attaching volume
This commit is contained in:
parent
9b923ba9dc
commit
388a9c2c6d
@ -2184,6 +2184,9 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
|
||||
vmMo.attachDisk(new String[] { datastoreVolumePath }, morDs, diskController);
|
||||
VirtualMachineDiskInfoBuilder diskInfoBuilder = vmMo.getDiskInfoBuilder();
|
||||
VirtualMachineDiskInfo diskInfo = diskInfoBuilder.getDiskInfoByBackingFileBaseName(volumePath, dsMo.getName());
|
||||
chainInfo = _gson.toJson(diskInfo);
|
||||
|
||||
if (isManaged) {
|
||||
expandVirtualDisk(vmMo, datastoreVolumePath, volumeTO.getSize());
|
||||
@ -2201,15 +2204,16 @@ public class VmwareStorageProcessor implements StorageProcessor {
|
||||
}
|
||||
if (datastoreChangeObserved) {
|
||||
answer.setContextParam("datastoreName", dsMo.getCustomFieldValue(CustomFieldConstants.CLOUD_UUID));
|
||||
answer.setContextParam("chainInfo", chainInfo);
|
||||
}
|
||||
|
||||
if (volumePathChangeObserved) {
|
||||
answer.setContextParam("volumePath", volumePath);
|
||||
answer.setContextParam("chainInfo", chainInfo);
|
||||
}
|
||||
}
|
||||
|
||||
if (chainInfo != null && !chainInfo.isEmpty())
|
||||
answer.setContextParam("chainInfo", chainInfo);
|
||||
|
||||
return answer;
|
||||
} catch (Throwable e) {
|
||||
if (e instanceof RemoteException) {
|
||||
|
||||
@ -3109,7 +3109,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
|
||||
|
||||
if (volumeToAttachStoragePool.isManaged() && volumeToAttach.getPath() == null) {
|
||||
volumeToAttach.setPath(answer.getDisk().getPath());
|
||||
_volsDao.update(volumeToAttach.getId(), volumeToAttach);
|
||||
}
|
||||
|
||||
String chainInfo = answer.getContextParam("chainInfo");
|
||||
if (chainInfo != null) {
|
||||
volumeToAttach = _volsDao.findById(volumeToAttach.getId());
|
||||
volumeToAttach.setChainInfo(chainInfo);
|
||||
_volsDao.update(volumeToAttach.getId(), volumeToAttach);
|
||||
}
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user