Bring up to date with master

This commit is contained in:
Ian Duffy 2013-08-31 00:25:48 +01:00
commit bdba0ddeed
1201 changed files with 86556 additions and 30780 deletions

View File

@ -213,6 +213,13 @@ Install needed packages:
$ yum install cloud-agent # agent (kvm) $ yum install cloud-agent # agent (kvm)
$ yum install cloud-usage # usage server $ yum install cloud-usage # usage server
## Installing CloudMonkey CLI
CloudMonkey is a CLI for Apache CloudStack. It was earlier in `tools/cli` within
the source code but now it has its own repository:
https://git-wip-us.apache.org/repos/asf?p=cloudstack-cloudmonkey.git
## Notes ## Notes
If you will be using Xen as your hypervisor, please download [vhd-util](http://download.cloud.com.s3.amazonaws.com/tools/vhd-util) If you will be using Xen as your hypervisor, please download [vhd-util](http://download.cloud.com.s3.amazonaws.com/tools/vhd-util)

13
LICENSE
View File

@ -306,7 +306,7 @@ Within the scripts/vm/hypervisor/xenserver directory
from OpenStack, LLC http://www.openstack.org from OpenStack, LLC http://www.openstack.org
swift swift
Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directories Within the tools/appliance/definitions/{devcloud,systemvmtemplate,systemvmtemplate64} directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2010-2012 Patrick Debois Copyright (c) 2010-2012 Patrick Debois
@ -460,7 +460,7 @@ Within the ui/lib directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2006 - 2011 Jörn Zaefferer Copyright (c) 2006 - 2011 Jörn Zaefferer
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@ -655,7 +655,7 @@ Within the ui/lib/jquery-ui directory
Within the ui/lib/qunit directory Within the ui/lib/qunit directory
licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows) licensed under the MIT License http://www.opensource.org/licenses/mit-license.php (as follows)
Copyright (c) 2012 John Resig, Jörn Zaefferer Copyright (c) 2012 John Resig, Jörn Zaefferer
Permission is hereby granted, free of charge, to any person obtaining Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the a copy of this software and associated documentation files (the
@ -686,3 +686,10 @@ Within the utils/src/com/cloud/utils/db directory
from Clinton Begin http://code.google.com/p/mybatis/ from Clinton Begin http://code.google.com/p/mybatis/
ScriptRunner.java from http://code.google.com/p/mybatis/ ScriptRunner.java from http://code.google.com/p/mybatis/
Within the utils/src/org/apache/commons/httpclient/contrib/ssl directory
licensed under the Apache License, Version 2 http://www.apache.org/licenses/LICENSE-2.0.txt (as above)
Copyright (c) 2007 The Apache Software Foundation
from The Apache Software Foundation http://www.apache.org/
EasySSLProtocolSocketFactory.java
EasyX509TrustManager.java

View File

@ -16,4 +16,4 @@
# under the License. # under the License.
configureSimulator=com.cloud.api.commands.ConfigureSimulator;1 configureSimulator=com.cloud.api.commands.ConfigureSimulatorCmd;1

View File

@ -94,3 +94,23 @@ domr.scripts.dir=scripts/network/domr/kvm
# libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver # libvirt.vif.driver=com.cloud.hypervisor.kvm.resource.DirectVifDriver
# network.direct.source.mode=private # network.direct.source.mode=private
# network.direct.device=eth0 # network.direct.device=eth0
# setting to enable the cpu model to kvm guest globally.
# three option:custom,host-model and host-passthrough.
# custom - user custom the CPU model which specified by guest.cpu.model.
# host-model - identify the named CPU model which most closely matches the host,
# and then request additional CPU flags to complete the match. This should give
# close to maximum functionality/performance, which maintaining good
# reliability/compatibility if the guest is migrated to another host with slightly different host CPUs.
# host-passthrough - tell KVM to passthrough the host CPU with no modifications.
# The difference to host-model, instead of just matching feature flags,
# every last detail of the host CPU is matched. This gives absolutely best performance,
# and can be important to some apps which check low level CPU details,
# but it comes at a cost wrt migration. The guest can only be migrated to
# an exactly matching host CPU.
#
# guest.cpu.mode=custom|host-model|host-passthrough
# This param is only valid if guest.cpu.mode=custom,
# for examples:"Conroe" "Penryn", "Nehalem", "Westmere", "pentiumpro" and so
# on,run virsh capabilities for more details.
# guest.cpu.model=

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId> <artifactId>cloudstack</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.3.0-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
@ -39,14 +39,12 @@
<dependency> <dependency>
<groupId>commons-daemon</groupId> <groupId>commons-daemon</groupId>
<artifactId>commons-daemon</artifactId> <artifactId>commons-daemon</artifactId>
<version>${cs.daemon.version}</version>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<plugins> <plugins>
<plugin> <plugin>
<artifactId>maven-antrun-plugin</artifactId> <artifactId>maven-antrun-plugin</artifactId>
<version>1.7</version>
<executions> <executions>
<execution> <execution>
<id>generate-resource</id> <id>generate-resource</id>
@ -98,7 +96,6 @@
<plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId> <artifactId>maven-dependency-plugin</artifactId>
<version>2.5.1</version>
<executions> <executions>
<execution> <execution>
<id>copy-dependencies</id> <id>copy-dependencies</id>

View File

@ -23,7 +23,7 @@
<parent> <parent>
<groupId>org.apache.cloudstack</groupId> <groupId>org.apache.cloudstack</groupId>
<artifactId>cloudstack</artifactId> <artifactId>cloudstack</artifactId>
<version>4.2.0-SNAPSHOT</version> <version>4.3.0-SNAPSHOT</version>
</parent> </parent>
<dependencies> <dependencies>
<dependency> <dependency>
@ -34,12 +34,27 @@
<dependency> <dependency>
<groupId>com.google.code.gson</groupId> <groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId> <artifactId>gson</artifactId>
<version>${cs.gson.version}</version> </dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-db</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
<build> <build>
<defaultGoal>install</defaultGoal> <plugins>
<sourceDirectory>src</sourceDirectory> <plugin>
<testSourceDirectory>test</testSourceDirectory> <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build> </build>
</project> </project>

View File

@ -27,6 +27,10 @@ import com.cloud.agent.api.LogLevel.Log4jLevel;
*/ */
public abstract class Command { public abstract class Command {
public static enum OnError {
Continue, Stop
}
public static final String HYPERVISOR_TYPE = "hypervisorType"; public static final String HYPERVISOR_TYPE = "hypervisorType";
// allow command to carry over hypervisor or other environment related context info // allow command to carry over hypervisor or other environment related context info

View File

@ -41,6 +41,7 @@ public class VolumeTO implements InternalIdentity {
private Long bytesWriteRate; private Long bytesWriteRate;
private Long iopsReadRate; private Long iopsReadRate;
private Long iopsWriteRate; private Long iopsWriteRate;
private Long chainSize;
public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) { public VolumeTO(long id, Volume.Type type, StoragePoolType poolType, String poolUuid, String name, String mountPoint, String path, long size, String chainInfo) {
this.id = id; this.id = id;
@ -77,6 +78,7 @@ public class VolumeTO implements InternalIdentity {
this.storagePoolUuid = pool.getUuid(); this.storagePoolUuid = pool.getUuid();
this.mountPoint = volume.getFolder(); this.mountPoint = volume.getFolder();
this.chainInfo = volume.getChainInfo(); this.chainInfo = volume.getChainInfo();
this.chainSize = volume.getVmSnapshotChainSize();
if (volume.getDeviceId() != null) if (volume.getDeviceId() != null)
this.deviceId = volume.getDeviceId(); this.deviceId = volume.getDeviceId();
} }
@ -170,4 +172,11 @@ public class VolumeTO implements InternalIdentity {
return iopsWriteRate; return iopsWriteRate;
} }
public Long getChainSize() {
return chainSize;
}
public void setChainSize(Long chainSize) {
this.chainSize = chainSize;
}
} }

View File

@ -20,11 +20,6 @@ import java.util.List;
import javax.naming.NamingException; import javax.naming.NamingException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.ResourceAllocationException;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; 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.CreateNetworkOfferingCmd;
import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd; import org.apache.cloudstack.api.command.admin.network.DeleteNetworkOfferingCmd;
@ -48,17 +43,23 @@ import org.apache.cloudstack.api.command.admin.zone.CreateZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd; import org.apache.cloudstack.api.command.admin.zone.DeleteZoneCmd;
import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd; import org.apache.cloudstack.api.command.admin.zone.UpdateZoneCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd; import org.apache.cloudstack.api.command.user.network.ListNetworkOfferingsCmd;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.region.PortableIp;
import org.apache.cloudstack.region.PortableIpRange;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod; import com.cloud.dc.Pod;
import com.cloud.dc.Vlan; import com.cloud.dc.Vlan;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Networks.TrafficType; import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.DiskOffering; import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering; import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account; import com.cloud.user.Account;
import org.apache.cloudstack.region.PortableIp;
import org.apache.cloudstack.region.PortableIpRange;
public interface ConfigurationService { public interface ConfigurationService {
@ -252,30 +253,12 @@ public interface ConfigurationService {
boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd); boolean deleteNetworkOffering(DeleteNetworkOfferingCmd cmd);
NetworkOffering getNetworkOffering(long id);
Integer getNetworkOfferingNetworkRate(long networkOfferingId, Long dataCenterId);
Account getVlanAccount(long vlanId); Account getVlanAccount(long vlanId);
List<? extends NetworkOffering> listNetworkOfferings(TrafficType trafficType, boolean systemOnly); List<? extends NetworkOffering> listNetworkOfferings(TrafficType trafficType, boolean systemOnly);
DataCenter getZone(long id);
ServiceOffering getServiceOffering(long serviceOfferingId);
Long getDefaultPageSize(); Long getDefaultPageSize();
Integer getServiceOfferingNetworkRate(long serviceOfferingId, Long dataCenterId);
DiskOffering getDiskOffering(long diskOfferingId);
/**
* @param offering
* @return
*/
boolean isOfferingForVpc(NetworkOffering offering);
PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException; PortableIpRange createPortableIpRange(CreatePortableIpRangeCmd cmd) throws ConcurrentOperationException;
boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd); boolean deletePortableIpRange(DeletePortableIpRangeCmd cmd);

View File

@ -14,18 +14,21 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
package com.cloud.server; package com.cloud.consoleproxy;
import java.util.List; import java.util.List;
import java.util.Map;
import com.cloud.api.commands.ConfigureSimulator; import com.cloud.utils.component.Adapter;
import com.cloud.vm.ConsoleProxy;
public class ManagementServerSimulatorImpl extends ManagementServerImpl { public interface ConsoleProxyAllocator extends Adapter {
@Override /**
public List<Class<?>> getCommands() { * Finds the least loaded console proxy.
List<Class<?>> cmdList = super.getCommands(); * @param candidates
cmdList.add(ConfigureSimulator.class); * @param loadInfo
return cmdList; * @param dataCenterId
} * @return id of the console proxy to use or null if none.
*/
public Long allocProxy(List<? extends ConsoleProxy> candidates, Map<Long, Integer> loadInfo, long dataCenterId);
} }

View File

@ -191,6 +191,13 @@ public interface DeploymentPlanner extends Adapter {
_podIds.add(podId); _podIds.add(podId);
} }
public void addPodList(Collection<Long> podList) {
if (_podIds == null) {
_podIds = new HashSet<Long>();
}
_podIds.addAll(podList);
}
public void addCluster(long clusterId) { public void addCluster(long clusterId) {
if (_clusterIds == null) { if (_clusterIds == null) {
_clusterIds = new HashSet<Long>(); _clusterIds = new HashSet<Long>();

View File

@ -19,7 +19,8 @@ package com.cloud.event;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import com.cloud.configuration.Configuration; import org.apache.cloudstack.config.Configuration;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod; import com.cloud.dc.Pod;
import com.cloud.dc.StorageNetworkIpRange; import com.cloud.dc.StorageNetworkIpRange;
@ -69,7 +70,7 @@ public class EventTypes {
public static final String EVENT_VM_REBOOT = "VM.REBOOT"; public static final String EVENT_VM_REBOOT = "VM.REBOOT";
public static final String EVENT_VM_UPDATE = "VM.UPDATE"; public static final String EVENT_VM_UPDATE = "VM.UPDATE";
public static final String EVENT_VM_UPGRADE = "VM.UPGRADE"; public static final String EVENT_VM_UPGRADE = "VM.UPGRADE";
public static final String EVENT_VM_SCALE = "VM.SCALE"; public static final String EVENT_VM_DYNAMIC_SCALE = "VM.DYNAMIC.SCALE";
public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD"; public static final String EVENT_VM_RESETPASSWORD = "VM.RESETPASSWORD";
public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY"; public static final String EVENT_VM_RESETSSHKEY = "VM.RESETSSHKEY";
public static final String EVENT_VM_MIGRATE = "VM.MIGRATE"; public static final String EVENT_VM_MIGRATE = "VM.MIGRATE";
@ -92,7 +93,6 @@ public class EventTypes {
public static final String EVENT_PROXY_STOP = "PROXY.STOP"; public static final String EVENT_PROXY_STOP = "PROXY.STOP";
public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT"; public static final String EVENT_PROXY_REBOOT = "PROXY.REBOOT";
public static final String EVENT_PROXY_HA = "PROXY.HA"; public static final String EVENT_PROXY_HA = "PROXY.HA";
public static final String EVENT_PROXY_SCALE = "PROXY.SCALE";
// VNC Console Events // VNC Console Events
@ -217,7 +217,6 @@ public class EventTypes {
public static final String EVENT_SSVM_STOP = "SSVM.STOP"; public static final String EVENT_SSVM_STOP = "SSVM.STOP";
public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT"; public static final String EVENT_SSVM_REBOOT = "SSVM.REBOOT";
public static final String EVENT_SSVM_HA = "SSVM.HA"; public static final String EVENT_SSVM_HA = "SSVM.HA";
public static final String EVENT_SSVM_SCALE = "SSVM.SCALE";
// Service Offerings // Service Offerings
public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE"; public static final String EVENT_SERVICE_OFFERING_CREATE = "SERVICE.OFFERING.CREATE";
@ -443,6 +442,8 @@ public class EventTypes {
public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE"; public static final String EVENT_DEDICATE_RESOURCE_RELEASE = "DEDICATE.RESOURCE.RELEASE";
public static final String EVENT_CLEANUP_VM_RESERVATION = "VM.RESERVATION.CLEANUP"; public static final String EVENT_CLEANUP_VM_RESERVATION = "VM.RESERVATION.CLEANUP";
public static final String EVENT_UCS_ASSOCIATED_PROFILE = "UCS.ASSOCIATEPROFILE";
static { static {

View File

@ -16,6 +16,8 @@
// under the License. // under the License.
package com.cloud.hypervisor; package com.cloud.hypervisor;
import com.cloud.storage.Storage.ImageFormat;
public class Hypervisor { public class Hypervisor {
public static enum HypervisorType { public static enum HypervisorType {
@ -63,6 +65,26 @@ public class Hypervisor {
return HypervisorType.None; return HypervisorType.None;
} }
} }
/**
* This method really needs to be part of the properties of the hypervisor type itself.
*
* @param hyperType
* @return
*/
public static ImageFormat getSupportedImageFormat(HypervisorType hyperType) {
if (hyperType == HypervisorType.XenServer) {
return ImageFormat.VHD;
} else if (hyperType == HypervisorType.KVM) {
return ImageFormat.QCOW2;
} else if (hyperType == HypervisorType.VMware) {
return ImageFormat.OVA;
} else if (hyperType == HypervisorType.Ovm) {
return ImageFormat.RAW;
} else {
return null;
}
}
} }
} }

View File

@ -61,8 +61,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Service Connectivity = new Service("Connectivity"); public static final Service Connectivity = new Service("Connectivity");
private String name; private final String name;
private Capability[] caps; private final Capability[] caps;
public Service(String name, Capability... caps) { public Service(String name, Capability... caps) {
this.name = name; this.name = name;
@ -123,13 +123,13 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false); public static final Provider SecurityGroupProvider = new Provider("SecurityGroupProvider", false);
public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false); public static final Provider VPCVirtualRouter = new Provider("VpcVirtualRouter", false);
public static final Provider None = new Provider("None", false); public static final Provider None = new Provider("None", false);
// NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking // NiciraNvp is not an "External" provider, otherwise we get in trouble with NetworkServiceImpl.providersConfiguredForExternalNetworking
public static final Provider NiciraNvp = new Provider("NiciraNvp", false); public static final Provider NiciraNvp = new Provider("NiciraNvp", false);
public static final Provider InternalLbVm = new Provider("InternalLbVm", false); public static final Provider InternalLbVm = new Provider("InternalLbVm", false);
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true); public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
private String name; private final String name;
private boolean isExternal; private final boolean isExternal;
public Provider(String name, boolean isExternal) { public Provider(String name, boolean isExternal) {
this.name = name; this.name = name;
@ -182,7 +182,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Capability LbSchemes = new Capability("LbSchemes"); public static final Capability LbSchemes = new Capability("LbSchemes");
public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets"); public static final Capability DhcpAccrossMultipleSubnets = new Capability("DhcpAccrossMultipleSubnets");
private String name; private final String name;
public Capability(String name) { public Capability(String name) {
this.name = name; this.name = name;
@ -247,8 +247,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
private String ip6Address; private String ip6Address;
public IpAddresses(String ip4Address, String ip6Address) { public IpAddresses(String ip4Address, String ip6Address) {
this.setIp4Address(ip4Address); setIp4Address(ip4Address);
this.setIp6Address(ip6Address); setIp6Address(ip6Address);
} }
public String getIp4Address() { public String getIp4Address() {
@ -297,6 +297,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
long getNetworkOfferingId(); long getNetworkOfferingId();
@Override
State getState(); State getState();
long getRelated(); long getRelated();
@ -325,6 +326,8 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
boolean getDisplayNetwork(); boolean getDisplayNetwork();
String getGuruName();
/** /**
* @return * @return
*/ */

View File

@ -23,68 +23,70 @@ import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType; import com.cloud.network.Networks.TrafficType;
public class NetworkProfile implements Network { public class NetworkProfile implements Network {
private long id; private final long id;
private String uuid; private final String uuid;
private long dataCenterId; private final long dataCenterId;
private long ownerId; private final long ownerId;
private long domainId; private final long domainId;
private String dns1; private String dns1;
private String dns2; private String dns2;
private URI broadcastUri; private URI broadcastUri;
private State state; private final State state;
private String name; private final String name;
private Mode mode; private final Mode mode;
private BroadcastDomainType broadcastDomainType; private final BroadcastDomainType broadcastDomainType;
private TrafficType trafficType; private TrafficType trafficType;
private String gateway; private final String gateway;
private String cidr; private final String cidr;
private String networkCidr; private final String networkCidr;
private String ip6Gateway; private final String ip6Gateway;
private String ip6Cidr; private final String ip6Cidr;
private long networkOfferingId; private final long networkOfferingId;
private long related; private final long related;
private String displayText; private final String displayText;
private String reservationId; private final String reservationId;
private String networkDomain; private final String networkDomain;
private Network.GuestType guestType; private final Network.GuestType guestType;
private Long physicalNetworkId; private Long physicalNetworkId;
private ACLType aclType; private final ACLType aclType;
private boolean restartRequired; private final boolean restartRequired;
private boolean specifyIpRanges; private final boolean specifyIpRanges;
private Long vpcId; private final Long vpcId;
private boolean displayNetwork; private final boolean displayNetwork;
private Long networkAclId; private Long networkAclId;
private final String guruName;
public NetworkProfile(Network network) { public NetworkProfile(Network network) {
this.id = network.getId(); id = network.getId();
this.uuid = network.getUuid(); uuid = network.getUuid();
this.broadcastUri = network.getBroadcastUri(); broadcastUri = network.getBroadcastUri();
this.dataCenterId = network.getDataCenterId(); dataCenterId = network.getDataCenterId();
this.ownerId = network.getAccountId(); ownerId = network.getAccountId();
this.state = network.getState(); state = network.getState();
this.name = network.getName(); name = network.getName();
this.mode = network.getMode(); mode = network.getMode();
this.broadcastDomainType = network.getBroadcastDomainType(); broadcastDomainType = network.getBroadcastDomainType();
this.trafficType = network.getTrafficType(); trafficType = network.getTrafficType();
this.gateway = network.getGateway(); gateway = network.getGateway();
this.cidr = network.getCidr(); cidr = network.getCidr();
this.networkCidr = network.getNetworkCidr(); networkCidr = network.getNetworkCidr();
this.ip6Gateway = network.getIp6Gateway(); ip6Gateway = network.getIp6Gateway();
this.ip6Cidr = network.getIp6Cidr(); ip6Cidr = network.getIp6Cidr();
this.networkOfferingId = network.getNetworkOfferingId(); networkOfferingId = network.getNetworkOfferingId();
this.related = network.getRelated(); related = network.getRelated();
this.displayText = network.getDisplayText(); displayText = network.getDisplayText();
this.reservationId = network.getReservationId(); reservationId = network.getReservationId();
this.networkDomain = network.getNetworkDomain(); networkDomain = network.getNetworkDomain();
this.domainId = network.getDomainId(); domainId = network.getDomainId();
this.guestType = network.getGuestType(); guestType = network.getGuestType();
this.physicalNetworkId = network.getPhysicalNetworkId(); physicalNetworkId = network.getPhysicalNetworkId();
this.aclType = network.getAclType(); aclType = network.getAclType();
this.restartRequired = network.isRestartRequired(); restartRequired = network.isRestartRequired();
this.specifyIpRanges = network.getSpecifyIpRanges(); specifyIpRanges = network.getSpecifyIpRanges();
this.vpcId = network.getVpcId(); vpcId = network.getVpcId();
this.displayNetwork = network.getDisplayNetwork(); displayNetwork = network.getDisplayNetwork();
this.networkAclId = network.getNetworkACLId(); networkAclId = network.getNetworkACLId();
guruName = network.getGuruName();
} }
public String getDns1() { public String getDns1() {
@ -103,6 +105,11 @@ public class NetworkProfile implements Network {
this.dns2 = dns2; this.dns2 = dns2;
} }
@Override
public String getGuruName() {
return guruName;
}
public void setBroadcastUri(URI broadcastUri) { public void setBroadcastUri(URI broadcastUri) {
this.broadcastUri = broadcastUri; this.broadcastUri = broadcastUri;
} }
@ -252,12 +259,12 @@ public class NetworkProfile implements Network {
@Override @Override
public void setNetworkACLId(Long networkACLId) { public void setNetworkACLId(Long networkACLId) {
this.networkAclId = networkACLId; networkAclId = networkACLId;
} }
@Override @Override
public void setTrafficType(TrafficType type) { public void setTrafficType(TrafficType type) {
this.trafficType = type; trafficType = type;
} }
@Override @Override

View File

@ -87,7 +87,7 @@ public interface NetworkService {
Long startIndex, Long pageSize, String name); Long startIndex, Long pageSize, String name);
PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags, PhysicalNetwork updatePhysicalNetwork(Long id, String networkSpeed, List<String> tags,
String newVnetRangeString, String state, String removeVlan); String newVnetRangeString, String state);
boolean deletePhysicalNetwork(Long id); boolean deletePhysicalNetwork(Long id);

View File

@ -55,13 +55,57 @@ public class Networks {
* Different types of broadcast domains. * Different types of broadcast domains.
*/ */
public enum BroadcastDomainType { public enum BroadcastDomainType {
Native(null, null), Native(null, null) {
Vlan("vlan", Integer.class), @Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains("://"))
return new URI(value.toString());
else
// strange requirement but this is how the code expects it
return new URI("vlan://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException("Unable to convert to broadcast URI: " + value);
}
}
},
Vlan("vlan", Integer.class) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains("://"))
return new URI(value.toString());
else
return new URI("vlan://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
},
Vswitch("vs", String.class), Vswitch("vs", String.class),
LinkLocal(null, null), LinkLocal(null, null),
Vnet("vnet", Long.class), Vnet("vnet", Long.class),
Storage("storage", Integer.class), Storage("storage", Integer.class),
Lswitch("lswitch", String.class), Lswitch("lswitch", String.class) {
@Override
public <T> URI toUri(T value) {
try {
return new URI("lswitch",value.toString(),null,null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
/**
* gets scheme specific part instead of host
*/
@Override
public String getValueFrom(URI uri) {
return uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class), Mido("mido", String.class),
Pvlan("pvlan", String.class), Pvlan("pvlan", String.class),
UnDecided(null, null); UnDecided(null, null);
@ -90,30 +134,53 @@ public class Networks {
return type; return type;
} }
/**
* The default implementation of toUri returns an uri with the scheme and value as host
*
* @param value will be put in the host field
* @return the resulting URI
*/
public <T> URI toUri(T value) { public <T> URI toUri(T value) {
try { try {
// do we need to check that value does not contain a scheme return new URI(scheme + "://" + value.toString());
// part?
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI(scheme, value.toString(), null);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new CloudRuntimeException( throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value); "Unable to convert to broadcast URI: " + value);
} }
} }
public static BroadcastDomainType getTypeOf(URI uri) { /**
return getType(uri.getScheme()); * get the enum value from this uri
*
* @param uri to get the scheme value from
* @return the scheme as BroadcastDomainType
*/
public static BroadcastDomainType getSchemeValue(URI uri) {
return toEnumValue(uri.getScheme());
} }
/**
* gets the type from a string encoded uri
*
* @param str the uri string
* @return the scheme as BroadcastDomainType
* @throws URISyntaxException when the string can not be converted to URI
*/
public static BroadcastDomainType getTypeOf(String str) public static BroadcastDomainType getTypeOf(String str)
throws URISyntaxException { throws URISyntaxException {
return getTypeOf(new URI(str)); if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
return Native;
}
return getSchemeValue(new URI(str));
} }
public static BroadcastDomainType getType(String scheme) { /**
* converts a String to a BroadcastDomainType
*
* @param scheme convert a string representation to a BroacastDomainType
* @return the value of this
*/
public static BroadcastDomainType toEnumValue(String scheme) {
if (scheme == null) { if (scheme == null) {
return UnDecided; return UnDecided;
} }
@ -125,23 +192,64 @@ public class Networks {
return UnDecided; return UnDecided;
} }
/**
* The default implementation of getValueFrom returns the host part of the uri
*
* @param uri to get the value from
* @return the host part as String
*/
public String getValueFrom(URI uri) {
return uri.getHost();
}
/**
* get the BroadcastDomain value from an arbitrary URI
* TODO what when the uri is useless
*
* @param uri the uri
* @return depending on the scheme/BroadcastDomainType
*/
public static String getValue(URI uri) {
return getSchemeValue(uri).getValueFrom(uri);
}
/**
* get the BroadcastDomain value from an arbitrary String
* TODO what when the uriString is useless
*
* @param uriString the string encoded uri
* @return depending on the scheme/BroadcastDomainType
* @throws URISyntaxException the string is not even an uri
*/
public static String getValue(String uriString) public static String getValue(String uriString)
throws URISyntaxException { throws URISyntaxException {
return getValue(new URI(uriString)); return getValue(new URI(uriString));
} }
public static String getValue(URI uri) { /**
BroadcastDomainType type = getTypeOf(uri); * encode a string into a BroadcastUri
if (type == Vlan) { * @param candidate the input string
// do complicated stuff for backward compatibility * @return an URI containing an appropriate (possibly given) scheme and the value
try { */
Long.parseLong(uri.getSchemeSpecificPart()); public static URI fromString(String candidate) {
return uri.getSchemeSpecificPart(); try {
} catch (NumberFormatException e) { Long.parseLong(candidate);
return uri.getHost(); return Vlan.toUri(candidate);
} catch (NumberFormatException nfe) {
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(candidate)) {
return Native.toUri(candidate);
}
try {
URI uri = new URI(candidate);
BroadcastDomainType tiep = getSchemeValue(uri);
if (tiep.scheme.equals(uri.getScheme())) {
return uri;
} else {
throw new CloudRuntimeException("string '" + candidate + "' has an unknown BroadcastDomainType.");
}
} catch (URISyntaxException e) {
throw new CloudRuntimeException("string is not a broadcast URI: " + candidate);
} }
} else {
return uri.getSchemeSpecificPart();
} }
} }
}; };
@ -188,7 +296,20 @@ public class Networks {
public enum IsolationType { public enum IsolationType {
None(null, null), None(null, null),
Ec2("ec2", String.class), Ec2("ec2", String.class),
Vlan("vlan", Integer.class), Vlan("vlan", Integer.class) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI("vlan", value.toString(), null, null);
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to isolation URI: " + value);
}
}
},
Vswitch("vs", String.class), Vswitch("vs", String.class),
Undecided(null, null), Undecided(null, null),
Vnet("vnet", Long.class); Vnet("vnet", Long.class);
@ -211,15 +332,7 @@ public class Networks {
public <T> URI toUri(T value) { public <T> URI toUri(T value) {
try { try {
// assert(this!=Vlan || return new URI(scheme + "://" + value.toString());
// value.getClass().isAssignableFrom(Integer.class)) :
// do we need to check that value does not contain a scheme
// part?
// "Why are you putting non integer into vlan url";
if (value.toString().contains(":"))
return new URI(value.toString());
else
return new URI(scheme, value.toString(), null);
} catch (URISyntaxException e) { } catch (URISyntaxException e) {
throw new CloudRuntimeException( throw new CloudRuntimeException(
"Unable to convert to isolation type URI: " + value); "Unable to convert to isolation type URI: " + value);

View File

@ -103,9 +103,10 @@ public interface LoadBalancingRulesService {
* balancer. * balancer.
* *
* @param cmd * @param cmd
* @return list of vm instances that have been or can be applied to a load balancer * @return list of vm instances that have been or can be applied to a load balancer along with service state,
* if the LB has health check policy created on it from cloudstack.
*/ */
List<? extends UserVm> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd); Pair<List<? extends UserVm>, List<String>> listLoadBalancerInstances(ListLoadBalancerRuleInstancesCmd cmd);
/** /**
* List load balancer rules based on the given criteria * List load balancer rules based on the given criteria

View File

@ -19,8 +19,6 @@ package com.cloud.network.security;
import org.apache.cloudstack.api.Identity; import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity; import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.async.AsyncInstanceCreateStatus;
public interface SecurityRule extends Identity, InternalIdentity { public interface SecurityRule extends Identity, InternalIdentity {
public static class SecurityRuleType { public static class SecurityRuleType {
@ -28,13 +26,13 @@ public interface SecurityRule extends Identity, InternalIdentity {
public static final SecurityRuleType EgressRule = new SecurityRuleType("egress"); public static final SecurityRuleType EgressRule = new SecurityRuleType("egress");
public SecurityRuleType(String type) { public SecurityRuleType(String type) {
this._type = type; _type = type;
} }
public String getType(){ public String getType(){
return _type; return _type;
} }
private String _type; private final String _type;
} }
long getSecurityGroupId(); long getSecurityGroupId();
@ -49,8 +47,6 @@ public interface SecurityRule extends Identity, InternalIdentity {
String getProtocol(); String getProtocol();
AsyncInstanceCreateStatus getCreateStatus();
Long getAllowedNetworkId(); Long getAllowedNetworkId();
String getAllowedSourceIpCidr(); String getAllowedSourceIpCidr();

View File

@ -56,7 +56,7 @@ public interface VpcGateway extends Identity, ControlledEntity, InternalIdentity
/** /**
* @return * @return
*/ */
Long getNetworkId(); long getNetworkId();
/** /**
* @return * @return

View File

@ -28,6 +28,12 @@ import org.apache.cloudstack.api.InternalIdentity;
* *
*/ */
public interface DiskOffering extends InfrastructureEntity, Identity, InternalIdentity { public interface DiskOffering extends InfrastructureEntity, Identity, InternalIdentity {
enum State {
Inactive,
Active,
}
State getState();
String getUniqueName(); String getUniqueName();
@ -65,6 +71,8 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
Long getMaxIops(); Long getMaxIops();
boolean isRecreatable();
void setBytesReadRate(Long bytesReadRate); void setBytesReadRate(Long bytesReadRate);
Long getBytesReadRate(); Long getBytesReadRate();
@ -80,4 +88,5 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
void setIopsWriteRate(Long iopsWriteRate); void setIopsWriteRate(Long iopsWriteRate);
Long getIopsWriteRate(); Long getIopsWriteRate();
} }

View File

@ -25,7 +25,7 @@ import org.apache.cloudstack.api.InternalIdentity;
/** /**
* offered. * offered.
*/ */
public interface ServiceOffering extends InfrastructureEntity, InternalIdentity, Identity { public interface ServiceOffering extends DiskOffering, InfrastructureEntity, InternalIdentity, Identity {
public static final String consoleProxyDefaultOffUniqueName = "Cloud.com-ConsoleProxy"; public static final String consoleProxyDefaultOffUniqueName = "Cloud.com-ConsoleProxy";
public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage"; public static final String ssvmDefaultOffUniqueName = "Cloud.com-SecondaryStorage";
public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter"; public static final String routerDefaultOffUniqueName = "Cloud.Com-SoftwareRouter";
@ -37,20 +37,25 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
shared shared
} }
@Override
String getDisplayText(); String getDisplayText();
@Override
Date getCreated(); Date getCreated();
@Override
String getTags(); String getTags();
/** /**
* @return user readable description * @return user readable description
*/ */
@Override
String getName(); String getName();
/** /**
* @return is this a system service offering * @return is this a system service offering
*/ */
@Override
boolean getSystemUse(); boolean getSystemUse();
/** /**
@ -96,8 +101,10 @@ public interface ServiceOffering extends InfrastructureEntity, InternalIdentity,
/** /**
* @return whether or not the service offering requires local storage * @return whether or not the service offering requires local storage
*/ */
@Override
boolean getUseLocalStorage(); boolean getUseLocalStorage();
@Override
Long getDomainId(); Long getDomainId();
/** /**

View File

@ -19,7 +19,9 @@ package com.cloud.server;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.cloud.exception.*; import com.cloud.exception.*;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd; import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd; import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
@ -46,9 +48,10 @@ import org.apache.cloudstack.api.command.user.ssh.ListSSHKeyPairsCmd;
import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd; import org.apache.cloudstack.api.command.user.ssh.RegisterSSHKeyPairCmd;
import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd; import org.apache.cloudstack.api.command.user.vm.GetVMPasswordCmd;
import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd; import org.apache.cloudstack.api.command.user.vmgroup.UpdateVMGroupCmd;
import org.apache.cloudstack.config.Configuration;
import com.cloud.alert.Alert; import com.cloud.alert.Alert;
import com.cloud.capacity.Capacity; import com.cloud.capacity.Capacity;
import com.cloud.configuration.Configuration;
import com.cloud.dc.Pod; import com.cloud.dc.Pod;
import com.cloud.dc.Vlan; import com.cloud.dc.Vlan;
import com.cloud.domain.Domain; import com.cloud.domain.Domain;

View File

@ -1,50 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package com.cloud.storage;
import java.util.Date;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import com.cloud.agent.api.to.S3TO;
public interface S3 extends InternalIdentity, Identity {
String getAccessKey();
String getSecretKey();
String getEndPoint();
String getBucketName();
Integer getHttpsFlag();
Integer getConnectionTimeout();
Integer getMaxErrorRetry();
Integer getSocketTimeout();
Date getCreated();
S3TO toS3TO();
}

View File

@ -20,8 +20,9 @@ import java.net.UnknownHostException;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd; import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd; import org.apache.cloudstack.api.command.admin.storage.CancelPrimaryStorageMaintenanceCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateCacheStoreCmd; import org.apache.cloudstack.api.command.admin.storage.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd; import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd; import org.apache.cloudstack.api.command.admin.storage.DeleteImageStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd; import org.apache.cloudstack.api.command.admin.storage.DeletePoolCmd;
import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd; import org.apache.cloudstack.api.command.admin.storage.UpdateStoragePoolCmd;
@ -48,8 +49,8 @@ public interface StorageService{
*/ */
StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException, StoragePool createPool(CreateStoragePoolCmd cmd) throws ResourceInUseException, IllegalArgumentException,
UnknownHostException, ResourceUnavailableException; UnknownHostException, ResourceUnavailableException;
ImageStore createCacheStore(CreateCacheStoreCmd cmd); ImageStore createSecondaryStagingStore(CreateSecondaryStagingStoreCmd cmd);
/** /**
* Delete the storage pool * Delete the storage pool
@ -92,6 +93,8 @@ public interface StorageService{
boolean deleteImageStore(DeleteImageStoreCmd cmd); boolean deleteImageStore(DeleteImageStoreCmd cmd);
boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException; ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
} }

View File

@ -184,4 +184,5 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
*/ */
void setReservationId(String reserv); void setReservationId(String reserv);
Storage.ImageFormat getFormat(); Storage.ImageFormat getFormat();
Long getVmSnapshotChainSize();
} }

View File

@ -20,6 +20,7 @@ package com.cloud.storage;
import java.net.URISyntaxException; 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.*;
import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ConcurrentOperationException;

View File

@ -36,7 +36,6 @@ import com.cloud.exception.InternalErrorException;
import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.StorageUnavailableException; import com.cloud.exception.StorageUnavailableException;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.utils.Pair;
import com.cloud.utils.exception.CloudRuntimeException; import com.cloud.utils.exception.CloudRuntimeException;
public interface TemplateApiService { public interface TemplateApiService {
@ -88,8 +87,6 @@ public interface TemplateApiService {
*/ */
String extract(ExtractTemplateCmd cmd) throws InternalErrorException; String extract(ExtractTemplateCmd cmd) throws InternalErrorException;
VirtualMachineTemplate getTemplate(long templateId);
List<String> listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd); List<String> listTemplatePermissions(BaseListTemplateOrIsoPermissionsCmd cmd);
boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd); boolean updateTemplateOrIsoPermissions(BaseUpdateTemplateOrIsoPermissionsCmd cmd);

View File

@ -28,6 +28,10 @@ import com.cloud.storage.Storage.ImageFormat;
import com.cloud.storage.Storage.TemplateType; import com.cloud.storage.Storage.TemplateType;
public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity { public interface VirtualMachineTemplate extends ControlledEntity, Identity, InternalIdentity {
enum State {
Active,
Inactive;
}
public static enum BootloaderType { public static enum BootloaderType {
PyGrub, HVM, External, CD PyGrub, HVM, External, CD
@ -44,6 +48,8 @@ public interface VirtualMachineTemplate extends ControlledEntity, Identity, Inte
all // all templates (only usable by admins) all // all templates (only usable by admins)
} }
State getState();
boolean isFeatured(); boolean isFeatured();
/** /**

View File

@ -517,7 +517,7 @@ public class ApiConstants {
public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable"; public static final String IS_DYNAMICALLY_SCALABLE = "isdynamicallyscalable";
public static final String ROUTING = "isrouting"; public static final String ROUTING = "isrouting";
public static final String MAX_CONNECTIONS = "maxconnections"; public static final String MAX_CONNECTIONS = "maxconnections";
public static final String SERVICE_STATE = "servicestate";
public enum HostDetails { public enum HostDetails {
all, capacity, events, stats, min; all, capacity, events, stats, min;
} }

View File

@ -16,10 +16,8 @@
// under the License. // under the License.
package org.apache.cloudstack.api; package org.apache.cloudstack.api;
import org.apache.cloudstack.api.response.AsyncJobResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import com.cloud.async.AsyncJob;
import com.cloud.user.User; import com.cloud.user.User;
/** /**
@ -33,7 +31,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
public static final String snapshotHostSyncObject = "snapshothost"; public static final String snapshotHostSyncObject = "snapshothost";
public static final String gslbSyncObject = "globalserverloadbalacner"; public static final String gslbSyncObject = "globalserverloadbalacner";
private AsyncJob job; private Object job;
@Parameter(name = "starteventid", type = CommandType.LONG) @Parameter(name = "starteventid", type = CommandType.LONG)
private Long startEventId; private Long startEventId;
@ -56,16 +54,8 @@ public abstract class BaseAsyncCmd extends BaseCmd {
*/ */
public abstract String getEventDescription(); public abstract String getEventDescription();
public ResponseObject getResponse(long jobId) {
AsyncJobResponse response = new AsyncJobResponse();
AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId); public void setJob(Object job) {
response.setJobId(job.getUuid());
response.setResponseName(getCommandName());
return response;
}
public void setJob(AsyncJob job) {
this.job = job; this.job = job;
} }
@ -100,7 +90,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
return null; return null;
} }
public AsyncJob getJob() { public Object getJob() {
return job; return job;
} }

View File

@ -16,13 +16,9 @@
// under the License. // under the License.
package org.apache.cloudstack.api; package org.apache.cloudstack.api;
import org.apache.cloudstack.api.response.CreateCmdResponse;
import com.cloud.async.AsyncJob;
import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceAllocationException;
public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd { public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
@Parameter(name = "id", type = CommandType.LONG)
private Long id; private Long id;
private String uuid; private String uuid;
@ -45,15 +41,6 @@ public abstract class BaseAsyncCreateCmd extends BaseAsyncCmd {
this.uuid = uuid; this.uuid = uuid;
} }
public String getResponse(long jobId, String objectUuid) {
CreateCmdResponse response = new CreateCmdResponse();
AsyncJob job = _entityMgr.findById(AsyncJob.class, jobId);
response.setJobId(job.getUuid());
response.setId(objectUuid);
response.setResponseName(getCommandName());
return _responseGenerator.toSerializedString(response, getResponseType());
}
public String getCreateEventType() { public String getCreateEventType() {
return null; return null;
} }

View File

@ -16,81 +16,12 @@
// under the License. // under the License.
package org.apache.cloudstack.api; package org.apache.cloudstack.api;
import com.cloud.async.AsyncJob;
import com.cloud.capacity.Capacity; import java.text.DecimalFormat;
import com.cloud.configuration.Configuration; import java.util.EnumSet;
import com.cloud.configuration.ResourceCount; import java.util.List;
import com.cloud.configuration.ResourceLimit; import java.util.Map;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.event.Event;
import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.GuestVlan;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.IsolationType;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VpnUser;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.as.Counter;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.StaticRoute;
import com.cloud.network.vpc.Vpc;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.server.ResourceTag;
import com.cloud.storage.GuestOS;
import com.cloud.storage.S3;
import com.cloud.storage.Snapshot;
import com.cloud.storage.StoragePool;
import com.cloud.storage.Swift;
import com.cloud.storage.Volume;
import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.storage.snapshot.SnapshotSchedule;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.utils.net.Ip;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.snapshot.VMSnapshot;
import org.apache.cloudstack.affinity.AffinityGroup; import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails; import org.apache.cloudstack.api.ApiConstants.HostDetails;
@ -150,7 +81,6 @@ import org.apache.cloudstack.api.response.RemoteAccessVpnResponse;
import org.apache.cloudstack.api.response.ResourceCountResponse; import org.apache.cloudstack.api.response.ResourceCountResponse;
import org.apache.cloudstack.api.response.ResourceLimitResponse; import org.apache.cloudstack.api.response.ResourceLimitResponse;
import org.apache.cloudstack.api.response.ResourceTagResponse; import org.apache.cloudstack.api.response.ResourceTagResponse;
import org.apache.cloudstack.api.response.S3Response;
import org.apache.cloudstack.api.response.SecurityGroupResponse; import org.apache.cloudstack.api.response.SecurityGroupResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.ServiceResponse; import org.apache.cloudstack.api.response.ServiceResponse;
@ -163,7 +93,6 @@ import org.apache.cloudstack.api.response.SnapshotScheduleResponse;
import org.apache.cloudstack.api.response.StaticRouteResponse; import org.apache.cloudstack.api.response.StaticRouteResponse;
import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse; import org.apache.cloudstack.api.response.StorageNetworkIpRangeResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse; import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse; import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.api.response.TemplatePermissionsResponse; import org.apache.cloudstack.api.response.TemplatePermissionsResponse;
@ -181,17 +110,85 @@ import org.apache.cloudstack.api.response.VpcOfferingResponse;
import org.apache.cloudstack.api.response.VpcResponse; import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.VpnUsersResponse; import org.apache.cloudstack.api.response.VpnUsersResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule; import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
import org.apache.cloudstack.region.PortableIp; import org.apache.cloudstack.region.PortableIp;
import org.apache.cloudstack.region.PortableIpRange; import org.apache.cloudstack.region.PortableIpRange;
import org.apache.cloudstack.region.Region; import org.apache.cloudstack.region.Region;
import org.apache.cloudstack.usage.Usage; import org.apache.cloudstack.usage.Usage;
import com.cloud.capacity.Capacity;
import com.cloud.configuration.ResourceCount;
import com.cloud.configuration.ResourceLimit;
import com.cloud.dc.DataCenter;
import com.cloud.dc.Pod;
import com.cloud.dc.StorageNetworkIpRange;
import com.cloud.dc.Vlan;
import com.cloud.domain.Domain;
import com.cloud.event.Event;
import com.cloud.host.Host;
import com.cloud.hypervisor.HypervisorCapabilities;
import com.cloud.network.GuestVlan;
import com.cloud.network.IpAddress;
import com.cloud.network.Network;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.IsolationType;
import com.cloud.network.PhysicalNetwork;
import com.cloud.network.PhysicalNetworkServiceProvider;
import com.cloud.network.PhysicalNetworkTrafficType;
import com.cloud.network.RemoteAccessVpn;
import com.cloud.network.Site2SiteCustomerGateway;
import com.cloud.network.Site2SiteVpnConnection;
import com.cloud.network.Site2SiteVpnGateway;
import com.cloud.network.VirtualRouterProvider;
import com.cloud.network.VpnUser;
import com.cloud.network.as.AutoScalePolicy;
import com.cloud.network.as.AutoScaleVmGroup;
import com.cloud.network.as.AutoScaleVmProfile;
import com.cloud.network.as.Condition;
import com.cloud.network.as.Counter;
import com.cloud.network.router.VirtualRouter;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.HealthCheckPolicy;
import com.cloud.network.rules.LoadBalancer;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.rules.StickinessPolicy;
import com.cloud.network.security.SecurityGroup;
import com.cloud.network.security.SecurityRule;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.PrivateGateway;
import com.cloud.network.vpc.StaticRoute;
import com.cloud.network.vpc.Vpc;
import com.cloud.network.vpc.VpcOffering;
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.org.Cluster;
import com.cloud.projects.Project;
import com.cloud.projects.ProjectAccount;
import com.cloud.projects.ProjectInvitation;
import com.cloud.region.ha.GlobalLoadBalancerRule;
import com.cloud.server.ResourceTag;
import com.cloud.storage.GuestOS;
import com.cloud.storage.ImageStore; import com.cloud.storage.ImageStore;
import java.text.DecimalFormat; import com.cloud.storage.Snapshot;
import java.util.EnumSet; import com.cloud.storage.StoragePool;
import java.util.List; import com.cloud.storage.Volume;
import java.util.Map; import com.cloud.storage.snapshot.SnapshotPolicy;
import com.cloud.storage.snapshot.SnapshotSchedule;
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.user.UserAccount;
import com.cloud.uservm.UserVm;
import com.cloud.utils.net.Ip;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.Nic;
import com.cloud.vm.NicSecondaryIp;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.snapshot.VMSnapshot;
public interface ResponseGenerator { public interface ResponseGenerator {
UserResponse createUserResponse(UserAccount user); UserResponse createUserResponse(UserAccount user);
@ -301,8 +298,6 @@ public interface ResponseGenerator {
String toSerializedString(CreateCmdResponse response, String responseType); String toSerializedString(CreateCmdResponse response, String responseType);
AsyncJobResponse createAsyncJobResponse(AsyncJob job);
EventResponse createEventResponse(Event event); EventResponse createEventResponse(Event event);
//List<EventResponse> createEventResponse(EventJoinVO... events); //List<EventResponse> createEventResponse(EventJoinVO... events);
@ -331,7 +326,7 @@ public interface ResponseGenerator {
List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly); List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
// List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly); // List<TemplateResponse> createIsoResponses(long isoId, Long zoneId, boolean readyOnly);
//List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly); //List<TemplateResponse> createIsoResponses(VirtualMachineTemplate iso, long zoneId, boolean readyOnly);
ProjectResponse createProjectResponse(Project project); ProjectResponse createProjectResponse(Project project);
@ -348,10 +343,6 @@ public interface ResponseGenerator {
SystemVmInstanceResponse createSystemVmInstanceResponse(VirtualMachine systemVM); SystemVmInstanceResponse createSystemVmInstanceResponse(VirtualMachine systemVM);
SwiftResponse createSwiftResponse(Swift swift);
S3Response createS3Response(S3 result);
PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result); PhysicalNetworkResponse createPhysicalNetworkResponse(PhysicalNetwork result);
ServiceResponse createNetworkServiceResponse(Service service); ServiceResponse createNetworkServiceResponse(Service service);

View File

@ -17,11 +17,9 @@
package org.apache.cloudstack.api.command.admin.cluster; package org.apache.cloudstack.api.command.admin.cluster;
import com.cloud.exception.DiscoveryException; import java.util.ArrayList;
import com.cloud.exception.InvalidParameterValueException; import java.util.List;
import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -34,8 +32,10 @@ import org.apache.cloudstack.api.response.PodResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import java.util.ArrayList; import com.cloud.exception.DiscoveryException;
import java.util.List; import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster;
import com.cloud.user.Account;
@APICommand(name = "addCluster", description="Adds a new cluster", responseObject=ClusterResponse.class) @APICommand(name = "addCluster", description="Adds a new cluster", responseObject=ClusterResponse.class)
public class AddClusterCmd extends BaseCmd { public class AddClusterCmd extends BaseCmd {
@ -87,10 +87,10 @@ public class AddClusterCmd extends BaseCmd {
@Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)") @Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Type of virtual switch used for public traffic in the cluster. Allowed values are, vmwaresvs (for VMware standard vSwitch) and vmwaredvs (for VMware distributed vSwitch)")
private String vSwitchTypePublicTraffic; private String vSwitchTypePublicTraffic;
@Parameter(name = ApiConstants.VSWITCH_TYPE_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.") @Parameter(name = ApiConstants.VSWITCH_NAME_GUEST_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for guest traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNameGuestTraffic; private String vSwitchNameGuestTraffic;
@Parameter(name = ApiConstants.VSWITCH_TYPE_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.") @Parameter(name = ApiConstants.VSWITCH_NAME_PUBLIC_TRAFFIC, type = CommandType.STRING, required = false, description = "Name of virtual switch used for public traffic in the cluster. This would override zone wide traffic label setting.")
private String vSwitchNamePublicTraffic; private String vSwitchNamePublicTraffic;
public String getVSwitchTypeGuestTraffic() { public String getVSwitchTypeGuestTraffic() {

View File

@ -24,9 +24,10 @@ import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListCmd; import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.*; import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.config.Configuration;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.configuration.Configuration;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
@APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class) @APICommand(name = "listConfigurations", description = "Lists all configurations.", responseObject = ConfigurationResponse.class)

View File

@ -23,9 +23,10 @@ import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.*; import org.apache.cloudstack.api.response.*;
import org.apache.cloudstack.config.Configuration;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.configuration.Configuration;
import com.cloud.user.Account; import com.cloud.user.Account;
@APICommand(name = "updateConfiguration", description="Updates a configuration.", responseObject=ConfigurationResponse.class) @APICommand(name = "updateConfiguration", description="Updates a configuration.", responseObject=ConfigurationResponse.class)

View File

@ -54,8 +54,6 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network") @Parameter(name=ApiConstants.VLAN, type=CommandType.STRING, description="the VLAN for the physical network")
private String vlan; private String vlan;
@Parameter(name=ApiConstants.REMOVE_VLAN, type = CommandType.STRING, description ="The vlan range we want to remove")
private String removevlan;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
@ -81,10 +79,6 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
return vlan; return vlan;
} }
public String getRemoveVlan(){
return removevlan;
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -101,7 +95,7 @@ public class UpdatePhysicalNetworkCmd extends BaseAsyncCmd {
@Override @Override
public void execute(){ public void execute(){
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState(), getRemoveVlan()); PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(),getNetworkSpeed(), getTags(), getVlan(), getState());
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result); PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); this.setResponseObject(response);

View File

@ -96,8 +96,6 @@ public class ListPortableIpRangesCmd extends BaseListCmd {
} }
rangeResponse.setPortableIpResponses(portableIpResponses); rangeResponse.setPortableIpResponses(portableIpResponses);
} }
rangeResponse.setObjectName("portableiprange");
responses.add(rangeResponse); responses.add(rangeResponse);
} }
} }

View File

@ -60,7 +60,7 @@ public class AddImageStoreCmd extends BaseCmd {
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss") @Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store. Example: details[0].key=accesskey&details[0].value=s389ddssaa&details[1].key=secretkey&details[1].value=8dshfsss")
private Map<String, String> details; private Map details;
@ -81,19 +81,19 @@ public class AddImageStoreCmd extends BaseCmd {
return zoneId; return zoneId;
} }
public Map<String, String> getDetails() { public Map<String, String> getDetails() {
Map<String, String> detailsMap = null; Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) { if (details != null && !details.isEmpty()) {
detailsMap = new HashMap<String, String>(); detailsMap = new HashMap<String, String>();
Collection<?> props = details.values(); Collection<?> props = details.values();
Iterator<?> iter = props.iterator(); Iterator<?> iter = props.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next(); HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key"); String key = detail.get("key");
String value = detail.get("value"); String value = detail.get("value");
detailsMap.put(key, value); detailsMap.put(key, value);
} }
} }
return detailsMap; return detailsMap;
} }
@ -139,10 +139,10 @@ public class AddImageStoreCmd extends BaseCmd {
ImageStore result = _storageService.discoverImageStore(this); ImageStore result = _storageService.discoverImageStore(this);
ImageStoreResponse storeResponse = null; ImageStoreResponse storeResponse = null;
if (result != null ) { if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result); storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName()); storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage"); storeResponse.setObjectName("imagestore");
this.setResponseObject(storeResponse); this.setResponseObject(storeResponse);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
} }

View File

@ -91,31 +91,44 @@ public final class AddS3Cmd extends BaseCmd {
@Override @Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, public void execute() throws ResourceUnavailableException, InsufficientCapacityException,
ServerApiException, ConcurrentOperationException, ResourceAllocationException, ServerApiException, ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException { NetworkRuleConflictException {
AddImageStoreCmd cmd = new AddImageStoreCmd(); AddImageStoreCmd cmd = new AddImageStoreCmd() {
@Override
public Map<String, String> getDetails() {
Map<String, String> dm = new HashMap<String, String>();
dm.put(ApiConstants.S3_ACCESS_KEY, getAccessKey());
dm.put(ApiConstants.S3_SECRET_KEY, getSecretKey());
dm.put(ApiConstants.S3_END_POINT, getEndPoint());
dm.put(ApiConstants.S3_BUCKET_NAME, getBucketName());
if (getHttpsFlag() != null) {
dm.put(ApiConstants.S3_HTTPS_FLAG, getHttpsFlag().toString());
}
if (getConnectionTimeout() != null) {
dm.put(ApiConstants.S3_CONNECTION_TIMEOUT, getConnectionTimeout().toString());
}
if (getMaxErrorRetry() != null) {
dm.put(ApiConstants.S3_MAX_ERROR_RETRY, getMaxErrorRetry().toString());
}
if (getSocketTimeout() != null) {
dm.put(ApiConstants.S3_SOCKET_TIMEOUT, getSocketTimeout().toString());
}
return dm;
}
};
cmd.setProviderName("S3"); cmd.setProviderName("S3");
Map<String, String> details = new HashMap<String, String>();
details.put(ApiConstants.S3_ACCESS_KEY, this.getAccessKey());
details.put(ApiConstants.S3_SECRET_KEY, this.getSecretKey());
details.put(ApiConstants.S3_END_POINT, this.getEndPoint());
details.put(ApiConstants.S3_BUCKET_NAME, this.getBucketName());
details.put(ApiConstants.S3_HTTPS_FLAG, this.getHttpsFlag().toString());
details.put(ApiConstants.S3_CONNECTION_TIMEOUT, this.getConnectionTimeout().toString());
details.put(ApiConstants.S3_MAX_ERROR_RETRY, this.getMaxErrorRetry().toString());
details.put(ApiConstants.S3_SOCKET_TIMEOUT, this.getSocketTimeout().toString());
try{ try{
ImageStore result = _storageService.discoverImageStore(cmd); ImageStore result = _storageService.discoverImageStore(cmd);
ImageStoreResponse storeResponse = null; ImageStoreResponse storeResponse = null;
if (result != null ) { if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result); storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName()); storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage"); storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse); this.setResponseObject(storeResponse);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 secondary storage");
} }
} catch (DiscoveryException ex) { } catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex); s_logger.warn("Exception: ", ex);

View File

@ -35,32 +35,32 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map; import java.util.Map;
@APICommand(name = "createCacheStore", description="create cache store.", responseObject=ImageStoreResponse.class) @APICommand(name = "createSecondaryStagingStore", description = "create secondary staging store.", responseObject = ImageStoreResponse.class)
public class CreateCacheStoreCmd extends BaseCmd { public class CreateSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(AddImageStoreCmd.class.getName());
private static final String s_name = "createcachestoreresponse"; private static final String s_name = "createsecondarystagingstoreresponse";
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//////////////// API parameters ///////////////////// //////////////// API parameters /////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, required=true, description="the URL for the cache store") @Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for the staging store")
private String url; private String url;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class,
description="the Zone ID for the image store") description = "the Zone ID for the staging store")
private Long zoneId; private Long zoneId;
@Parameter(name=ApiConstants.DETAILS, type=CommandType.MAP, description="the details for the image store") @Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "the details for the staging store")
private Map<String, String> details; private Map<String, String> details;
@Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING, @Parameter(name=ApiConstants.SCOPE, type=CommandType.STRING,
required=false, description="the scope of the image store: zone only for now") required = false, description = "the scope of the staging store: zone only for now")
private String scope; private String scope;
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, @Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
required=false, description="the cache store provider name") required = false, description = "the staging store provider name")
private String providerName; private String providerName;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -75,25 +75,25 @@ public class CreateCacheStoreCmd extends BaseCmd {
return zoneId; return zoneId;
} }
public Map<String, String> getDetails() { public Map<String, String> getDetails() {
Map<String, String> detailsMap = null; Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) { if (details != null && !details.isEmpty()) {
detailsMap = new HashMap<String, String>(); detailsMap = new HashMap<String, String>();
Collection<?> props = details.values(); Collection<?> props = details.values();
Iterator<?> iter = props.iterator(); Iterator<?> iter = props.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next(); HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key"); String key = detail.get("key");
String value = detail.get("value"); String value = detail.get("value");
detailsMap.put(key, value); detailsMap.put(key, value);
} }
} }
return detailsMap; return detailsMap;
} }
public String getScope() { public String getScope() {
return this.scope; return this.scope;
} }
public String getProviderName() { public String getProviderName() {
return this.providerName; return this.providerName;
@ -117,13 +117,13 @@ public class CreateCacheStoreCmd extends BaseCmd {
@Override @Override
public void execute(){ public void execute(){
try{ try{
ImageStore result = _storageService.createCacheStore(this); ImageStore result = _storageService.createSecondaryStagingStore(this);
ImageStoreResponse storeResponse = null; ImageStoreResponse storeResponse = null;
if (result != null ) { if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result); storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName()); storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage"); storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse); this.setResponseObject(storeResponse);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
} }

View File

@ -0,0 +1,79 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.storage;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;
@APICommand(name = "deleteSecondaryStagingStore", description = "Deletes a secondary staging store .", responseObject = SuccessResponse.class, since = "4.2.0")
public class DeleteSecondaryStagingStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(DeleteSecondaryStagingStoreCmd.class.getName());
private static final String s_name = "deletesecondarystagingstoreresponse";
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ImageStoreResponse.class,
required = true, description = "the staging store ID")
private Long id;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public Long getId() {
return id;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute() {
boolean result = _storageService.deleteSecondaryStagingStore(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete secondary staging store");
}
}
}

View File

@ -29,7 +29,7 @@ import org.apache.log4j.Logger;
public class ListImageStoresCmd extends BaseListCmd { public class ListImageStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListImageStoresCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(ListImageStoresCmd.class.getName());
private static final String s_name = "listimagestoreresponse"; private static final String s_name = "listimagestoresresponse";
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//////////////// API parameters ///////////////////// //////////////// API parameters /////////////////////

View File

@ -25,31 +25,31 @@ import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
@APICommand(name = "listCacheStores", description="Lists cache stores.", responseObject=ImageStoreResponse.class, since = "4.2.0") @APICommand(name = "listSecondaryStagingStores", description = "Lists secondary staging stores.", responseObject = ImageStoreResponse.class, since = "4.2.0")
public class ListCacheStoresCmd extends BaseListCmd { public class ListSecondaryStagingStoresCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListCacheStoresCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(ListSecondaryStagingStoresCmd.class.getName());
private static final String s_name = "listcachestoreresponse"; private static final String s_name = "listsecondarystagingstoreresponse";
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
//////////////// API parameters ///////////////////// //////////////// API parameters /////////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name of the cache store") @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the staging store")
private String storeName; private String storeName;
@Parameter(name=ApiConstants.PROTOCOL, type=CommandType.STRING, description="the cache store protocol") @Parameter(name = ApiConstants.PROTOCOL, type = CommandType.STRING, description = "the staging store protocol")
private String protocol; private String protocol;
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING, description="the cache store provider") @Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "the staging store provider")
private String provider; private String provider;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class, @Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType = ZoneResponse.class,
description="the Zone ID for the cache store") description = "the Zone ID for the staging store")
private Long zoneId; private Long zoneId;
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = ImageStoreResponse.class, @Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType = ImageStoreResponse.class,
description="the ID of the cache store") description = "the ID of the staging store")
private Long id; private Long id;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
@ -97,7 +97,7 @@ public class ListCacheStoresCmd extends BaseListCmd {
@Override @Override
public void execute(){ public void execute(){
ListResponse<ImageStoreResponse> response = _queryService.searchForCacheStores(this); ListResponse<ImageStoreResponse> response = _queryService.searchForSecondaryStagingStores(this);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); this.setResponseObject(response);
} }

