Fix for CS-15279.

Issue happens when ROOT volume gets created and there is subsequent failure in starting the VM. During retry if allocator assigns a different storage pool the scenario was not handled. Now in case of local storage the volume get recreated on the newly assigned pool and old one gets cleaned up. In case of shared storage the existing volume is migrated to new storage pool.

Reviewed-by: Prachi, Edison, Nitin
This commit is contained in:
Koushik Das 2012-07-13 11:13:00 +05:30
parent 7ef5f314ee
commit 1bcb9afa89
1 changed files with 18 additions and 3 deletions

View File

@ -3207,10 +3207,25 @@ public class StorageManagerImpl implements StorageManager, Manager, ClusterManag
} else {
if (assignedPool.getId() != vol.getPoolId()) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Volume " + vol + " is not recreatable! Cannot recreate on storagepool: " + assignedPool);
s_logger.debug("Mismatch in storage pool " + assignedPool + " assigned by deploymentPlanner and the one associated with volume " + vol);
}
if (vm.getServiceOffering().getUseLocalStorage())
{
if (s_logger.isDebugEnabled()) {
s_logger.debug("Local volume " + vol + " will be recreated on storage pool " + assignedPool + " assigned by deploymentPlanner");
}
recreateVols.add(vol);
} else {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Shared volume " + vol + " will be migrated on storage pool " + assignedPool + " assigned by deploymentPlanner");
}
try {
Volume migratedVol = migrateVolume(vol.getId(), assignedPool.getId());
vm.addDisk(new VolumeTO(migratedVol, assignedPool));
} catch (ConcurrentOperationException e) {
throw new StorageUnavailableException("Volume migration failed for " + vol, Volume.class, vol.getId());
}
}
throw new StorageUnavailableException("Volume is not recreatable, Unable to create " + vol, Volume.class, vol.getId());
// copy volume usecase - not yet developed.
} else {
StoragePoolVO pool = _storagePoolDao.findById(vol.getPoolId());
vm.addDisk(new VolumeTO(vol, pool));