cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bfede...@apache.org
Subject [20/50] [abbrv] Squashed & merged commit of the following:
Date Thu, 24 Oct 2013 18:30:58 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
index 3eaeb1f..82dc347 100644
--- a/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/default/src/org/apache/cloudstack/storage/datastore/driver/CloudStackPrimaryDataStoreDriverImpl.java
@@ -18,6 +18,35 @@
  */
 package org.apache.cloudstack.storage.datastore.driver;
 
+import java.util.UUID;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
+import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
+import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
+import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
+import org.apache.cloudstack.storage.command.CommandResult;
+import org.apache.cloudstack.storage.command.CopyCmdAnswer;
+import org.apache.cloudstack.storage.command.CopyCommand;
+import org.apache.cloudstack.storage.command.CreateObjectCommand;
+import org.apache.cloudstack.storage.command.DeleteCommand;
+import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
+import org.apache.cloudstack.storage.to.TemplateObjectTO;
+import org.apache.cloudstack.storage.volume.VolumeObject;
+import org.apache.log4j.Logger;
+
 import com.cloud.agent.api.Answer;
 import com.cloud.agent.api.storage.ResizeVolumeAnswer;
 import com.cloud.agent.api.storage.ResizeVolumeCommand;
@@ -42,25 +71,6 @@ import com.cloud.template.TemplateManager;
 import com.cloud.utils.NumbersUtil;
 import com.cloud.vm.dao.VMInstanceDao;
 
-import org.apache.cloudstack.engine.orchestration.service.VolumeOrchestrationService;
-import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
-import org.apache.cloudstack.engine.subsystem.api.storage.*;
-import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
-import org.apache.cloudstack.storage.command.CommandResult;
-import org.apache.cloudstack.storage.command.CopyCmdAnswer;
-import org.apache.cloudstack.storage.command.CopyCommand;
-import org.apache.cloudstack.storage.command.CreateObjectCommand;
-import org.apache.cloudstack.storage.command.DeleteCommand;
-import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
-import org.apache.cloudstack.storage.to.TemplateObjectTO;
-import org.apache.cloudstack.storage.volume.VolumeObject;
-
-import org.apache.log4j.Logger;
-
-import javax.inject.Inject;
-import java.util.UUID;
-
 public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
     private static final Logger s_logger = Logger.getLogger(CloudStackPrimaryDataStoreDriverImpl.class);
     @Inject
@@ -296,5 +306,4 @@ public class CloudStackPrimaryDataStoreDriverImpl implements PrimaryDataStoreDri
 
         callback.complete(result);
     }
-
 }

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
index ece7b26..75e8823 100644
--- a/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
+++ b/plugins/storage/volume/sample/src/org/apache/cloudstack/storage/datastore/driver/SamplePrimaryDataStoreDriverImpl.java
@@ -16,11 +16,18 @@
 // under the License.
 package org.apache.cloudstack.storage.datastore.driver;
 
-import com.cloud.agent.api.Answer;
-import com.cloud.agent.api.to.DataStoreTO;
-import com.cloud.agent.api.to.DataTO;
-import com.cloud.storage.dao.StoragePoolHostDao;
-import org.apache.cloudstack.engine.subsystem.api.storage.*;
+import javax.inject.Inject;
+
+import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPoint;
+import org.apache.cloudstack.engine.subsystem.api.storage.EndPointSelector;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCallbackDispatcher;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.framework.async.AsyncRpcContext;
@@ -29,7 +36,10 @@ import org.apache.cloudstack.storage.command.CreateObjectCommand;
 import org.apache.cloudstack.storage.datastore.DataObjectManager;
 import org.apache.log4j.Logger;
 
