You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mc...@apache.org on 2013/08/07 01:02:56 UTC
[3/3] git commit: updated refs/heads/master to a8ee45d
CLOUDSTACK-4074: if hypervisor doesn't return size of volume/template, don't update it into db
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/a8ee45de
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/a8ee45de
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/a8ee45de
Branch: refs/heads/master
Commit: a8ee45de7cb55f26fcee5a2696ab3889423e86c2
Parents: ec89e23
Author: Edison Su <su...@gmail.com>
Authored: Mon Aug 5 16:21:15 2013 -0700
Committer: Min Chen <mi...@citrix.com>
Committed: Tue Aug 6 15:53:57 2013 -0700
----------------------------------------------------------------------
.../src/org/apache/cloudstack/storage/to/VolumeObjectTO.java | 4 ++--
.../org/apache/cloudstack/storage/volume/VolumeObject.java | 8 ++++++--
.../com/cloud/storage/resource/VmwareStorageProcessor.java | 5 ++---
3 files changed, 10 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8ee45de/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
----------------------------------------------------------------------
diff --git a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 9f466ae..5685fad 100644
--- a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@ -30,7 +30,7 @@ public class VolumeObjectTO implements DataTO {
private Volume.Type volumeType;
private DataStoreTO dataStore;
private String name;
- private long size;
+ private Long size;
private String path;
private Long volumeId;
private String vmName;
@@ -108,7 +108,7 @@ public class VolumeObjectTO implements DataTO {
return this.name;
}
- public long getSize() {
+ public Long getSize() {
return this.size;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8ee45de/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
index de63d7d..404e3b2 100644
--- a/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
+++ b/engine/storage/volume/src/org/apache/cloudstack/storage/volume/VolumeObject.java
@@ -564,7 +564,9 @@ public class VolumeObject implements VolumeInfo {
VolumeVO vol = this.volumeDao.findById(this.getId());
VolumeObjectTO newVol = (VolumeObjectTO) cpyAnswer.getNewData();
vol.setPath(newVol.getPath());
- vol.setSize(newVol.getSize());
+ if (newVol.getSize() != null) {
+ vol.setSize(newVol.getSize());
+ }
vol.setPoolId(this.getDataStore().getId());
volumeDao.update(vol.getId(), vol);
} else if (answer instanceof CreateObjectAnswer) {
@@ -572,7 +574,9 @@ public class VolumeObject implements VolumeInfo {
VolumeObjectTO newVol = (VolumeObjectTO) createAnswer.getData();
VolumeVO vol = this.volumeDao.findById(this.getId());
vol.setPath(newVol.getPath());
- vol.setSize(newVol.getSize());
+ if (newVol.getSize() != null) {
+ vol.setSize(newVol.getSize());
+ }
vol.setPoolId(this.getDataStore().getId());
volumeDao.update(vol.getId(), vol);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/a8ee45de/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
index cc1a168..ffd192e 100644
--- a/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
+++ b/plugins/hypervisors/vmware/src/com/cloud/storage/resource/VmwareStorageProcessor.java
@@ -943,7 +943,7 @@ public class VmwareStorageProcessor implements StorageProcessor {
TemplateObjectTO newTemplate = new TemplateObjectTO();
newTemplate.setPath(result.first());
- newTemplate.setSize(result.second());
+ newTemplate.setSize(result.third());
newTemplate.setFormat(ImageFormat.OVA);
return new CopyCmdAnswer(newTemplate);
} catch (Throwable e) {
@@ -1651,12 +1651,11 @@ public class VmwareStorageProcessor implements StorageProcessor {
}
DatastoreMO primaryDsMo = new DatastoreMO(hyperHost.getContext(), morPrimaryDs);
- Long size = restoreVolumeFromSecStorage(hyperHost, primaryDsMo,
+ restoreVolumeFromSecStorage(hyperHost, primaryDsMo,
newVolumeName, secondaryStorageUrl, backupPath, backedUpSnapshotUuid);
VolumeObjectTO newVol = new VolumeObjectTO();
newVol.setPath(newVolumeName);
- newVol.setSize(size);
return new CopyCmdAnswer(newVol);
} catch (Throwable e) {
if (e instanceof RemoteException) {