cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From saks...@apache.org
Subject git commit: updated refs/heads/master to 690a5de
Date Mon, 24 Nov 2014 05:56:10 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 31db58f72 -> 690a5ded3


CLOUDSTACK-7962: VM Snaptshot should add check for root volume status also


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

Branch: refs/heads/master
Commit: 690a5ded358fe6f4d8671f497049f510d4894b1e
Parents: 31db58f
Author: Saksham Srivastava <saksham.srivastava@citrix.com>
Authored: Fri Nov 21 17:28:06 2014 +0530
Committer: Saksham Srivastava <saksham.srivastava@citrix.com>
Committed: Mon Nov 24 11:20:19 2014 +0530

----------------------------------------------------------------------
 .../com/cloud/vm/snapshot/VMSnapshotManagerImpl.java   | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/690a5ded/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
index 6590a74..4198320 100644
--- a/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
+++ b/server/src/com/cloud/vm/snapshot/VMSnapshotManagerImpl.java
@@ -29,7 +29,6 @@ import javax.naming.ConfigurationException;
 
 import org.apache.log4j.Logger;
 import org.springframework.stereotype.Component;
-
 import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
 import org.apache.cloudstack.context.CallContext;
 import org.apache.cloudstack.engine.subsystem.api.storage.StorageStrategyFactory;
@@ -62,6 +61,7 @@ import com.cloud.projects.Project.ListProjectResourcesCriteria;
 import com.cloud.service.dao.ServiceOfferingDetailsDao;
 import com.cloud.storage.Snapshot;
 import com.cloud.storage.SnapshotVO;
+import com.cloud.storage.Volume.Type;
 import com.cloud.storage.VolumeVO;
 import com.cloud.storage.dao.GuestOSDao;
 import com.cloud.storage.dao.SnapshotDao;
@@ -413,6 +413,17 @@ public class VMSnapshotManagerImpl extends ManagerBase implements VMSnapshotMana
         if (userVm == null) {
             throw new InvalidParameterValueException("Create vm to snapshot failed due to
vm: " + vmId + " is not found");
         }
+
+        List<VolumeVO> volumeVos = _volumeDao.findByInstanceAndType(vmId, Type.ROOT);
+        if(volumeVos == null ||volumeVos.isEmpty()) {
+            throw new CloudRuntimeException("Create vm to snapshot failed due to no root
disk found");
+        }
+
+        VolumeVO rootVolume = volumeVos.get(0);
+        if(!rootVolume.getState().equals(State.Running)) {
+            throw new CloudRuntimeException("Create vm to snapshot failed due to vm: " +
vmId + " has root disk in " + rootVolume.getState() + " state");
+        }
+
         VMSnapshotVO vmSnapshot = _vmSnapshotDao.findById(vmSnapshotId);
         if (vmSnapshot == null) {
             throw new CloudRuntimeException("VM snapshot id: " + vmSnapshotId + " can not
be found");


Mime
View raw message