View File

@ -47,6 +47,13 @@ public class UpdateStoragePoolCmd extends BaseCmd {
@Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma-separated list of tags for the storage pool") @Parameter(name=ApiConstants.TAGS, type=CommandType.LIST, collectionType=CommandType.STRING, description="comma-separated list of tags for the storage pool")
private List<String> tags; private List<String> tags;
@Parameter(name=ApiConstants.CAPACITY_IOPS, type=CommandType.LONG,
required=false, description="IOPS CloudStack can provision from this storage pool")
private Long capacityIops;
@Parameter(name=ApiConstants.CAPACITY_BYTES, type=CommandType.LONG,
required=false, description="bytes CloudStack can provision from this storage pool")
private Long capacityBytes;
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////////// Accessors /////////////////////// /////////////////// Accessors ///////////////////////
@ -60,6 +67,14 @@ public class UpdateStoragePoolCmd extends BaseCmd {
return tags; return tags;
} }
public Long getCapacityIops() {
return capacityIops;
}
public Long getCapacityBytes() {
return capacityBytes;
}
///////////////////////////////////////////////////// /////////////////////////////////////////////////////
/////////////// API Implementation/////////////////// /////////////// API Implementation///////////////////
///////////////////////////////////////////////////// /////////////////////////////////////////////////////

