You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bf...@apache.org on 2013/11/21 23:11:29 UTC
[60/69] [abbrv] Reformat of source code to set a stable base for the
future. I couldn't get checkstyle enabled. There's still about a thousand
errors from checkstyle. Most of it from length errors from comments and
strings. Will attempt to remove tho
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/com/cloud/agent/api/to/VolumeTO.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/agent/api/to/VolumeTO.java
index 4dec4d8,c9bb2f9..eb1d918
--- a/api/src/com/cloud/agent/api/to/VolumeTO.java
+++ b/api/src/com/cloud/agent/api/to/VolumeTO.java
@@@ -135,8 -136,8 +137,8 @@@ public class VolumeTO implements Intern
public String getOsType() {
return guestOsType;
}
-
+
- public void setPath(String path){
+ public void setPath(String path) {
this.path = path;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/com/cloud/offering/DiskOffering.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/com/cloud/vm/DiskProfile.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/vm/DiskProfile.java
index 4412e3f,2f7cd96..d08b710
--- a/api/src/com/cloud/vm/DiskProfile.java
+++ b/api/src/com/cloud/vm/DiskProfile.java
@@@ -59,12 -59,20 +60,20 @@@ public class DiskProfile
}
public DiskProfile(Volume vol, DiskOffering offering, HypervisorType hyperType) {
- this(vol.getId(), vol.getVolumeType(), vol.getName(), offering.getId(), vol.getSize(), offering.getTagsArray(), offering.getUseLocalStorage(), offering.isCustomized(), null);
+ this(vol.getId(),
+ vol.getVolumeType(),
+ vol.getName(),
+ offering.getId(),
+ vol.getSize(),
+ offering.getTagsArray(),
+ offering.getUseLocalStorage(),
+ offering.isCustomized(),
+ null);
this.hyperType = hyperType;
}
-
+
public DiskProfile(DiskProfile dp) {
-
+
}
/**
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/com/cloud/vm/VirtualMachine.java
----------------------------------------------------------------------
diff --cc api/src/com/cloud/vm/VirtualMachine.java
index 3400898,f12aebc..331b8a3
--- a/api/src/com/cloud/vm/VirtualMachine.java
+++ b/api/src/com/cloud/vm/VirtualMachine.java
@@@ -33,10 -33,8 +33,8 @@@ import com.cloud.utils.fsm.StateObject
*/
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
- public enum PowerState {
+ public enum PowerState {
- PowerUnknown,
- PowerOn,
- PowerOff,
+ PowerUnknown, PowerOn, PowerOff,
}
public enum State {
@@@ -270,11 -257,9 +262,9 @@@
*/
long getTemplateId();
-
-
/**
* returns the guest OS ID
- *
+ *
* @return guestOSId
*/
long getGuestOSId();
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
index 8649890,affa106..3917cb5
--- a/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
+++ b/api/src/org/apache/cloudstack/api/response/DiskOfferingResponse.java
@@@ -24,65 -26,79 +26,82 @@@ import org.apache.cloudstack.api.Entity
import com.cloud.offering.DiskOffering;
import com.cloud.serializer.Param;
- import com.google.gson.annotations.SerializedName;
- @EntityReference(value=DiskOffering.class)
+ @EntityReference(value = DiskOffering.class)
public class DiskOfferingResponse extends BaseResponse {
- @SerializedName(ApiConstants.ID) @Param(description="unique ID of the disk offering")
+ @SerializedName(ApiConstants.ID)
+ @Param(description = "unique ID of the disk offering")
private String id;
- @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.")
+ @SerializedName(ApiConstants.DOMAIN_ID)
+ @Param(description = "the domain ID this disk offering belongs to. Ignore this information as it is not currently applicable.")
private String domainId;
- @SerializedName(ApiConstants.DOMAIN) @Param(description="the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.")
+ @SerializedName(ApiConstants.DOMAIN)
+ @Param(description = "the domain name this disk offering belongs to. Ignore this information as it is not currently applicable.")
private String domain;
- @SerializedName(ApiConstants.NAME) @Param(description="the name of the disk offering")
+ @SerializedName(ApiConstants.NAME)
+ @Param(description = "the name of the disk offering")
private String name;
- @SerializedName(ApiConstants.DISPLAY_TEXT) @Param(description="an alternate display text of the disk offering.")
+ @SerializedName(ApiConstants.DISPLAY_TEXT)
+ @Param(description = "an alternate display text of the disk offering.")
private String displayText;
- @SerializedName(ApiConstants.DISK_SIZE) @Param(description="the size of the disk offering in GB")
+ @SerializedName(ApiConstants.DISK_SIZE)
+ @Param(description = "the size of the disk offering in GB")
private Long diskSize;
- @SerializedName(ApiConstants.CREATED) @Param(description="the date this disk offering was created")
+ @SerializedName(ApiConstants.CREATED)
+ @Param(description = "the date this disk offering was created")
private Date created;
- @SerializedName("iscustomized") @Param(description="true if disk offering uses custom size, false otherwise")
+ @SerializedName("iscustomized")
+ @Param(description = "true if disk offering uses custom size, false otherwise")
private Boolean customized;
- @SerializedName("iscustomizediops") @Param(description="true if disk offering uses custom iops, false otherwise")
+ @SerializedName("iscustomizediops")
+ @Param(description = "true if disk offering uses custom iops, false otherwise")
private Boolean customizedIops;
- @SerializedName(ApiConstants.MIN_IOPS) @Param(description="the min iops of the disk offering")
+ @SerializedName(ApiConstants.MIN_IOPS)
+ @Param(description = "the min iops of the disk offering")
private Long minIops;
- @SerializedName(ApiConstants.MAX_IOPS) @Param(description="the max iops of the disk offering")
+ @SerializedName(ApiConstants.MAX_IOPS)
+ @Param(description = "the max iops of the disk offering")
private Long maxIops;
- @SerializedName(ApiConstants.TAGS) @Param(description="the tags for the disk offering")
+ @SerializedName(ApiConstants.TAGS)
+ @Param(description = "the tags for the disk offering")
private String tags;
- @SerializedName("storagetype") @Param(description="the storage type for this disk offering")
+ @SerializedName("storagetype")
+ @Param(description = "the storage type for this disk offering")
private String storageType;
- @SerializedName("diskBytesReadRate") @Param(description="bytes read rate of the disk offering")
+ @SerializedName("diskBytesReadRate")
+ @Param(description = "bytes read rate of the disk offering")
private Long bytesReadRate;
- @SerializedName("diskBytesWriteRate") @Param(description="bytes write rate of the disk offering")
+ @SerializedName("diskBytesWriteRate")
+ @Param(description = "bytes write rate of the disk offering")
private Long bytesWriteRate;
- @SerializedName("diskIopsReadRate") @Param(description="io requests read rate of the disk offering")
+ @SerializedName("diskIopsReadRate")
+ @Param(description = "io requests read rate of the disk offering")
private Long iopsReadRate;
- @SerializedName("diskIopsWriteRate") @Param(description="io requests write rate of the disk offering")
+ @SerializedName("diskIopsWriteRate")
+ @Param(description = "io requests write rate of the disk offering")
private Long iopsWriteRate;
+ @SerializedName("cacheMode") @Param(description="the cache mode to use for this disk offering. none, writeback or writethrough")
+ private String cacheMode;
+
- @SerializedName("displayoffering") @Param(description="whether to display the offering to the end user or not.")
+ @SerializedName("displayoffering")
+ @Param(description = "whether to display the offering to the end user or not.")
private Boolean displayOffering;
public Boolean getDisplayOffering() {
@@@ -190,14 -206,6 +209,14 @@@
this.maxIops = maxIops;
}
+ public String getCacheMode() {
- return this.cacheMode;
++ return cacheMode;
+ }
+
+ public void setCacheMode(String cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
public String getStorageType() {
return storageType;
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/api/src/org/apache/cloudstack/context/CallContext.java
----------------------------------------------------------------------
diff --cc api/src/org/apache/cloudstack/context/CallContext.java
index 3cdccc5,7a0b2d0..2d5aea4
--- a/api/src/org/apache/cloudstack/context/CallContext.java
+++ b/api/src/org/apache/cloudstack/context/CallContext.java
@@@ -40,12 -41,11 +41,11 @@@ import com.cloud.utils.exception.CloudR
public class CallContext {
private static final Logger s_logger = Logger.getLogger(CallContext.class);
private static ManagedThreadLocal<CallContext> s_currentContext = new ManagedThreadLocal<CallContext>();
- private static ManagedThreadLocal<Stack<CallContext>> s_currentContextStack =
- new ManagedThreadLocal<Stack<CallContext>>() {
+ private static ManagedThreadLocal<Stack<CallContext>> s_currentContextStack = new ManagedThreadLocal<Stack<CallContext>>() {
- @Override
- protected Stack<CallContext> initialValue() {
- return new Stack<CallContext>();
- }
+ @Override
+ protected Stack<CallContext> initialValue() {
+ return new Stack<CallContext>();
+ }
};
private String contextId;
@@@ -197,21 -197,9 +197,21 @@@
}
return register(user, account);
}
+
+ public static CallContext register(long callingUserId, long callingAccountId, String contextId) throws CloudAuthenticationException {
+ Account account = s_entityMgr.findById(Account.class, callingAccountId);
+ if (account == null) {
+ throw new CloudAuthenticationException("The account is no longer current.").add(Account.class, Long.toString(callingAccountId));
+ }
+ User user = s_entityMgr.findById(User.class, callingUserId);
+ if (user == null) {
+ throw new CloudAuthenticationException("The user is no longer current.").add(User.class, Long.toString(callingUserId));
+ }
+ return register(user, account, contextId);
+ }
public static void unregisterAll() {
- while ( unregister() != null ) {
+ while (unregister() != null) {
// NOOP
}
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/core/src/com/cloud/agent/api/AttachVolumeCommand.java
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
----------------------------------------------------------------------
diff --cc core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
index 732fa7b,4499049..11a3324
--- a/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
+++ b/core/src/org/apache/cloudstack/storage/to/VolumeObjectTO.java
@@@ -23,6 -21,7 +21,8 @@@ import org.apache.cloudstack.engine.sub
import com.cloud.agent.api.to.DataObjectType;
import com.cloud.agent.api.to.DataStoreTO;
import com.cloud.agent.api.to.DataTO;
+ import com.cloud.hypervisor.Hypervisor;
++import com.cloud.offering.DiskOffering.DiskCacheMode;
import com.cloud.storage.Storage;
import com.cloud.storage.Volume;
@@@ -53,57 -51,55 +53,56 @@@ public class VolumeObjectTO implements
}
public VolumeObjectTO(VolumeInfo volume) {
-- this.uuid = volume.getUuid();
-- this.path = volume.getPath();
-- this.accountId = volume.getAccountId();
++ uuid = volume.getUuid();
++ path = volume.getPath();
++ accountId = volume.getAccountId();
if (volume.getDataStore() != null) {
-- this.dataStore = volume.getDataStore().getTO();
++ dataStore = volume.getDataStore().getTO();
} else {
-- this.dataStore = null;
++ dataStore = null;
}
-- this.vmName = volume.getAttachedVmName();
-- this.size = volume.getSize();
-- this.setVolumeId(volume.getId());
-- this.chainInfo = volume.getChainInfo();
-- this.volumeType = volume.getVolumeType();
-- this.name = volume.getName();
-- this.setId(volume.getId());
-- this.format = volume.getFormat();
-- this.bytesReadRate = volume.getBytesReadRate();
-- this.bytesWriteRate = volume.getBytesWriteRate();
-- this.iopsReadRate = volume.getIopsReadRate();
-- this.iopsWriteRate = volume.getIopsWriteRate();
- this.cacheMode = volume.getCacheMode();
-- this.hypervisorType = volume.getHypervisorType();
++ vmName = volume.getAttachedVmName();
++ size = volume.getSize();
++ setVolumeId(volume.getId());
++ chainInfo = volume.getChainInfo();
++ volumeType = volume.getVolumeType();
++ name = volume.getName();
++ setId(volume.getId());
++ format = volume.getFormat();
++ bytesReadRate = volume.getBytesReadRate();
++ bytesWriteRate = volume.getBytesWriteRate();
++ iopsReadRate = volume.getIopsReadRate();
++ iopsWriteRate = volume.getIopsWriteRate();
++ cacheMode = volume.getCacheMode();
++ hypervisorType = volume.getHypervisorType();
setDeviceId(volume.getDeviceId());
}
public String getUuid() {
-- return this.uuid;
++ return uuid;
}
@Override
public String getPath() {
-- return this.path;
++ return path;
}
public Volume.Type getVolumeType() {
-- return this.volumeType;
++ return volumeType;
}
@Override
public DataStoreTO getDataStore() {
-- return this.dataStore;
++ return dataStore;
}
@Override
public Hypervisor.HypervisorType getHypervisorType() {
-- return this.hypervisorType;
++ return hypervisorType;
}
-
- public void setDataStore(DataStoreTO store){
- this.dataStore = store;
+ public void setDataStore(DataStoreTO store) {
- this.dataStore = store;
++ dataStore = store;
}
public void setDataStore(PrimaryDataStoreTO dataStore) {
@@@ -111,11 -107,11 +110,11 @@@
}
public String getName() {
-- return this.name;
++ return name;
}
public Long getSize() {
-- return this.size;
++ return size;
}
@Override
@@@ -234,12 -229,4 +232,11 @@@
this.deviceId = deviceId;
}
+ public void setCacheMode(DiskCacheMode cacheMode) {
+ this.cacheMode = cacheMode;
+ }
+
+ public DiskCacheMode getCacheMode() {
+ return cacheMode;
+ }
-
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/api/src/com/cloud/vm/VirtualMachineManager.java
----------------------------------------------------------------------
diff --cc engine/api/src/com/cloud/vm/VirtualMachineManager.java
index 9d19cf5,6757870..c78942f
--- a/engine/api/src/com/cloud/vm/VirtualMachineManager.java
+++ b/engine/api/src/com/cloud/vm/VirtualMachineManager.java
@@@ -122,19 -108,14 +113,20 @@@ public interface VirtualMachineManager
void migrateAway(String vmUuid, long hostId) throws InsufficientServerCapacityException;
void migrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException;
+
+ void orchestrateMigrate(String vmUuid, long srcHostId, DeployDestination dest) throws ResourceUnavailableException, ConcurrentOperationException;
- void migrateWithStorage(String vmUuid, long srcId, long destId, Map<Volume, StoragePool> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException;
+ void migrateWithStorage(String vmUuid, long srcId, long destId, Map<Volume, StoragePool> volumeToPool) throws ResourceUnavailableException,
+ ConcurrentOperationException;
-
+
+ void orchestrateMigrateWithStorage(String vmUuid, long srcId, long destId, Map<Volume, StoragePool> volumeToPool) throws ResourceUnavailableException, ConcurrentOperationException;
+
void reboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException;
+ void orchestrateReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException;
+
void advanceReboot(String vmUuid, Map<VirtualMachineProfile.Param, Object> params) throws InsufficientCapacityException, ResourceUnavailableException,
- ConcurrentOperationException, OperationTimedoutException;
+ ConcurrentOperationException, OperationTimedoutException;
/**
* Check to see if a virtual machine can be upgraded to the given service offering
@@@ -173,12 -152,8 +165,12 @@@
* @throws ResourceUnavailableException
* @throws InsufficientCapacityException
*/
- NicProfile addVmToNetwork(VirtualMachine vm, Network network, NicProfile requested) throws ConcurrentOperationException,
- ResourceUnavailableException, InsufficientCapacityException;
+ NicProfile addVmToNetwork(VirtualMachine vm, Network network, NicProfile requested) throws ConcurrentOperationException, ResourceUnavailableException,
+ InsufficientCapacityException;
+
+ NicProfile orchestrateAddVmToNetwork(VirtualMachine vm, Network network, NicProfile requested) throws ConcurrentOperationException,
+ ResourceUnavailableException, InsufficientCapacityException;
+
/**
* @param vm
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
----------------------------------------------------------------------
diff --cc engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
index a7dbf79,5f936ae..5cba79a
--- a/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
+++ b/engine/api/src/org/apache/cloudstack/engine/subsystem/api/storage/VolumeInfo.java
@@@ -43,9 -42,10 +43,12 @@@ public interface VolumeInfo extends Dat
boolean stateTransit(Volume.Event event);
Long getBytesReadRate();
+
Long getBytesWriteRate();
+
Long getIopsReadRate();
+
Long getIopsWriteRate();
+
+ DiskCacheMode getCacheMode();
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/433a6319/engine/components-api/src/com/cloud/alert/AlertManager.java
----------------------------------------------------------------------
diff --cc engine/components-api/src/com/cloud/alert/AlertManager.java
index eb5ac0c,a00f3bb..5aea465
--- a/engine/components-api/src/com/cloud/alert/AlertManager.java
+++ b/engine/components-api/src/com/cloud/alert/AlertManager.java
@@@ -51,18 -51,18 +51,20 @@@ public interface AlertManager extends M
public static final short ALERT_TYPE_LOCAL_STORAGE = 25;
public static final short ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = 26; // Generated when the resource limit exceeds the limit. Currently used for recurring snapshots only
+ public static final short ALERT_TYPE_SYNC = 27;
+
static final ConfigKey<Double> StorageCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.storage.capacity.notificationthreshold", "Alert", "0.75",
- "Percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available.", true, ConfigKey.Scope.Cluster, null);
+ "Percentage (as a value between 0 and 1) of storage utilization above which alerts will be sent about low storage available.", true, ConfigKey.Scope.Cluster,
+ null);
static final ConfigKey<Double> CPUCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.cpu.allocated.capacity.notificationthreshold", "Alert", "0.75",
"Percentage (as a value between 0 and 1) of cpu utilization above which alerts will be sent about low cpu available.", true, ConfigKey.Scope.Cluster, null);
- static final ConfigKey<Double> MemoryCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.memory.allocated.capacity.notificationthreshold", "Alert", "0.75",
- "Percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available.", true, ConfigKey.Scope.Cluster, null);
- static final ConfigKey<Double> StorageAllocatedCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.storage.allocated.capacity.notificationthreshold", "Alert",
- "0.75", "Percentage (as a value between 0 and 1) of allocated storage utilization above which alerts will be sent about low storage available.", true,
+ static final ConfigKey<Double> MemoryCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.memory.allocated.capacity.notificationthreshold", "Alert",
+ "0.75", "Percentage (as a value between 0 and 1) of memory utilization above which alerts will be sent about low memory available.", true,
+ ConfigKey.Scope.Cluster, null);
+ static final ConfigKey<Double> StorageAllocatedCapacityThreshold = new ConfigKey<Double>(Double.class, "cluster.storage.allocated.capacity.notificationthreshold",
+ "Alert", "0.75", "Percentage (as a value between 0 and 1) of allocated storage utilization above which alerts will be sent about low storage available.", true,
ConfigKey.Scope.Cluster, null);
-
+
void clearAlert(short alertType, long dataCenterId, long podId);
void sendAlert(short alertType, long dataCenterId, Long podId, String subject, String body);