You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by hu...@apache.org on 2014/06/27 15:16:17 UTC
git commit: updated refs/heads/master to 190116c
Repository: cloudstack
Updated Branches:
refs/heads/master 69e86cb45 -> 190116c94
Fix CID 1223793 Use equals to test equality of values contained in
objects.
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/190116c9
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/190116c9
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/190116c9
Branch: refs/heads/master
Commit: 190116c94cb082f876bbbaa4c5b374712e7266c9
Parents: 69e86cb
Author: Hugo Trippaers <ht...@schubergphilis.com>
Authored: Fri Jun 27 15:15:29 2014 +0200
Committer: Hugo Trippaers <ht...@schubergphilis.com>
Committed: Fri Jun 27 15:15:29 2014 +0200
----------------------------------------------------------------------
.../com/cloud/storage/StorageManagerImpl.java | 86 ++++++++++----------
1 file changed, 43 insertions(+), 43 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/190116c9/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 07ae695..06f2718 100755
--- a/server/src/com/cloud/storage/StorageManagerImpl.java
+++ b/server/src/com/cloud/storage/StorageManagerImpl.java
@@ -41,8 +41,6 @@ import javax.ejb.Local;
import javax.inject.Inject;
import javax.naming.ConfigurationException;
-import com.cloud.utils.DateUtil;
-import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
import org.apache.log4j.Logger;
import org.springframework.stereotype.Component;
@@ -91,6 +89,7 @@ import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.TemplateDataStoreVO;
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreDao;
import org.apache.cloudstack.storage.datastore.db.VolumeDataStoreVO;
+import org.apache.cloudstack.storage.image.datastore.ImageStoreEntity;
import com.cloud.agent.AgentManager;
import com.cloud.agent.api.Answer;
@@ -152,6 +151,7 @@ import com.cloud.template.TemplateManager;
import com.cloud.user.Account;
import com.cloud.user.AccountManager;
import com.cloud.user.dao.UserDao;
+import com.cloud.utils.DateUtil;
import com.cloud.utils.NumbersUtil;
import com.cloud.utils.Pair;
import com.cloud.utils.StringUtils;
@@ -458,7 +458,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
_storageCleanupInterval = NumbersUtil.parseInt(time, 86400);
s_logger.info("Storage cleanup enabled: " + _storageCleanupEnabled + ", interval: " + _storageCleanupInterval + ", template cleanup enabled: " +
- _templateCleanupEnabled);
+ _templateCleanupEnabled);
String cleanupInterval = configs.get("extract.url.cleanup.interval");
_downloadUrlCleanupInterval = NumbersUtil.parseInt(cleanupInterval, 7200);
@@ -743,7 +743,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (details.containsKey(existingKeyToKeep)) {
throw new CloudRuntimeException("Storage tag '" + existingKeyToKeep +
- "' conflicts with a stored property of this primary storage. No changes were made.");
+ "' conflicts with a stored property of this primary storage. No changes were made.");
}
details.put(existingKeyToKeep, existingValueToKeep);
@@ -765,7 +765,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
Long capacityIops = cmd.getCapacityIops();
if (capacityIops != null) {
- if (capacityIops != pool.getCapacityIops()) {
+ if (!capacityIops.equals(pool.getCapacityIops())) {
updatedCapacityIops = capacityIops;
}
}
@@ -908,8 +908,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
s_logger.debug("Total over provisioned capacity of the pool " + storagePool.getName() + " id: " + storagePool.getId() + " is " + totalOverProvCapacity);
if (capacities.size() == 0) {
CapacityVO capacity =
- new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
- capacityType);
+ new CapacityVO(storagePool.getId(), storagePool.getDataCenterId(), storagePool.getPodId(), storagePool.getClusterId(), allocated, totalOverProvCapacity,
+ capacityType);
if (storagePool.getScope() == ScopeType.ZONE) {
DataCenterVO dc = ApiDBUtils.findZoneById(storagePool.getDataCenterId());
@@ -943,7 +943,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
}
s_logger.debug("Successfully set Capacity - " + totalOverProvCapacity + " for capacity type - " + capacityType + " , DataCenterId - " +
- storagePool.getDataCenterId() + ", HostOrPoolId - " + storagePool.getId() + ", PodId " + storagePool.getPodId());
+ storagePool.getDataCenterId() + ", HostOrPoolId - " + storagePool.getId() + ", PodId " + storagePool.getPodId());
}
@Override
@@ -972,7 +972,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
}
if (hostIds == null || hostIds.isEmpty()) {
throw new StorageUnavailableException("Unable to send command to the pool " + pool.getId() + " due to there is no enabled hosts up in this cluster",
- pool.getId());
+ pool.getId());
}
for (Long hostId : hostIds) {
try {
@@ -1016,11 +1016,11 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
List<VMTemplateStoragePoolVO> unusedTemplatesInPool = _tmpltMgr.getUnusedTemplatesInPool(pool);
s_logger.debug("Storage pool garbage collector found " + unusedTemplatesInPool.size() + " templates to clean up in storage pool: " +
- pool.getName());
+ pool.getName());
for (VMTemplateStoragePoolVO templatePoolVO : unusedTemplatesInPool) {
if (templatePoolVO.getDownloadState() != VMTemplateStorageResourceAssoc.Status.DOWNLOADED) {
s_logger.debug("Storage pool garbage collector is skipping templatePoolVO with ID: " + templatePoolVO.getId() +
- " because it is not completely downloaded.");
+ " because it is not completely downloaded.");
continue;
}
@@ -1028,7 +1028,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
templatePoolVO.setMarkedForGC(true);
_vmTemplatePoolDao.update(templatePoolVO.getId(), templatePoolVO);
s_logger.debug("Storage pool garbage collector has marked templatePoolVO with ID: " + templatePoolVO.getId() +
- " for garbage collection.");
+ " for garbage collection.");
continue;
}
@@ -1131,7 +1131,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
long storeId = store.getId();
List<TemplateDataStoreVO> destroyedTemplateStoreVOs = _templateStoreDao.listDestroyed(storeId);
s_logger.debug("Secondary storage garbage collector found " + destroyedTemplateStoreVOs.size() +
- " templates to cleanup on template_store_ref for store: " + store.getName());
+ " templates to cleanup on template_store_ref for store: " + store.getName());
for (TemplateDataStoreVO destroyedTemplateStoreVO : destroyedTemplateStoreVOs) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Deleting template store DB entry: " + destroyedTemplateStoreVO);
@@ -1148,7 +1148,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
try {
List<SnapshotDataStoreVO> destroyedSnapshotStoreVOs = _snapshotStoreDao.listDestroyed(store.getId());
s_logger.debug("Secondary storage garbage collector found " + destroyedSnapshotStoreVOs.size() +
- " snapshots to cleanup on snapshot_store_ref for store: " + store.getName());
+ " snapshots to cleanup on snapshot_store_ref for store: " + store.getName());
for (SnapshotDataStoreVO destroyedSnapshotStoreVO : destroyedSnapshotStoreVOs) {
// check if this snapshot has child
SnapshotInfo snap = snapshotFactory.getSnapshot(destroyedSnapshotStoreVO.getSnapshotId(), store);
@@ -1176,7 +1176,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
try {
List<VolumeDataStoreVO> destroyedStoreVOs = _volumeStoreDao.listDestroyed(store.getId());
s_logger.debug("Secondary storage garbage collector found " + destroyedStoreVOs.size() + " volumes to cleanup on volume_store_ref for store: " +
- store.getName());
+ store.getName());
for (VolumeDataStoreVO destroyedStoreVO : destroyedStoreVOs) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Deleting volume store DB entry: " + destroyedStoreVO);
@@ -1219,7 +1219,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (!primaryStorage.getStatus().equals(StoragePoolStatus.Up) && !primaryStorage.getStatus().equals(StoragePoolStatus.ErrorInMaintenance)) {
throw new InvalidParameterValueException("Primary storage with id " + primaryStorageId + " is not ready for migration, as the status is:" +
- primaryStorage.getStatus().toString());
+ primaryStorage.getStatus().toString());
}
DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider(primaryStorage.getStorageProviderName());
@@ -1246,7 +1246,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (primaryStorage.getStatus().equals(StoragePoolStatus.Up) || primaryStorage.getStatus().equals(StoragePoolStatus.PrepareForMaintenance)) {
throw new StorageUnavailableException("Primary storage with id " + primaryStorageId + " is not ready to complete migration, as the status is:" +
- primaryStorage.getStatus().toString(), primaryStorageId);
+ primaryStorage.getStatus().toString(), primaryStorageId);
}
DataStoreProvider provider = dataStoreProviderMgr.getDataStoreProvider(primaryStorage.getStorageProviderName());
@@ -1293,8 +1293,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
StoragePoolVO pool = _storagePoolDao.findById(poolId);
// check if pool is in an inconsistent state
if (pool != null &&
- (pool.getStatus().equals(StoragePoolStatus.ErrorInMaintenance) || pool.getStatus().equals(StoragePoolStatus.PrepareForMaintenance) || pool.getStatus()
- .equals(StoragePoolStatus.CancelMaintenance))) {
+ (pool.getStatus().equals(StoragePoolStatus.ErrorInMaintenance) || pool.getStatus().equals(StoragePoolStatus.PrepareForMaintenance) || pool.getStatus()
+ .equals(StoragePoolStatus.CancelMaintenance))) {
_storagePoolWorkDao.removePendingJobsOnMsRestart(vo.getMsid(), poolId);
pool.setStatus(StoragePoolStatus.ErrorInMaintenance);
_storagePoolDao.update(poolId, pool);
@@ -1495,12 +1495,12 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
double usedPercentage = ((double)stats.getByteUsed() / (double)totalSize);
if (s_logger.isDebugEnabled()) {
s_logger.debug("Checking pool " + pool.getId() + " for storage, totalSize: " + pool.getCapacityBytes() + ", usedBytes: " + stats.getByteUsed() +
- ", usedPct: " + usedPercentage + ", disable threshold: " + storageUsedThreshold);
+ ", usedPct: " + usedPercentage + ", disable threshold: " + storageUsedThreshold);
}
if (usedPercentage >= storageUsedThreshold) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Insufficient space on pool: " + pool.getId() + " since its usage percentage: " + usedPercentage +
- " has crossed the pool.storage.capacity.disablethreshold: " + storageUsedThreshold);
+ " has crossed the pool.storage.capacity.disablethreshold: " + storageUsedThreshold);
}
return false;
}
@@ -1592,8 +1592,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (usedPercentage > storageAllocatedThreshold) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Insufficient un-allocated capacity on: " + pool.getId() + " for volume allocation: " + volumes.toString() +
- " since its allocated percentage: " + usedPercentage + " has crossed the allocated pool.storage.allocated.capacity.disablethreshold: " +
- storageAllocatedThreshold + ", skipping this pool");
+ " since its allocated percentage: " + usedPercentage + " has crossed the allocated pool.storage.allocated.capacity.disablethreshold: " +
+ storageAllocatedThreshold + ", skipping this pool");
}
return false;
}
@@ -1601,8 +1601,8 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
if (totalOverProvCapacity < (allocatedSizeWithtemplate + totalAskingSize)) {
if (s_logger.isDebugEnabled()) {
s_logger.debug("Insufficient un-allocated capacity on: " + pool.getId() + " for volume allocation: " + volumes.toString() +
- ", not enough storage, maxSize : " + totalOverProvCapacity + ", totalAllocatedSize : " + allocatedSizeWithtemplate + ", askingSize : " +
- totalAskingSize);
+ ", not enough storage, maxSize : " + totalOverProvCapacity + ", totalAllocatedSize : " + allocatedSizeWithtemplate + ", askingSize : " +
+ totalAskingSize);
}
return false;
}
@@ -1654,7 +1654,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
@Override
public ImageStore discoverImageStore(String name, String url, String providerName, Long dcId, Map details) throws IllegalArgumentException, DiscoveryException,
- InvalidParameterValueException {
+ InvalidParameterValueException {
DataStoreProvider storeProvider = _dataStoreProviderMgr.getDataStoreProvider(providerName);
if (storeProvider == null) {
@@ -1750,7 +1750,7 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
@Override
public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException,
- InvalidParameterValueException {
+ InvalidParameterValueException {
// check if current cloud is ready to migrate, we only support cloud with only NFS secondary storages
List<ImageStoreVO> imgStores = _imageStoreDao.listImageStores();
List<ImageStoreVO> nfsStores = new ArrayList<ImageStoreVO>();
@@ -1849,14 +1849,14 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus status) {
- // first delete from image_store_details table, we need to do that since
- // we are not actually deleting record from main
- // image_data_store table, so delete cascade will not work
- _imageStoreDetailsDao.deleteDetails(storeId);
- _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.Image);
- _volumeStoreDao.deletePrimaryRecordsForStore(storeId);
- _templateStoreDao.deletePrimaryRecordsForStore(storeId);
- _imageStoreDao.remove(storeId);
+ // first delete from image_store_details table, we need to do that since
+ // we are not actually deleting record from main
+ // image_data_store table, so delete cascade will not work
+ _imageStoreDetailsDao.deleteDetails(storeId);
+ _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.Image);
+ _volumeStoreDao.deletePrimaryRecordsForStore(storeId);
+ _templateStoreDao.deletePrimaryRecordsForStore(storeId);
+ _imageStoreDao.remove(storeId);
}
});
@@ -1961,14 +1961,14 @@ public class StorageManagerImpl extends ManagerBase implements StorageManager, C
Transaction.execute(new TransactionCallbackNoReturn() {
@Override
public void doInTransactionWithoutResult(TransactionStatus status) {
- // first delete from image_store_details table, we need to do that since
- // we are not actually deleting record from main
- // image_data_store table, so delete cascade will not work
- _imageStoreDetailsDao.deleteDetails(storeId);
- _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.ImageCache);
- _volumeStoreDao.deletePrimaryRecordsForStore(storeId);
- _templateStoreDao.deletePrimaryRecordsForStore(storeId);
- _imageStoreDao.remove(storeId);
+ // first delete from image_store_details table, we need to do that since
+ // we are not actually deleting record from main
+ // image_data_store table, so delete cascade will not work
+ _imageStoreDetailsDao.deleteDetails(storeId);
+ _snapshotStoreDao.deletePrimaryRecordsForStore(storeId, DataStoreRole.ImageCache);
+ _volumeStoreDao.deletePrimaryRecordsForStore(storeId);
+ _templateStoreDao.deletePrimaryRecordsForStore(storeId);
+ _imageStoreDao.remove(storeId);
}
});