cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject [1/2] git commit: updated refs/heads/master to 0f0d908
Date Thu, 30 Mar 2017 08:20:59 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 525c45c1e -> 0f0d90829


CLOUDSTACK-9851 travis CI build failure after merge of PR#1953


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

Branch: refs/heads/master
Commit: 7348f9412a20ecff2f7a9f26633013e06e5394dd
Parents: 525c45c
Author: Sudharma Jain <sudharma.jain@accelerite.com>
Authored: Tue Mar 28 17:57:28 2017 +0530
Committer: Sudharma Jain <sudharma.jain@accelerite.com>
Committed: Thu Mar 30 09:22:58 2017 +0530

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


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/7348f941/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 c073d5f..57804a7 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -1433,7 +1433,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         // that supported by hypervisor
         if (deviceId == null || deviceId.longValue() != 0) {
             List<VolumeVO> existingDataVolumes = _volsDao.findByInstanceAndType(vmId,
Volume.Type.DATADISK);
-            int maxAttachableDataVolumesSupported = getMaxDataVolumesSupported(vm) - 2; //IDs:
0 (ROOT) and 3 (CD-ROM) are reserved
+            int maxAttachableDataVolumesSupported = getMaxDataVolumesSupported(vm);
             if (existingDataVolumes.size() >= maxAttachableDataVolumesSupported) {
                 throw new InvalidParameterValueException("The specified VM already has the
maximum number of data disks (" + maxAttachableDataVolumesSupported + ") attached. Please
specify another VM.");
             }
@@ -2634,11 +2634,12 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
 
     private Long getDeviceId(UserVmVO vm, Long deviceId) {
         // allocate deviceId
-        int maxDeviceId = getMaxDataVolumesSupported(vm) - 1;
+        int maxDevices = getMaxDataVolumesSupported(vm) + 2; // add 2 to consider devices
root volume and cdrom
+        int maxDeviceId = maxDevices - 1;
         List<VolumeVO> vols = _volsDao.findByInstance(vm.getId());
         if (deviceId != null) {
-            if (deviceId.longValue() <= 0 || deviceId.longValue() > maxDeviceId ||
deviceId.longValue() == 3) {
-                throw new RuntimeException("deviceId should be 1,2,4-" + maxDeviceId);
+            if (deviceId.longValue() < 0 || deviceId.longValue() > maxDeviceId  ||
deviceId.longValue() == 3) {
+                throw new RuntimeException("deviceId should be 0,1,2,4-" + maxDeviceId);
             }
             for (VolumeVO vol : vols) {
                 if (vol.getDeviceId().equals(deviceId)) {


Mime
View raw message