-import javax.inject.Inject;
+import com.cloud.agent.api.Answer;
+import com.cloud.agent.api.to.DataStoreTO;
+import com.cloud.agent.api.to.DataTO;
+import com.cloud.storage.dao.StoragePoolHostDao;
 
 public class SamplePrimaryDataStoreDriverImpl implements PrimaryDataStoreDriver {
     private static final Logger s_logger = Logger.getLogger(SamplePrimaryDataStoreDriverImpl.class);

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
----------------------------------------------------------------------
diff --git a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
index 8046b6c..a02474d 100644
--- a/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
+++ b/plugins/storage/volume/solidfire/src/org/apache/cloudstack/storage/datastore/driver/SolidfirePrimaryDataStoreDriver.java
@@ -20,12 +20,19 @@ import java.util.List;
 
 import javax.inject.Inject;
 
-import org.apache.cloudstack.engine.subsystem.api.storage.*;
+import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.CopyCommandResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.CreateCmdResult;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
+import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
+import org.apache.cloudstack.engine.subsystem.api.storage.PrimaryDataStoreDriver;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
+import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.framework.async.AsyncCompletionCallback;
 import org.apache.cloudstack.storage.command.CommandResult;
 import org.apache.cloudstack.storage.datastore.db.PrimaryDataStoreDao;
-import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailVO;
+import org.apache.cloudstack.storage.datastore.db.StoragePoolDetailsDao;
 import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.storage.datastore.util.SolidFireUtil;
 import org.apache.commons.lang.StringUtils;
@@ -39,9 +46,9 @@ import com.cloud.storage.Storage.StoragePoolType;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.VolumeDao;
 import com.cloud.storage.dao.VolumeDetailsDao;
-import com.cloud.user.AccountVO;
-import com.cloud.user.AccountDetailsDao;
 import com.cloud.user.AccountDetailVO;
+import com.cloud.user.AccountDetailsDao;
+import com.cloud.user.AccountVO;
 import com.cloud.user.dao.AccountDao;
 
 public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver {
@@ -122,10 +129,10 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
         String clusterAdminPassword = sfConnection.getClusterAdminPassword();
 
         long accountNumber = SolidFireUtil.createSolidFireAccount(mVip, mPort,
-            clusterAdminUsername, clusterAdminPassword, sfAccountName);
+                clusterAdminUsername, clusterAdminPassword, sfAccountName);
 
         return SolidFireUtil.getSolidFireAccountById(mVip, mPort,
-            clusterAdminUsername, clusterAdminPassword, accountNumber);
+                clusterAdminUsername, clusterAdminPassword, accountNumber);
     }
 
     private void updateCsDbWithAccountInfo(long csAccountId, SolidFireUtil.SolidFireAccount
sfAccount) {
@@ -174,18 +181,22 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
             _targetSecret = targetSecret;
         }
 
+        @Override
         public String getInitiatorUsername() {
             return _initiatorUsername;
         }
 
+        @Override
         public String getInitiatorSecret() {
             return _initiatorSecret;
         }
 
+        @Override
         public String getTargetUsername() {
             return _targetUsername;
         }
 
+        @Override
         public String getTargetSecret() {
             return _targetSecret;
         }
@@ -268,7 +279,7 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
         Long maxIops = volumeInfo.getMaxIops();
 
         if (minIops == null || minIops <= 0 ||
-            maxIops == null || maxIops <= 0) {
+                maxIops == null || maxIops <= 0) {
             long defaultMaxIops = getDefaultMaxIops(storagePoolId);
 
             iops = new Iops(getDefaultMinIops(storagePoolId), defaultMaxIops, getDefaultBurstIops(storagePoolId,
defaultMaxIops));
@@ -328,22 +339,22 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
             _minIops = minIops;
             _maxIops = maxIops;
             _burstIops = burstIops;
-    	}
-
-    	public long getMinIops()
-    	{
-    		return _minIops;
-    	}
-
-    	public long getMaxIops()
-    	{
-    		return _maxIops;
-    	}
-
-    	public long getBurstIops()
-    	{
-    		return _burstIops;
-    	}
+        }
+
+        public long getMinIops()
+        {
+            return _minIops;
+        }
+
+        public long getMaxIops()
+        {
+            return _maxIops;
+        }
+
+        public long getBurstIops()
+        {
+            return _burstIops;
+        }
     }
 
     private void deleteSolidFireVolume(VolumeInfo volumeInfo, SolidFireConnection sfConnection)
