cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mtutkow...@apache.org
Subject git commit: updated refs/heads/master to 8aa34d0
Date Tue, 27 Jan 2015 00:26:01 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master c84783166 -> 8aa34d048


Putting in an extra check to see if this volume is already attached to a VM


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

Branch: refs/heads/master
Commit: 8aa34d048ab3e459de6d254049f3a31dde42b50d
Parents: c847831
Author: Mike Tutkowski <mike.tutkowski@solidfire.com>
Authored: Mon Jan 26 16:59:26 2015 -0700
Committer: Mike Tutkowski <mike.tutkowski@solidfire.com>
Committed: Mon Jan 26 17:25:17 2015 -0700

----------------------------------------------------------------------
 server/src/com/cloud/storage/VolumeApiServiceImpl.java | 5 +++++
 1 file changed, 5 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8aa34d04/server/src/com/cloud/storage/VolumeApiServiceImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/VolumeApiServiceImpl.java b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
index 22c801f..f04656a 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1174,6 +1174,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
     private Volume orchestrateAttachVolumeToVM(Long vmId, Long volumeId, Long deviceId) {
         VolumeInfo volumeToAttach = volFactory.getVolume(volumeId);
+
+        if (volumeToAttach.isAttachedVM()) {
+            throw new CloudRuntimeException("This volume is already attached to a VM.");
+        }
+
         UserVmVO vm = _userVmDao.findById(vmId);
         VolumeVO exstingVolumeOfVm = null;
         List<VolumeVO> rootVolumesOfVm = _volsDao.findByInstanceAndType(vmId, Volume.Type.ROOT);


Mime
View raw message