cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sanjaytripa...@apache.org
Subject git commit: updated refs/heads/master to b844155
Date Wed, 05 Nov 2014 11:09:09 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 083feab7c -> b84415524


CLOUDSTACK-7842: Wrong size column is getting updated with snapshot physical size in snapshot_store_ref
table.

Also fixed the issue that snapshot size with hypervisor XS >= 6.2.5 is not getting updated
in snapshot_store_ref table.


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

Branch: refs/heads/master
Commit: b8441552400e7372950ef2d64c4a73d7ccc27460
Parents: 083feab
Author: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Authored: Wed Nov 5 16:19:43 2014 +0530
Committer: Sanjay Tripathi <sanjay.tripathi@citrix.com>
Committed: Wed Nov 5 16:42:28 2014 +0530

----------------------------------------------------------------------
 .../cloudstack/storage/snapshot/SnapshotObject.java    |  2 +-
 .../datastore/ObjectInDataStoreManagerImpl.java        |  3 ++-
 .../resource/Xenserver625StorageProcessor.java         | 13 +++++++++----
 .../cloud/resourcelimit/ResourceLimitManagerImpl.java  |  2 +-
 .../cloud/storage/snapshot/SnapshotManagerImpl.java    |  9 ++++-----
 5 files changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8441552/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