View File

@ -0,0 +1,122 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.swift;
import java.util.HashMap;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.storage.AddImageStoreCmd;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.log4j.Logger;
import com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
@APICommand(name = "addSwift", description = "Adds Swift.", responseObject = ImageStoreResponse.class, since="3.0.0")
public class AddSwiftCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddSwiftCmd.class.getName());
private static final String s_name = "addswiftresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, required = true, description = "the URL for swift")
private String url;
@Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "the account for swift")
private String account;
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, description = "the username for swift")
private String username;
@Parameter(name = ApiConstants.KEY, type = CommandType.STRING, description = " key for the user for swift")
private String key;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getUrl() {
return url;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
public String getAccount() {
return account;
}
public String getUsername() {
return username;
}
public String getKey() {
return key;
}
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
AddImageStoreCmd cmd = new AddImageStoreCmd() {
@Override
public Map<String, String> getDetails() {
Map<String, String> dm = new HashMap<String, String>();
dm.put(ApiConstants.ACCOUNT, getAccount());
dm.put(ApiConstants.USERNAME, getUsername());
dm.put(ApiConstants.KEY, getKey());
return dm;
}
};
cmd.setProviderName("Swift");
cmd.setUrl(this.getUrl());
try{
ImageStore result = _storageService.discoverImageStore(cmd);
ImageStoreResponse storeResponse = null;
if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift secondary storage");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}

View File

@ -0,0 +1,70 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.command.admin.swift;
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.command.admin.storage.ListImageStoresCmd;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;
@APICommand(name = "listSwifts", description = "List Swift.", responseObject = ImageStoreResponse.class, since="3.0.0")
public class ListSwiftsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSwiftsCmd.class.getName());
private static final String s_name = "listswiftsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.LONG, description = "the id of the swift")
private Long id;
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
public Long getId() {
return id;
}
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
ListImageStoresCmd cmd = new ListImageStoresCmd();
cmd.setProvider("Swift");
ListResponse<ImageStoreResponse> response = _queryService.searchForImageStores(cmd);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}

