Source:
<code>protected void verifyLiveMigrationForKVM(Map<VolumeInfo, DataStore> volumeDataStoreMap, Host destHost) { Boolean storageTypeConsistency = null; Map<String, Storage.StoragePoolType> sourcePools = new HashMap<>(); for (Map.Entry<VolumeInfo, DataStore> entry : volumeDataStoreMap.entrySet()) { VolumeInfo volumeInfo = entry.getKey(); Long storagePoolId = volumeInfo.getPoolId(); StoragePoolVO srcStoragePoolVO = _storagePoolDao.findById(storagePoolId); if (srcStoragePoolVO == null) { throw new CloudRuntimeException("Volume with ID " + volumeInfo.getId() + " is not associated with a storage pool."); } if (srcStoragePoolVO.isManaged()) { throw new CloudRuntimeException("Migrating a volume online with KVM from managed storage is not currently supported."); } DataStore dataStore = entry.getValue(); StoragePoolVO destStoragePoolVO = _storagePoolDao.findById(dataStore.getId()); if (destStoragePoolVO == null) { throw new CloudRuntimeException("Destination storage pool with ID " + dataStore.getId() + " was not located."); } if (storageTypeConsistency == null) { storageTypeConsistency = destStoragePoolVO.isManaged(); } else if (storageTypeConsistency != destStoragePoolVO.isManaged()) { throw new CloudRuntimeException("Destination storage pools must be either all managed or all not managed"); } if (!destStoragePoolVO.isManaged()) { <START> if (destStoragePoolVO.getScope() != ScopeType.CLUSTER) { <END> throw new CloudRuntimeException("KVM live storage migrations currently support cluster-wide " + "not managed destination storage"); } if (!sourcePools.containsKey(srcStoragePoolVO.getUuid())) { sourcePools.put(srcStoragePoolVO.getUuid(), srcStoragePoolVO.getPoolType()); } } } verifyDestinationStorage(sourcePools, destHost); }</code><technical_language>In case of local storage migration, storage pool scope type is of ScopeType.HOST; therefore, this is breaking for local storage migration, throwing exception CloudRuntimeException</technical_language>

Target:
protected void verifyLiveMigrationForKVM(Map<VolumeInfo, DataStore> volumeDataStoreMap, Host destHost) { Boolean storageTypeConsistency = null; Map<String, Storage.StoragePoolType> sourcePools = new HashMap<>(); for (Map.Entry<VolumeInfo, DataStore> entry : volumeDataStoreMap.entrySet()) { VolumeInfo volumeInfo = entry.getKey(); Long storagePoolId = volumeInfo.getPoolId(); StoragePoolVO srcStoragePoolVO = _storagePoolDao.findById(storagePoolId); if (srcStoragePoolVO == null) { throw new CloudRuntimeException("Volume with ID " + volumeInfo.getId() + " is not associated with a storage pool."); } if (srcStoragePoolVO.isManaged()) { throw new CloudRuntimeException("Migrating a volume online with KVM from managed storage is not currently supported."); } DataStore dataStore = entry.getValue(); StoragePoolVO destStoragePoolVO = _storagePoolDao.findById(dataStore.getId()); if (destStoragePoolVO == null) { throw new CloudRuntimeException("Destination storage pool with ID " + dataStore.getId() + " was not located."); } if (storageTypeConsistency == null) { storageTypeConsistency = destStoragePoolVO.isManaged(); } else if (storageTypeConsistency != destStoragePoolVO.isManaged()) { throw new CloudRuntimeException("Destination storage pools must be either all managed or all not managed"); } if (!destStoragePoolVO.isManaged()) { if (destStoragePoolVO.getPoolType() == StoragePoolType.NetworkFilesystem && destStoragePoolVO.getScope() != ScopeType.CLUSTER) { throw new CloudRuntimeException("KVM live storage migrations currently support cluster-wide " + "not managed NFS destination storage"); } if (!sourcePools.containsKey(srcStoragePoolVO.getUuid())) { sourcePools.put(srcStoragePoolVO.getUuid(), srcStoragePoolVO.getPoolType()); } } } verifyDestinationStorage(sourcePools, destHost); }