----------------------------------------------------------------------
diff --git a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
index da8d341..c64f78f 100644
--- a/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
+++ b/engine/storage/snapshot/src/org/apache/cloudstack/storage/snapshot/SnapshotObject.java
@@ -288,7 +288,7 @@ public class SnapshotObject implements SnapshotInfo {
                 snapshotStore.setInstallPath(snapshotTO.getPath());
                 if (snapshotTO.getPhysicalSize() != null) {
                     // For S3 delta snapshot, physical size is currently not set
-                snapshotStore.setSize(snapshotTO.getPhysicalSize());
+                snapshotStore.setPhysicalSize(snapshotTO.getPhysicalSize());
                 }
                 if (snapshotTO.getParentSnapshotPath() == null) {
                     snapshotStore.setParentSnapshotId(0L);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8441552/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
----------------------------------------------------------------------
diff --git a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
index 82164ee..fbce860 100644
--- a/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
+++ b/engine/storage/src/org/apache/cloudstack/storage/datastore/ObjectInDataStoreManagerImpl.java
@@ -116,6 +116,7 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager
{
                 ss.setRole(dataStore.getRole());
                 ss.setVolumeId(snapshotInfo.getVolumeId());
                 ss.setSize(snapshotInfo.getSize()); // this is the virtual size of snapshot
in primary storage.
+                ss.setPhysicalSize(snapshotInfo.getSize()); // this physical size will get
updated with actual size once the snapshot backup is done.
                 SnapshotDataStoreVO snapshotDataStoreVO = snapshotDataStoreDao.findParent(dataStore.getRole(),
dataStore.getId(), snapshotInfo.getVolumeId());
                 if (snapshotDataStoreVO != null) {
                     ss.setParentSnapshotId(snapshotDataStoreVO.getSnapshotId());
@@ -156,7 +157,7 @@ public class ObjectInDataStoreManagerImpl implements ObjectInDataStoreManager
{
                     ss.setSnapshotId(obj.getId());
                     ss.setDataStoreId(dataStore.getId());
                     ss.setRole(dataStore.getRole());
-                    ss.setRole(dataStore.getRole());
+                    ss.setSize(snapshot.getSize());
                     ss.setVolumeId(snapshot.getVolumeId());
                     SnapshotDataStoreVO snapshotDataStoreVO = snapshotDataStoreDao.findParent(dataStore.getRole(),
dataStore.getId(), snapshot.getVolumeId());
                     if (snapshotDataStoreVO != null) {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8441552/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
----------------------------------------------------------------------
diff --git a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
index f531094..20baffd 100644
--- a/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
+++ b/plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/Xenserver625StorageProcessor.java
@@ -329,8 +329,8 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
                     }
                 }
             }
-            String backupUuid = dvdi.getUuid(conn);
-            return backupUuid;
+            String result = dvdi.getUuid(conn).concat("#").concat(dvdi.getPhysicalUtilisation(conn).toString());
+            return result;
         } catch (Exception e) {
             String msg = "Exception in backupsnapshot stage due to " + e.toString();
             s_logger.debug(msg);
@@ -392,6 +392,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
         String details = null;
         String snapshotBackupUuid = null;
         boolean fullbackup = Boolean.parseBoolean(options.get("fullSnapshot"));
+        Long physicalSize = null;
         try {
             SR primaryStorageSR = hypervisorResource.getSRByNameLabelandHost(conn, primaryStorageNameLabel);
             if (primaryStorageSR == null) {
@@ -431,6 +432,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
                     hypervisorResource.checkForSuccess(conn, task);
                     VDI backedVdi = Types.toVDI(task, conn);
                     snapshotBackupUuid = backedVdi.getUuid(conn);
+                    physicalSize = backedVdi.getPhysicalUtilisation(conn);
 
                     if( destStore instanceof SwiftTO) {
                         try {
@@ -488,9 +490,11 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
                         throw new CloudRuntimeException("S3 upload of snapshots " + snapshotPaUuid
+ " failed");
                     }
                 } else {
-                    snapshotBackupUuid = backupSnapshot(conn, primaryStorageSRUuid, localMountPoint,
folder,
+                    String result = backupSnapshot(conn, primaryStorageSRUuid, localMountPoint,
folder,
                             secondaryStorageMountPath, snapshotUuid, prevBackupUuid, prevSnapshotUuid,
isISCSI, wait);
-
+                    String[] tmp = result.split("#");
+                    snapshotBackupUuid = tmp[0];
+                    physicalSize = Long.parseLong(tmp[1]);
                     finalPath = folder + File.separator + snapshotBackupUuid;
                 }
             }
@@ -499,6 +503,7 @@ public class Xenserver625StorageProcessor extends XenServerStorageProcessor
{
 
             SnapshotObjectTO newSnapshot = new SnapshotObjectTO();
             newSnapshot.setPath(finalPath);
+            newSnapshot.setPhysicalSize(physicalSize);
             if (fullbackup) {
                 newSnapshot.setParentSnapshotPath(null);
             } else {

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8441552/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
index d15b68a..fd348af 100755
--- a/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
+++ b/server/src/com/cloud/resourcelimit/ResourceLimitManagerImpl.java
@@ -198,7 +198,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
         templateSizeSearch.done();
 
         snapshotSizeSearch = _snapshotDataStoreDao.createSearchBuilder(SumCount.class);
-        snapshotSizeSearch.select("sum", Func.SUM, snapshotSizeSearch.entity().getSize());
+        snapshotSizeSearch.select("sum", Func.SUM, snapshotSizeSearch.entity().getPhysicalSize());
         snapshotSizeSearch.and("state", snapshotSizeSearch.entity().getState(), Op.EQ);
         snapshotSizeSearch.and("storeRole", snapshotSizeSearch.entity().getRole(), Op.EQ);
         SearchBuilder<SnapshotVO> join2 = _snapshotDao.createSearchBuilder();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/b8441552/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
index 1625889..10449e3 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -448,7 +448,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
                     SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId,
DataStoreRole.Image);
 
                     if (snapshotStoreRef != null) {
-                        _resourceLimitMgr.decrementResourceCount(snapshotCheck.getAccountId(),
ResourceType.secondary_storage, new Long(snapshotStoreRef.getSize()));
+                        _resourceLimitMgr.decrementResourceCount(snapshotCheck.getAccountId(),
ResourceType.secondary_storage, new Long(snapshotStoreRef.getPhysicalSize()));
                     }
                 }
             }
@@ -642,7 +642,7 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
                     if (Type.MANUAL == snapshot.getRecurringType()) {
                         _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
                         if  (snapshotStoreRef != null) {
-                            _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,
new Long(snapshotStoreRef.getSize()));
+                            _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.secondary_storage,
new Long(snapshotStoreRef.getPhysicalSize()));
                         }
                     }
 
@@ -991,11 +991,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             try {
                 postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());
                 SnapshotDataStoreVO snapshotStoreRef = _snapshotStoreDao.findBySnapshot(snapshotId,
DataStoreRole.Image);
-                // FIXME - snapshotStoreRef.getSize() refers to physical size, correct that
                 UsageEventUtils.publishUsageEvent(EventTypes.EVENT_SNAPSHOT_CREATE, snapshot.getAccountId(),
snapshot.getDataCenterId(), snapshotId, snapshot.getName(),
-                    null, null, snapshotStoreRef.getSize(), volume.getSize(), snapshot.getClass().getName(),
snapshot.getUuid());
+                    null, null, snapshotStoreRef.getPhysicalSize(), volume.getSize(), snapshot.getClass().getName(),
snapshot.getUuid());
                 // Correct the resource count of snapshot in case of delta snapshots.
-                _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage,
new Long(volume.getSize() - snapshotStoreRef.getSize()));
+                _resourceLimitMgr.decrementResourceCount(snapshotOwner.getId(), ResourceType.secondary_storage,
new Long(volume.getSize() - snapshotStoreRef.getPhysicalSize()));
             } catch (Exception e) {
                 s_logger.debug("post process snapshot failed", e);
             }


Mime
View raw message