mirror of https://github.com/apache/cloudstack.git
CLOUDSTACK-8101: volume sync not working as expected - MS restart during upload volume leaves volume in hung state.
This commit is contained in:
parent
4cb9505548
commit
ea634550fc
|
|
@ -1382,6 +1382,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
return;
|
||||
}
|
||||
|
||||
// we can only resume those uploaded volume with a URL specified
|
||||
List<VolumeDataStoreVO> dbVolumes = _volumeStoreDao.listUploadedVolumesByStoreId(storeId);
|
||||
List<VolumeDataStoreVO> toBeDownloaded = new ArrayList<VolumeDataStoreVO>(dbVolumes);
|
||||
for (VolumeDataStoreVO volumeStore : dbVolumes) {
|
||||
|
|
@ -1405,7 +1406,7 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
volumeStore.setDownloadState(Status.DOWNLOAD_ERROR);
|
||||
String msg = "Volume " + volume.getUuid() + " is corrupted on image store ";
|
||||
volumeStore.setErrorString(msg);
|
||||
s_logger.info("msg");
|
||||
s_logger.info(msg);
|
||||
if (volumeStore.getDownloadUrl() == null) {
|
||||
msg =
|
||||
"Volume (" + volume.getUuid() + ") with install path " + volInfo.getInstallPath() +
|
||||
|
|
@ -1454,7 +1455,6 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
if (volumeStore.getDownloadState() != Status.DOWNLOADED) {
|
||||
s_logger.info("Volume Sync did not find " + volume.getName() + " ready on image store " + storeId +
|
||||
", will request download to start/resume shortly");
|
||||
toBeDownloaded.add(volumeStore);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1477,8 +1477,13 @@ public class VolumeServiceImpl implements VolumeService {
|
|||
}
|
||||
|
||||
s_logger.debug("Volume " + volumeHost.getVolumeId() + " needs to be downloaded to " + store.getName());
|
||||
// TODO: pass a callback later
|
||||
VolumeInfo vol = volFactory.getVolume(volumeHost.getVolumeId());
|
||||
// reset volume status back to Allocated
|
||||
VolumeObject vol = (VolumeObject)volFactory.getVolume(volumeHost.getVolumeId());
|
||||
vol.processEvent(Event.OperationFailed); // reset back volume status
|
||||
// remove leftover volume_store_ref entry since re-download will create it again
|
||||
_volumeStoreDao.remove(volumeHost.getId());
|
||||
// get an updated volumeVO
|
||||
vol = (VolumeObject)volFactory.getVolume(volumeHost.getVolumeId());
|
||||
RegisterVolumePayload payload = new RegisterVolumePayload(volumeHost.getDownloadUrl(), volumeHost.getChecksum(), vol.getFormat().toString());
|
||||
vol.addPayload(payload);
|
||||
createVolumeAsync(vol, store);
|
||||
|
|
|
|||
|
|
@ -219,6 +219,11 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
|
|||
_volumeStoreDao.persist(volumeHost);
|
||||
} else if ((volumeHost.getJobId() != null) && (volumeHost.getJobId().length() > 2)) {
|
||||
downloadJobExists = true;
|
||||
} else {
|
||||
// persit url and checksum
|
||||
volumeHost.setDownloadUrl(url);
|
||||
volumeHost.setChecksum(checkSum);
|
||||
_volumeStoreDao.update(volumeHost.getId(), volumeHost);
|
||||
}
|
||||
|
||||
Long maxVolumeSizeInBytes = getMaxVolumeSizeInBytes();
|
||||
|
|
|
|||
Loading…
Reference in New Issue