cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject git commit: updated refs/heads/4.4 to 71e0cff
Date Sat, 03 May 2014 12:02:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/4.4 1085695b5 -> 71e0cff46


CLOUDSTACK-6568:API:createVolume: Volume gets created with wrong domain
ID.


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

Branch: refs/heads/4.4
Commit: 71e0cff46ecbbce204032e6467a66cf740859f6e
Parents: 1085695
Author: Min Chen <min.chen@citrix.com>
Authored: Fri May 2 16:29:34 2014 -0700
Committer: Daan Hoogland <daan@onecht.net>
Committed: Sat May 3 14:02:16 2014 +0200

----------------------------------------------------------------------
 .../src/com/cloud/storage/VolumeApiServiceImpl.java | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/71e0cff4/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 680cd2e..2cf0512 100644
--- a/server/src/com/cloud/storage/VolumeApiServiceImpl.java
+++ b/server/src/com/cloud/storage/VolumeApiServiceImpl.java
@@ -379,10 +379,11 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         Account caller = CallContext.current().getCallingAccount();
 
         long ownerId = cmd.getEntityOwnerId();
+        Account owner = _accountMgr.getActiveAccountById(ownerId);
         Boolean displayVolume = cmd.getDisplayVolume();
 
         // permission check
-        _accountMgr.checkAccess(caller, null, _accountMgr.getActiveAccountById(ownerId));
+        _accountMgr.checkAccess(caller, null, owner);
 
         if (displayVolume == null) {
             displayVolume = true;
@@ -394,7 +395,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         }
 
         // Check that the resource limit for volumes won't be exceeded
-        _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.volume,
displayVolume);
+        _resourceLimitMgr.checkResourceLimit(owner, ResourceType.volume, displayVolume);
 
         Long zoneId = cmd.getZoneId();
         Long diskOfferingId = null;
@@ -529,7 +530,7 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
         }
 
         // Check that the resource limit for primary storage won't be exceeded
-        _resourceLimitMgr.checkResourceLimit(_accountMgr.getAccount(ownerId), ResourceType.primary_storage,
displayVolume, new Long(size));
+        _resourceLimitMgr.checkResourceLimit(owner, ResourceType.primary_storage, displayVolume,
new Long(size));
 
         // Verify that zone exists
         DataCenterVO zone = _dcDao.findById(zoneId);
@@ -553,13 +554,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
             userSpecifiedName = getRandomVolumeName();
         }
 
-        VolumeVO volume = commitVolume(cmd, caller, ownerId, displayVolume, zoneId, diskOfferingId,
size, minIops, maxIops, parentVolume, userSpecifiedName,
+        VolumeVO volume = commitVolume(cmd, caller, owner, displayVolume, zoneId, diskOfferingId,
size, minIops, maxIops, parentVolume, userSpecifiedName,
                 _uuidMgr.generateUuid(Volume.class, cmd.getCustomId()));
 
         return volume;
     }
 
-    private VolumeVO commitVolume(final CreateVolumeCmd cmd, final Account caller, final
long ownerId, final Boolean displayVolume, final Long zoneId,
+    private VolumeVO commitVolume(final CreateVolumeCmd cmd, final Account caller, final
Account owner, final Boolean displayVolume, final Long zoneId,
             final Long diskOfferingId, final Long size, final Long minIops, final Long maxIops,
final VolumeVO parentVolume, final String userSpecifiedName, final String uuid) {
         return Transaction.execute(new TransactionCallback<VolumeVO>() {
             @Override
@@ -569,15 +570,14 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
                 volume.setUuid(uuid);
         volume.setDataCenterId(zoneId);
         volume.setPodId(null);
-        volume.setAccountId(ownerId);
-        volume.setDomainId(((caller == null) ? Domain.ROOT_DOMAIN : caller.getDomainId()));
+                volume.setAccountId(owner.getId());
+                volume.setDomainId(owner.getDomainId());
         volume.setDiskOfferingId(diskOfferingId);
         volume.setSize(size);
         volume.setMinIops(minIops);
         volume.setMaxIops(maxIops);
         volume.setInstanceId(null);
         volume.setUpdated(new Date());
-        volume.setDomainId((caller == null) ? Domain.ROOT_DOMAIN : caller.getDomainId());
                 volume.setDisplayVolume(displayVolume);
         if (parentVolume != null) {
             volume.setTemplateId(parentVolume.getTemplateId());


Mime
View raw message