You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ah...@apache.org on 2013/07/01 23:25:31 UTC
[47/50] [abbrv] Another merge from master. This is just getting
laborious
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/com/cloud/storage/VolumeManagerImpl.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/storage/VolumeManagerImpl.java
index da2f9c4,30fb322..585468b
--- a/server/src/com/cloud/storage/VolumeManagerImpl.java
+++ b/server/src/com/cloud/storage/VolumeManagerImpl.java
@@@ -41,9 -41,10 +41,10 @@@ import org.apache.cloudstack.api.comman
import org.apache.cloudstack.api.command.user.volume.ExtractVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.MigrateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
+import org.apache.cloudstack.api.command.user.volume.UpdateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
-
-import com.cloud.storage.dao.*;
-import org.apache.cloudstack.api.command.user.volume.*;
+import org.apache.cloudstack.context.CallContext;
++import org.apache.cloudstack.engine.subsystem.api.storage.ChapInfo;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreManager;
import org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProviderManager;
@@@ -517,10 -524,10 +522,10 @@@ public class VolumeManagerImpl extends
newVol.setFormat(oldVol.getFormat());
return _volsDao.persist(newVol);
}
-
+
@DB
protected VolumeInfo createVolumeFromSnapshot(VolumeVO volume,
- SnapshotVO snapshot) {
+ SnapshotVO snapshot) throws StorageUnavailableException {
Account account = _accountDao.findById(volume.getAccountId());
final HashSet<StoragePool> poolsToAvoid = new HashSet<StoragePool>();
@@@ -544,10 -551,16 +549,16 @@@
while ((pool = storageMgr.findStoragePool(dskCh, dc, pod.first(), null, null,
null, poolsToAvoid)) != null) {
break;
-
+
}
}
-
+
+ if (pool == null) {
+ String msg = "There are no available storage pools to store the volume in";
+ s_logger.info(msg);
+ throw new StorageUnavailableException(msg, -1);
+ }
+
VolumeInfo vol = volFactory.getVolume(volume.getId());
DataStore store = dataStoreMgr.getDataStore(pool.getId(), DataStoreRole.Primary);
SnapshotInfo snapInfo = snapshotFactory.getSnapshot(snapshot.getId(), DataStoreRole.Image);
@@@ -1396,8 -1444,9 +1442,9 @@@
Long size = _tmpltMgr.getTemplateSize(template.getId(), vm.getDataCenterId());
VolumeVO vol = new VolumeVO(type, name, vm.getDataCenterId(),
- owner.getDomainId(), owner.getId(), offering.getId(), size);
+ owner.getDomainId(), owner.getId(), offering.getId(), size,
+ offering.getMinIops(), offering.getMaxIops(), null);
- vol.setFormat(this.getSupportedImageFormatForCluster(template.getHypervisorType()));
+ vol.setFormat(getSupportedImageFormatForCluster(template.getHypervisorType()));
if (vm != null) {
vol.setInstanceId(vm.getId());
}
@@@ -1536,12 -1585,12 +1583,12 @@@
if (storeForRootStoreScope.getScopeType() != storeForDataStoreScope.getScopeType()) {
throw new CloudRuntimeException("Can't move volume between scope: " + storeForDataStoreScope.getScopeType() + " and " + storeForRootStoreScope.getScopeType());
}
-
+
return !storeForRootStoreScope.isSameScope(storeForDataStoreScope);
}
-
+
- private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volume, Long deviceId) {
- String errorMsg = "Failed to attach volume: " + volume.getName()
+ private VolumeVO sendAttachVolumeCommand(UserVmVO vm, VolumeVO volumeToAttach, Long deviceId) {
+ String errorMsg = "Failed to attach volume: " + volumeToAttach.getName()
+ " to VM: " + vm.getHostName();
boolean sendCommand = (vm.getState() == State.Running);
AttachAnswer answer = null;
@@@ -1928,14 -2031,9 +2019,9 @@@
}
}
-
-
-
-
-
@DB
protected VolumeVO switchVolume(VolumeVO existingVolume,
- VirtualMachineProfile<? extends VirtualMachine> vm)
+ VirtualMachineProfile vm)
throws StorageUnavailableException {
Transaction txn = Transaction.currentTxn();
@@@ -2222,16 -2323,16 +2308,16 @@@
}
if (vm.getType() == VirtualMachine.Type.User) {
- UserVmVO userVM = (UserVmVO) vm.getVirtualMachine();
+ UserVm userVM = _entityMgr.findById(UserVm.class, vm.getId());
if (userVM.getIsoId() != null) {
DataTO dataTO = tmplFactory.getTemplate(userVM.getIsoId(), DataStoreRole.Image, userVM.getDataCenterId()).getTO();
- DiskTO iso = new DiskTO(dataTO, 3L, Volume.Type.ISO);
+ DiskTO iso = new DiskTO(dataTO, 3L, null, Volume.Type.ISO);
- vm.addDisk(iso);
+ vm.addDisk(iso);
+ }
}
}
- }
-
+
private static enum VolumeTaskType {
RECREATE,
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/com/cloud/storage/secondary/SecondaryStorageManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/com/cloud/template/TemplateAdapterBase.java
----------------------------------------------------------------------
diff --cc server/src/com/cloud/template/TemplateAdapterBase.java
index 25b2984,c5d4a6b..88909d8
--- a/server/src/com/cloud/template/TemplateAdapterBase.java
+++ b/server/src/com/cloud/template/TemplateAdapterBase.java
@@@ -223,17 -223,17 +223,17 @@@ public abstract class TemplateAdapterBa
@Override
public TemplateProfile prepare(RegisterTemplateCmd cmd) throws ResourceAllocationException {
//check if the caller can operate with the template owner
- Account caller = UserContext.current().getCaller();
+ Account caller = CallContext.current().getCallingAccount();
Account owner = _accountMgr.getAccount(cmd.getEntityOwnerId());
_accountMgr.checkAccess(caller, null, true, owner);
-
+
-
+ boolean isRouting = (cmd.isRoutingType() == null) ? false : cmd.isRoutingType();
-
- return prepare(false, UserContext.current().getCallerUserId(), cmd.getTemplateName(), cmd.getDisplayText(),
- cmd.getBits(), cmd.isPasswordEnabled(), cmd.getRequiresHvm(), cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(),
- cmd.isExtractable(), cmd.getFormat(), cmd.getOsTypeId(), cmd.getZoneId(), HypervisorType.getType(cmd.getHypervisor()),
+
+ return prepare(false, CallContext.current().getCallingUserId(), cmd.getTemplateName(), cmd.getDisplayText(),
+ cmd.getBits(), cmd.isPasswordEnabled(), cmd.getRequiresHvm(), cmd.getUrl(), cmd.isPublic(), cmd.isFeatured(),
+ cmd.isExtractable(), cmd.getFormat(), cmd.getOsTypeId(), cmd.getZoneId(), HypervisorType.getType(cmd.getHypervisor()),
cmd.getChecksum(), true, cmd.getTemplateTag(), owner, cmd.getDetails(), cmd.isSshKeyEnabled(), null, cmd.isDynamicallyScalable(),
- cmd.isRoutingType() ? TemplateType.ROUTING : TemplateType.USER);
+ isRouting ? TemplateType.ROUTING : TemplateType.USER);
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/com/cloud/template/TemplateManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/com/cloud/vm/UserVmManagerImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/src/org/apache/cloudstack/region/gslb/GlobalLoadBalancingRulesServiceImpl.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
----------------------------------------------------------------------
diff --cc server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
index c7675c8,7a61978..f71067d
--- a/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
+++ b/server/test/com/cloud/vpc/MockConfigurationManagerImpl.java
@@@ -604,8 -655,9 +604,9 @@@ public class MockConfigurationManagerIm
* @see com.cloud.configuration.ConfigurationManager#createDiskOffering(java.lang.Long, java.lang.String, java.lang.String, java.lang.Long, java.lang.String, boolean, boolean, boolean)
*/
@Override
- public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized, boolean localStorageRequired, boolean isDisplayOfferingEnabled,
+ public DiskOfferingVO createDiskOffering(Long domainId, String name, String description, Long numGibibytes, String tags, boolean isCustomized,
+ boolean localStorageRequired, boolean isDisplayOfferingEnabled, Boolean isCustomizedIops, Long minIops, Long maxIops,
- Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
+ Long bytesReadRate, Long bytesWriteRate, Long iopsReadRate, Long iopsWriteRate) {
// TODO Auto-generated method stub
return null;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/57bafc8f/setup/db/db/schema-410to420.sql
----------------------------------------------------------------------