Reformatted all of the code.

This commit is contained in:
Alex Huang 2013-11-21 06:15:26 -08:00
parent eaa250fd3c
commit d620df2bdd
3156 changed files with 43639 additions and 35957 deletions

View File

@ -35,9 +35,10 @@ import java.util.concurrent.atomic.AtomicInteger;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
import org.apache.log4j.Logger;
import org.apache.cloudstack.managed.context.ManagedContextTimerTask;
import com.cloud.agent.api.AgentControlAnswer;
import com.cloud.agent.api.AgentControlCommand;
import com.cloud.agent.api.Answer;
@ -132,11 +133,13 @@ public class Agent implements HandlerFactory, IAgentControl {
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
"UgentTask"));
_ugentTaskPool =
new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
"UgentTask"));
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
"agentRequest-Handler"));
_executor =
new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
"agentRequest-Handler"));
}
public Agent(IAgentShell shell, int localAgentId, ServerResource resource) throws ConfigurationException {
@ -168,14 +171,16 @@ public class Agent implements HandlerFactory, IAgentControl {
s_logger.debug("Adding shutdown hook");
Runtime.getRuntime().addShutdownHook(new ShutdownThread(this));
_ugentTaskPool = new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
"UgentTask"));
_ugentTaskPool =
new ThreadPoolExecutor(shell.getPingRetries(), 2 * shell.getPingRetries(), 10, TimeUnit.MINUTES, new SynchronousQueue<Runnable>(), new NamedThreadFactory(
"UgentTask"));
_executor = new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
"agentRequest-Handler"));
_executor =
new ThreadPoolExecutor(_shell.getWorkers(), 5 * _shell.getWorkers(), 1, TimeUnit.DAYS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory(
"agentRequest-Handler"));
s_logger.info("Agent [id = " + (_id != null ? _id : "new") + " : type = " + getResourceName() + " : zone = " + _shell.getZone() + " : pod = " + _shell.getPod() +
" : workers = " + _shell.getWorkers() + " : host = " + _shell.getHost() + " : port = " + _shell.getPort());
" : workers = " + _shell.getWorkers() + " : host = " + _shell.getHost() + " : port = " + _shell.getPort());
}
public String getVersion() {
@ -489,7 +494,7 @@ public class Agent implements HandlerFactory, IAgentControl {
} else {
if (cmd instanceof ReadyCommand) {
processReadyCommand((ReadyCommand)cmd);
processReadyCommand(cmd);
}
_inProgress.incrementAndGet();
try {

View File

@ -401,6 +401,7 @@ public class AgentShell implements IAgentShell, Daemon {
return _nextAgentId++;
}
@Override
public void start() {
try {
/* By default we only search for log4j.xml */
@ -444,10 +445,12 @@ public class AgentShell implements IAgentShell, Daemon {
}
}
@Override
public void stop() {
_exit = true;
}
@Override
public void destroy() {
}

View File

@ -20,7 +20,6 @@ import java.io.IOException;
import java.net.DatagramPacket;
import java.net.DatagramSocket;
import java.net.InetAddress;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.LinkedBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
@ -42,6 +41,7 @@ public class DhcpProtocolParserServer extends Thread {
_running = true;
}
@Override
public void run() {
while (_running) {
try {

View File

@ -33,6 +33,7 @@ public interface DhcpSnooper extends Adapter {
public Map<String, InetAddress> syncIpAddr();
@Override
public boolean stop();
public void initializeMacTable(List<Pair<String, String>> macVmNameList);

View File

@ -53,8 +53,8 @@ public class MockVmMgr implements VmMgr {
}
@Override
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP, String publicMac,
String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword) {
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP,
String publicMac, String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword) {
if (s_logger.isInfoEnabled()) {
StringBuffer sb = new StringBuffer();
@ -132,6 +132,7 @@ public class MockVmMgr implements VmMgr {
return false;
}
@Override
public MockVm getVm(String vmName) {
synchronized (this) {
MockVm vm = vms.get(vmName);

View File

@ -25,8 +25,8 @@ import com.cloud.vm.VirtualMachine.State;
public interface VmMgr {
public Set<String> getCurrentVMs();
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP, String publicMac,
String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword);
public String startVM(String vmName, String vnetId, String gateway, String dns, String privateIP, String privateMac, String privateMask, String publicIP,
String publicMac, String publicMask, int cpuCount, int cpuUtilization, long ramSize, String localPath, String vncPassword);
public String stopVM(String vmName, boolean force);

View File

@ -32,9 +32,9 @@ import com.cloud.agent.api.Command;
import com.cloud.agent.api.PingCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.agent.api.StartupRoutingCommand;
import com.cloud.agent.api.StartupRoutingCommand.VmState;
import com.cloud.agent.api.StartupStorageCommand;
import com.cloud.agent.api.StoragePoolInfo;
import com.cloud.agent.api.StartupRoutingCommand.VmState;
import com.cloud.host.Host;
import com.cloud.host.Host.Type;
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@ -110,14 +110,14 @@ public class DummyResource implements ServerResource {
protected void fillNetworkInformation(final StartupCommand cmd) {
cmd.setPrivateIpAddress((String)getConfiguredProperty("private.ip.address", "127.0.0.1"));
cmd.setPrivateMacAddress((String)getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
cmd.setPrivateNetmask((String)getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
cmd.setPrivateIpAddress(getConfiguredProperty("private.ip.address", "127.0.0.1"));
cmd.setPrivateMacAddress(getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
cmd.setPrivateNetmask(getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
cmd.setStorageIpAddress((String)getConfiguredProperty("private.ip.address", "127.0.0.1"));
cmd.setStorageMacAddress((String)getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
cmd.setStorageNetmask((String)getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
cmd.setGatewayIpAddress((String)getConfiguredProperty("gateway.ip.address", "127.0.0.1"));
cmd.setStorageIpAddress(getConfiguredProperty("private.ip.address", "127.0.0.1"));
cmd.setStorageMacAddress(getConfiguredProperty("private.mac.address", "8A:D2:54:3F:7C:C3"));
cmd.setStorageNetmask(getConfiguredProperty("private.ip.netmask", "255.255.255.0"));
cmd.setGatewayIpAddress(getConfiguredProperty("gateway.ip.address", "127.0.0.1"));
}
@ -133,13 +133,13 @@ public class DummyResource implements ServerResource {
}
protected StoragePoolInfo initializeLocalStorage() {
String hostIp = (String)getConfiguredProperty("private.ip.address", "127.0.0.1");
String localStoragePath = (String)getConfiguredProperty("local.storage.path", "/mnt");
String hostIp = getConfiguredProperty("private.ip.address", "127.0.0.1");
String localStoragePath = getConfiguredProperty("local.storage.path", "/mnt");
String lh = hostIp + localStoragePath;
String uuid = UUID.nameUUIDFromBytes(lh.getBytes()).toString();
String capacity = (String)getConfiguredProperty("local.storage.capacity", "1000000000");
String available = (String)getConfiguredProperty("local.storage.avail", "10000000");
String capacity = getConfiguredProperty("local.storage.capacity", "1000000000");
String available = getConfiguredProperty("local.storage.avail", "10000000");
return new StoragePoolInfo(uuid, hostIp, localStoragePath, localStoragePath, StoragePoolType.Filesystem, Long.parseLong(capacity), Long.parseLong(available));
@ -151,8 +151,9 @@ public class DummyResource implements ServerResource {
final List<Object> info = getHostInfo();
final StartupRoutingCommand cmd = new StartupRoutingCommand((Integer)info.get(0), (Long)info.get(1), (Long)info.get(2), (Long)info.get(4), (String)info.get(3),
HypervisorType.KVM, RouterPrivateIpStrategy.HostLocal, changes, null);
final StartupRoutingCommand cmd =
new StartupRoutingCommand((Integer)info.get(0), (Long)info.get(1), (Long)info.get(2), (Long)info.get(4), (String)info.get(3), HypervisorType.KVM,
RouterPrivateIpStrategy.HostLocal, changes, null);
fillNetworkInformation(cmd);
cmd.getHostDetails().putAll(getVersionStrings());
cmd.setCluster(getConfiguredProperty("cluster", "1"));

View File

@ -23,7 +23,6 @@ import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.FirewallRule.State;
import com.cloud.network.rules.FirewallRule.TrafficType;
import com.cloud.utils.net.NetUtils;
/**
@ -60,8 +59,8 @@ public class FirewallRuleTO implements InternalIdentity {
protected FirewallRuleTO() {
}
public FirewallRuleTO(long id, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded, FirewallRule.Purpose purpose,
List<String> sourceCidr, Integer icmpType, Integer icmpCode) {
public FirewallRuleTO(long id, String srcIp, String protocol, Integer srcPortStart, Integer srcPortEnd, boolean revoked, boolean alreadyAdded,
FirewallRule.Purpose purpose, List<String> sourceCidr, Integer icmpType, Integer icmpCode) {
this(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, purpose, sourceCidr, icmpType, icmpCode);
}
@ -157,7 +156,8 @@ public class FirewallRuleTO implements InternalIdentity {
this.trafficType = trafficType;
}
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType, boolean defaultEgressPolicy) {
public FirewallRuleTO(FirewallRule rule, String srcVlanTag, String srcIp, FirewallRule.Purpose purpose, FirewallRule.TrafficType trafficType,
boolean defaultEgressPolicy) {
this(rule.getId(),
srcVlanTag,
srcIp,
@ -213,6 +213,7 @@ public class FirewallRuleTO implements InternalIdentity {
return trafficType;
}
@Override
public long getId() {
return id;
}

View File

@ -31,8 +31,8 @@ import com.cloud.network.lb.LoadBalancingRule.LbAutoScaleVmProfile;
import com.cloud.network.lb.LoadBalancingRule.LbCondition;
import com.cloud.network.lb.LoadBalancingRule.LbDestination;
import com.cloud.network.lb.LoadBalancingRule.LbHealthCheckPolicy;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.network.lb.LoadBalancingRule.LbSslCert;
import com.cloud.network.lb.LoadBalancingRule.LbStickinessPolicy;
import com.cloud.utils.Pair;
public class LoadBalancerTO {
@ -83,7 +83,8 @@ public class LoadBalancerTO {
}
public LoadBalancerTO(String id, String srcIp, int srcPort, String protocol, String algorithm, boolean revoked, boolean alreadyAdded, boolean inline,
List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert, String lbProtocol) {
List<LbDestination> arg_destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies, LbSslCert sslCert,
String lbProtocol) {
this(id, srcIp, srcPort, protocol, algorithm, revoked, alreadyAdded, inline, arg_destinations);
this.stickinessPolicies = null;
this.healthCheckPolicies = null;
@ -106,8 +107,9 @@ public class LoadBalancerTO {
this.healthCheckPolicies = new HealthCheckPolicyTO[MAX_HEALTHCHECK_POLICIES];
int index = 0;
for (LbHealthCheckPolicy hcp : healthCheckPolicies) {
this.healthCheckPolicies[0] = new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(), hcp.getResponseTime(), hcp.getHealthcheckInterval(),
hcp.getHealthcheckThresshold(), hcp.getUnhealthThresshold(), hcp.isRevoked());
this.healthCheckPolicies[0] =
new HealthCheckPolicyTO(hcp.getpingpath(), hcp.getDescription(), hcp.getResponseTime(), hcp.getHealthcheckInterval(), hcp.getHealthcheckThresshold(),
hcp.getUnhealthThresshold(), hcp.isRevoked());
index++;
if (index == MAX_HEALTHCHECK_POLICIES)
break;
@ -215,7 +217,8 @@ public class LoadBalancerTO {
private int unhealthThresshold;
private boolean revoke = false;
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
public HealthCheckPolicyTO(String pingPath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold,
boolean revoke) {
this.description = description;
this.pingPath = pingPath;
@ -411,8 +414,9 @@ public class LoadBalancerTO {
private final String vmName;
private final String networkId;
public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey, String serviceOfferingId,
String templateId, String vmName, String networkId, String otherDeployParams, List<Pair<String, String>> counterParamList, Integer destroyVmGraceperiod) {
public AutoScaleVmProfileTO(String zoneId, String domainId, String cloudStackApiUrl, String autoScaleUserApiKey, String autoScaleUserSecretKey,
String serviceOfferingId, String templateId, String vmName, String networkId, String otherDeployParams, List<Pair<String, String>> counterParamList,
Integer destroyVmGraceperiod) {
this.zoneId = zoneId;
this.domainId = domainId;
this.serviceOfferingId = serviceOfferingId;
@ -487,8 +491,8 @@ public class LoadBalancerTO {
private final String state;
private final String currentState;
AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile, String state,
String currentState) {
AutoScaleVmGroupTO(String uuid, int minMembers, int maxMembers, int memberPort, int interval, List<AutoScalePolicyTO> policies, AutoScaleVmProfileTO profile,
String state, String currentState) {
this.uuid = uuid;
this.minMembers = minMembers;
this.maxMembers = maxMembers;
@ -551,20 +555,21 @@ public class LoadBalancerTO {
conditionTOs.add(conditionTO);
}
AutoScalePolicy autoScalePolicy = lbAutoScalePolicy.getPolicy();
autoScalePolicyTOs.add(new AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(), autoScalePolicy.getQuietTime(), autoScalePolicy.getAction(),
conditionTOs, lbAutoScalePolicy.isRevoked()));
autoScalePolicyTOs.add(new AutoScalePolicyTO(autoScalePolicy.getId(), autoScalePolicy.getDuration(), autoScalePolicy.getQuietTime(),
autoScalePolicy.getAction(), conditionTOs, lbAutoScalePolicy.isRevoked()));
}
LbAutoScaleVmProfile lbAutoScaleVmProfile = lbAutoScaleVmGroup.getProfile();
AutoScaleVmProfile autoScaleVmProfile = lbAutoScaleVmProfile.getProfile();
AutoScaleVmProfileTO autoScaleVmProfileTO = new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(), lbAutoScaleVmProfile.getCsUrl(),
lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(), lbAutoScaleVmProfile.getServiceOfferingId(),
lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(), lbAutoScaleVmProfile.getNetworkId(), autoScaleVmProfile.getOtherDeployParams(),
autoScaleVmProfile.getCounterParams(), autoScaleVmProfile.getDestroyVmGraceperiod());
AutoScaleVmProfileTO autoScaleVmProfileTO =
new AutoScaleVmProfileTO(lbAutoScaleVmProfile.getZoneId(), lbAutoScaleVmProfile.getDomainId(), lbAutoScaleVmProfile.getCsUrl(),
lbAutoScaleVmProfile.getAutoScaleUserApiKey(), lbAutoScaleVmProfile.getAutoScaleUserSecretKey(), lbAutoScaleVmProfile.getServiceOfferingId(),
lbAutoScaleVmProfile.getTemplateId(), lbAutoScaleVmProfile.getVmName(), lbAutoScaleVmProfile.getNetworkId(), autoScaleVmProfile.getOtherDeployParams(),
autoScaleVmProfile.getCounterParams(), autoScaleVmProfile.getDestroyVmGraceperiod());
AutoScaleVmGroup autoScaleVmGroup = lbAutoScaleVmGroup.getVmGroup();
autoScaleVmGroupTO = new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(),
autoScaleVmGroup.getMemberPort(), autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(),
lbAutoScaleVmGroup.getCurrentState());
autoScaleVmGroupTO =
new AutoScaleVmGroupTO(autoScaleVmGroup.getUuid(), autoScaleVmGroup.getMinMembers(), autoScaleVmGroup.getMaxMembers(), autoScaleVmGroup.getMemberPort(),
autoScaleVmGroup.getInterval(), autoScalePolicyTOs, autoScaleVmProfileTO, autoScaleVmGroup.getState(), lbAutoScaleVmGroup.getCurrentState());
}
}

View File

@ -20,10 +20,10 @@ package com.cloud.agent.api.to;
import java.util.ArrayList;
import java.util.List;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.NetworkACLItem.TrafficType;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.NetworkACLItem.TrafficType;
import com.cloud.utils.net.NetUtils;
public class NetworkACLTO implements InternalIdentity {
@ -95,6 +95,7 @@ public class NetworkACLTO implements InternalIdentity {
rule.getNumber());
}
@Override
public long getId() {
return id;
}

View File

@ -39,8 +39,8 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
this.dstPortRange = new int[] {rule.getDestinationPortStart(), rule.getDestinationPortEnd()};
}
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol, boolean revoked,
boolean alreadyAdded) {
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol,
boolean revoked, boolean alreadyAdded) {
super(id, null, srcIp, protocol, srcPortStart, srcPortEnd, revoked, alreadyAdded, FirewallRule.Purpose.PortForwarding, null, 0, 0);
this.dstIp = dstIp;
this.dstPortRange = new int[] {dstPortStart, dstPortEnd};

View File

@ -47,8 +47,9 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
}
public S3TO(final Long id, final String uuid, final String accessKey, final String secretKey, final String endPoint, final String bucketName, final Boolean httpsFlag,
final Integer connectionTimeout, final Integer maxErrorRetry, final Integer socketTimeout, final Date created, final boolean enableRRS, final long maxUploadSize) {
public S3TO(final Long id, final String uuid, final String accessKey, final String secretKey, final String endPoint, final String bucketName,
final Boolean httpsFlag, final Integer connectionTimeout, final Integer maxErrorRetry, final Integer socketTimeout, final Date created,
final boolean enableRRS, final long maxUploadSize) {
super();
@ -158,6 +159,7 @@ public final class S3TO implements S3Utils.ClientOptions, DataStoreTO {
this.id = id;
}
@Override
public String getUuid() {
return this.uuid;
}

View File

@ -42,6 +42,7 @@ public class SwiftTO implements DataStoreTO, SwiftUtil.SwiftClientCfg {
return id;
}
@Override
public String getUrl() {
return url;
}

View File

@ -35,6 +35,7 @@ public class TemplateTO implements InternalIdentity {
this.format = template.getFormat();
}
@Override
public long getId() {
return id;
}

View File

@ -61,8 +61,8 @@ public class VirtualMachineTO {
DiskTO[] disks;
NicTO[] nics;
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader, String os,
boolean enableHA, boolean limitCpuUse, String vncPassword) {
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
this.id = id;
this.name = instanceName;
this.type = type;

View File

@ -92,6 +92,7 @@ public class VolumeTO implements InternalIdentity {
this.deviceId = id;
}
@Override
public long getId() {
return id;
}

View File

@ -18,8 +18,6 @@ package com.cloud.configuration;
import java.util.List;
import javax.naming.NamingException;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
import org.apache.cloudstack.api.command.admin.network.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;

View File

@ -21,6 +21,7 @@ import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface DedicatedResources extends InfrastructureEntity, InternalIdentity, Identity {
@Override
long getId();
Long getDataCenterId();
@ -35,6 +36,7 @@ public interface DedicatedResources extends InfrastructureEntity, InternalIdenti
Long getAccountId();
@Override
String getUuid();
long getAffinityGroupId();

View File

@ -18,9 +18,10 @@ package com.cloud.deploy;
import java.util.List;
import org.apache.cloudstack.framework.config.ConfigKey;
import com.cloud.exception.InsufficientServerCapacityException;
import com.cloud.vm.VirtualMachineProfile;
import org.apache.cloudstack.framework.config.ConfigKey;
/**
*/
@ -29,20 +30,22 @@ public interface DeploymentClusterPlanner extends DeploymentPlanner {
static final String ClusterCPUCapacityDisableThresholdCK = "cluster.cpu.allocated.capacity.disablethreshold";
static final String ClusterMemoryCapacityDisableThresholdCK = "cluster.memory.allocated.capacity.disablethreshold";
static final ConfigKey<Float> ClusterCPUCapacityDisableThreshold = new ConfigKey<Float>(
Float.class,
ClusterCPUCapacityDisableThresholdCK,
"Alert",
"0.85",
"Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
true, ConfigKey.Scope.Cluster, null);
static final ConfigKey<Float> ClusterMemoryCapacityDisableThreshold = new ConfigKey<Float>(
Float.class,
ClusterMemoryCapacityDisableThresholdCK,
"Alert",
"0.85",
"Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
true, ConfigKey.Scope.Cluster, null);
static final ConfigKey<Float> ClusterCPUCapacityDisableThreshold =
new ConfigKey<Float>(
Float.class,
ClusterCPUCapacityDisableThresholdCK,
"Alert",
"0.85",
"Percentage (as a value between 0 and 1) of cpu utilization above which allocators will disable using the cluster for low cpu available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
true, ConfigKey.Scope.Cluster, null);
static final ConfigKey<Float> ClusterMemoryCapacityDisableThreshold =
new ConfigKey<Float>(
Float.class,
ClusterMemoryCapacityDisableThresholdCK,
"Alert",
"0.85",
"Percentage (as a value between 0 and 1) of memory utilization above which allocators will disable using the cluster for low memory available. Keep the corresponding notification threshold lower than this to be notified beforehand.",
true, ConfigKey.Scope.Cluster, null);
/**
* This is called to determine list of possible clusters where a virtual

View File

@ -60,6 +60,7 @@ public interface Domain extends OwnedBy, Identity, InternalIdentity {
String getNetworkDomain();
@Override
public String getUuid();
}

View File

@ -18,8 +18,9 @@
*/
package com.cloud.event;
import static java.lang.annotation.ElementType.*;
import static java.lang.annotation.RetentionPolicy.*;
import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
import java.lang.annotation.Retention;
import java.lang.annotation.Target;

View File

@ -16,10 +16,10 @@
// under the License.
package com.cloud.event;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
import org.apache.cloudstack.api.InternalIdentity;
public interface UsageEvent extends InternalIdentity {
String getType();

View File

@ -16,8 +16,6 @@
// under the License.
package com.cloud.exception;
import com.cloud.exception.CloudException;
public class AgentControlChannelException extends CloudException {
private static final long serialVersionUID = -310647782960500466L;

View File

@ -30,23 +30,10 @@ import com.cloud.utils.fsm.StateObject;
*/
public interface Host extends StateObject<Status>, Identity, InternalIdentity {
public enum Type {
Storage(false),
Routing(false),
SecondaryStorage(false),
SecondaryStorageCmdExecutor(false),
ConsoleProxy(true),
ExternalFirewall(false),
ExternalLoadBalancer(false),
ExternalVirtualSwitchSupervisor(false),
PxeServer(false),
BaremetalPxe(false),
BaremetalDhcp(false),
TrafficMonitor(false),
Storage(false), Routing(false), SecondaryStorage(false), SecondaryStorageCmdExecutor(false), ConsoleProxy(true), ExternalFirewall(false), ExternalLoadBalancer(
false), ExternalVirtualSwitchSupervisor(false), PxeServer(false), BaremetalPxe(false), BaremetalDhcp(false), TrafficMonitor(false),
ExternalDhcp(false),
SecondaryStorageVM(true),
LocalSecondaryStorage(false),
L2Networking(false);
ExternalDhcp(false), SecondaryStorageVM(true), LocalSecondaryStorage(false), L2Networking(false);
boolean _virtual;
private Type(boolean virtual) {

View File

@ -23,10 +23,15 @@ import com.cloud.utils.fsm.NoTransitionException;
import com.cloud.utils.fsm.StateMachine2;
public enum Status {
Creating(true, false, false), Connecting(true, false, false), Up(true, false, false), Down(true, true, true), Disconnected(true, true, true), Alert(true, true, true), Removed(
true,
false,
true), Error(true, false, true), Rebalancing(true, false, true);
Creating(true, false, false),
Connecting(true, false, false),
Up(true, false, false),
Down(true, true, true),
Disconnected(true, true, true),
Alert(true, true, true),
Removed(true, false, true),
Error(true, false, true),
Rebalancing(true, false, true);
private final boolean updateManagementServer;
private final boolean checkManagementServer;

View File

@ -21,6 +21,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface GuestVlan extends InternalIdentity, Identity {
@Override
public long getId();
public long getAccountId();

View File

@ -32,6 +32,7 @@ public interface MonitoringService extends ControlledEntity, Identity, InternalI
Dhcp, LoadBalancing, Ssh, Webserver,
}
@Override
long getId();
String getService();

View File

@ -19,7 +19,6 @@ package com.cloud.network;
import com.cloud.deploy.DeployDestination;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**

View File

@ -32,7 +32,6 @@ import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.GuestVlan;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
@ -51,12 +50,13 @@ public interface NetworkService {
List<? extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException, ConcurrentOperationException;
IpAddress allocateIP(Account ipOwner, long zoneId, Long networkId) throws ResourceAllocationException, InsufficientAddressCapacityException,
ConcurrentOperationException;
boolean releaseIpAddress(long ipAddressId) throws InsufficientAddressCapacityException;
IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException, InsufficientAddressCapacityException,
ConcurrentOperationException;
IpAddress allocatePortableIP(Account ipOwner, int regionId, Long zoneId, Long networkId, Long vpcId) throws ResourceAllocationException,
InsufficientAddressCapacityException, ConcurrentOperationException;
boolean releasePortableIpAddress(long ipAddressId);
@ -90,9 +90,11 @@ public interface NetworkService {
List<? extends Service> listNetworkServices(String providerName);
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId, List<String> enabledServices);
PhysicalNetworkServiceProvider addProviderToPhysicalNetwork(Long physicalNetworkId, String providerName, Long destinationPhysicalNetworkId,
List<String> enabledServices);
Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> listNetworkServiceProviders(Long physicalNetworkId, String name, String state, Long startIndex, Long pageSize);
Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> listNetworkServiceProviders(Long physicalNetworkId, String name, String state, Long startIndex,
Long pageSize);
PhysicalNetworkServiceProvider updateNetworkServiceProvider(Long id, String state, List<String> enabledServices);
@ -161,8 +163,9 @@ public interface NetworkService {
* @throws ConcurrentOperationException
* @throws ResourceAllocationException
*/
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri, String startIp, String endIP, String gateway, String netmask,
long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId) throws ResourceAllocationException, ConcurrentOperationException, InsufficientCapacityException;
Network createPrivateNetwork(String networkName, String displayText, long physicalNetworkId, String broadcastUri, String startIp, String endIP, String gateway,
String netmask, long networkOwnerId, Long vpcId, Boolean sourceNat, Long networkOfferingId) throws ResourceAllocationException, ConcurrentOperationException,
InsufficientCapacityException;
/* Requests an IP address for the guest nic */
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId, Long networkId, String ipaddress) throws InsufficientAddressCapacityException;

View File

@ -18,12 +18,11 @@ package com.cloud.network;
import java.util.List;
import com.cloud.host.Host;
import org.apache.cloudstack.api.command.admin.usage.AddTrafficMonitorCmd;
import org.apache.cloudstack.api.command.admin.usage.DeleteTrafficMonitorCmd;
import org.apache.cloudstack.api.command.admin.usage.ListTrafficMonitorsCmd;
import org.apache.cloudstack.api.response.TrafficMonitorResponse;
import com.cloud.host.Host;
import com.cloud.utils.component.Manager;
public interface NetworkUsageService extends Manager {

View File

@ -18,10 +18,11 @@ package com.cloud.network;
import java.util.List;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.utils.Pair;
/**
*
*/

View File

@ -31,6 +31,7 @@ public interface PhysicalNetworkServiceProvider extends InternalIdentity {
Disabled, Enabled, Shutdown;
}
@Override
long getId();
State getState();

View File

@ -26,6 +26,7 @@ public interface Site2SiteVpnConnection extends ControlledEntity, InternalIdenti
Pending, Connected, Disconnected, Error,
}
@Override
public long getId();
public String getUuid();

View File

@ -16,16 +16,16 @@
// under the License.
package com.cloud.network;
import java.util.List;
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterCmd;
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.router.VirtualRouter;
import com.cloud.user.Account;
import org.apache.cloudstack.api.command.admin.router.UpgradeRouterTemplateCmd;
import java.util.List;
public interface VirtualNetworkApplianceService {
/**

View File

@ -22,6 +22,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface AutoScalePolicy extends ControlledEntity, InternalIdentity {
@Override
long getId();
String getUuid();

View File

@ -27,6 +27,7 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
String State_Enabled = "enabled";
String State_Disabled = "disabled";
@Override
long getId();
@Override

View File

@ -29,6 +29,7 @@ import com.cloud.utils.Pair;
*/
public interface AutoScaleVmProfile extends ControlledEntity, InternalIdentity {
@Override
public long getId();
public String getUuid();

View File

@ -23,12 +23,11 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface DhcpServiceProvider extends NetworkElement {
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
InsufficientCapacityException, ResourceUnavailableException;
boolean addDhcpEntry(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean configDhcpSupportForSubnet(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;

View File

@ -20,7 +20,6 @@ import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.vpc.NetworkACLItem;
public interface NetworkACLServiceProvider extends NetworkElement {

View File

@ -33,7 +33,6 @@ import com.cloud.offering.NetworkOffering;
import com.cloud.utils.component.Adapter;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
/**
@ -84,7 +83,8 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException;
/**
* The network is being shutdown.
@ -121,7 +121,8 @@ public interface NetworkElement extends Adapter {
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException;
boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException;
/**
* This should return true if out of multiple services provided by this element, only some can be enabled. If all the services MUST be provided, this should return false.

View File

@ -23,7 +23,6 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.vm.NicProfile;
import com.cloud.vm.ReservationContext;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachineProfile;
public interface UserDataServiceProvider extends NetworkElement {

View File

@ -108,7 +108,8 @@ public interface NetworkGuru extends Adapter {
* environment. At this time, the admin generally must be involved to
* allocate more resources before any more guest network can be implemented.
*/
Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context) throws InsufficientVirtualNetworkCapcityException;
Network implement(Network network, NetworkOffering offering, DeployDestination destination, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException;
/**
* Once a guest network has been designed, virtual machines can be
@ -126,8 +127,8 @@ public interface NetworkGuru extends Adapter {
* @throws InsufficientAddressCapacityException if there are not addresses
* to be assigned.
*/
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException,
ConcurrentOperationException;
NicProfile allocate(Network network, NicProfile nic, VirtualMachineProfile vm) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* Once a guest network is implemented, then the virtual machine must
@ -147,8 +148,8 @@ public interface NetworkGuru extends Adapter {
* @throws ConcurrentOperationException if there are multiple operations
* happening on this guest network or vm.
*/
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException, ConcurrentOperationException;
void reserve(NicProfile nic, Network network, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context)
throws InsufficientVirtualNetworkCapcityException, InsufficientAddressCapacityException, ConcurrentOperationException;
/**
* When a virtual machine is stopped, the NetworkGuru is informed via the

View File

@ -16,13 +16,13 @@
// under the License.
package com.cloud.network.lb;
import java.util.List;
import org.apache.cloudstack.api.command.user.loadbalancer.DeleteSslCertCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.ListSslCertsCmd;
import org.apache.cloudstack.api.command.user.loadbalancer.UploadSslCertCmd;
import org.apache.cloudstack.api.response.SslCertResponse;
import java.util.List;
public interface CertService {
public SslCertResponse uploadSslCert(UploadSslCertCmd certCmd);

View File

@ -39,8 +39,8 @@ public class LoadBalancingRule {
private LbSslCert sslCert;
private String lbProtocol;
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies,
Ip sourceIp) {
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies,
List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
@ -48,8 +48,8 @@ public class LoadBalancingRule {
this.sourceIp = sourceIp;
}
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies, List<LbHealthCheckPolicy> healthCheckPolicies,
Ip sourceIp, LbSslCert sslCert, String lbProtocol) {
public LoadBalancingRule(LoadBalancer lb, List<LbDestination> destinations, List<LbStickinessPolicy> stickinessPolicies,
List<LbHealthCheckPolicy> healthCheckPolicies, Ip sourceIp, LbSslCert sslCert, String lbProtocol) {
this.lb = lb;
this.destinations = destinations;
this.stickinessPolicies = stickinessPolicies;
@ -196,7 +196,8 @@ public class LoadBalancingRule {
this(pingpath, description, responseTime, healthcheckInterval, healthcheckThresshold, unhealthThresshold, false);
}
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold, boolean revoke) {
public LbHealthCheckPolicy(String pingpath, String description, int responseTime, int healthcheckInterval, int healthcheckThresshold, int unhealthThresshold,
boolean revoke) {
this.pingpath = pingpath;
this.description = description;
this.responseTime = responseTime;

View File

@ -49,8 +49,8 @@ public interface LoadBalancingRulesService {
* @return the newly created LoadBalancerVO if successful, null otherwise
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd, Long ipAddrId,
String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException,
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,
Long ipAddrId, String protocol, String algorithm, long networkId, long lbOwnerId, boolean openFirewall, String lbProtocol) throws NetworkRuleConflictException,
InsufficientAddressCapacityException;
LoadBalancer updateLoadBalancerRule(UpdateLoadBalancerRuleCmd cmd);

View File

@ -16,9 +16,6 @@
// under the License.
package com.cloud.network.rules;
import java.util.List;
import com.cloud.utils.Pair;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;

View File

@ -28,8 +28,8 @@ import com.cloud.utils.Pair;
import com.cloud.utils.net.Ip;
public interface RulesService {
Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId, Long projectId,
boolean isRecursive, boolean listAll);
Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId,
Long projectId, boolean isRecursive, boolean listAll);
/**
* Creates a port forwarding rule between two ip addresses or between

View File

@ -24,7 +24,6 @@ import org.apache.cloudstack.api.command.user.securitygroup.CreateSecurityGroupC
import org.apache.cloudstack.api.command.user.securitygroup.DeleteSecurityGroupCmd;
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupEgressCmd;
import org.apache.cloudstack.api.command.user.securitygroup.RevokeSecurityGroupIngressCmd;
import org.apache.cloudstack.api.command.user.vm.AddIpToVmNicCmd;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;

View File

@ -17,7 +17,6 @@
package com.cloud.network.vpc;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.InternalIdentity;
public interface NetworkACL extends InternalIdentity {
@ -30,6 +29,7 @@ public interface NetworkACL extends InternalIdentity {
Long getVpcId();
@Override
long getId();
String getName();

View File

@ -16,12 +16,10 @@
// under the License.
package com.cloud.network.vpc;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.List;
import org.apache.cloudstack.api.InternalIdentity;
public interface NetworkACLItem extends InternalIdentity {
String getUuid();

View File

@ -16,12 +16,13 @@
// under the License.
package com.cloud.network.vpc;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
import java.util.List;
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
import java.util.List;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.Pair;
public interface NetworkACLService {
/**

View File

@ -23,10 +23,11 @@ public interface VpcProvisioningService {
public VpcOffering getVpcOffering(long vpcOfferingId);
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders, Long serviceOfferingId);
public VpcOffering createVpcOffering(String name, String displayText, List<String> supportedServices, Map<String, List<String>> serviceProviders,
Long serviceOfferingId);
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword, String state,
Long startIndex, Long pageSizeVal);
List<? extends VpcOffering> listVpcOfferings(Long id, String name, String displayText, List<String> supportedServicesStr, Boolean isDefault, String keyword,
String state, Long startIndex, Long pageSizeVal);
/**
* @param offId

View File

@ -46,7 +46,8 @@ public interface VpcService {
* @return
* @throws ResourceAllocationException TODO
*/
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain) throws ResourceAllocationException;
public Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain)
throws ResourceAllocationException;
/**
* Deletes a VPC

View File

@ -34,8 +34,10 @@ public interface Project extends PartOf, Identity, InternalIdentity {
String getDisplayText();
@Override
long getDomainId();
@Override
long getId();
Date getCreated();

View File

@ -75,6 +75,7 @@ public interface GlobalLoadBalancerRule extends Identity, InternalIdentity, Cont
public int getRegion();
@Override
public long getAccountId();
public State getState();

View File

@ -17,11 +17,17 @@
package com.cloud.region.ha;
import com.cloud.network.rules.LoadBalancer;
import org.apache.cloudstack.api.command.user.region.ha.gslb.*;
import java.util.List;
import org.apache.cloudstack.api.command.user.region.ha.gslb.AssignToGlobalLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.region.ha.gslb.CreateGlobalLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.region.ha.gslb.DeleteGlobalLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.region.ha.gslb.ListGlobalLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.region.ha.gslb.RemoveFromGlobalLoadBalancerRuleCmd;
import org.apache.cloudstack.api.command.user.region.ha.gslb.UpdateGlobalLoadBalancerRuleCmd;
import com.cloud.network.rules.LoadBalancer;
public interface GlobalLoadBalancingRulesService {
/*

View File

@ -25,9 +25,16 @@ public enum ResourceState {
Creating, Enabled, Disabled, PrepareForMaintenance, ErrorInMaintenance, Maintenance, Error;
public enum Event {
InternalCreated("Resource is created"), Enable("Admin enables"), Disable("Admin disables"), AdminAskMaintenace("Admin asks to enter maintenance"), AdminCancelMaintenance(
"Admin asks to cancel maintenance"), InternalEnterMaintenance("Resource enters maintenance"), UpdatePassword("Admin updates password of host"), UnableToMigrate(
"Management server migrates VM failed"), Error("An internal error happened"), DeleteHost("Admin delete a host"),
InternalCreated("Resource is created"),
Enable("Admin enables"),
Disable("Admin disables"),
AdminAskMaintenace("Admin asks to enter maintenance"),
AdminCancelMaintenance("Admin asks to cancel maintenance"),
InternalEnterMaintenance("Resource enters maintenance"),
UpdatePassword("Admin updates password of host"),
UnableToMigrate("Management server migrates VM failed"),
Error("An internal error happened"),
DeleteHost("Admin delete a host"),
/*
* Below events don't cause resource state to change, they are merely

View File

@ -16,8 +16,8 @@
// under the License.
package com.cloud.resource;
import com.cloud.utils.SerialVersionUID;
import com.cloud.exception.CloudException;
import com.cloud.utils.SerialVersionUID;
public class UnableDeleteHostException extends CloudException {
private static final long serialVersionUID = SerialVersionUID.UnableDeleteHostException;

View File

@ -349,7 +349,8 @@ public interface ManagementService {
String[] listEventTypes();
Pair<List<? extends HypervisorCapabilities>, Integer> listHypervisorCapabilities(Long id, HypervisorType hypervisorType, String keyword, Long startIndex, Long pageSizeVal);
Pair<List<? extends HypervisorCapabilities>, Integer> listHypervisorCapabilities(Long id, HypervisorType hypervisorType, String keyword, Long startIndex,
Long pageSizeVal);
HypervisorCapabilities updateHypervisorCapabilities(Long id, Long maxGuestsLimit, Boolean securityGroupEnabled);

View File

@ -24,27 +24,13 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
//FIXME - extract enum to another interface as its used both by resourceTags and resourceMetaData code
public enum ResourceObjectType {
UserVm(true, true),
Template(true, true),
ISO(true, false),
Volume(true, true),
Snapshot(true, false),
Network(true, true),
Nic(false, true),
LoadBalancer(true, true),
PortForwardingRule(true, true),
FirewallRule(true, true),
SecurityGroup(true, false),
PublicIpAddress(true, true),
Project(true, false),
Vpc(true, false),
NetworkACL(true, false),
StaticRoute(true, false),
VMSnapshot(true, false),
RemoteAccessVpn(true, true),
Zone(false, true),
ServiceOffering(false, true),
Storage(false, true);
UserVm(true, true), Template(true, true), ISO(true, false), Volume(true, true), Snapshot(true, false), Network(true, true), Nic(false, true), LoadBalancer(
true,
true), PortForwardingRule(true, true), FirewallRule(true, true), SecurityGroup(true, false), PublicIpAddress(true, true), Project(true, false), Vpc(
true,
false), NetworkACL(true, false), StaticRoute(true, false), VMSnapshot(true, false), RemoteAccessVpn(true, true), Zone(false, true), ServiceOffering(
false,
true), Storage(false, true);
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
this.resourceTagsSupport = resourceTagsSupport;

View File

@ -53,6 +53,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
//it's a state, user can't see the snapshot from ui, while the snapshot may still exist on the storage
Error;
@Override
public String toString() {
return this.name();
}
@ -68,6 +69,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
public static final long MANUAL_POLICY_ID = 0L;
@Override
long getAccountId();
long getVolumeId();
@ -78,6 +80,7 @@ public interface Snapshot extends ControlledEntity, Identity, InternalIdentity,
Type getRecurringType();
@Override
State getState();
HypervisorType getHypervisorType();

View File

@ -21,11 +21,14 @@ import java.util.List;
public class Storage {
public static enum ImageFormat {
QCOW2(true, true, false, "qcow2"), RAW(false, false, false, "raw"), VHD(true, true, true, "vhd"), ISO(false, false, false, "iso"), OVA(true, true, true, "ova"), VHDX(
true,
true,
true,
"vhdx"), BAREMETAL(false, false, false, "BAREMETAL"), TAR(false, false, false, "tar");
QCOW2(true, true, false, "qcow2"),
RAW(false, false, false, "raw"),
VHD(true, true, true, "vhd"),
ISO(false, false, false, "iso"),
OVA(true, true, true, "ova"),
VHDX(true, true, true, "vhdx"),
BAREMETAL(false, false, false, "BAREMETAL"),
TAR(false, false, false, "tar");
private final boolean thinProvisioned;
private final boolean supportSparse;

View File

@ -29,5 +29,6 @@ public interface StoragePoolDiscoverer extends Adapter {
Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details) throws DiscoveryException;
Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password) throws DiscoveryException;
Map<? extends StoragePool, Map<String, String>> find(long dcId, Long podId, URI uri, Map<String, String> details, String username, String password)
throws DiscoveryException;
}

View File

@ -154,6 +154,7 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
Long getPoolId();
@Override
State getState();
Date getAttached();

View File

@ -20,8 +20,13 @@ package com.cloud.storage;
import java.net.URISyntaxException;
import com.cloud.exception.StorageUnavailableException;
import org.apache.cloudstack.api.command.user.volume.*;
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
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.UploadVolumeCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InternalErrorException;

View File

@ -16,11 +16,11 @@
// under the License.
package com.cloud.storage.snapshot;
import java.util.Date;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
public interface SnapshotSchedule extends InternalIdentity, Identity {
Long getVolumeId();

View File

@ -56,6 +56,7 @@ public interface Account extends ControlledEntity, InternalIdentity, Identity {
public Long getDefaultZoneId();
@Override
public String getUuid();
boolean isDefault();

View File

@ -54,8 +54,8 @@ public interface AccountService {
*
* @return the user if created successfully, null otherwise
*/
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName, short accountType,
Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
UserAccount createUserAccount(String userName, String password, String firstName, String lastName, String email, String timezone, String accountName,
short accountType, Long domainId, String networkDomain, Map<String, String> details, String accountUUID, String userUUID);
/**
* Locks a user by userId. A locked user cannot access the API, but will still have running VMs/IP addresses
@ -70,7 +70,8 @@ public interface AccountService {
User getSystemUser();
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
User
createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
boolean isAdmin(short accountType);

View File

@ -23,6 +23,7 @@ import org.apache.cloudstack.api.InternalIdentity;
public interface User extends OwnedBy, InternalIdentity {
public static final long UID_SYSTEM = 1;
@Override
public long getId();
public String getUuid();

View File

@ -21,6 +21,7 @@ import java.util.Date;
import org.apache.cloudstack.api.InternalIdentity;
public interface UserAccount extends InternalIdentity {
@Override
long getId();
String getUsername();

View File

@ -45,7 +45,8 @@ public class DiskProfile {
protected DiskProfile() {
}
public DiskProfile(long volumeId, Volume.Type type, String name, long diskOfferingId, long size, String[] tags, boolean useLocalStorage, boolean recreatable, Long templateId) {
public DiskProfile(long volumeId, Volume.Type type, String name, long diskOfferingId, long size, String[] tags, boolean useLocalStorage, boolean recreatable,
Long templateId) {
this.type = type;
this.name = name;
this.size = size;

View File

@ -31,6 +31,7 @@ public interface NicIpAlias extends ControlledEntity, Identity, InternalIdentity
active, revoked,
}
@Override
long getId();
long getNicId();

View File

@ -162,6 +162,7 @@ public class NicProfile implements InternalIdentity {
return vmId;
}
@Override
public long getId() {
return id;
}

View File

@ -27,6 +27,7 @@ public interface NicSecondaryIp extends ControlledEntity, Identity, InternalIden
/**
* @return id in the CloudStack database
*/
@Override
long getId();
long getNicId();

View File

@ -40,6 +40,7 @@ import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
import org.apache.cloudstack.api.command.user.vmgroup.DeleteVMGroupCmd;
import com.cloud.dc.DataCenter;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
@ -202,11 +203,11 @@ public interface UserVmService {
* available.
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList, Account owner,
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed,
Integer memory, Integer cpuNumber, Long rootdisksize) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
StorageUnavailableException, ResourceAllocationException;
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is enabled) in
@ -284,8 +285,8 @@ public interface UserVmService {
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize) throws InsufficientCapacityException, ConcurrentOperationException,
ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
List<Long> affinityGroupIdList, Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdisksize) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
@ -359,10 +360,10 @@ public interface UserVmService {
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner,
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList, Integer cpuSpeed,
Integer memory, Integer cpuNumber, Long rootdkisksize)
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
Integer cpuSpeed, Integer memory, Integer cpuNumber, Long rootdkisksize)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Starts the virtual machine created from createVirtualMachine.
@ -407,8 +408,8 @@ public interface UserVmService {
HypervisorType getHypervisorTypeOfUserVM(long vmid);
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException, StorageUnavailableException,
ResourceAllocationException;
UserVm createVirtualMachine(DeployVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException, ConcurrentOperationException,
StorageUnavailableException, ResourceAllocationException;
UserVm getUserVm(long vmId);
@ -464,13 +465,15 @@ public interface UserVmService {
VirtualMachine migrateVirtualMachineWithVolume(Long vmId, Host destinationHost, Map<String, String> volumeToPool) throws ResourceUnavailableException,
ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
UserVm moveVMToUser(AssignVMCmd moveUserVMCmd) throws ResourceAllocationException, ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
UserVm moveVMToUser(AssignVMCmd moveUserVMCmd) throws ResourceAllocationException, ConcurrentOperationException, ResourceUnavailableException,
InsufficientCapacityException;
VirtualMachine vmStorageMigration(Long vmId, StoragePool destPool);
UserVm restoreVM(RestoreVMCmd cmd) throws InsufficientCapacityException, ResourceUnavailableException;
UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException, VirtualMachineMigrationException;
UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException, ManagementServerException,
VirtualMachineMigrationException;
UserVm expungeVm(ExpungeVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;

View File

@ -38,15 +38,16 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
}
public enum State {
Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."), Running(
false,
"VM is running. host id has the host that it is running on."), Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."), Stopped(
false,
"VM is stopped. host id should be null."), Destroyed(false, "VM is marked for destroy."), Expunging(true, "VM is being expunged."), Migrating(
true,
"VM is being migrated. host id holds to from host"), Error(false, "VM is in error"), Unknown(false, "VM state is unknown."), Shutdowned(
false,
"VM is shutdowned from inside");
Starting(true, "VM is being started. At this state, you should find host id filled which means it's being started on that host."),
Running(false, "VM is running. host id has the host that it is running on."),
Stopping(true, "VM is being stopped. host id has the host that it is being stopped on."),
Stopped(false, "VM is stopped. host id should be null."),
Destroyed(false, "VM is marked for destroy."),
Expunging(true, "VM is being expunged."),
Migrating(true, "VM is being migrated. host id holds to from host"),
Error(false, "VM is in error"),
Unknown(false, "VM state is unknown."),
Shutdowned(false, "VM is shutdowned from inside");
private final boolean _transitional;
String _description;

View File

@ -19,23 +19,19 @@ package com.cloud.vm.snapshot;
import java.util.Date;
import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import org.apache.cloudstack.acl.ControlledEntity;
import com.cloud.utils.fsm.StateMachine2;
import com.cloud.utils.fsm.StateObject;
public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity, StateObject<VMSnapshot.State> {
enum State {
Allocated("The VM snapshot is allocated but has not been created yet."),
Creating("The VM snapshot is being created."),
Ready("The VM snapshot is ready to be used."),
Reverting("The VM snapshot is being used to revert"),
Expunging("The volume is being expunging"),
Removed("The volume is destroyed, and can't be recovered."),
Error("The volume is in error state, and can't be recovered");
Allocated("The VM snapshot is allocated but has not been created yet."), Creating("The VM snapshot is being created."), Ready(
"The VM snapshot is ready to be used."), Reverting("The VM snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed(
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered");
String _description;
@ -74,12 +70,14 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
CreateRequested, OperationFailed, OperationSucceeded, RevertRequested, ExpungeRequested,
}
@Override
long getId();
public String getName();
public Long getVmId();
@Override
public State getState();
public Date getCreated();
@ -102,5 +100,6 @@ public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity
public Date getRemoved();
@Override
public long getAccountId();
}

View File

@ -17,21 +17,16 @@
package org.apache.cloudstack.affinity;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import org.apache.cloudstack.api.response.ControlledEntityResponse;
import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import com.cloud.network.security.SecurityGroup;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@EntityReference(value = AffinityGroup.class)
@ -93,6 +88,7 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
this.description = description;
}
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
}
@ -106,6 +102,7 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
this.domainId = domainId;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
}

View File

@ -16,18 +16,13 @@
// under the License.
package org.apache.cloudstack.affinity;
import java.util.HashSet;
import java.util.Set;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference;
import org.apache.cloudstack.api.response.ControlledEntityResponse;
import org.apache.cloudstack.api.response.ControlledViewEntityResponse;
import com.cloud.network.security.SecurityGroup;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused")
@EntityReference(value = AffinityGroup.class)

View File

@ -50,6 +50,7 @@ public enum ApiErrorCode {
this.httpCode = httpCode;
}
@Override
public String toString() {
return String.valueOf(this.httpCode);
}

View File

@ -26,18 +26,15 @@ import java.util.regex.Pattern;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupService;
import com.cloud.server.ResourceMetaDataService;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
import com.cloud.domain.Domain;
import com.cloud.exception.ConcurrentOperationException;
@ -54,10 +51,10 @@ import com.cloud.network.StorageNetworkService;
import com.cloud.network.VpcVirtualNetworkApplianceService;
import com.cloud.network.as.AutoScaleService;
import com.cloud.network.firewall.FirewallService;
import com.cloud.network.vpc.NetworkACLService;
import com.cloud.network.lb.LoadBalancingRulesService;
import com.cloud.network.rules.RulesService;
import com.cloud.network.security.SecurityGroupService;
import com.cloud.network.vpc.NetworkACLService;
import com.cloud.network.vpc.VpcProvisioningService;
import com.cloud.network.vpc.VpcService;
import com.cloud.network.vpn.RemoteAccessVpnService;
@ -66,6 +63,7 @@ import com.cloud.projects.Project;
import com.cloud.projects.ProjectService;
import com.cloud.resource.ResourceService;
import com.cloud.server.ManagementService;
import com.cloud.server.ResourceMetaDataService;
import com.cloud.server.TaggedResourceService;
import com.cloud.storage.DataStoreProviderApiService;
import com.cloud.storage.StorageService;
@ -272,7 +270,7 @@ public abstract class BaseCmd {
int arrayStartLastIndex = key.lastIndexOf('[');
if (arrayStartIndex != arrayStartLastIndex) {
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
if (arrayStartIndex > 0) {
@ -281,7 +279,7 @@ public abstract class BaseCmd {
if ((arrayEndIndex < arrayStartIndex) || (arrayEndIndex != arrayEndLastIndex)) {
// malformed parameter
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
// Now that we have an array object, check for a field name in the case of a complex object
@ -289,7 +287,7 @@ public abstract class BaseCmd {
String fieldName = null;
if (fieldIndex < arrayEndIndex) {
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
} else {
fieldName = key.substring(fieldIndex + 1);
}
@ -314,7 +312,7 @@ public abstract class BaseCmd {
if (!parsedIndex) {
throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "Unable to decode parameter " + key +
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
"; if specifying an object array, please use parameter[index].field=XXX, e.g. userGroupList[0].group=httpGroup");
}
Object value = lowercaseParams.get(paramName);
@ -349,7 +347,8 @@ public abstract class BaseCmd {
}
public static boolean isAdmin(short accountType) {
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
return ((accountType == Account.ACCOUNT_TYPE_ADMIN) || (accountType == Account.ACCOUNT_TYPE_RESOURCE_DOMAIN_ADMIN) ||
(accountType == Account.ACCOUNT_TYPE_DOMAIN_ADMIN) || (accountType == Account.ACCOUNT_TYPE_READ_ONLY_ADMIN));
}
public static boolean isRootAdmin(short accountType) {
@ -381,7 +380,7 @@ public abstract class BaseCmd {
return account.getId();
} else {
throw new PermissionDeniedException("Can't add resources to the account id=" + account.getId() + " in state=" + account.getState() +
" as it's no longer active");
" as it's no longer active");
}
} else {
// idList is not used anywhere, so removed it now
@ -397,8 +396,9 @@ public abstract class BaseCmd {
if (!enabledOnly || project.getState() == Project.State.Active) {
return project.getProjectAccountId();
} else {
PermissionDeniedException ex = new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
" as it's no longer active");
PermissionDeniedException ex =
new PermissionDeniedException("Can't add resources to the project with specified projectId in state=" + project.getState() +
" as it's no longer active");
ex.addProxyObject(project.getUuid(), "projectId");
throw ex;
}

View File

@ -64,6 +64,7 @@ public abstract class BaseListCmd extends BaseCmd {
return pageSize;
}
@Override
public void configure() {
if (MAX_PAGESIZE == null) {
if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {

View File

@ -20,18 +20,18 @@ import org.apache.cloudstack.api.response.DomainResponse;
public abstract class BaseListDomainResourcesCmd extends BaseListCmd {
@Parameter(name = ApiConstants.LIST_ALL,
type = CommandType.BOOLEAN,
description = "If set to false, "
+ "list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
@Parameter(name = ApiConstants.LIST_ALL, type = CommandType.BOOLEAN, description = "If set to false, "
+ "list only resources belonging to the command's caller; if set to true - list resources that the caller is authorized to see. Default value is false")
private Boolean listAll;
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "list only resources belonging to the domain specified")
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
entityType = DomainResponse.class,
description = "list only resources belonging to the domain specified")
private Long domainId;
@Parameter(name = ApiConstants.IS_RECURSIVE,
type = CommandType.BOOLEAN,
description = "defaults to false," + " but if true, lists all resources from the parent specified by the domainId till leaves.")
@Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false,"
+ " but if true, lists all resources from the parent specified by the domainId till leaves.")
private Boolean recursive;
public boolean listAll() {

View File

@ -18,11 +18,11 @@ package org.apache.cloudstack.api;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;

View File

@ -16,9 +16,10 @@
// under the License.
package org.apache.cloudstack.api;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import com.cloud.serializer.Param;
public abstract class BaseResponse implements ResponseObject {
private transient String responseName;
private transient String objectName;

View File

@ -16,10 +16,11 @@
// under the License.
package org.apache.cloudstack.api;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.command.user.iso.UpdateIsoCmd;
import org.apache.cloudstack.api.response.GuestOSResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateIsoCmd.class.getName());

View File

@ -18,10 +18,11 @@ package org.apache.cloudstack.api;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;

View File

@ -16,8 +16,10 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
import java.util.Collection;
import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@ -29,10 +31,8 @@ import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.Map;
import com.cloud.user.Account;
import com.cloud.user.UserAccount;
@APICommand(name = "createAccount", description = "Creates an account", responseObject = AccountResponse.class)
public class CreateAccountCmd extends BaseCmd {
@ -172,8 +172,9 @@ public class CreateAccountCmd extends BaseCmd {
@Override
public void execute() {
CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
UserAccount userAccount = _accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(),
getAccountType(), getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
UserAccount userAccount =
_accountService.createUserAccount(getUsername(), getPassword(), getFirstName(), getLastName(), getEmail(), getTimeZone(), getAccountName(), getAccountType(),
getDomainId(), getNetworkDomain(), getDetails(), getAccountUUID(), getUserUUID());
if (userAccount != null) {
AccountResponse response = _responseGenerator.createUserAccountResponse(userAccount);
response.setResponseName(getCommandName());

View File

@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.account;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -30,8 +32,6 @@ import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.region.RegionService;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
import com.cloud.user.User;
@ -91,7 +91,7 @@ public class DeleteAccountCmd extends BaseAsyncCmd {
public String getEventDescription() {
User user = _responseGenerator.findUserById(getId());
return (user != null ? ("deleting User " + user.getUsername() + " (id: " + user.getId() + ") and accountId = " + user.getAccountId())
: "user delete, but this user does not exist in the system");
: "user delete, but this user does not exist in the system");
}
@Override

View File

@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.account;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -30,8 +32,6 @@ import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.region.RegionService;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;

View File

@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.admin.account;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -27,7 +29,6 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.region.RegionService;
import org.apache.log4j.Logger;
import com.cloud.user.Account;

View File

@ -16,13 +16,14 @@
// under the License.
package org.apache.cloudstack.api.command.admin.account;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;

View File

@ -21,6 +21,8 @@ import java.util.Map;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -30,7 +32,6 @@ import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.region.RegionService;
import org.apache.log4j.Logger;
import com.cloud.user.Account;

View File

@ -17,6 +17,8 @@
package org.apache.cloudstack.api.command.admin.autoscale;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -25,7 +27,6 @@ import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.network.as.Counter;

View File

@ -17,6 +17,8 @@
package org.apache.cloudstack.api.command.admin.autoscale;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants;
@ -26,7 +28,6 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.CounterResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceInUseException;

View File

@ -20,6 +20,8 @@ package org.apache.cloudstack.api.command.admin.cluster;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -30,7 +32,6 @@ import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.DiscoveryException;
import com.cloud.exception.ResourceInUseException;

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -24,7 +26,6 @@ import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;

View File

@ -19,6 +19,8 @@ package org.apache.cloudstack.api.command.admin.cluster;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
@ -28,7 +30,6 @@ import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger;
import com.cloud.org.Cluster;
import com.cloud.utils.Pair;

View File

@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api.command.admin.cluster;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
@ -23,7 +25,6 @@ import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.org.Cluster;

View File

@ -19,15 +19,20 @@ package org.apache.cloudstack.api.command.admin.config;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;
import org.apache.log4j.Logger;
import com.cloud.utils.Pair;
@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class)

Some files were not shown because too many files have changed in this diff Show More