View File

@ -16,19 +16,6 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.admin.systemvm; package org.apache.cloudstack.api.command.admin.systemvm;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.SystemVmInstanceResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
@ -38,8 +25,18 @@ import com.cloud.exception.VirtualMachineMigrationException;
import com.cloud.host.Host; import com.cloud.host.Host;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
@APICommand(name = "migrateSystemVm", description="Attempts Migration of a system virtual machine to the host specified.", responseObject=SystemVmInstanceResponse.class) @APICommand(name = "migrateSystemVm", description="Attempts Migration of a system virtual machine to the host specified.", responseObject=SystemVmResponse.class)
public class MigrateSystemVMCmd extends BaseAsyncCmd { public class MigrateSystemVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(MigrateSystemVMCmd.class.getName());
@ -113,7 +110,7 @@ public class MigrateSystemVMCmd extends BaseAsyncCmd {
VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost); VirtualMachine migratedVm = _userVmService.migrateVirtualMachine(getVirtualMachineId(), destinationHost);
if (migratedVm != null) { if (migratedVm != null) {
// return the generic system VM instance response // return the generic system VM instance response
SystemVmInstanceResponse response = _responseGenerator.createSystemVmInstanceResponse(migratedVm); SystemVmResponse response = _responseGenerator.createSystemVmResponse(migratedVm);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); this.setResponseObject(response);
} else { } else {

View File

@ -16,17 +16,25 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.admin.systemvm; package org.apache.cloudstack.api.command.admin.systemvm;
import com.cloud.event.EventTypes; import org.apache.log4j.Logger;
import com.cloud.exception.*;
import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd; import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.response.ServiceOfferingResponse; import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger; import com.cloud.event.EventTypes;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ManagementServerException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.exception.VirtualMachineMigrationException;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine; import com.cloud.vm.VirtualMachine;
@ -85,7 +93,7 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
public void execute(){ public void execute(){
CallContext.current().setEventDetails("SystemVm Id: "+getId()); CallContext.current().setEventDetails("SystemVm Id: "+getId());
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
if (serviceOffering == null) { if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
} }
@ -109,25 +117,19 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
if (result != null) { if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale system vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade system vm");
} }
} }
@Override @Override
public String getEventType() { public String getEventType() {
VirtualMachine.Type type = _mgr.findSystemVMTypeById(getId()); return EventTypes.EVENT_VM_UPGRADE;
if(type == VirtualMachine.Type.ConsoleProxy){
return EventTypes.EVENT_PROXY_SCALE;
}
else{
return EventTypes.EVENT_SSVM_SCALE;
}
} }
@Override @Override
public String getEventDescription() { public String getEventDescription() {
return "scaling system vm: " + getId() + " to service offering: " + getServiceOfferingId(); return "Upgrading system vm: " + getId() + " to service offering: " + getServiceOfferingId();
} }
} }

View File

@ -16,6 +16,8 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.admin.systemvm; package org.apache.cloudstack.api.command.admin.systemvm;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -27,8 +29,6 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SystemVmResponse; import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -88,7 +88,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
public void execute(){ public void execute(){
CallContext.current().setEventDetails("Vm Id: "+getId()); CallContext.current().setEventDetails("Vm Id: "+getId());
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
if (serviceOffering == null) { if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
} }
@ -97,7 +97,7 @@ public class UpgradeSystemVMCmd extends BaseCmd {
if (result != null) { if (result != null) {
SystemVmResponse response = _responseGenerator.createSystemVmResponse(result); SystemVmResponse response = _responseGenerator.createSystemVmResponse(result);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to reboot system vm");
} }

View File

@ -35,7 +35,7 @@ import org.apache.log4j.Logger;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.uservm.UserVm; import com.cloud.uservm.UserVm;
@APICommand(name = "assignVirtualMachine", description="Assign a VM from one account to another under the same domain. This API is available for Basic zones with security groups and Advance zones with guest networks. The VM is restricted to move between accounts under same domain.", responseObject=UserVmResponse.class, since="3.0.0") @APICommand(name = "assignVirtualMachine", description="Change ownership of a VM from one account to another. This API is available for Basic zones with security groups and Advanced zones with guest networks. A root administrator can reassign a VM from any account to any other account in any domain. A domain administrator can reassign a VM to any account in the same domain.", responseObject=UserVmResponse.class, since="3.0.0")
public class AssignVMCmd extends BaseCmd { public class AssignVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName()); public static final Logger s_logger = Logger.getLogger(AssignVMCmd.class.getName());

View File

@ -18,6 +18,8 @@ package org.apache.cloudstack.api.command.user.address;
import java.util.List; import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
@ -36,8 +38,6 @@ import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
@ -51,6 +51,7 @@ import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.IpAddress; import com.cloud.network.IpAddress;
import com.cloud.network.Network; import com.cloud.network.Network;
import com.cloud.network.vpc.Vpc; import com.cloud.network.vpc.Vpc;
import com.cloud.offering.NetworkOffering;
import com.cloud.projects.Project; import com.cloud.projects.Project;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -163,7 +164,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
return null; return null;
} }
DataCenter zone = _configService.getZone(zoneId); DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
if (zone.getNetworkType() == NetworkType.Advanced) { if (zone.getNetworkType() == NetworkType.Advanced) {
List<? extends Network> networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(), List<? extends Network> networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(),
_accountService.getAccount(getEntityOwnerId())); _accountService.getAccount(getEntityOwnerId()));
@ -211,6 +212,20 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
} }
} else if (networkId != null){ } else if (networkId != null){
Network network = _networkService.getNetwork(networkId); Network network = _networkService.getNetwork(networkId);
if (network == null) {
throw new InvalidParameterValueException("Unable to find network by network id specified");
}
NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, network.getNetworkOfferingId());
DataCenter zone = _entityMgr.findById(DataCenter.class, network.getDataCenterId());
if (zone.getNetworkType() == NetworkType.Basic && offering.getElasticIp() && offering.getElasticLb()) {
// Since the basic zone network is owned by 'Root' domain, domain access checkers will fail for the
// accounts in non-root domains while acquiring public IP. So add an exception for the 'Basic' zone
// shared network with EIP/ELB service.
return caller.getAccountId();
}
return network.getAccountId(); return network.getAccountId();
} else if (vpcId != null) { } else if (vpcId != null) {
Vpc vpc = _vpcService.getVpc(getVpcId()); Vpc vpc = _vpcService.getVpc(getVpcId());
@ -263,8 +278,8 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
} }
if (ip != null) { if (ip != null) {
this.setEntityId(ip.getId()); setEntityId(ip.getId());
this.setEntityUuid(ip.getUuid()); setEntityUuid(ip.getUuid());
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to allocate ip address");
} }
@ -294,7 +309,7 @@ public class AssociateIPAddrCmd extends BaseAsyncCreateCmd {
if (result != null) { if (result != null) {
IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(result); IPAddressResponse ipResponse = _responseGenerator.createIPAddressResponse(result);
ipResponse.setResponseName(getCommandName()); ipResponse.setResponseName(getCommandName());
this.setResponseObject(ipResponse); setResponseObject(ipResponse);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to assign ip address");
} }

View File

@ -116,11 +116,11 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
return otherDeployParams; return otherDeployParams;
} }
public Long getAutoscaleUserId() { public long getAutoscaleUserId() {
if (autoscaleUserId != null) { if (autoscaleUserId != null) {
return autoscaleUserId; return autoscaleUserId;
} else { } else {
return CallContext.current().getCallingAccount().getId(); return CallContext.current().getCallingUserId();
} }
} }

View File

@ -18,10 +18,11 @@ package org.apache.cloudstack.api.command.user.config;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.response.CapabilitiesResponse; import org.apache.cloudstack.api.response.CapabilitiesResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -52,6 +53,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired")); response.setProjectInviteRequired((Boolean)capabilities.get("projectInviteRequired"));
response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects")); response.setAllowUsersCreateProjects((Boolean)capabilities.get("allowusercreateprojects"));
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize")); response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
if (capabilities.containsKey("apiLimitInterval")) { if (capabilities.containsKey("apiLimitInterval")) {
response.setApiLimitInterval((Integer) capabilities.get("apiLimitInterval")); response.setApiLimitInterval((Integer) capabilities.get("apiLimitInterval"));
} }

View File

@ -256,7 +256,7 @@ public class CreateFirewallRuleCmd extends BaseAsyncCreateCmd implements Firewal
@Override @Override
public String getEventDescription() { public String getEventDescription() {
IpAddress ip = _networkService.getIp(ipAddressId); IpAddress ip = _networkService.getIp(ipAddressId);
return ("Createing firewall rule for Ip: " + ip.getAddress() + " for protocol:" + this.getProtocol()); return ("Creating firewall rule for Ip: " + ip.getAddress() + " for protocol:" + this.getProtocol());
} }
@Override @Override

View File

@ -26,6 +26,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.IpAddress; import com.cloud.network.IpAddress;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -127,4 +128,22 @@ public class UpdatePortForwardingRuleCmd extends BaseAsyncCmd {
// throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update port forwarding rule"); // throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update port forwarding rule");
// } // }
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
return getIp().getAssociatedWithNetworkId();
}
private IpAddress getIp() {
IpAddress ip = _networkService.getIp(publicIpId);
if (ip == null) {
throw new InvalidParameterValueException("Unable to find ip address by id " + publicIpId);
}
return ip;
}
} }

View File

@ -22,6 +22,7 @@ import java.util.Map;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
@ -32,6 +33,7 @@ import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException; import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.ResourceUnavailableException;
@ -157,5 +159,18 @@ public class CreateLBStickinessPolicyCmd extends BaseAsyncCreateCmd {
return "creating a Load Balancer Stickiness policy: " + getLBStickinessPolicyName(); return "creating a Load Balancer Stickiness policy: " + getLBStickinessPolicyName();
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
LoadBalancer lb = _lbService.findById(getLbRuleId());
if (lb == null) {
throw new InvalidParameterValueException("Unable to find load balancer rule " + getLbRuleId() + " to create stickiness rule");
}
return lb.getNetworkId();
}
} }

View File