@@ -501,14 +512,14 @@ public class SolidfirePrimaryDataStoreDriver implements PrimaryDataStoreDriver
{
 
             _volumeDao.deleteVolumesByInstance(volumeInfo.getId());
 
-//            if (!sfAccountHasVolume(sfAccountId, sfConnection)) {
-//                // delete the account from the SolidFire SAN
-//                deleteSolidFireAccount(sfAccountId, sfConnection);
-//
-//                // delete the info in the account_details table
-//                // that's related to the SolidFire account
-//                _accountDetailsDao.deleteDetails(account.getAccountId());
-//            }
+            //            if (!sfAccountHasVolume(sfAccountId, sfConnection)) {
+            //                // delete the account from the SolidFire SAN
+            //                deleteSolidFireAccount(sfAccountId, sfConnection);
+            //
+            //                // delete the info in the account_details table
+            //                // that's related to the SolidFire account
+            //                _accountDetailsDao.deleteDetails(account.getAccountId());
+            //            }
 
             StoragePoolVO storagePool = _storagePoolDao.findById(storagePoolId);
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/server/src/com/cloud/api/ApiResponseHelper.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/api/ApiResponseHelper.java b/server/src/com/cloud/api/ApiResponseHelper.java
index 6978c9b..77be43f 100755
--- a/server/src/com/cloud/api/ApiResponseHelper.java
+++ b/server/src/com/cloud/api/ApiResponseHelper.java
@@ -31,8 +31,6 @@ import java.util.TimeZone;
 
 import javax.inject.Inject;
 
-import org.apache.log4j.Logger;
-
 import org.apache.cloudstack.acl.ControlledEntity;
 import org.apache.cloudstack.acl.ControlledEntity.ACLType;
 import org.apache.cloudstack.affinity.AffinityGroup;
@@ -134,6 +132,8 @@ import org.apache.cloudstack.api.response.VpnUsersResponse;
 import org.apache.cloudstack.api.response.ZoneResponse;
 import org.apache.cloudstack.config.Configuration;
 import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
 import org.apache.cloudstack.framework.jobs.AsyncJob;
 import org.apache.cloudstack.framework.jobs.AsyncJobManager;
 import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
@@ -144,6 +144,7 @@ import org.apache.cloudstack.storage.datastore.db.StoragePoolVO;
 import org.apache.cloudstack.usage.Usage;
 import org.apache.cloudstack.usage.UsageService;
 import org.apache.cloudstack.usage.UsageTypes;
+import org.apache.log4j.Logger;
 
 import com.cloud.api.query.ViewResponseHelper;
 import com.cloud.api.query.vo.AccountJoinVO;
@@ -257,6 +258,7 @@ import com.cloud.server.Criteria;
 import com.cloud.server.ResourceTag;
 import com.cloud.server.ResourceTag.TaggedResourceType;
 import com.cloud.service.ServiceOfferingVO;
+import com.cloud.storage.DataStoreRole;
 import com.cloud.storage.DiskOfferingVO;
 import com.cloud.storage.GuestOS;
 import com.cloud.storage.GuestOSCategoryVO;
@@ -281,6 +283,7 @@ import com.cloud.uservm.UserVm;
 import com.cloud.utils.Pair;
 import com.cloud.utils.StringUtils;
 import com.cloud.utils.db.EntityManager;
+import com.cloud.utils.exception.CloudRuntimeException;
 import com.cloud.utils.net.Ip;
 import com.cloud.utils.net.NetUtils;
 import com.cloud.vm.ConsoleProxyVO;
@@ -312,6 +315,8 @@ public class ApiResponseHelper implements ResponseGenerator {
     protected AsyncJobManager _jobMgr;
     @Inject
     ConfigurationManager _configMgr;
+    @Inject
+    SnapshotDataFactory snapshotfactory;
 
     @Override
     public UserResponse createUserResponse(User user) {
@@ -447,6 +452,19 @@ public class ApiResponseHelper implements ResponseGenerator {
         snapshotResponse.setIntervalType(ApiDBUtils.getSnapshotIntervalTypes(snapshot.getId()));
         snapshotResponse.setState(snapshot.getState());
 
+        SnapshotInfo snapshotInfo = null;
+        if (!(snapshot instanceof SnapshotInfo)) {
+            snapshotInfo = snapshotfactory.getSnapshot(snapshot.getId(), DataStoreRole.Image);
+        } else {
+            snapshotInfo = (SnapshotInfo)snapshot;
+        }
+
+        if (snapshotInfo == null) {
+            throw new CloudRuntimeException("Unable to find info for image store snapshot
with uuid '"+snapshot.getUuid()+"'");
+        }
+
+        snapshotResponse.setRevertable(snapshotInfo.isRevertable());
+
         // set tag information
         List<? extends ResourceTag> tags = ApiDBUtils.listByResourceTypeAndId(TaggedResourceType.Snapshot,
snapshot.getId());
         List<ResourceTagResponse> tagResponses = new ArrayList<ResourceTagResponse>();

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/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 dade983..7073c64 100755
--- a/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
+++ b/server/src/com/cloud/storage/snapshot/SnapshotManagerImpl.java
@@ -40,8 +40,8 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotService;
 import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy;
+import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotStrategy.SnapshotOperation;
 import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority;
-import org.apache.cloudstack.engine.subsystem.api.storage.StrategyPriority.Priority;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeDataFactory;
 import org.apache.cloudstack.engine.subsystem.api.storage.VolumeInfo;
 import org.apache.cloudstack.engine.subsystem.api.storage.ZoneScope;
@@ -278,17 +278,10 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             }
         }
 
-        StrategyPriority.sortStrategies(snapshotStrategies, snapshot);
-
-        SnapshotStrategy snapshotStrategy = null;
-        for (SnapshotStrategy strategy : snapshotStrategies) {
-            if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) {
-                snapshotStrategy = strategy;
-                break;
-            }
-        }
+        SnapshotStrategy snapshotStrategy = StrategyPriority.pickStrategy(snapshotStrategies,
snapshot, SnapshotOperation.REVERT);
 
         if (snapshotStrategy == null) {
+            s_logger.error("Unable to find snaphot strategy to handle snapshot with id '"+snapshotId+"'");
             return false;
         }
 
@@ -517,16 +510,13 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             throw new InvalidParameterValueException("unable to find a snapshot with id "
+ snapshotId);
         }
 
-        StrategyPriority.sortStrategies(snapshotStrategies, snapshotCheck);
-
         _accountMgr.checkAccess(caller, null, true, snapshotCheck);
-        SnapshotStrategy snapshotStrategy = null;
-        for (SnapshotStrategy strategy : snapshotStrategies) {
-            if (strategy.canHandle(snapshotCheck) != Priority.CANT_HANDLE) {
-                snapshotStrategy = strategy;
-                break;
-            }
+        SnapshotStrategy snapshotStrategy = StrategyPriority.pickStrategy(snapshotStrategies,
snapshotCheck, SnapshotOperation.DELETE);
+        if (snapshotStrategy == null) {
+            s_logger.error("Unable to find snaphot strategy to handle snapshot with id '"+snapshotId+"'");
+            return false;
         }
+
         try {
             boolean result = snapshotStrategy.deleteSnapshot(snapshotId);
             if (result) {
@@ -711,17 +701,12 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
             // Either way delete the snapshots for this volume.
             List<SnapshotVO> snapshots = listSnapsforVolume(volumeId);
             for (SnapshotVO snapshot : snapshots) {
-                SnapshotVO snap = _snapshotDao.findById(snapshot.getId());
-                SnapshotStrategy snapshotStrategy = null;
-
-                StrategyPriority.sortStrategies(snapshotStrategies, snapshot);
-
-                for (SnapshotStrategy strategy : snapshotStrategies) {
-                    if (strategy.canHandle(snap) != Priority.CANT_HANDLE) {
-                        snapshotStrategy = strategy;
-                        break;
-                    }
+                SnapshotStrategy snapshotStrategy = StrategyPriority.pickStrategy(snapshotStrategies,
snapshot, SnapshotOperation.DELETE);
+                if (snapshotStrategy == null) {
+                    s_logger.error("Unable to find snaphot strategy to handle snapshot with
id '"+snapshot.getId()+"'");
+                    continue;
                 }
+
                 if (snapshotStrategy.deleteSnapshot(snapshot.getId())) {
                     if (snapshot.getRecurringType() == Type.MANUAL) {
                         _resourceLimitMgr.decrementResourceCount(accountId, ResourceType.snapshot);
@@ -1045,22 +1030,16 @@ public class SnapshotManagerImpl extends ManagerBase implements SnapshotManager,
         Long snapshotId = payload.getSnapshotId();
         Account snapshotOwner = payload.getAccount();
         SnapshotInfo snapshot = snapshotFactory.getSnapshot(snapshotId, volume.getDataStore());
-        boolean processed = false;
-
-        StrategyPriority.sortStrategies(snapshotStrategies, snapshot);
 
         try {
-            for (SnapshotStrategy strategy : snapshotStrategies) {
-                if (strategy.canHandle(snapshot) != Priority.CANT_HANDLE) {
-                    processed = true;
-                    snapshot = strategy.takeSnapshot(snapshot);
-                    break;
-                }
-            }
-            if (!processed) {
+            SnapshotStrategy snapshotStrategy = StrategyPriority.pickStrategy(snapshotStrategies,
snapshot, SnapshotOperation.TAKE);
+
+            if (snapshotStrategy == null) {
                 throw new CloudRuntimeException("Can't find snapshot strategy to deal with
snapshot:" + snapshotId);
             }
 
+            snapshotStrategy.takeSnapshot(snapshot);
+
             try {
                 postCreateSnapshot(volume.getId(), snapshotId, payload.getSnapshotPolicyId());
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0ed7ebd7/ui/scripts/storage.js
----------------------------------------------------------------------
diff --git a/ui/scripts/storage.js b/ui/scripts/storage.js
index b16f4d4..314621e 100644
--- a/ui/scripts/storage.js
+++ b/ui/scripts/storage.js
@@ -1960,7 +1960,7 @@
             allowedActions.push("createTemplate");
             allowedActions.push("createVolume");
 
-            if (args.context.volumes[0].vmstate == "Stopped") {
+            if (jsonObj.revertable && args.context.volumes[0].vmstate == "Stopped")
{
                 allowedActions.push("revertSnapshot");
             }
         }


Mime
View raw message