You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/02/26 19:51:34 UTC
[7/24] git commit: refs/heads/ui-regions - CLOUDSTACK-1374 - When
user uploads a volume using uploadVolume API command,
only volume_host_ref table is getting updated with corresponding size of
volume and "volumes" table, the size of volume still remains
CLOUDSTACK-1374 - When user uploads a volume using uploadVolume API command, only volume_host_ref table is getting updated with corresponding size of volume and "volumes" table, the size of volume still remains zero even ager the volume gets completely downloaded.
Signed-off-by: Nitin Mehta <ni...@citrix.com>
Project: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/commit/10236bee
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/tree/10236bee
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/diff/10236bee
Branch: refs/heads/ui-regions
Commit: 10236bee26f79391838c103972d0afa551e5efd4
Parents: a1b33ca
Author: Sanjay Tripathi <sa...@citrix.com>
Authored: Tue Feb 26 10:43:19 2013 +0530
Committer: Nitin Mehta <ni...@citrix.com>
Committed: Tue Feb 26 10:51:25 2013 +0530
----------------------------------------------------------------------
.../cloud/storage/download/DownloadListener.java | 8 +++++-
.../storage/download/DownloadMonitorImpl.java | 22 +++++++++-----
2 files changed, 21 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/10236bee/server/src/com/cloud/storage/download/DownloadListener.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/download/DownloadListener.java b/server/src/com/cloud/storage/download/DownloadListener.java
index d0b1868..d4c20cf 100755
--- a/server/src/com/cloud/storage/download/DownloadListener.java
+++ b/server/src/com/cloud/storage/download/DownloadListener.java
@@ -343,8 +343,14 @@ public class DownloadListener implements Listener {
updateBuilder.setInstallPath(answer.getInstallPath());
updateBuilder.setSize(answer.getTemplateSize());
updateBuilder.setPhysicalSize(answer.getTemplatePhySicalSize());
-
+
volumeHostDao.update(getVolumeHostId(), updateBuilder);
+
+ // Update volume size in Volume table.
+ VolumeVO updateVolume = _volumeDao.createForUpdate();
+ updateVolume.setSize(answer.getTemplateSize());
+ _volumeDao.update(volume.getId(), updateVolume);
+
/*if (answer.getCheckSum() != null) {
VMTemplateVO templateDaoBuilder = _vmTemplateDao.createForUpdate();
templateDaoBuilder.setChecksum(answer.getCheckSum());
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/10236bee/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 1fd1996..0bc89e3 100755
--- a/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
+++ b/server/src/com/cloud/storage/download/DownloadMonitorImpl.java
@@ -717,7 +717,7 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
//Exists then don't download
if (volumeInfos.containsKey(volume.getId())){
TemplateInfo volInfo = volumeInfos.remove(volume.getId());
- toBeDownloaded.remove(volumeHost);
+ toBeDownloaded.remove(volumeHost);
s_logger.info("Volume Sync found " + volume.getUuid() + " already in the volume host table");
if (volumeHost.getDownloadState() != Status.DOWNLOADED) {
volumeHost.setErrorString("");
@@ -735,13 +735,19 @@ public class DownloadMonitorImpl extends ManagerBase implements DownloadMonitor
}
} else { // Put them in right status
- volumeHost.setDownloadPercent(100);
- volumeHost.setDownloadState(Status.DOWNLOADED);
- volumeHost.setInstallPath(volInfo.getInstallPath());
- volumeHost.setSize(volInfo.getSize());
- volumeHost.setPhysicalSize(volInfo.getPhysicalSize());
- volumeHost.setLastUpdated(new Date());
- _volumeHostDao.update(volumeHost.getId(), volumeHost);
+ volumeHost.setDownloadPercent(100);
+ volumeHost.setDownloadState(Status.DOWNLOADED);
+ volumeHost.setInstallPath(volInfo.getInstallPath());
+ volumeHost.setSize(volInfo.getSize());
+ volumeHost.setPhysicalSize(volInfo.getPhysicalSize());
+ volumeHost.setLastUpdated(new Date());
+ _volumeHostDao.update(volumeHost.getId(), volumeHost);
+
+ if (volume.getSize() == 0) {
+ // Set volume size in volumes table
+ volume.setSize(volInfo.getSize());
+ _volumeDao.update(volumeHost.getVolumeId(), volume);
+ }
}
continue;
}