@ -22,6 +22,7 @@ import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType; import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
@ -163,7 +164,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
} }
if (zoneId != null) { if (zoneId != null) {
DataCenter zone = _configService.getZone(zoneId); DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
if (zone.getNetworkType() == NetworkType.Advanced) { if (zone.getNetworkType() == NetworkType.Advanced) {
List<? extends Network> networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(), _accountService.getAccount(getEntityOwnerId())); List<? extends Network> networks = _networkService.getIsolatedNetworksOwnedByAccountInZone(getZoneId(), _accountService.getAccount(getEntityOwnerId()));
if (networks.size() == 0) { if (networks.size() == 0) {
@ -315,7 +316,7 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
if (account != null) { if (account != null) {
return account.getId(); return account.getId();
} else { } else {
throw new InvalidParameterValueException("Unable to find account " + account + " in domain id=" + domainId); throw new InvalidParameterValueException("Unable to find account " + accountName + " in domain id=" + domainId);
} }
} else { } else {
throw new InvalidParameterValueException("Can't define IP owner. Either specify account/domainId or publicIpId"); throw new InvalidParameterValueException("Can't define IP owner. Either specify account/domainId or publicIpId");
@ -381,5 +382,14 @@ public class CreateLoadBalancerRuleCmd extends BaseAsyncCreateCmd /*implements
return ApiCommandJobType.FirewallRule; return ApiCommandJobType.FirewallRule;
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
return getNetworkId();
}
} }

View File

@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.user.loadbalancer; package org.apache.cloudstack.api.command.user.loadbalancer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
@ -29,6 +30,7 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.uservm.UserVm; import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
@APICommand(name = "listLoadBalancerRuleInstances", description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class) @APICommand(name = "listLoadBalancerRuleInstances", description="List all virtual machine instances that are assigned to a load balancer rule.", responseObject=UserVmResponse.class)
public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd { public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
@ -70,12 +72,18 @@ public class ListLoadBalancerRuleInstancesCmd extends BaseListCmd {
@Override @Override
public void execute(){ public void execute(){
List<? extends UserVm> result = _lbService.listLoadBalancerInstances(this); Pair<List<? extends UserVm>, List<String>> vmServiceMap = _lbService.listLoadBalancerInstances(this);
List<? extends UserVm> result = vmServiceMap.first();
List<String> serviceStates = vmServiceMap.second();
ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>(); ListResponse<UserVmResponse> response = new ListResponse<UserVmResponse>();
List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>(); List<UserVmResponse> vmResponses = new ArrayList<UserVmResponse>();
if (result != null) { if (result != null) {
vmResponses = _responseGenerator.createUserVmResponse("loadbalancerruleinstance", result.toArray(new UserVm[result.size()])); vmResponses = _responseGenerator.createUserVmResponse("loadbalancerruleinstance", result.toArray(new UserVm[result.size()]));
} }
for (int i=0;i<result.size(); i++) {
vmResponses.get(i).setServiceState(serviceStates.get(i));
}
response.setResponses(vmResponses); response.setResponses(vmResponses);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); this.setResponseObject(response);

View File

@ -29,6 +29,7 @@ import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.network.rules.LoadBalancer; import com.cloud.network.rules.LoadBalancer;
import com.cloud.user.Account; import com.cloud.user.Account;
@ -114,4 +115,18 @@ public class UpdateLoadBalancerRuleCmd extends BaseAsyncCmd {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load balancer rule"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update load balancer rule");
} }
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
LoadBalancer lb = _lbService.findById(getId());
if (lb == null) {
throw new InvalidParameterValueException("Unable to find load balancer rule " + getId());
}
return lb.getNetworkId();
}
} }

View File

@ -19,13 +19,12 @@ package org.apache.cloudstack.api.command.user.network;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.cloud.network.vpc.NetworkACL; import org.apache.commons.lang.StringUtils;
import com.cloud.network.vpc.NetworkACLItem; import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.BaseAsyncCreateCmd; import org.apache.cloudstack.api.BaseAsyncCreateCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
@ -34,16 +33,10 @@ import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkResponse; import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.commons.lang.StringUtils;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network; import com.cloud.network.vpc.NetworkACLItem;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.cloud.utils.net.NetUtils; import com.cloud.utils.net.NetUtils;

View File

@ -16,17 +16,24 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.network; package org.apache.cloudstack.api.command.user.network;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseCmd; import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.*; import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.NetworkOfferingResponse;
import org.apache.cloudstack.api.response.NetworkResponse;
import org.apache.cloudstack.api.response.PhysicalNetworkResponse;
import org.apache.cloudstack.api.response.ProjectResponse;
import org.apache.cloudstack.api.response.VpcResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.exception.ConcurrentOperationException; import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException; import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
@ -212,7 +219,7 @@ public class CreateNetworkCmd extends BaseCmd {
} }
public Long getPhysicalNetworkId() { public Long getPhysicalNetworkId() {
NetworkOffering offering = _configService.getNetworkOffering(networkOfferingId); NetworkOffering offering = _entityMgr.findById(NetworkOffering.class, networkOfferingId);
if (offering == null) { if (offering == null) {
throw new InvalidParameterValueException("Unable to find network offering by id " + networkOfferingId); throw new InvalidParameterValueException("Unable to find network offering by id " + networkOfferingId);
} }
@ -288,7 +295,7 @@ public class CreateNetworkCmd extends BaseCmd {
if (result != null) { if (result != null) {
NetworkResponse response = _responseGenerator.createNetworkResponse(result); NetworkResponse response = _responseGenerator.createNetworkResponse(result);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); setResponseObject(response);
}else { }else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network");
} }

View File

@ -16,8 +16,7 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.network; package org.apache.cloudstack.api.command.user.network;
import com.cloud.network.vpc.NetworkACLItem; import org.apache.log4j.Logger;
import com.cloud.user.Account;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
@ -25,19 +24,13 @@ import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd; import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.FirewallRuleResponse;
import org.apache.cloudstack.api.response.NetworkACLItemResponse; import org.apache.cloudstack.api.response.NetworkACLItemResponse;
import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException; import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule; import com.cloud.user.Account;
@APICommand(name = "deleteNetworkACL", description="Deletes a Network ACL", responseObject=SuccessResponse.class) @APICommand(name = "deleteNetworkACL", description="Deletes a Network ACL", responseObject=SuccessResponse.class)
public class DeleteNetworkACLCmd extends BaseAsyncCmd { public class DeleteNetworkACLCmd extends BaseAsyncCmd {
@ -91,7 +84,7 @@ public class DeleteNetworkACLCmd extends BaseAsyncCmd {
if (result) { if (result) {
SuccessResponse response = new SuccessResponse(getCommandName()); SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL Item"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL Item");
} }

View File

@ -16,23 +16,21 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.network; package org.apache.cloudstack.api.command.user.network;
import com.cloud.async.AsyncJob; import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.vpc.NetworkACL;
import com.cloud.network.vpc.Vpc;
import com.cloud.user.Account;
import org.apache.cloudstack.api.*; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.response.AccountResponse; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.response.FirewallRuleResponse; import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.NetworkACLResponse; import org.apache.cloudstack.api.response.NetworkACLResponse;
import org.apache.cloudstack.api.response.SuccessResponse; import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger; import com.cloud.event.EventTypes;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.user.Account;
@APICommand(name = "deleteNetworkACLList", description="Deletes a Network ACL", responseObject=SuccessResponse.class) @APICommand(name = "deleteNetworkACLList", description="Deletes a Network ACL", responseObject=SuccessResponse.class)
public class DeleteNetworkACLListCmd extends BaseAsyncCmd { public class DeleteNetworkACLListCmd extends BaseAsyncCmd {
@ -86,7 +84,7 @@ public class DeleteNetworkACLListCmd extends BaseAsyncCmd {
if (result) { if (result) {
SuccessResponse response = new SuccessResponse(getCommandName()); SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete network ACL");
} }

View File

@ -159,4 +159,14 @@ public class UpdateNetworkCmd extends BaseAsyncCmd {
public String getEventType() { public String getEventType() {
return EventTypes.EVENT_NETWORK_UPDATE; return EventTypes.EVENT_NETWORK_UPDATE;
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.networkSyncObject;
}
@Override
public Long getSyncObjId() {
return id;
}
} }

View File

@ -24,6 +24,8 @@ import java.util.LinkedHashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.apache.log4j.Logger;
import org.apache.cloudstack.acl.SecurityChecker.AccessType; import org.apache.cloudstack.acl.SecurityChecker.AccessType;
import org.apache.cloudstack.affinity.AffinityGroupResponse; import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ACL; import org.apache.cloudstack.api.ACL;
@ -46,8 +48,6 @@ import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.ZoneResponse; import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.dc.DataCenter; import com.cloud.dc.DataCenter;
import com.cloud.dc.DataCenter.NetworkType; import com.cloud.dc.DataCenter.NetworkType;
import com.cloud.event.EventTypes; import com.cloud.event.EventTypes;
@ -443,7 +443,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
if (result != null) { if (result != null) {
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to deploy vm");
} }
@ -455,17 +455,17 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
//Verify that all objects exist before passing them to the service //Verify that all objects exist before passing them to the service
Account owner = _accountService.getActiveAccountById(getEntityOwnerId()); Account owner = _accountService.getActiveAccountById(getEntityOwnerId());
DataCenter zone = _configService.getZone(zoneId); DataCenter zone = _entityMgr.findById(DataCenter.class, zoneId);
if (zone == null) { if (zone == null) {
throw new InvalidParameterValueException("Unable to find zone by id=" + zoneId); throw new InvalidParameterValueException("Unable to find zone by id=" + zoneId);
} }
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
if (serviceOffering == null) { if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
} }
VirtualMachineTemplate template = _templateService.getTemplate(templateId); VirtualMachineTemplate template = _entityMgr.findById(VirtualMachineTemplate.class, templateId);
// Make sure a valid template ID was specified // Make sure a valid template ID was specified
if (template == null) { if (template == null) {
throw new InvalidParameterValueException("Unable to use template " + templateId); throw new InvalidParameterValueException("Unable to use template " + templateId);
@ -473,7 +473,7 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
DiskOffering diskOffering = null; DiskOffering diskOffering = null;
if (diskOfferingId != null) { if (diskOfferingId != null) {
diskOffering = _configService.getDiskOffering(diskOfferingId); diskOffering = _entityMgr.findById(DiskOffering.class, diskOfferingId);
if (diskOffering == null) { if (diskOffering == null) {
throw new InvalidParameterValueException("Unable to find disk offering " + diskOfferingId); throw new InvalidParameterValueException("Unable to find disk offering " + diskOfferingId);
} }
@ -495,19 +495,19 @@ public class DeployVMCmd extends BaseAsyncCreateCmd {
throw new InvalidParameterValueException("Can't specify network Ids in Basic zone"); throw new InvalidParameterValueException("Can't specify network Ids in Basic zone");
} else { } else {
vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name, vm = _userVmService.createBasicSecurityGroupVirtualMachine(zone, serviceOffering, template, getSecurityGroupIdList(), owner, name,
displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList()); displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
} }
} else { } else {
if (zone.isSecurityGroupEnabled()) { if (zone.isSecurityGroupEnabled()) {
vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(), vm = _userVmService.createAdvancedSecurityGroupVirtualMachine(zone, serviceOffering, template, getNetworkIds(), getSecurityGroupIdList(),
owner, name, displayName, diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList()); owner, name, displayName, diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
} else { } else {
if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) { if (getSecurityGroupIdList() != null && !getSecurityGroupIdList().isEmpty()) {
throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone"); throw new InvalidParameterValueException("Can't create vm with security groups; security group feature is not enabled per zone");
} }
vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName, vm = _userVmService.createAdvancedVirtualMachine(zone, serviceOffering, template, getNetworkIds(), owner, name, displayName,
diskOfferingId, size, group, getHypervisor(), this.getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList()); diskOfferingId, size, group, getHypervisor(), getHttpMethod(), userData, sshKeyPairName, getIpToNetworkMap(), addrs, displayVm, keyboard, getAffinityGroupIdList());
} }
} }

View File

@ -66,7 +66,7 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
private Long id; private Long id;
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the virtual machine") @Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="name of the virtual machine")
private String instanceName; private String name;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, @Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class,
description="the pod ID") description="the pod ID")
@ -130,8 +130,8 @@ public class ListVMsCmd extends BaseListTaggedResourcesCmd {
return id; return id;
} }
public String getInstanceName() { public String getName() {
return instanceName; return name;
} }
public Long getPodId() { public Long getPodId() {

View File

@ -86,9 +86,18 @@ public class ScaleVMCmd extends BaseAsyncCmd {
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
} }
@Override
public String getEventType() {
return EventTypes.EVENT_VM_UPGRADE;
}
@Override
public String getEventDescription() {
return "upgrading vm: " + getId() + " to service offering: " + getServiceOfferingId();
}
@Override @Override
public void execute(){ public void execute(){
//UserContext.current().setEventDetails("Vm Id: "+getId());
UserVm result; UserVm result;
try { try {
result = _userVmService.upgradeVirtualMachine(this); result = _userVmService.upgradeVirtualMachine(this);
@ -114,14 +123,4 @@ public class ScaleVMCmd extends BaseAsyncCmd {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to scale vm");
} }
} }
@Override
public String getEventType() {
return EventTypes.EVENT_VM_SCALE;
}
@Override
public String getEventDescription() {
return "scaling volume: " + getId() + " to service offering: " + getServiceOfferingId();
}
} }

View File

@ -16,6 +16,8 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.vm; package org.apache.cloudstack.api.command.user.vm;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand; import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode; import org.apache.cloudstack.api.ApiErrorCode;
@ -26,8 +28,6 @@ import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.context.CallContext; import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.ResourceAllocationException; import com.cloud.exception.ResourceAllocationException;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
@ -92,7 +92,7 @@ public class UpgradeVMCmd extends BaseCmd {
public void execute() throws ResourceAllocationException{ public void execute() throws ResourceAllocationException{
CallContext.current().setEventDetails("Vm Id: "+getId()); CallContext.current().setEventDetails("Vm Id: "+getId());
ServiceOffering serviceOffering = _configService.getServiceOffering(serviceOfferingId); ServiceOffering serviceOffering = _entityMgr.findById(ServiceOffering.class, serviceOfferingId);
if (serviceOffering == null) { if (serviceOffering == null) {
throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId); throw new InvalidParameterValueException("Unable to find service offering: " + serviceOfferingId);
} }
@ -101,7 +101,7 @@ public class UpgradeVMCmd extends BaseCmd {
if (result != null){ if (result != null){
UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0); UserVmResponse response = _responseGenerator.createUserVmResponse("virtualmachine", result).get(0);
response.setResponseName(getCommandName()); response.setResponseName(getCommandName());
this.setResponseObject(response); setResponseObject(response);
} else { } else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm"); throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade vm");
} }

View File

@ -16,27 +16,21 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.user.volume; package org.apache.cloudstack.api.command.user.volume;
import com.cloud.server.ResourceTag; import java.util.Collection;
import java.util.HashMap;
import org.apache.cloudstack.api.APICommand; import java.util.Iterator;
import org.apache.cloudstack.api.ApiConstants; import java.util.Map;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseAsyncCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.SuccessResponse;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VolumeResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
import com.cloud.async.AsyncJob; import org.apache.cloudstack.api.APICommand;
import com.cloud.event.EventTypes; import org.apache.cloudstack.api.ApiConstants;
import com.cloud.storage.Volume; import org.apache.cloudstack.api.BaseAsyncCmd;
import com.cloud.user.Account; import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.SuccessResponse;
import java.util.*; import com.cloud.event.EventTypes;
import com.cloud.server.ResourceTag;
@APICommand(name = "addResourceDetail", description="Adds detail for the Resource.", responseObject=SuccessResponse.class) @APICommand(name = "addResourceDetail", description="Adds detail for the Resource.", responseObject=SuccessResponse.class)
public class AddResourceDetailCmd extends BaseAsyncCmd { public class AddResourceDetailCmd extends BaseAsyncCmd {
@ -113,6 +107,6 @@ public class AddResourceDetailCmd extends BaseAsyncCmd {
@Override @Override
public void execute(){ public void execute(){
_resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails()); _resourceMetaDataService.addResourceMetaData(getResourceId(), getResourceType(), getDetails());
this.setResponseObject(new SuccessResponse(getCommandName())); setResponseObject(new SuccessResponse(getCommandName()));
} }
} }

View File

@ -99,6 +99,7 @@ public class MigrateVolumeCmd extends BaseAsyncCmd {
@Override @Override
public void execute(){ public void execute(){
Volume result; Volume result;
result = _volumeService.migrateVolume(this); result = _volumeService.migrateVolume(this);
if (result != null) { if (result != null) {
VolumeResponse response = _responseGenerator.createVolumeResponse(result); VolumeResponse response = _responseGenerator.createVolumeResponse(result);

View File

@ -101,4 +101,13 @@ public class DeleteVPCCmd extends BaseAsyncCmd{
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.vpcSyncObject;
}
@Override
public Long getSyncObjId() {
return getId();
}
} }

View File

@ -106,4 +106,14 @@ public class RestartVPCCmd extends BaseAsyncCmd{
public String getEventDescription() { public String getEventDescription() {
return "restarting VPC id=" + getId(); return "restarting VPC id=" + getId();
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.vpcSyncObject;
}
@Override
public Long getSyncObjId() {
return getId();
}
} }

View File

@ -105,4 +105,14 @@ public class UpdateVPCCmd extends BaseAsyncCmd{
public String getEventDescription() { public String getEventDescription() {
return "updating VPC id=" + getId(); return "updating VPC id=" + getId();
} }
@Override
public String getSyncObjType() {
return BaseAsyncCmd.vpcSyncObject;
}
@Override
public Long getSyncObjId() {
return getId();
}
} }

View File

@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.cloud.user.Account; import com.cloud.user.Account;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@EntityReference(value = Account.class) @EntityReference(value = Account.class)
@ -189,7 +190,7 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
@Override @Override
public String getObjectId() { public String getObjectId() {
return this.id; return id;
} }
public void setId(String id) { public void setId(String id) {
@ -351,7 +352,22 @@ public class AccountResponse extends BaseResponse implements ResourceLimitAndCou
public void setNetworkAvailable(String networkAvailable) { public void setNetworkAvailable(String networkAvailable) {
this.networkAvailable = networkAvailable; this.networkAvailable = networkAvailable;
} }
@Override
public void setVpcLimit(String vpcLimit) {
this.vpcLimit = networkLimit;
}
@Override
public void setVpcTotal(Long vpcTotal) {
this.vpcTotal = vpcTotal;
}
@Override
public void setVpcAvailable(String vpcAvailable) {
this.vpcAvailable = vpcAvailable;
}
@Override @Override
public void setCpuLimit(String cpuLimit) { public void setCpuLimit(String cpuLimit) {
this.cpuLimit = cpuLimit; this.cpuLimit = cpuLimit;

View File

@ -18,17 +18,17 @@ package org.apache.cloudstack.api.response;
import java.util.Date; import java.util.Date;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import org.apache.cloudstack.api.ResponseObject; import org.apache.cloudstack.api.ResponseObject;
import org.apache.cloudstack.jobs.JobInfo;
import com.cloud.async.AsyncJob;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value=AsyncJob.class) @EntityReference(value = JobInfo.class)
@SuppressWarnings("unused")
public class AsyncJobResponse extends BaseResponse { public class AsyncJobResponse extends BaseResponse {
@SerializedName("accountid") @Param(description="the account that executed the async command") @SerializedName("accountid") @Param(description="the account that executed the async command")

View File

@ -16,11 +16,12 @@
// under the License. // under the License.
package org.apache.cloudstack.api.response; package org.apache.cloudstack.api.response;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
public class CapabilitiesResponse extends BaseResponse { public class CapabilitiesResponse extends BaseResponse {
@ -46,6 +47,9 @@ public class CapabilitiesResponse extends BaseResponse {
"create disk from disk offering with custom size") "create disk from disk offering with custom size")
private Long diskOffMaxSize; private Long diskOffMaxSize;
@SerializedName("regionsecondaryenabled") @Param(description = "true if region wide secondary is enabled, false otherwise")
private boolean regionSecondaryEnabled;
@SerializedName("apilimitinterval") @Param(description="time interval (in seconds) to reset api count") @SerializedName("apilimitinterval") @Param(description="time interval (in seconds) to reset api count")
private Integer apiLimitInterval; private Integer apiLimitInterval;
@ -81,6 +85,10 @@ public class CapabilitiesResponse extends BaseResponse {
this.diskOffMaxSize = diskOffMaxSize; this.diskOffMaxSize = diskOffMaxSize;
} }
public void setRegionSecondaryEnabled(boolean regionSecondaryEnabled){
this.regionSecondaryEnabled = regionSecondaryEnabled;
}
public void setApiLimitInterval(Integer apiLimitInterval) { public void setApiLimitInterval(Integer apiLimitInterval) {
this.apiLimitInterval = apiLimitInterval; this.apiLimitInterval = apiLimitInterval;
} }

View File

@ -16,9 +16,14 @@
// under the License. // under the License.
package org.apache.cloudstack.api.response; package org.apache.cloudstack.api.response;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
public class CreateCmdResponse extends BaseResponse { public class CreateCmdResponse extends BaseResponse {
@SerializedName(ApiConstants.ID)
private String id; private String id;
public String getId() { public String getId() {

View File

@ -91,6 +91,8 @@ public class NetworkOfferingResponse extends BaseResponse {
@SerializedName(ApiConstants.EGRESS_DEFAULT_POLICY) @Param(description="true if network offering supports persistent networks, false otherwise") @SerializedName(ApiConstants.EGRESS_DEFAULT_POLICY) @Param(description="true if network offering supports persistent networks, false otherwise")
private Boolean egressDefaultPolicy; private Boolean egressDefaultPolicy;
@SerializedName(ApiConstants.MAX_CONNECTIONS) @Param(description = "maximum number of concurrents connections to be handled by lb")
private Integer concurrentConnections;
public void setId(String id) { public void setId(String id) {
this.id = id; this.id = id;
@ -173,4 +175,8 @@ public class NetworkOfferingResponse extends BaseResponse {
this.egressDefaultPolicy = egressDefaultPolicy; this.egressDefaultPolicy = egressDefaultPolicy;
} }
public void setConcurrentConnections(Integer concurrentConnections) {
this.concurrentConnections = concurrentConnections;
}
} }

View File

@ -76,6 +76,9 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
@SerializedName("networkofferingdisplaytext") @Param(description="display text of the network offering the network is created from") @SerializedName("networkofferingdisplaytext") @Param(description="display text of the network offering the network is created from")
private String networkOfferingDisplayText; private String networkOfferingDisplayText;
@SerializedName("networkofferingconservemode") @Param(description="true if network offering is ip conserve mode enabled")
private Boolean networkOfferingConserveMode;
@SerializedName("networkofferingavailability") @Param(description="availability of the network offering the network is created from") @SerializedName("networkofferingavailability") @Param(description="availability of the network offering the network is created from")
private String networkOfferingAvailability; private String networkOfferingAvailability;
@ -247,7 +250,11 @@ public class NetworkResponse extends BaseResponse implements ControlledEntityRes
public void setNetworkOfferingDisplayText(String networkOfferingDisplayText) { public void setNetworkOfferingDisplayText(String networkOfferingDisplayText) {
this.networkOfferingDisplayText = networkOfferingDisplayText; this.networkOfferingDisplayText = networkOfferingDisplayText;
} }
public void setNetworkOfferingConserveMode(Boolean networkOfferingConserveMode) {
this.networkOfferingConserveMode = networkOfferingConserveMode;
}
public void setDisplaytext(String displaytext) { public void setDisplaytext(String displaytext) {
this.displaytext = displaytext; this.displaytext = displaytext;
} }

View File

@ -19,13 +19,14 @@ package org.apache.cloudstack.api.response;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import com.google.gson.annotations.SerializedName;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.EntityReference; import org.apache.cloudstack.api.EntityReference;
import com.cloud.projects.Project; import com.cloud.projects.Project;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value=Project.class) @EntityReference(value=Project.class)
@SuppressWarnings("unused") @SuppressWarnings("unused")
@ -182,7 +183,7 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
} }
public void setOwner(String owner) { public void setOwner(String owner) {
this.ownerName = owner; ownerName = owner;
} }
public void setState(String state) { public void setState(String state) {
@ -194,7 +195,7 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
} }
public void addTag(ResourceTagResponse tag){ public void addTag(ResourceTagResponse tag){
this.tags.add(tag); tags.add(tag);
} }
@Override @Override
@ -296,7 +297,22 @@ public class ProjectResponse extends BaseResponse implements ResourceLimitAndCou
public void setNetworkAvailable(String networkAvailable) { public void setNetworkAvailable(String networkAvailable) {
this.networkAvailable = networkAvailable; this.networkAvailable = networkAvailable;
} }
@Override
public void setVpcLimit(String vpcLimit) {
this.vpcLimit = networkLimit;
}
@Override
public void setVpcTotal(Long vpcTotal) {
this.vpcTotal = vpcTotal;
}
@Override
public void setVpcAvailable(String vpcAvailable) {
this.vpcAvailable = vpcAvailable;
}
@Override @Override
public void setCpuLimit(String cpuLimit) { public void setCpuLimit(String cpuLimit) {
this.cpuLimit = cpuLimit; this.cpuLimit = cpuLimit;

View File

@ -35,6 +35,12 @@ public class RegionResponse extends BaseResponse {
@SerializedName(ApiConstants.END_POINT) @Param(description="the end point of the region") @SerializedName(ApiConstants.END_POINT) @Param(description="the end point of the region")
private String endPoint; private String endPoint;
@SerializedName("gslbserviceenabled") @Param(description="true if GSLB service is enabled in the region, false otherwise")
private boolean gslbServiceEnabled;
@SerializedName("portableipserviceenabled") @Param(description="true if security groups support is enabled, false otherwise")
private boolean portableipServiceEnabled;
public Integer getId() { public Integer getId() {
return id; return id;
} }
@ -59,4 +65,11 @@ public class RegionResponse extends BaseResponse {
this.endPoint = endPoint; this.endPoint = endPoint;
} }
} public void setGslbServiceEnabled(boolean gslbServiceEnabled) {
this.gslbServiceEnabled = gslbServiceEnabled;
}
public void setPortableipServiceEnabled(boolean portableipServiceEnabled) {
this.portableipServiceEnabled = portableipServiceEnabled;
}
}

View File

@ -29,6 +29,12 @@ public interface ResourceLimitAndCountResponse {
public void setNetworkAvailable(String networkAvailable); public void setNetworkAvailable(String networkAvailable);
public void setVpcLimit(String vpcLimit);
public void setVpcTotal(Long vpcTotal);
public void setVpcAvailable(String vpcAvailable);
public void setCpuLimit(String cpuLimit); public void setCpuLimit(String cpuLimit);
public void setCpuTotal(Long cpuTotal); public void setCpuTotal(Long cpuTotal);

View File

@ -1,218 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.cloudstack.api.response;
import static org.apache.cloudstack.api.ApiConstants.ID;
import static org.apache.cloudstack.api.ApiConstants.S3_ACCESS_KEY;
import static org.apache.cloudstack.api.ApiConstants.S3_BUCKET_NAME;
import static org.apache.cloudstack.api.ApiConstants.S3_CONNECTION_TIMEOUT;
import static org.apache.cloudstack.api.ApiConstants.S3_END_POINT;
import static org.apache.cloudstack.api.ApiConstants.S3_HTTPS_FLAG;
import static org.apache.cloudstack.api.ApiConstants.S3_MAX_ERROR_RETRY;
import static org.apache.cloudstack.api.ApiConstants.S3_SECRET_KEY;
import static org.apache.cloudstack.api.ApiConstants.S3_SOCKET_TIMEOUT;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class S3Response extends BaseResponse {
@SerializedName(ID)
@Param(description = "The ID of the S3 configuration")
private String id;
@SerializedName(S3_ACCESS_KEY)
@Param(description = "The S3 access key")
private String accessKey;
@SerializedName(S3_SECRET_KEY)
@Param(description = "The S3 secret key")
private String secretKey;
@SerializedName(S3_END_POINT)
@Param(description = "The S3 end point")
private String endPoint;
@SerializedName(S3_BUCKET_NAME)
@Param(description = "The name of the template storage bucket")
private String bucketName;
@SerializedName(S3_HTTPS_FLAG)
@Param(description = "Connect to S3 using HTTPS?")
private Integer httpsFlag;
@SerializedName(S3_CONNECTION_TIMEOUT)
@Param(description = "The connection timeout (milliseconds)")
private Integer connectionTimeout;
@SerializedName(S3_MAX_ERROR_RETRY)
@Param(description = "The maximum number of time to retry a connection on error.")
private Integer maxErrorRetry;
@SerializedName(S3_SOCKET_TIMEOUT)
@Param(description = "The connection socket (milliseconds)")
private Integer socketTimeout;
@Override
public boolean equals(final Object thatObject) {
if (this == thatObject) {
return true;
}
if (thatObject == null || this.getClass() != thatObject.getClass()) {
return false;
}
final S3Response thatS3Response = (S3Response) thatObject;
if (this.httpsFlag != null ? !this.httpsFlag.equals(thatS3Response.httpsFlag) : thatS3Response.httpsFlag != null) {
return false;
}
if (this.accessKey != null ? !this.accessKey.equals(thatS3Response.accessKey) : thatS3Response.accessKey != null) {
return false;
}
if (this.connectionTimeout != null ? !this.connectionTimeout.equals(thatS3Response.connectionTimeout) : thatS3Response.connectionTimeout != null) {
return false;
}
if (this.endPoint != null ? !this.endPoint.equals(thatS3Response.endPoint) : thatS3Response.endPoint != null) {
return false;
}
if (this.id != null ? !this.id.equals(thatS3Response.id) : thatS3Response.id != null) {
return false;
}
if (this.maxErrorRetry != null ? !this.maxErrorRetry.equals(thatS3Response.maxErrorRetry) : thatS3Response.maxErrorRetry != null) {
return false;
}
if (this.secretKey != null ? !this.secretKey.equals(thatS3Response.secretKey) : thatS3Response.secretKey != null) {
return false;
}
if (this.socketTimeout != null ? !this.socketTimeout.equals(thatS3Response.socketTimeout) : thatS3Response.socketTimeout != null) {
return false;
}
if (this.bucketName != null ? !this.bucketName.equals(thatS3Response.bucketName) : thatS3Response.bucketName != null) {
return false;
}
return true;
}
@Override
public int hashCode() {
int result = this.id != null ? this.id.hashCode() : 0;
result = 31 * result + (this.accessKey != null ? this.accessKey.hashCode() : 0);
result = 31 * result + (this.secretKey != null ? this.secretKey.hashCode() : 0);
result = 31 * result + (this.endPoint != null ? this.endPoint.hashCode() : 0);
result = 31 * result + (this.bucketName != null ? this.bucketName.hashCode() : 0);
result = 31 * result + (this.httpsFlag != null ? this.httpsFlag : 0);
result = 31 * result + (this.connectionTimeout != null ? this.connectionTimeout.hashCode() : 0);
result = 31 * result + (this.maxErrorRetry != null ? this.maxErrorRetry.hashCode() : 0);
result = 31 * result + (this.socketTimeout != null ? this.socketTimeout.hashCode() : 0);
return result;
}
@Override
public String getObjectId() {
return this.id;
}
public void setObjectId(String id) {
this.id = id;
}
public String getAccessKey() {
return this.accessKey;
}
public void setAccessKey(final String accessKey) {
this.accessKey = accessKey;
}
public String getSecretKey() {
return this.secretKey;
}
public void setSecretKey(final String secretKey) {
this.secretKey = secretKey;
}
public String getEndPoint() {
return this.endPoint;
}
public void setEndPoint(final String endPoint) {
this.endPoint = endPoint;
}
public String getTemplateBucketName() {
return this.bucketName;
}
public void setTemplateBucketName(final String templateBucketName) {
this.bucketName = templateBucketName;
}
public Integer getHttpsFlag() {
return this.httpsFlag;
}
public void setHttpsFlag(final Integer httpsFlag) {
this.httpsFlag = httpsFlag;
}
public Integer getConnectionTimeout() {
return this.connectionTimeout;
}
public void setConnectionTimeout(final Integer connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
public Integer getMaxErrorRetry() {
return this.maxErrorRetry;
}
public void setMaxErrorRetry(final Integer maxErrorRetry) {
this.maxErrorRetry = maxErrorRetry;
}
public Integer getSocketTimeout() {
return this.socketTimeout;
}
public void setSocketTimeout(final Integer socketTimeout) {
this.socketTimeout = socketTimeout;
}
}

View File

@ -18,7 +18,11 @@ package org.apache.cloudstack.api.response;
import java.util.Date; import java.util.Date;
import javax.persistence.Column;
import com.google.gson.annotations.SerializedName;
import java.util.Map;
import org.apache.cloudstack.api.ApiConstants; import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse; import org.apache.cloudstack.api.BaseResponse;
@ -26,7 +30,6 @@ import org.apache.cloudstack.api.EntityReference;
import com.cloud.offering.ServiceOffering; import com.cloud.offering.ServiceOffering;
import com.cloud.serializer.Param; import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
@EntityReference(value = ServiceOffering.class) @EntityReference(value = ServiceOffering.class)
public class ServiceOfferingResponse extends BaseResponse { public class ServiceOfferingResponse extends BaseResponse {
@ -102,6 +105,10 @@ public class ServiceOfferingResponse extends BaseResponse {
@SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy used to deploy VM.") @SerializedName(ApiConstants.DEPLOYMENT_PLANNER) @Param(description="deployment strategy used to deploy VM.")
private String deploymentPlanner; private String deploymentPlanner;
@SerializedName(ApiConstants.SERVICE_OFFERING_DETAILS)
@Param(description = "additional key/value details tied with this service offering", since = "4.2.0")
private Map<String, String> details;
public String getId() { public String getId() {
return id; return id;
} }
@ -141,7 +148,7 @@ public class ServiceOfferingResponse extends BaseResponse {
} }
public void setSystemVmType(String vmtype) { public void setSystemVmType(String vmtype) {
this.vm_type = vmtype; vm_type = vmtype;
} }
@ -276,4 +283,8 @@ public class ServiceOfferingResponse extends BaseResponse {
public void setIopsWriteRate(Long iopsWriteRate) { public void setIopsWriteRate(Long iopsWriteRate) {
this.iopsWriteRate = iopsWriteRate; this.iopsWriteRate = iopsWriteRate;
} }
public void setDetails(Map<String, String> details) {
this.details = details;
}
} }

View File

@ -1,86 +0,0 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.api.response;
import java.util.Date;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseResponse;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
public class SwiftResponse extends BaseResponse {
@SerializedName(ApiConstants.ID)
@Param(description = "the ID of swift")
private String id;
@SerializedName(ApiConstants.URL)
@Param(description = "url for swift")
private String url;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date and time the host was created")
private Date created;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the account for swift")
private String account;
@SerializedName(ApiConstants.ACCOUNT)
@Param(description = "the username for swift")
private String username;
public void setId(String id) {
this.id = id;
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public Date getCreated() {
return created;
}
public void setCreated(Date created) {
this.created = created;
}
public String getAccount() {
return account;
}
public void setAccount(String account) {
this.account = account;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
}

View File

@ -17,7 +17,6 @@
package org.apache.cloudstack.api.response; package org.apache.cloudstack.api.response;
import java.util.Date; import java.util.Date;
import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set; import java.util.Set;
@ -35,408 +34,624 @@ import com.google.gson.annotations.SerializedName;
@SuppressWarnings("unused") @SuppressWarnings("unused")
@EntityReference(value={VirtualMachine.class, UserVm.class, VirtualRouter.class}) @EntityReference(value={VirtualMachine.class, UserVm.class, VirtualRouter.class})
public class UserVmResponse extends BaseResponse implements ControlledEntityResponse { public class UserVmResponse extends BaseResponse implements ControlledEntityResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the virtual machine") @SerializedName(ApiConstants.ID) @Param(description="the ID of the virtual machine")
private String id; private String id;
@SerializedName(ApiConstants.NAME) @Param(description="the name of the virtual machine") @SerializedName(ApiConstants.NAME) @Param(description="the name of the virtual machine")
private String name; private String name;
@SerializedName("displayname") @Param(description="user generated name. The name of the virtual machine is returned if no displayname exists.") @SerializedName("displayname") @Param(description="user generated name. The name of the virtual machine is returned if no displayname exists.")
private String displayName; private String displayName;
@SerializedName(ApiConstants.ACCOUNT) @Param(description="the account associated with the virtual machine") @SerializedName(ApiConstants.ACCOUNT) @Param(description="the account associated with the virtual machine")
private String accountName; private String accountName;
@SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vm") @SerializedName(ApiConstants.PROJECT_ID) @Param(description="the project id of the vm")
private String projectId; private String projectId;
@SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vm") @SerializedName(ApiConstants.PROJECT) @Param(description="the project name of the vm")
private String projectName; private String projectName;
@SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain in which the virtual machine exists") @SerializedName(ApiConstants.DOMAIN_ID) @Param(description="the ID of the domain in which the virtual machine exists")
private String domainId; private String domainId;
@SerializedName(ApiConstants.DOMAIN) @Param(description="the name of the domain in which the virtual machine exists") @SerializedName(ApiConstants.DOMAIN) @Param(description="the name of the domain in which the virtual machine exists")
private String domainName; private String domainName;
@SerializedName(ApiConstants.CREATED) @Param(description="the date when this virtual machine was created") @SerializedName(ApiConstants.CREATED) @Param(description="the date when this virtual machine was created")
private Date created; private Date created;
@SerializedName(ApiConstants.STATE) @Param(description="the state of the virtual machine") @SerializedName(ApiConstants.STATE) @Param(description="the state of the virtual machine")
private String state; private String state;
@SerializedName(ApiConstants.HA_ENABLE) @Param(description="true if high-availability is enabled, false otherwise") @SerializedName(ApiConstants.HA_ENABLE) @Param(description="true if high-availability is enabled, false otherwise")
private Boolean haEnable; private Boolean haEnable;
@SerializedName(ApiConstants.GROUP_ID) @Param(description="the group ID of the virtual machine") @SerializedName(ApiConstants.GROUP_ID) @Param(description="the group ID of the virtual machine")
private String groupId; private String groupId;
@SerializedName(ApiConstants.GROUP) @Param(description="the group name of the virtual machine") @SerializedName(ApiConstants.GROUP) @Param(description="the group name of the virtual machine")
private String group; private String group;
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the availablility zone for the virtual machine") @SerializedName(ApiConstants.ZONE_ID) @Param(description="the ID of the availablility zone for the virtual machine")
private String zoneId; private String zoneId;
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the availability zone for the virtual machine") @SerializedName(ApiConstants.ZONE_NAME) @Param(description="the name of the availability zone for the virtual machine")
private String zoneName; private String zoneName;
@SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the host for the virtual machine") @SerializedName(ApiConstants.HOST_ID) @Param(description="the ID of the host for the virtual machine")
private String hostId; private String hostId;
@SerializedName("hostname") @Param(description="the name of the host for the virtual machine") @SerializedName("hostname") @Param(description="the name of the host for the virtual machine")
private String hostName; private String hostName;
@SerializedName(ApiConstants.TEMPLATE_ID) @Param(description="the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.") @SerializedName(ApiConstants.TEMPLATE_ID) @Param(description="the ID of the template for the virtual machine. A -1 is returned if the virtual machine was created from an ISO file.")
private String templateId; private String templateId;
@SerializedName("templatename") @Param(description="the name of the template for the virtual machine") @SerializedName("templatename") @Param(description="the name of the template for the virtual machine")
private String templateName; private String templateName;
@SerializedName("templatedisplaytext") @Param(description=" an alternate display text of the template for the virtual machine") @SerializedName("templatedisplaytext") @Param(description=" an alternate display text of the template for the virtual machine")
private String templateDisplayText; private String templateDisplayText;
@SerializedName(ApiConstants.PASSWORD_ENABLED) @Param(description="true if the password rest feature is enabled, false otherwise") @SerializedName(ApiConstants.PASSWORD_ENABLED) @Param(description="true if the password rest feature is enabled, false otherwise")
private Boolean passwordEnabled; private Boolean passwordEnabled;
@SerializedName("isoid") @Param(description="the ID of the ISO attached to the virtual machine") @SerializedName("isoid") @Param(description="the ID of the ISO attached to the virtual machine")
private String isoId; private String isoId;
@SerializedName("isoname") @Param(description="the name of the ISO attached to the virtual machine") @SerializedName("isoname") @Param(description="the name of the ISO attached to the virtual machine")
private String isoName; private String isoName;
@SerializedName("isodisplaytext") @Param(description="an alternate display text of the ISO attached to the virtual machine") @SerializedName("isodisplaytext") @Param(description="an alternate display text of the ISO attached to the virtual machine")
private String isoDisplayText; private String isoDisplayText;
@SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description="the ID of the service offering of the virtual machine") @SerializedName(ApiConstants.SERVICE_OFFERING_ID) @Param(description="the ID of the service offering of the virtual machine")
private String serviceOfferingId; private String serviceOfferingId;
@SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine") @SerializedName("serviceofferingname") @Param(description="the name of the service offering of the virtual machine")
private String serviceOfferingName; private String serviceOfferingName;
@SerializedName("forvirtualnetwork") @Param(description="the virtual network for the service offering") @SerializedName("forvirtualnetwork") @Param(description="the virtual network for the service offering")
private Boolean forVirtualNetwork; private Boolean forVirtualNetwork;
@SerializedName(ApiConstants.CPU_NUMBER) @Param(description="the number of cpu this virtual machine is running with") @SerializedName(ApiConstants.CPU_NUMBER) @Param(description="the number of cpu this virtual machine is running with")
private Integer cpuNumber; private Integer cpuNumber;
@SerializedName(ApiConstants.CPU_SPEED) @Param(description="the speed of each cpu") @SerializedName(ApiConstants.CPU_SPEED) @Param(description="the speed of each cpu")
private Integer cpuSpeed; private Integer cpuSpeed;
@SerializedName(ApiConstants.MEMORY) @Param(description="the memory allocated for the virtual machine") @SerializedName(ApiConstants.MEMORY) @Param(description="the memory allocated for the virtual machine")
private Integer memory; private Integer memory;
@SerializedName("cpuused") @Param(description="the amount of the vm's CPU currently used") @SerializedName("cpuused") @Param(description="the amount of the vm's CPU currently used")
private String cpuUsed; private String cpuUsed;
@SerializedName("networkkbsread") @Param(description="the incoming network traffic on the vm") @SerializedName("networkkbsread") @Param(description="the incoming network traffic on the vm")
private Long networkKbsRead; private Long networkKbsRead;
@SerializedName("networkkbswrite") @Param(description="the outgoing network traffic on the host") @SerializedName("networkkbswrite") @Param(description="the outgoing network traffic on the host")
private Long networkKbsWrite; private Long networkKbsWrite;
@SerializedName("diskkbsread") @Param(description="the read (bytes) of disk on the vm") @SerializedName("diskkbsread") @Param(description="the read (bytes) of disk on the vm")
private Long diskKbsRead; private Long diskKbsRead;
@SerializedName("diskkbswrite") @Param(description="the write (bytes) of disk on the vm")
private Long diskKbsWrite;
@SerializedName("diskioread") @Param(description="the read (io) of disk on the vm")
private Long diskIORead;
@SerializedName("diskiowrite") @Param(description="the write (io) of disk on the vm")
private Long diskIOWrite;
@SerializedName("guestosid") @Param(description="Os type ID of the virtual machine")
private String guestOsId;
@SerializedName("rootdeviceid") @Param(description="device ID of the root volume") @SerializedName("diskkbswrite") @Param(description="the write (bytes) of disk on the vm")
private Long rootDeviceId; private Long diskKbsWrite;
@SerializedName("rootdevicetype") @Param(description="device type of the root volume") @SerializedName("diskioread") @Param(description="the read (io) of disk on the vm")
private String rootDeviceType; private Long diskIORead;
@SerializedName("securitygroup") @Param(description="list of security groups associated with the virtual machine", responseObject = SecurityGroupResponse.class) @SerializedName("diskiowrite") @Param(description="the write (io) of disk on the vm")
private Set<SecurityGroupResponse> securityGroupList; private Long diskIOWrite;
@SerializedName(ApiConstants.PASSWORD) @Param(description="the password (if exists) of the virtual machine") @SerializedName("guestosid") @Param(description="Os type ID of the virtual machine")
private String password; private String guestOsId;
@SerializedName("nic") @Param(description="the list of nics associated with vm", responseObject = NicResponse.class) @SerializedName("rootdeviceid") @Param(description="device ID of the root volume")
private Set<NicResponse> nics; private Long rootDeviceId;
@SerializedName("hypervisor") @Param(description="the hypervisor on which the template runs") @SerializedName("rootdevicetype") @Param(description="device type of the root volume")
private String hypervisor; private String rootDeviceType;
@SerializedName(ApiConstants.PUBLIC_IP_ID) @Param(description="public IP address id associated with vm via Static nat rule") @SerializedName("securitygroup") @Param(description="list of security groups associated with the virtual machine", responseObject = SecurityGroupResponse.class)
private String publicIpId; private Set<SecurityGroupResponse> securityGroupList;
@SerializedName(ApiConstants.PUBLIC_IP) @Param(description="public IP address id associated with vm via Static nat rule") @SerializedName(ApiConstants.PASSWORD) @Param(description="the password (if exists) of the virtual machine")
private String publicIp; private String password;
@SerializedName(ApiConstants.INSTANCE_NAME) @Param(description="instance name of the user vm; this parameter is returned to the ROOT admin only", since="3.0.1") @SerializedName("nic") @Param(description="the list of nics associated with vm", responseObject = NicResponse.class)
private String instanceName; private Set<NicResponse> nics;
@SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with vm", responseObject = ResourceTagResponse.class) @SerializedName("hypervisor") @Param(description="the hypervisor on which the template runs")
private Set<ResourceTagResponse> tags; private String hypervisor;
@SerializedName(ApiConstants.SSH_KEYPAIR) @Param(description="ssh key-pair") @SerializedName(ApiConstants.PUBLIC_IP_ID) @Param(description="public IP address id associated with vm via Static nat rule")
private String keyPairName; private String publicIpId;
@SerializedName("affinitygroup") @SerializedName(ApiConstants.PUBLIC_IP) @Param(description="public IP address id associated with vm via Static nat rule")
@Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class) private String publicIp;
private Set<AffinityGroupResponse> affinityGroupList;
@SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.") @SerializedName(ApiConstants.INSTANCE_NAME) @Param(description="instance name of the user vm; this parameter is returned to the ROOT admin only", since="3.0.1")
private Boolean displayVm; private String instanceName;
@SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) @Param(description="true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.") @SerializedName(ApiConstants.TAGS) @Param(description="the list of resource tags associated with vm", responseObject = ResourceTagResponse.class)
private Boolean isDynamicallyScalable; private Set<ResourceTagResponse> tags;
public UserVmResponse(){ @SerializedName(ApiConstants.SSH_KEYPAIR) @Param(description="ssh key-pair")
securityGroupList = new LinkedHashSet<SecurityGroupResponse>(); private String keyPairName;
nics = new LinkedHashSet<NicResponse>();
tags = new LinkedHashSet<ResourceTagResponse>();
affinityGroupList = new LinkedHashSet<AffinityGroupResponse>();
}
public void setHypervisor(String hypervisor) { @SerializedName("affinitygroup")
this.hypervisor = hypervisor; @Param(description = "list of affinity groups associated with the virtual machine", responseObject = AffinityGroupResponse.class)
} private Set<AffinityGroupResponse> affinityGroupList;
public void setId(String id) { @SerializedName(ApiConstants.DISPLAY_VM) @Param(description="an optional field whether to the display the vm to the end user or not.")
this.id = id; private Boolean displayVm;
}
public String getId() { @SerializedName(ApiConstants.IS_DYNAMICALLY_SCALABLE) @Param(description="true if vm contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory.")
return this.id; private Boolean isDynamicallyScalable;
} @SerializedName(ApiConstants.SERVICE_STATE) @Param(description="State of the Service from LB rule")
private String serviceState;
public Boolean getDisplayVm() { public UserVmResponse(){
return displayVm; securityGroupList = new LinkedHashSet<SecurityGroupResponse>();
} nics = new LinkedHashSet<NicResponse>();
tags = new LinkedHashSet<ResourceTagResponse>();
affinityGroupList = new LinkedHashSet<AffinityGroupResponse>();
}
public void setDisplayVm(Boolean displayVm) { public void setHypervisor(String hypervisor) {
this.displayVm = displayVm; this.hypervisor = hypervisor;
} }
@Override
public String getObjectId() {
return this.getId();
}
public void setName(String name) {
this.name = name;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public void setAccountName(String accountName) {
this.accountName = accountName;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public void setCreated(Date created) { public void setId(String id) {
this.created = created; this.id = id;
} }
public void setState(String state) { public String getId() {
this.state = state; return this.id;
} }
public void setHaEnable(Boolean haEnable) { public Boolean getDisplayVm() {
this.haEnable = haEnable; return displayVm;
} }
public void setGroupId(String groupId) { public void setDisplayVm(Boolean displayVm) {
this.groupId = groupId; this.displayVm = displayVm;
} }
public void setGroup(String group) { @Override
this.group = group; public String getObjectId() {
} return this.getId();
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId; public String getName() {
} return name;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName; public String getDisplayName() {
} return displayName;
}
public void setHostId(String hostId) {
this.hostId = hostId; public String getAccountName() {
} return accountName;
}
public void setHostName(String hostName) {
this.hostName = hostName; public String getProjectId() {
} return projectId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId; public String getProjectName() {
} return projectName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName; public String getDomainId() {
} return domainId;
}
public void setTemplateDisplayText(String templateDisplayText) {
this.templateDisplayText = templateDisplayText; public String getDomainName() {
} return domainName;
}
public void setPasswordEnabled(Boolean passwordEnabled) {
this.passwordEnabled = passwordEnabled; public Date getCreated() {
} return created;
}
public void setIsoId(String isoId) {
this.isoId = isoId; public String getState() {
} return state;
}
public void setIsoName(String isoName) {
this.isoName = isoName; public Boolean getHaEnable() {
} return haEnable;
}
public void setIsoDisplayText(String isoDisplayText) {
this.isoDisplayText = isoDisplayText; public String getGroupId() {
} return groupId;
}
public void setDiskKbsRead(Long diskKbsRead) {
this.diskKbsRead = diskKbsRead; public String getGroup() {
} return group;
}
public void setDiskKbsWrite(Long diskKbsWrite) {
this.diskKbsWrite = diskKbsWrite; public String getZoneId() {
} return zoneId;
}
public void setDiskIORead(Long diskIORead) {
this.diskIORead = diskIORead; public String getZoneName() {
} return zoneName;
}
public void setDiskIOWrite(Long diskIOWrite) {
this.diskIOWrite = diskIOWrite; public String getHostId() {
} return hostId;
}
public void setServiceOfferingId(String serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId; public String getHostName() {
} return hostName;
}
public void setServiceOfferingName(String serviceOfferingName) {
this.serviceOfferingName = serviceOfferingName; public String getTemplateId() {
} return templateId;
}
public void setCpuNumber(Integer cpuNumber) {
this.cpuNumber = cpuNumber; public String getTemplateName() {
} return templateName;
}
public void setCpuSpeed(Integer cpuSpeed) {
this.cpuSpeed = cpuSpeed; public String getTemplateDisplayText() {
} return templateDisplayText;
}
public void setMemory(Integer memory) {
this.memory = memory; public Boolean getPasswordEnabled() {
} return passwordEnabled;
}
public void setCpuUsed(String cpuUsed) {
this.cpuUsed = cpuUsed; public String getIsoId() {
} return isoId;
}
public void setNetworkKbsRead(Long networkKbsRead) {
this.networkKbsRead = networkKbsRead; public String getIsoName() {
} return isoName;
}
public void setNetworkKbsWrite(Long networkKbsWrite) {
this.networkKbsWrite = networkKbsWrite; public String getIsoDisplayText() {
} return isoDisplayText;
}
public void setGuestOsId(String guestOsId) {
this.guestOsId = guestOsId; public String getServiceOfferingId() {
} return serviceOfferingId;
}
public void setRootDeviceId(Long rootDeviceId) {
this.rootDeviceId = rootDeviceId; public String getServiceOfferingName() {
} return serviceOfferingName;
}
public void setRootDeviceType(String rootDeviceType) {
this.rootDeviceType = rootDeviceType; public Boolean getForVirtualNetwork() {
} return forVirtualNetwork;
}
public void setPassword(String password) {
this.password = password; public Integer getCpuNumber() {
} return cpuNumber;
}
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
this.forVirtualNetwork = forVirtualNetwork; public Integer getCpuSpeed() {
} return cpuSpeed;
}
public void setNics(Set<NicResponse> nics) {
this.nics = nics; public Integer getMemory() {
} return memory;
}
public void addNic(NicResponse nic) {
this.nics.add(nic); public String getCpuUsed() {
} return cpuUsed;
}
public void setSecurityGroupList(Set<SecurityGroupResponse> securityGroups) {
this.securityGroupList = securityGroups; public Long getNetworkKbsRead() {
} return networkKbsRead;
}
public void addSecurityGroup(SecurityGroupResponse securityGroup){
this.securityGroupList.add(securityGroup); public Long getNetworkKbsWrite() {
} return networkKbsWrite;
}
@Override
public void setProjectId(String projectId) { public Long getDiskKbsRead() {
this.projectId = projectId; return diskKbsRead;
} }
@Override public Long getDiskKbsWrite() {
public void setProjectName(String projectName) { return diskKbsWrite;
this.projectName = projectName; }
}
public Long getDiskIORead() {
public void setPublicIpId(String publicIpId) { return diskIORead;
this.publicIpId = publicIpId; }
}
public Long getDiskIOWrite() {
public void setPublicIp(String publicIp) { return diskIOWrite;
this.publicIp = publicIp; }
}
public String getGuestOsId() {
public void setInstanceName(String instanceName) { return guestOsId;
this.instanceName = instanceName; }
}
public Long getRootDeviceId() {
public void setTags(Set<ResourceTagResponse> tags) { return rootDeviceId;
this.tags = tags; }
}
public String getRootDeviceType() {
public void addTag(ResourceTagResponse tag){ return rootDeviceType;
this.tags.add(tag); }
}
public Set<SecurityGroupResponse> getSecurityGroupList() {
public void setKeyPairName(String keyPairName) { return securityGroupList;
this.keyPairName = keyPairName; }
}
public String getPassword() {
public void setAffinityGroupList(Set<AffinityGroupResponse> affinityGroups) { return password;
this.affinityGroupList = affinityGroups; }
}
public Set<NicResponse> getNics() {
public void addAffinityGroup(AffinityGroupResponse affinityGroup) { return nics;
this.affinityGroupList.add(affinityGroup); }
}
public String getHypervisor() {
public void setDynamicallyScalable(boolean isDynamicallyScalable) { return hypervisor;
this.isDynamicallyScalable = isDynamicallyScalable; }
}
public String getPublicIpId() {
return publicIpId;
}
public String getPublicIp() {
return publicIp;
}
public String getInstanceName() {
return instanceName;
}
public Set<ResourceTagResponse> getTags() {
return tags;
}
public String getKeyPairName() {
return keyPairName;
}
public Set<AffinityGroupResponse> getAffinityGroupList() {
return affinityGroupList;
}
public Boolean getIsDynamicallyScalable() {
return isDynamicallyScalable;
}
public String getServiceState() {
return serviceState;
}
public void setIsDynamicallyScalable(Boolean isDynamicallyScalable) {
this.isDynamicallyScalable = isDynamicallyScalable;
}
public void setName(String name) {
this.name = name;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
@Override
public void setAccountName(String accountName) {
this.accountName = accountName;
}
@Override
public void setDomainId(String domainId) {
this.domainId = domainId;
}
@Override
public void setDomainName(String domainName) {
this.domainName = domainName;
}
public void setCreated(Date created) {
this.created = created;
}
public void setState(String state) {
this.state = state;
}
public void setHaEnable(Boolean haEnable) {
this.haEnable = haEnable;
}
public void setGroupId(String groupId) {
this.groupId = groupId;
}
public void setGroup(String group) {
this.group = group;
}
public void setZoneId(String zoneId) {
this.zoneId = zoneId;
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setHostId(String hostId) {
this.hostId = hostId;
}
public void setHostName(String hostName) {
this.hostName = hostName;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public void setTemplateDisplayText(String templateDisplayText) {
this.templateDisplayText = templateDisplayText;
}
public void setPasswordEnabled(Boolean passwordEnabled) {
this.passwordEnabled = passwordEnabled;
}
public void setIsoId(String isoId) {
this.isoId = isoId;
}
public void setIsoName(String isoName) {
this.isoName = isoName;
}
public void setIsoDisplayText(String isoDisplayText) {
this.isoDisplayText = isoDisplayText;
}
public void setDiskKbsRead(Long diskKbsRead) {
this.diskKbsRead = diskKbsRead;
}
public void setDiskKbsWrite(Long diskKbsWrite) {
this.diskKbsWrite = diskKbsWrite;
}
public void setDiskIORead(Long diskIORead) {
this.diskIORead = diskIORead;
}
public void setDiskIOWrite(Long diskIOWrite) {
this.diskIOWrite = diskIOWrite;
}
public void setServiceOfferingId(String serviceOfferingId) {
this.serviceOfferingId = serviceOfferingId;
}
public void setServiceOfferingName(String serviceOfferingName) {
this.serviceOfferingName = serviceOfferingName;
}
public void setCpuNumber(Integer cpuNumber) {
this.cpuNumber = cpuNumber;
}
public void setCpuSpeed(Integer cpuSpeed) {
this.cpuSpeed = cpuSpeed;
}
public void setMemory(Integer memory) {
this.memory = memory;
}
public void setCpuUsed(String cpuUsed) {
this.cpuUsed = cpuUsed;
}
public void setNetworkKbsRead(Long networkKbsRead) {
this.networkKbsRead = networkKbsRead;
}
public void setNetworkKbsWrite(Long networkKbsWrite) {
this.networkKbsWrite = networkKbsWrite;
}
public void setGuestOsId(String guestOsId) {
this.guestOsId = guestOsId;
}
public void setRootDeviceId(Long rootDeviceId) {
this.rootDeviceId = rootDeviceId;
}
public void setRootDeviceType(String rootDeviceType) {
this.rootDeviceType = rootDeviceType;
}
public void setPassword(String password) {
this.password = password;
}
public void setForVirtualNetwork(Boolean forVirtualNetwork) {
this.forVirtualNetwork = forVirtualNetwork;
}
public void setNics(Set<NicResponse> nics) {
this.nics = nics;
}
public void addNic(NicResponse nic) {
this.nics.add(nic);
}
public void setSecurityGroupList(Set<SecurityGroupResponse> securityGroups) {
this.securityGroupList = securityGroups;
}
public void addSecurityGroup(SecurityGroupResponse securityGroup){
this.securityGroupList.add(securityGroup);
}
@Override
public void setProjectId(String projectId) {
this.projectId = projectId;
}
@Override
public void setProjectName(String projectName) {
this.projectName = projectName;
}
public void setPublicIpId(String publicIpId) {
this.publicIpId = publicIpId;
}
public void setPublicIp(String publicIp) {
this.publicIp = publicIp;
}
public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
public void setTags(Set<ResourceTagResponse> tags) {
this.tags = tags;
}
public void addTag(ResourceTagResponse tag){
this.tags.add(tag);
}
public void setKeyPairName(String keyPairName) {
this.keyPairName = keyPairName;
}
public void setAffinityGroupList(Set<AffinityGroupResponse> affinityGroups) {
this.affinityGroupList = affinityGroups;
}
public void addAffinityGroup(AffinityGroupResponse affinityGroup) {
this.affinityGroupList.add(affinityGroup);
}
public void setDynamicallyScalable(boolean isDynamicallyScalable) {
this.isDynamicallyScalable = isDynamicallyScalable;
}
public void setServiceState(String state) {
this.serviceState = state;
}
} }

View File

@ -0,0 +1,84 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package org.apache.cloudstack.config;
import java.util.Date;
/**
* Configuration represents one global configuration parameter for CloudStack.
* Its scope should indicate whether this parameter can be set at different
* organization levels in CloudStack.
*
*/
public interface Configuration {
/**
* @return Category of the parameter.
*/
String getCategory();
/**
* @return Server instance that uses this parameter.
*/
String getInstance();
/**
* @return Component that introduced this parameter.
*/
String getComponent();
/**
* @return Name of the parameter.
*/
String getName();
/**
* @return Value set by the administrator. Defaults to the defaultValue.
*/
String getValue();
/**
* @return Description of the value and the range of the value.
*/
String getDescription();
/**
* @return Default value for this parameter. Null indicates this parameter is optional.
*/
String getDefaultValue();
/**
* @return Scope for the parameter. Null indicates that this parameter is
* always global. A non-null value indicates that this parameter can be
* set at a certain organization level.
*/
String getScope();
/**
* @return can the configuration parameter be changed without restarting the server.
*/
boolean isDynamic();
/**
* @return The date this VO was updated by the components. Note that this is not
* a date for when an administrator updates the value. This is when the system
* updated this value. By searching on this field gives you all the config
* parameters that have changed in an upgrade. Null value indicates that this
* parameter is no longer used and can be deleted.
*/
Date getUpdated();
}

View File

@ -14,15 +14,37 @@
// KIND, either express or implied. See the License for the // KIND, either express or implied. See the License for the
// specific language governing permissions and limitations // specific language governing permissions and limitations
// under the License. // under the License.
package com.cloud.async; package org.apache.cloudstack.jobs;
import org.apache.cloudstack.api.ApiCommandJobType;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date; import java.util.Date;
public interface AsyncJob extends Identity, InternalIdentity { import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface JobInfo extends Identity, InternalIdentity {
public enum Status {
IN_PROGRESS(false),
SUCCEEDED(true),
FAILED(true),
CANCELLED(true);
private final boolean done;
private Status(boolean done) {
this.done = done;
}
public boolean done() {
return done;
}
}
String getType();
String getDispatcher();
int getPendingSignals();
long getUserId(); long getUserId();
long getAccountId(); long getAccountId();
@ -33,11 +55,7 @@ public interface AsyncJob extends Identity, InternalIdentity {
String getCmdInfo(); String getCmdInfo();
int getCallbackType(); Status getStatus();
String getCallbackAddress();
int getStatus();
int getProcessStatus(); int getProcessStatus();
@ -47,6 +65,8 @@ public interface AsyncJob extends Identity, InternalIdentity {
Long getInitMsid(); Long getInitMsid();
Long getExecutingMsid();
Long getCompleteMsid(); Long getCompleteMsid();
Date getCreated(); Date getCreated();
@ -55,17 +75,7 @@ public interface AsyncJob extends Identity, InternalIdentity {
Date getLastPolled(); Date getLastPolled();
Date getRemoved(); String getInstanceType();
ApiCommandJobType getInstanceType();
Long getInstanceId(); Long getInstanceId();
String getSessionKey();
String getCmdOriginator();
boolean isFromPreviousSession();
SyncQueueItem getSyncSource();
} }

View File

@ -20,7 +20,7 @@ import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd; import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd; import org.apache.cloudstack.api.command.admin.internallb.ListInternalLBVMsCmd;
import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd; import org.apache.cloudstack.api.command.admin.router.ListRoutersCmd;
import org.apache.cloudstack.api.command.admin.storage.ListCacheStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListSecondaryStagingStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd; import org.apache.cloudstack.api.command.admin.storage.ListImageStoresCmd;
import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd; import org.apache.cloudstack.api.command.admin.storage.ListStoragePoolsCmd;
import org.apache.cloudstack.api.command.admin.user.ListUsersCmd; import org.apache.cloudstack.api.command.admin.user.ListUsersCmd;
@ -81,7 +81,7 @@ public interface QueryService {
public ListResponse<ImageStoreResponse> searchForImageStores(ListImageStoresCmd cmd); public ListResponse<ImageStoreResponse> searchForImageStores(ListImageStoresCmd cmd);
public ListResponse<ImageStoreResponse> searchForCacheStores(ListCacheStoresCmd cmd); public ListResponse<ImageStoreResponse> searchForSecondaryStagingStores(ListSecondaryStagingStoresCmd cmd);
public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd); public ListResponse<AccountResponse> searchForAccounts(ListAccountsCmd cmd);

View File

@ -31,10 +31,11 @@ public interface Region {
public void setName(String name); public void setName(String name);
public String getEndPoint(); public String getEndPoint();
public boolean checkIfServiceEnabled(Service service); public boolean checkIfServiceEnabled(Service service);
public void enableService(Service service);
/** /**
* A region level service, is a service that constitute services across one or more zones in the region or a service * A region level service, is a service that constitute services across one or more zones in the region or a service
* made available to all the zones in the region. * made available to all the zones in the region.
@ -45,6 +46,7 @@ public interface Region {
private static List<Service> regionServices = new ArrayList<Service>(); private static List<Service> regionServices = new ArrayList<Service>();
public static final Service Gslb = new Service("Gslb"); public static final Service Gslb = new Service("Gslb");
public static final Service PortableIp = new Service("PortableIp");
public Service(String name ) { public Service(String name ) {
this.name = name; this.name = name;

View File

@ -16,19 +16,8 @@
// under the License. // under the License.
package org.apache.cloudstack.usage; package org.apache.cloudstack.usage;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date; import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
public interface Usage { public interface Usage {
public long getId(); public long getId();
@ -39,7 +28,7 @@ public interface Usage {
public Long getDomainId(); public Long getDomainId();
public String getDescription(); public String getDescription();
public String getUsageDisplay(); public String getUsageDisplay();

View File

@ -40,6 +40,7 @@ public class UsageTypes {
public static final int VM_DISK_IO_WRITE = 22; public static final int VM_DISK_IO_WRITE = 22;
public static final int VM_DISK_BYTES_READ = 23; public static final int VM_DISK_BYTES_READ = 23;
public static final int VM_DISK_BYTES_WRITE = 24; public static final int VM_DISK_BYTES_WRITE = 24;
public static final int VM_SNAPSHOT = 25;
public static List<UsageTypeResponse> listUsageTypes(){ public static List<UsageTypeResponse> listUsageTypes(){
List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>(); List<UsageTypeResponse> responseList = new ArrayList<UsageTypeResponse>();
@ -61,6 +62,7 @@ public class UsageTypes {
responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM Disk usage(I/O Write)")); responseList.add(new UsageTypeResponse(VM_DISK_IO_WRITE, "VM Disk usage(I/O Write)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM Disk usage(Bytes Read)")); responseList.add(new UsageTypeResponse(VM_DISK_BYTES_READ, "VM Disk usage(Bytes Read)"));
responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM Disk usage(Bytes Write)")); responseList.add(new UsageTypeResponse(VM_DISK_BYTES_WRITE, "VM Disk usage(Bytes Write)"));
responseList.add(new UsageTypeResponse(VM_SNAPSHOT, "VM Snapshot storage usage"));
return responseList; return responseList;
} }
} }

View File

@ -23,6 +23,7 @@ import org.junit.Before;
import org.junit.Test; import org.junit.Test;
import com.cloud.network.Networks.BroadcastDomainType; import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.IsolationType;
/** /**
* @author dhoogland * @author dhoogland
@ -45,7 +46,8 @@ public class NetworksTest {
@Test @Test
public void vlanBroadcastDomainTypeTest() throws URISyntaxException { public void vlanBroadcastDomainTypeTest() throws URISyntaxException {
String uri1 = "vlan://1"; String uri1 = "vlan://1";
String uri2 = "vlan:2"; Long value2 = 2L;
String uri2 = BroadcastDomainType.Vlan.toUri(value2).toString();
BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(uri1); BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(uri1);
BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2); BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2);
String id1 = BroadcastDomainType.getValue(uri1); String id1 = BroadcastDomainType.getValue(uri1);
@ -55,20 +57,29 @@ public class NetworksTest {
Assert.assertEquals("uri2 should be of broadcasttype vlan", Assert.assertEquals("uri2 should be of broadcasttype vlan",
BroadcastDomainType.Vlan, type2); BroadcastDomainType.Vlan, type2);
Assert.assertEquals("id1 should be \"1\"", "1", id1); Assert.assertEquals("id1 should be \"1\"", "1", id1);
Assert.assertEquals("id1 should be \"2\"", "2", id2); Assert.assertEquals("id2 should be \"2\"", "2", id2);
}
@Test
public void vlanIsolationTypeTest() throws URISyntaxException {
String uri1 = "vlan://1";
Long value2 = 2L;
String uri2 = IsolationType.Vlan.toUri(value2).toString();
Assert.assertEquals("id1 should be \"vlan://1\"", "vlan://1", uri1);
Assert.assertEquals("id2 should be \"vlan://2\"", "vlan://2", uri2);
} }
@Test @Test
public void otherTypesTest() throws URISyntaxException { public void otherTypesTest() throws URISyntaxException {
String bogeyUri = "lswitch://1"; String bogeyUri = "lswitch://1";
String uri2 = "mido:2"; String uri2 = "mido://2";
BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(bogeyUri); BroadcastDomainType type1 = BroadcastDomainType.getTypeOf(bogeyUri);
BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2); BroadcastDomainType type2 = BroadcastDomainType.getTypeOf(uri2);
String id1 = BroadcastDomainType.getValue(bogeyUri); String id1 = BroadcastDomainType.getValue(bogeyUri);
String id2 = BroadcastDomainType.getValue(uri2); String id2 = BroadcastDomainType.getValue(uri2);
Assert.assertEquals("uri1 should be of broadcasttype vlan", Assert.assertEquals("uri1 should be of broadcasttype lswitch",
BroadcastDomainType.Lswitch, type1); BroadcastDomainType.Lswitch, type1);
Assert.assertEquals("uri2 should be of broadcasttype vlan", Assert.assertEquals("uri2 should be of broadcasttype mido",
BroadcastDomainType.Mido, type2); BroadcastDomainType.Mido, type2);
Assert.assertEquals("id1 should be \"//1\"", "//1", id1); Assert.assertEquals("id1 should be \"//1\"", "//1", id1);
Assert.assertEquals("id1 should be \"2\"", "2", id2); Assert.assertEquals("id1 should be \"2\"", "2", id2);

View File

@ -16,25 +16,26 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.test; package org.apache.cloudstack.api.command.test;
import java.util.Arrays;
import junit.framework.Assert; import junit.framework.Assert;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.cluster.AddClusterCmd;
import com.cloud.exception.DiscoveryException; import com.cloud.exception.DiscoveryException;
import com.cloud.exception.ResourceInUseException; import com.cloud.exception.ResourceInUseException;
import com.cloud.org.Cluster; import com.cloud.org.Cluster;
import com.cloud.resource.ResourceService; import com.cloud.resource.ResourceService;
import edu.emory.mathcs.backport.java.util.Arrays;
public class AddClusterCmdTest extends TestCase { public class AddClusterCmdTest extends TestCase {
private AddClusterCmd addClusterCmd; private AddClusterCmd addClusterCmd;
@ -44,6 +45,7 @@ public class AddClusterCmdTest extends TestCase {
@Rule @Rule
public ExpectedException expectedException = ExpectedException.none(); public ExpectedException expectedException = ExpectedException.none();
@Override
@Before @Before
public void setUp() { public void setUp() {
/* /*
@ -110,8 +112,7 @@ public class AddClusterCmdTest extends TestCase {
Cluster cluster = Mockito.mock(Cluster.class); Cluster cluster = Mockito.mock(Cluster.class);
Cluster[] clusterArray = new Cluster[] { cluster }; Cluster[] clusterArray = new Cluster[] { cluster };
Mockito.when(resourceService.discoverCluster(addClusterCmd)) Mockito.doReturn(Arrays.asList(clusterArray)).when(resourceService).discoverCluster(addClusterCmd);
.thenReturn(Arrays.asList(clusterArray));
addClusterCmd.execute(); addClusterCmd.execute();

View File

@ -16,27 +16,28 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.test; package org.apache.cloudstack.api.command.test;
import java.util.Arrays;
import junit.framework.Assert; import junit.framework.Assert;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.mockito.Mockito; import org.mockito.Mockito;
import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.host.AddHostCmd;
import org.apache.cloudstack.api.response.HostResponse;
import org.apache.cloudstack.api.response.ListResponse;
import com.cloud.exception.DiscoveryException; import com.cloud.exception.DiscoveryException;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.host.Host; import com.cloud.host.Host;
import com.cloud.resource.ResourceService; import com.cloud.resource.ResourceService;
import edu.emory.mathcs.backport.java.util.Arrays;
public class AddHostCmdTest extends TestCase { public class AddHostCmdTest extends TestCase {
private AddHostCmd addHostCmd; private AddHostCmd addHostCmd;
@ -46,6 +47,7 @@ public class AddHostCmdTest extends TestCase {
@Rule @Rule
public ExpectedException expectedException = ExpectedException.none(); public ExpectedException expectedException = ExpectedException.none();
@Override
@Before @Before
public void setUp() { public void setUp() {
resourceService = Mockito.mock(ResourceService.class); resourceService = Mockito.mock(ResourceService.class);
@ -125,14 +127,12 @@ public class AddHostCmdTest extends TestCase {
HostResponse responseHost = new HostResponse(); HostResponse responseHost = new HostResponse();
responseHost.setName("Test"); responseHost.setName("Test");
Mockito.when(resourceService.discoverHosts(addHostCmd)).thenReturn( Mockito.doReturn(Arrays.asList(mockArray)).when(resourceService).discoverHosts(addHostCmd);
Arrays.asList(mockArray)); Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(responseHost);
Mockito.when(responseGenerator.createHostResponse(host)).thenReturn(
responseHost);
addHostCmd.execute(); addHostCmd.execute();
Mockito.verify(responseGenerator).createHostResponse(host); Mockito.verify(responseGenerator).createHostResponse(host);
ListResponse<HostResponse> actualResponse = ((ListResponse<HostResponse>) addHostCmd @SuppressWarnings("unchecked")
.getResponseObject()); ListResponse<HostResponse> actualResponse = ((ListResponse<HostResponse>)addHostCmd.getResponseObject());
Assert.assertEquals(responseHost, actualResponse.getResponses().get(0)); Assert.assertEquals(responseHost, actualResponse.getResponses().get(0));
Assert.assertEquals("addhostresponse", actualResponse.getResponseName()); Assert.assertEquals("addhostresponse", actualResponse.getResponseName());
@ -144,8 +144,7 @@ public class AddHostCmdTest extends TestCase {
addHostCmd._resourceService = resourceService; addHostCmd._resourceService = resourceService;
try { try {
Mockito.when(resourceService.discoverHosts(addHostCmd)).thenThrow( Mockito.when(resourceService.discoverHosts(addHostCmd)).thenThrow(DiscoveryException.class);
DiscoveryException.class);
} catch (InvalidParameterValueException e) { } catch (InvalidParameterValueException e) {
e.printStackTrace(); e.printStackTrace();
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException e) {

View File

@ -16,19 +16,22 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.test; package org.apache.cloudstack.api.command.test;
import com.cloud.configuration.Configuration;
import com.cloud.configuration.ConfigurationService; import com.cloud.configuration.ConfigurationService;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.resource.ResourceService; import com.cloud.resource.ResourceService;
import com.cloud.server.ManagementService; import com.cloud.server.ManagementService;
import com.cloud.utils.Pair; import com.cloud.utils.Pair;
import junit.framework.Assert; import junit.framework.Assert;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd; import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
import org.apache.cloudstack.api.response.ConfigurationResponse; import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.ListResponse; import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.config.Configuration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;

View File

@ -24,16 +24,12 @@ import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd; import org.apache.cloudstack.api.command.user.vm.ScaleVMCmd;
import org.apache.cloudstack.api.response.SwiftResponse;
import org.apache.cloudstack.api.response.UserVmResponse; import org.apache.cloudstack.api.response.UserVmResponse;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;
import org.junit.rules.ExpectedException; import org.junit.rules.ExpectedException;
import org.mockito.Mockito; import org.mockito.Mockito;
import static org.mockito.Matchers.anyInt;
import java.util.LinkedList; import java.util.LinkedList;
import java.util.List; import java.util.List;
@ -45,6 +41,7 @@ public class ScaleVMCmdTest extends TestCase{
@Rule @Rule
public ExpectedException expectedException = ExpectedException.none(); public ExpectedException expectedException = ExpectedException.none();
@Override
@Before @Before
public void setUp() { public void setUp() {

View File

@ -16,16 +16,19 @@
// under the License. // under the License.
package org.apache.cloudstack.api.command.test; package org.apache.cloudstack.api.command.test;
import com.cloud.configuration.Configuration;
import com.cloud.configuration.ConfigurationService; import com.cloud.configuration.ConfigurationService;
import com.cloud.exception.InvalidParameterValueException; import com.cloud.exception.InvalidParameterValueException;
import com.cloud.resource.ResourceService; import com.cloud.resource.ResourceService;
import junit.framework.Assert; import junit.framework.Assert;
import junit.framework.TestCase; import junit.framework.TestCase;
import org.apache.cloudstack.api.ResponseGenerator; import org.apache.cloudstack.api.ResponseGenerator;
import org.apache.cloudstack.api.ServerApiException; import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd; import org.apache.cloudstack.api.command.admin.config.UpdateCfgCmd;
import org.apache.cloudstack.api.response.ConfigurationResponse; import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.config.Configuration;
import org.junit.Before; import org.junit.Before;
import org.junit.Rule; import org.junit.Rule;
import org.junit.Test; import org.junit.Test;

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