@Override public void updateVolumeDiskChain(long volumeId, String path, String chainInfo) { VolumeVO vol = _volsDao.findById(volumeId); boolean needUpdate = false; // Volume path is not getting updated in the DB, need to find reason and fix the issue. if (vol.getPath() == null) { return; } if (!vol.getPath().equalsIgnoreCase(path)) { needUpdate = true; } if (chainInfo != null && (vol.getChainInfo() == null || !chainInfo.equalsIgnoreCase(vol.getChainInfo()))) { needUpdate = true; } if (needUpdate) { s_logger.info("Update volume disk chain info. vol: " + vol.getId() + ", " + vol.getPath() + " -> " + path + ", " + vol.getChainInfo() + " -> " + chainInfo); vol.setPath(path); vol.setChainInfo(chainInfo); _volsDao.update(volumeId, vol); } } }
protected VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePool pool) { Long lastPoolId = volume.getPoolId(); String folder = pool.getPath(); // For SMB, pool credentials are also stored in the uri query string. We trim the query string // part here to make sure the credentials do not get stored in the db unencrypted. if (pool.getPoolType() == StoragePoolType.SMB && folder != null && folder.contains("?")) { folder = folder.substring(0, folder.indexOf("?")); } VolumeVO newVol = new VolumeVO(volume); newVol.setInstanceId(null); newVol.setChainInfo(null); newVol.setPath(null); newVol.setFolder(folder); newVol.setPodId(pool.getPodId()); newVol.setPoolId(pool.getId()); newVol.setLastPoolId(lastPoolId); newVol.setPodId(pool.getPodId()); return volDao.persist(newVol); }
private VolumeVO duplicateVolumeOnAnotherStorage(Volume volume, StoragePoolVO storagePoolVO) { Long lastPoolId = volume.getPoolId(); VolumeVO newVol = new VolumeVO(volume); newVol.setInstanceId(null); newVol.setChainInfo(null); newVol.setPath(null); newVol.setFolder(null); newVol.setPodId(storagePoolVO.getPodId()); newVol.setPoolId(storagePoolVO.getId()); newVol.setLastPoolId(lastPoolId); return _volumeDao.persist(newVol); }
private void handleSuccessfulVolumeMigration(VolumeInfo srcVolumeInfo, StoragePool destPool, MigrateVolumeAnswer migrateVolumeAnswer) { VolumeVO volumeVO = _volumeDao.findById(srcVolumeInfo.getId()); volumeVO.setPath(migrateVolumeAnswer.getVolumePath()); String chainInfo = migrateVolumeAnswer.getVolumeChainInfo(); if (chainInfo != null) { volumeVO.setChainInfo(chainInfo); } volumeVO.setPodId(destPool.getPodId()); volumeVO.setPoolId(destPool.getId()); volumeVO.setLastPoolId(srcVolumeInfo.getPoolId()); _volumeDao.update(srcVolumeInfo.getId(), volumeVO); }
String chainInfo = ((MigrateVolumeAnswer)answer).getVolumeChainInfo(); if (chainInfo != null) { volumeVo.setChainInfo(chainInfo);
volume.setChainInfo(chainInfo);