mirror of https://github.com/apache/cloudstack.git
Addressed review comments on code refactor
This commit is contained in:
parent
e51a689f69
commit
5c26f0a6d3
|
|
@ -424,29 +424,7 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
|||
vol.setSize(finalSize);
|
||||
vol.update();
|
||||
|
||||
VolumeVO volumeVO = volumeDao.findById(vol.getId());
|
||||
String datastoreUUID = answer.getContextParam("datastoreUUID");
|
||||
if (datastoreUUID != null) {
|
||||
StoragePoolVO storagePoolVO = primaryStoreDao.findByUuid(datastoreUUID);
|
||||
if (storagePoolVO != null) {
|
||||
volumeVO.setPoolId(storagePoolVO.getId());
|
||||
} else {
|
||||
s_logger.warn(String.format("Unable to find datastore %s while updating the new datastore of the volume %d", datastoreUUID, vol.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
String volumePath = answer.getContextParam("volumePath");
|
||||
if (volumePath != null) {
|
||||
volumeVO.setPath(volumePath);
|
||||
}
|
||||
|
||||
String chainInfo = answer.getContextParam("chainInfo");
|
||||
if (chainInfo != null) {
|
||||
volumeVO.setChainInfo(chainInfo);
|
||||
}
|
||||
|
||||
volumeDao.update(volumeVO.getId(), volumeVO);
|
||||
|
||||
updateVolumePathDetails(vol, answer);
|
||||
} else if (answer != null) {
|
||||
result.setResult(answer.getDetails());
|
||||
} else {
|
||||
|
|
@ -462,6 +440,31 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
|
|||
callback.complete(result);
|
||||
}
|
||||
|
||||
private void updateVolumePathDetails(VolumeObject vol, ResizeVolumeAnswer answer) {
|
||||
VolumeVO volumeVO = volumeDao.findById(vol.getId());
|
||||
String datastoreUUID = answer.getContextParam("datastoreUUID");
|
||||
if (datastoreUUID != null) {
|
||||
StoragePoolVO storagePoolVO = primaryStoreDao.findByUuid(datastoreUUID);
|
||||
if (storagePoolVO != null) {
|
||||
volumeVO.setPoolId(storagePoolVO.getId());
|
||||
} else {
|
||||
s_logger.warn(String.format("Unable to find datastore %s while updating the new datastore of the volume %d", datastoreUUID, vol.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
String volumePath = answer.getContextParam("volumePath");
|
||||
if (volumePath != null) {
|
||||
volumeVO.setPath(volumePath);
|
||||
}
|
||||
|
||||
String chainInfo = answer.getContextParam("chainInfo");
|
||||
if (chainInfo != null) {
|
||||
volumeVO.setChainInfo(chainInfo);
|
||||
}
|
||||
|
||||
volumeDao.update(volumeVO.getId(), volumeVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleQualityOfServiceForVolumeMigration(VolumeInfo volumeInfo, QualityOfServiceState qualityOfServiceState) {}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue