cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mc...@apache.org
Subject git commit: updated refs/heads/4.5 to c5d3a73
Date Sat, 20 Dec 2014 00:50:36 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.5 a29a1e060 -> c5d3a73c6


CLOUDSTACK-8101: volume sync not working as expected - MS restart during
upload volume leaves volume in hung state.



Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/c5d3a73c
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/c5d3a73c
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/c5d3a73c

Branch: refs/heads/4.5
Commit: c5d3a73c67056048c9640f16730bc5929627d486
Parents: a29a1e0
Author: Min Chen <min.chen@citrix.com>
Authored: Fri Dec 19 16:43:02 2014 -0800
Committer: Min Chen <min.chen@citrix.com>
Committed: Fri Dec 19 16:43:02 2014 -0800

----------------------------------------------------------------------
 .../cloudstack/storage/volume/VolumeServiceImpl.java | 15 +++++++++++----
 .../cloud/storage/download/DownloadMonitorImpl.java  |  5 +++++
 2 files changed, 16 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c5d3a73c/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
index e91477e..6a66ea3 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeServiceImpl.java
@@ -79,6 +79,7 @@ import com.cloud.exception.ResourceAllocationException;
 import com.cloud.host.Host;
 import com.cloud.host.dao.HostDao;
 import com.cloud.storage.DataStoreRole;
+import com.cloud.storage.RegisterVolumePayload;
 import com.cloud.storage.ScopeType;
 import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.StoragePool;
@@ -1404,7 +1405,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() +
@@ -1453,7 +1454,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);
                         }
                     }
 
@@ -1476,8 +1476,15 @@ 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);
                         }
                     }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/c5d3a73c/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
index eed1581..f1937f8 100755
--- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
+++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
@@ -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();


Mime
View raw message