You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by mt...@apache.org on 2013/08/14 20:38:51 UTC
git commit: updated refs/heads/4.2 to 4ee6a6d
Updated Branches:
refs/heads/4.2 3b9ea8ee4 -> 4ee6a6d3a
CLOUDSTACK-4331 - Enable more capacity from a managed storage device to be given to CloudStack
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/4ee6a6d3
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/4ee6a6d3
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/4ee6a6d3
Branch: refs/heads/4.2
Commit: 4ee6a6d3ab9d83edd5c6f1daa997d42ef3536645
Parents: 3b9ea8e
Author: Mike Tutkowski <mi...@solidfire.com>
Authored: Wed Aug 14 12:36:01 2013 -0600
Committer: Mike Tutkowski <mi...@solidfire.com>
Committed: Wed Aug 14 12:38:38 2013 -0600
----------------------------------------------------------------------
.../admin/storage/UpdateStoragePoolCmd.java | 15 +++++++
.../datastore/db/PrimaryDataStoreDao.java | 16 +++-----
.../datastore/db/PrimaryDataStoreDaoImpl.java | 9 ++---
.../com/cloud/storage/StorageManagerImpl.java | 42 +++++++++++++++++++-
4 files changed, 65 insertions(+), 17 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ee6a6d3/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
----------------------------------------------------------------------
diff --git a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
index 2ecb90f..f04ecbc 100644
--- a/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
+++ b/api/src/org/apache/cloudstack/api/command/admin/storage/UpdateStoragePoolCmd.java
@@ -47,6 +47,13 @@ public class UpdateStoragePoolCmd extends BaseCmd {
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma-separated list of tags for the storage pool")
private List<String> tags;
+ @Parameter(name=ApiConstants.CAPACITY_IOPS, type=CommandType.LONG,
+ required=false, description="IOPS CloudStack can provision from this storage pool")
+ private Long capacityIops;
+
+ @Parameter(name=ApiConstants.CAPACITY_BYTES, type=CommandType.LONG,
+ required=false, description="bytes CloudStack can provision from this storage pool")
+ private Long capacityBytes;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@@ -60,6 +67,14 @@ public class UpdateStoragePoolCmd extends BaseCmd {
return tags;
}
+ public Long getCapacityIops() {
+ return capacityIops;
+ }
+
+ public Long getCapacityBytes() {
+ return capacityBytes;
+ }
+
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ee6a6d3/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
index 669dd25..38dd884 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDao.java
@@ -28,7 +28,6 @@ import com.cloud.utils.db.GenericDao;
* Data Access Object for storage_pool table
*/
public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
-
/**
* @param datacenterId -- the id of the datacenter (availability zone)
*/
@@ -42,19 +41,16 @@ public interface PrimaryDataStoreDao extends GenericDao<StoragePoolVO, Long> {
/**
* Set capacity of storage pool in bytes
* @param id pool id.
- * @param capacity capacity in bytes
+ * @param capacityBytes capacity in bytes
*/
- void updateCapacity(long id, long capacity);
+ void updateCapacityBytes(long id, long capacityBytes);
/**
- * Set available bytes of storage pool in bytes
- *
- * @param id
- * pool id.
- * @param available
- * available capacity in bytes
+ * Set iops capacity of storage pool
+ * @param id pool id.
+ * @param capacityIops iops capacity
*/
- void updateAvailable(long id, long available);
+ void updateCapacityIops(long id, long capacityIops);
StoragePoolVO persist(StoragePoolVO pool, Map<String, String> details);
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ee6a6d3/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
----------------------------------------------------------------------
diff --git a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
index 96e18fc..2c27b0e 100644
--- a/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
+++ b/engine/api/src/org/apache/cloudstack/storage/datastore/db/PrimaryDataStoreDaoImpl.java
@@ -145,18 +145,17 @@ public class PrimaryDataStoreDaoImpl extends GenericDaoBase<StoragePoolVO, Long>
}
@Override
- public void updateAvailable(long id, long available) {
+ public void updateCapacityBytes(long id, long capacityBytes) {
StoragePoolVO pool = createForUpdate(id);
- pool.setUsedBytes(available);
+ pool.setCapacityBytes(capacityBytes);
update(id, pool);
}
@Override
- public void updateCapacity(long id, long capacity) {
+ public void updateCapacityIops(long id, long capacityIops) {
StoragePoolVO pool = createForUpdate(id);
- pool.setCapacityBytes(capacity);
+ pool.setCapacityIops(capacityIops);
update(id, pool);
-
}
@Override
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/4ee6a6d3/server/src/com/cloud/storage/StorageManagerImpl.java
----------------------------------------------------------------------
diff --git a/server/src/com/cloud/storage/StorageManagerImpl.java b/server/src/com/cloud/storage/StorageManagerImpl.java
index 2b94df2..4ce134e 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -791,6 +791,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
throw new IllegalArgumentException("Unable to find storage pool with ID: " + id);
}
+ Map<String, String> updatedDetails = new HashMap<String, String>();
+
if (tags != null) {
Map<String, String> existingDetails = _storagePoolDetailsDao.getDetails(id);
Set<String> existingKeys = existingDetails.keySet();
@@ -825,10 +827,46 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
details.put(existingKeyToKeep, existingValueToKeep);
}
- _storagePoolDao.updateDetails(id, details);
+ updatedDetails.putAll(details);
+ }
+
+ Long updatedCapacityBytes = null;
+ Long capacityBytes = cmd.getCapacityBytes();
+
+ if (capacityBytes != null) {
+ if (capacityBytes > pool.getCapacityBytes()) {
+ updatedCapacityBytes = capacityBytes;
+ }
+ else if (capacityBytes < pool.getCapacityBytes()) {
+ throw new CloudRuntimeException("The value of 'Capacity bytes' cannot be reduced in this version.");
+ }
+ }
+
+ Long updatedCapacityIops = null;
+ Long capacityIops = cmd.getCapacityIops();
+
+ if (capacityIops != null) {
+ if (capacityIops > pool.getCapacityIops()) {
+ updatedCapacityIops = capacityIops;
+ }
+ else if (capacityIops < pool.getCapacityIops()) {
+ throw new CloudRuntimeException("The value of 'Capacity IOPS' cannot be reduced in this version.");
+ }
+ }
+
+ if (updatedDetails.size() > 0) {
+ _storagePoolDao.updateDetails(id, updatedDetails);
+ }
+
+ if (updatedCapacityBytes != null) {
+ _storagePoolDao.updateCapacityBytes(id, capacityBytes);
+ }
+
+ if (updatedCapacityIops != null) {
+ _storagePoolDao.updateCapacityIops(id, capacityIops);
}
- return (PrimaryDataStoreInfo) dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
+ return (PrimaryDataStoreInfo)dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
}
@Override