Merge branch 'master' into ui-restyle

Conflicts:
	client/WEB-INF/classes/resources/messages.properties
	ui/dictionary.jsp
	ui/scripts/ui-custom/accountsWizard.js
This commit is contained in:
Brian Federle 2014-01-30 14:40:22 -08:00
commit 849d601ccf
1374 changed files with 77507 additions and 45648 deletions

1
.gitignore vendored
View File

@ -86,3 +86,4 @@ engine/storage/integration-test/test-output
tools/apidoc/log/
log/
plugins/network-elements/juniper-contrail/logs/
scripts/vm/hypervisor/xenserver/vhd-util

16
LICENSE.header Normal file
View File

@ -0,0 +1,16 @@
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.

View File

@ -114,3 +114,7 @@ domr.scripts.dir=scripts/network/domr/kvm
# for examples:"Conroe" "Penryn", "Nehalem", "Westmere", "pentiumpro" and so
# on,run virsh capabilities for more details.
# guest.cpu.model=
#
# vm.memballoon.disable=true
# Disable memory ballooning on vm guests for overcommit, by default overcommit
# feature enables balloon and sets currentMemory to a minimum value.

View File

@ -115,38 +115,5 @@
</executions>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.maven.plugins
</groupId>
<artifactId>
maven-antrun-plugin
</artifactId>
<versionRange>[1.7,)</versionRange>
<goals>
<goal>run</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

View File

@ -304,7 +304,7 @@ public class AgentShell implements IAgentShell, Daemon {
// For KVM agent, do it specially here
File file = new File("/etc/cloudstack/agent/log4j-cloud.xml");
if(!file.exists()) {
if (!file.exists()) {
file = PropertiesUtil.findConfigFile("log4j-cloud.xml");
}

View File

@ -180,8 +180,8 @@ public class DummyResource implements ServerResource {
return true;
}
public void setParams(Map<String, Object> _params) {
this._params = _params;
public void setParams(Map<String, Object> params) {
this._params = params;
}
@Override

View File

@ -1,4 +1,3 @@
#!/usr/bin/env bash
# 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
@ -15,12 +14,5 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
usage() {
printf " %s routerip <alias_count:ip:netmask;alias_count2:ip2:netmask2;....> \n" $(basename $0) >&2
}
set -x
cert="/root/.ssh/id_rsa.cloud"
ssh -p 3922 -q -o StrictHostKeyChecking=no -i $cert root@$1 "/root/createIpAlias.sh $2"
name=api-config
parent=core

View File

@ -0,0 +1,32 @@
<!--
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.
-->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
>
<bean id="apiServiceConfiguration" class="org.apache.cloudstack.config.ApiServiceConfiguration" />
</beans>

View File

@ -33,6 +33,8 @@ public class IpAddressTO {
private Integer networkRate;
private TrafficType trafficType;
private String networkName;
private Integer nicDevId;
private boolean newNic;
public IpAddressTO(long accountId, String ipAddress, boolean add, boolean firstIP, boolean sourceNat, String broadcastUri, String vlanGateway, String vlanNetmask,
String vifMacAddress, Integer networkRate, boolean isOneToOneNat) {
@ -116,4 +118,19 @@ public class IpAddressTO {
return networkRate;
}
public Integer getNicDevId() {
return nicDevId;
}
public void setNicDevId(Integer nicDevId) {
this.nicDevId = nicDevId;
}
public boolean isNewNic() {
return newNic;
}
public void setNewNic(boolean newNic) {
this.newNic = newNic;
}
}

View File

@ -44,8 +44,8 @@ public class NfsTO implements DataStoreTO {
return _url;
}
public void setUrl(String _url) {
this._url = _url;
public void setUrl(String url) {
this._url = url;
}
@Override
@ -53,8 +53,8 @@ public class NfsTO implements DataStoreTO {
return _role;
}
public void setRole(DataStoreRole _role) {
this._role = _role;
public void setRole(DataStoreRole role) {
this._role = role;
}
@Override

View File

@ -129,15 +129,15 @@ public class VolumeTO implements InternalIdentity {
public String getChainInfo() {
return chainInfo;
}
public void setChainInfo(String chainInfo) {
this.chainInfo = chainInfo;
this.chainInfo = chainInfo;
}
public String getOsType() {
return guestOsType;
}
public void setPath(String path) {
this.path = path;
}

View File

@ -39,5 +39,6 @@ public interface Alert extends Identity, InternalIdentity {
Date getResolved();
boolean getArchived();
String getName();
}

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.deploy;
import java.io.Serializable;
import java.util.Map;
import com.cloud.dc.DataCenter;
@ -26,7 +27,9 @@ import com.cloud.storage.StoragePool;
import com.cloud.storage.Volume;
import com.cloud.utils.NumbersUtil;
public class DeployDestination {
public class DeployDestination implements Serializable {
private static final long serialVersionUID = 7113840781939014695L;
DataCenter _dc;
Pod _pod;
Cluster _cluster;
@ -76,28 +79,28 @@ public class DeployDestination {
@Override
public boolean equals(Object obj) {
DeployDestination that = (DeployDestination)obj;
if (this._dc == null || that._dc == null) {
if (_dc == null || that._dc == null) {
return false;
}
if (this._dc.getId() != that._dc.getId()) {
if (_dc.getId() != that._dc.getId()) {
return false;
}
if (this._pod == null || that._pod == null) {
if (_pod == null || that._pod == null) {
return false;
}
if (this._pod.getId() != that._pod.getId()) {
if (_pod.getId() != that._pod.getId()) {
return false;
}
if (this._cluster == null || that._cluster == null) {
if (_cluster == null || that._cluster == null) {
return false;
}
if (this._cluster.getId() != that._cluster.getId()) {
if (_cluster.getId() != that._cluster.getId()) {
return false;
}
if (this._host == null || that._host == null) {
if (_host == null || that._host == null) {
return false;
}
return this._host.getId() == that._host.getId();
return _host.getId() == that._host.getId();
}
@Override

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.deploy;
import java.io.Serializable;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
@ -89,7 +90,9 @@ public interface DeploymentPlanner extends Adapter {
Shared, Dedicated;
}
public static class ExcludeList {
public static class ExcludeList implements Serializable {
private static final long serialVersionUID = -482175549460148301L;
private Set<Long> _dcIds;
private Set<Long> _podIds;
private Set<Long> _clusterIds;
@ -99,22 +102,22 @@ public interface DeploymentPlanner extends Adapter {
public ExcludeList() {
}
public ExcludeList(Set<Long> _dcIds, Set<Long> _podIds, Set<Long> _clusterIds, Set<Long> _hostIds, Set<Long> _poolIds) {
if (_dcIds != null) {
this._dcIds = new HashSet<Long>(_dcIds);
public ExcludeList(Set<Long> dcIds, Set<Long> podIds, Set<Long> clusterIds, Set<Long> hostIds, Set<Long> poolIds) {
if (dcIds != null) {
this._dcIds = new HashSet<Long>(dcIds);
}
if (_podIds != null) {
this._podIds = new HashSet<Long>(_podIds);
if (podIds != null) {
this._podIds = new HashSet<Long>(podIds);
}
if (_clusterIds != null) {
this._clusterIds = new HashSet<Long>(_clusterIds);
if (clusterIds != null) {
this._clusterIds = new HashSet<Long>(clusterIds);
}
if (_hostIds != null) {
this._hostIds = new HashSet<Long>(_hostIds);
if (hostIds != null) {
this._hostIds = new HashSet<Long>(hostIds);
}
if (_poolIds != null) {
this._poolIds = new HashSet<Long>(_poolIds);
if (poolIds != null) {
this._poolIds = new HashSet<Long>(poolIds);
}
}
@ -173,6 +176,12 @@ public interface DeploymentPlanner extends Adapter {
_poolIds.add(poolId);
}
public void removePool(long poolId) {
if (_poolIds != null) {
_poolIds.remove(poolId);
}
}
public void addDataCenter(long dataCenterId) {
if (_dcIds == null) {
_dcIds = new HashSet<Long>();

View File

@ -0,0 +1,21 @@
// 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.deploy;
public interface HAPlanner extends DeploymentPlanner {
}

View File

@ -455,7 +455,11 @@ public class EventTypes {
//Alert generation
public static final String ALERT_GENERATE = "ALERT.GENERATE";
// OpenDaylight
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER = "PHYSICAL.ODLCONTROLLER.ADD";
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.DELETE";
public static final String EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER = "PHYSICAL.ODLCONTROLLER.CONFIGURE";
static {
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@ -761,6 +765,11 @@ public class EventTypes {
entityEventDetails.put(EVENT_AUTOSCALEVMGROUP_DISABLE, AutoScaleVmGroup.class.getName());
entityEventDetails.put(EVENT_GUEST_VLAN_RANGE_DEDICATE, GuestVlan.class.getName());
entityEventDetails.put(EVENT_DEDICATED_GUEST_VLAN_RANGE_RELEASE, GuestVlan.class.getName());
// OpenDaylight
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_ADD_CONTROLLER, "OpenDaylightController");
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_DELETE_CONTROLLER, "OpenDaylightController");
entityEventDetails.put(EVENT_EXTERNAL_OPENDAYLIGHT_CONFIGURE_CONTROLLER, "OpenDaylightController");
}
public static String getEntityForEvent(String eventName) {

View File

@ -27,6 +27,7 @@ import com.cloud.utils.exception.CSExceptionErrorCode;
*/
public class CloudException extends Exception {
private static final long serialVersionUID = 8784427323859682503L;
// This holds a list of uuids and their names. Add uuid:fieldname pairs
protected ArrayList<String> idList = new ArrayList<String>();
@ -58,10 +59,10 @@ public class CloudException extends Exception {
}
public void setCSErrorCode(int cserrcode) {
this.csErrorCode = cserrcode;
csErrorCode = cserrcode;
}
public int getCSErrorCode() {
return this.csErrorCode;
return csErrorCode;
}
}

View File

@ -28,7 +28,15 @@ public class OperationTimedoutException extends CloudException {
long _agentId;
long _seqId;
int _time;
Command[] _cmds;
// TODO
// I did a reference search on usage of getCommands() and found none
//
// to prevent serialization problems across boundaries, I'm disabling serialization of _cmds here
// getCommands() will still be available within the same serialization boundary, but it will be lost
// when exception is propagated across job boundaries.
//
transient Command[] _cmds;
boolean _isActive;
public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) {

View File

@ -78,6 +78,11 @@ public interface Host extends StateObject<Status>, Identity, InternalIdentity {
*/
String getPrivateIpAddress();
/**
* @return the ip address of the host.
*/
String getStorageUrl();
/**
* @return the ip address of the host attached to the storage network.
*/

View File

@ -75,4 +75,6 @@ public interface HypervisorGuru extends Adapter {
*
*/
List<Command> finalizeExpungeNics(VirtualMachine vm, List<NicProfile> nics);
List<Command> finalizeExpungeVolumes(VirtualMachine vm);
}

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.network;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
@ -33,7 +34,7 @@ import com.cloud.utils.fsm.StateObject;
/**
* owned by an account.
*/
public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity {
public interface Network extends ControlledEntity, StateObject<Network.State>, InternalIdentity, Identity, Serializable {
public enum GuestType {
Shared, Isolated
@ -47,9 +48,9 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Service Dns = new Service("Dns", Capability.AllowDnsSuffixModification);
public static final Service Gateway = new Service("Gateway");
public static final Service Firewall = new Service("Firewall", Capability.SupportedProtocols, Capability.MultipleIps, Capability.TrafficStatistics,
Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
Capability.SupportedTrafficDirection, Capability.SupportedEgressProtocols);
public static final Service Lb = new Service("Lb", Capability.SupportedLBAlgorithms, Capability.SupportedLBIsolation, Capability.SupportedProtocols,
Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
Capability.TrafficStatistics, Capability.LoadBalancingSupportedIps, Capability.SupportedStickinessMethods, Capability.ElasticLb, Capability.LbSchemes);
public static final Service UserData = new Service("UserData");
public static final Service SourceNat = new Service("SourceNat", Capability.SupportedSourceNatTypes, Capability.RedundantRouter);
public static final Service StaticNat = new Service("StaticNat", Capability.ElasticIp);
@ -111,7 +112,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
private static List<Provider> supportedProviders = new ArrayList<Provider>();
public static final Provider VirtualRouter = new Provider("VirtualRouter", false);
public static final Provider JuniperContrail = new Provider("JuniperContrail", false);
public static final Provider JuniperContrailRouter = new Provider("JuniperContrailRouter", false);
public static final Provider JuniperSRX = new Provider("JuniperSRX", true);
public static final Provider PaloAlto = new Provider("PaloAlto", true);
public static final Provider F5BigIp = new Provider("F5BigIp", true);
@ -128,6 +129,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
public static final Provider CiscoVnmc = new Provider("CiscoVnmc", true);
// add new Ovs provider
public static final Provider Ovs = new Provider("Ovs", false);
public static final Provider Opendaylight = new Provider("Opendaylight", false);
private final String name;
private final boolean isExternal;
@ -213,7 +215,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
Allocated("Indicates the network configuration is in allocated but not setup"), Setup("Indicates the network configuration is setup"), Implementing(
"Indicates the network configuration is being implemented"), Implemented("Indicates the network configuration is in use"), Shutdown(
"Indicates the network configuration is being destroyed"), Destroy("Indicates that the network is destroyed");
"Indicates the network configuration is being destroyed"), Destroy("Indicates that the network is destroyed");
protected static final StateMachine2<State, Network.Event, Network> s_fsm = new StateMachine2<State, Network.Event, Network>();
@ -223,7 +225,7 @@ public interface Network extends ControlledEntity, StateObject<Network.State>, I
s_fsm.addTransition(State.Implementing, Event.OperationFailed, State.Shutdown);
s_fsm.addTransition(State.Implemented, Event.DestroyNetwork, State.Shutdown);
s_fsm.addTransition(State.Shutdown, Event.OperationSucceeded, State.Allocated);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Implemented);
s_fsm.addTransition(State.Shutdown, Event.OperationFailed, State.Shutdown);
s_fsm.addTransition(State.Setup, Event.DestroyNetwork, State.Destroy);
s_fsm.addTransition(State.Allocated, Event.DestroyNetwork, State.Destroy);
}

View File

@ -60,6 +60,8 @@ public interface NetworkModel {
*/
List<? extends IpAddress> listPublicIpsAssignedToGuestNtwk(long accountId, long associatedNetworkId, Boolean sourceNat);
List<? extends IpAddress> listPublicIpsAssignedToGuestNtwk(long associatedNetworkId, Boolean sourceNat);
List<? extends NetworkOffering> getSystemAccountNetworkOfferings(String... offeringNames);
List<? extends Nic> getNics(long vmId);

View File

@ -62,9 +62,9 @@ public interface NetworkService {
Network createGuestNetwork(CreateNetworkCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
List<? extends Network> searchForNetworks(ListNetworksCmd cmd);
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId);
boolean deleteNetwork(long networkId, boolean forced);
boolean restartNetwork(RestartNetworkCmd cmd, boolean cleanup) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException;
@ -110,7 +110,7 @@ public interface NetworkService {
long findPhysicalNetworkId(long zoneId, String tag, TrafficType trafficType);
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String xenLabel, String kvmLabel, String vmwareLabel,
PhysicalNetworkTrafficType addTrafficTypeToPhysicalNetwork(Long physicalNetworkId, String trafficType, String isolationMethod, String xenLabel, String kvmLabel, String vmwareLabel,
String simulatorLabel, String vlan, String hypervLabel);
PhysicalNetworkTrafficType getPhysicalNetworkTrafficType(Long id);
@ -168,7 +168,7 @@ public interface NetworkService {
InsufficientCapacityException;
/* Requests an IP address for the guest nic */
NicSecondaryIp allocateSecondaryGuestIP(Account account, long zoneId, Long nicId, Long networkId, String ipaddress) throws InsufficientAddressCapacityException;
NicSecondaryIp allocateSecondaryGuestIP(long nicId, String ipaddress) throws InsufficientAddressCapacityException;
boolean releaseSecondaryIpFromNic(long ipAddressId);

View File

@ -31,7 +31,7 @@ public class Networks {
None, DcGlobal, // global to data center
HostLocal;
public static String DummyPrivateIp = "169.254.1.1";
public static final String DummyPrivateIp = "169.254.1.1";
}
/**
@ -94,7 +94,22 @@ public class Networks {
return uri.getSchemeSpecificPart();
}
},
Mido("mido", String.class), Pvlan("pvlan", String.class), Vxlan("vxlan", Long.class), UnDecided(null, null);
Mido("mido", String.class), Pvlan("pvlan", String.class),
Vxlan("vxlan", Long.class) {
@Override
public <T> URI toUri(T value) {
try {
if (value.toString().contains("://"))
return new URI(value.toString());
else
return new URI("vxlan://" + value.toString());
} catch (URISyntaxException e) {
throw new CloudRuntimeException(
"Unable to convert to broadcast URI: " + value);
}
}
},
UnDecided(null, null), OpenDaylight("opendaylight", String.class);
private final String scheme;
private final Class<?> type;

View File

@ -20,7 +20,7 @@ import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
public interface OvsProvider extends InternalIdentity, Identity {
public boolean isEnabled();
public boolean isEnabled();
public long getNspId();
public long getNspId();
}

View File

@ -33,7 +33,7 @@ public interface PhysicalNetwork extends Identity, InternalIdentity {
}
public enum IsolationMethod {
VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN;
VLAN, L3, GRE, STT, VNS, MIDO, SSP, VXLAN, ODL, L3VPN;
}
public enum BroadcastDomainRange {

View File

@ -69,5 +69,5 @@ public interface VirtualNetworkApplianceService {
List<Long> upgradeRouterTemplate(UpgradeRouterTemplateCmd cmd);
public static final String _minVRVersion = "4.2.0";
public static final String MinVRVersion = "4.3.0";
}

View File

@ -32,8 +32,8 @@ public interface AutoScalePolicy extends ControlledEntity, InternalIdentity {
public int getDuration();
public int getQuietTime();
public Date getLastQuiteTime();
public Date getLastQuiteTime();
public String getAction();

View File

@ -47,7 +47,7 @@ public interface AutoScaleVmGroup extends ControlledEntity, InternalIdentity {
int getInterval();
Date getLastInterval();
Date getLastInterval();
String getState();

View File

@ -34,5 +34,5 @@ public interface Counter extends InternalIdentity, Identity {
String getValue();
Source getSource();
}

View File

@ -22,7 +22,6 @@ import java.util.Set;
import com.cloud.deploy.DeployDestination;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InsufficientCapacityException;
import com.cloud.exception.InsufficientNetworkCapacityException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.Network.Capability;
@ -67,7 +66,6 @@ public interface NetworkElement extends Adapter {
* @return
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
* @throws InsufficientNetworkCapacityException
*/
boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException;

View File

@ -33,5 +33,5 @@ public interface UserDataServiceProvider extends NetworkElement {
boolean saveUserData(Network network, NicProfile nic, VirtualMachineProfile vm) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String SSHPublicKey) throws ResourceUnavailableException;
boolean saveSSHKey(Network network, NicProfile nic, VirtualMachineProfile vm, String sshPublicKey) throws ResourceUnavailableException;
}

View File

@ -31,12 +31,13 @@ import com.cloud.utils.component.PluggableService;
public interface VirtualRouterElementService extends PluggableService {
VirtualRouterProvider configure(ConfigureVirtualRouterElementCmd cmd);
OvsProvider configure(ConfigureOvsElementCmd cmd);
OvsProvider configure(ConfigureOvsElementCmd cmd);
VirtualRouterProvider addElement(Long nspId, Type providerType);
VirtualRouterProvider getCreatedElement(long id);
List<? extends VirtualRouterProvider> searchForVirtualRouterElement(ListVirtualRouterElementsCmd cmd);
List<? extends OvsProvider> searchForOvsElement(ListOvsElementsCmd cmd);
List<? extends OvsProvider> searchForOvsElement(ListOvsElementsCmd cmd);
}

View File

@ -44,7 +44,7 @@ public interface FirewallService {
boolean applyEgressFirewallRules(FirewallRule rule, Account caller) throws ResourceUnavailableException;
boolean applyIngressFirewallRules(long Ipid, Account caller) throws ResourceUnavailableException;
boolean applyIngressFirewallRules(long ipId, Account caller) throws ResourceUnavailableException;
FirewallRule getFirewallRule(long ruleId);

View File

@ -101,7 +101,7 @@ public interface LoadBalancingRulesService {
boolean applyLoadBalancerConfig(long lbRuleId) throws ResourceUnavailableException;
boolean assignCertToLoadBalancer(long lbRuleId, Long CertId);
boolean assignCertToLoadBalancer(long lbRuleId, Long certId);
boolean removeCertFromLoadBalancer(long lbRuleId);
@ -145,7 +145,7 @@ public interface LoadBalancingRulesService {
List<? extends HealthCheckPolicy> searchForLBHealthCheckPolicies(ListLBHealthCheckPoliciesCmd cmd);
LoadBalancer findById(long LoadBalancer);
LoadBalancer findById(long loadBalancer);
public void updateLBHealthChecks(Scheme scheme) throws ResourceUnavailableException;

View File

@ -36,7 +36,8 @@ public interface FirewallRule extends ControlledEntity, Identity, InternalIdenti
Staged, // Rule been created but has never got through network rule conflict detection. Rules in this state can not be sent to network elements.
Add, // Add means the rule has been created and has gone through network rule conflict detection.
Active, // Rule has been sent to the network elements and reported to be active.
Revoke // Revoke means this rule has been revoked. If this rule has been sent to the network elements, the rule will be deleted from database.
Revoke, // Revoke means this rule has been revoked. If this rule has been sent to the network elements, the rule will be deleted from database.
Deleting // rule has been revoked and is scheduled for deletion
}
enum TrafficType {

View File

@ -47,5 +47,5 @@ public interface SecurityGroupService {
public List<? extends SecurityRule> authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressCmd cmd);
public boolean securityGroupRulesForVmSecIp(Long nicId, Long networkId, String secondaryIp, boolean ruleAction);
public boolean securityGroupRulesForVmSecIp(long nicId, String secondaryIp, boolean ruleAction);
}

View File

@ -47,7 +47,7 @@ public interface NetworkACLService {
* @param cmd
* @return
*/
Pair<List<? extends NetworkACL>,Integer> listNetworkACLs(ListNetworkACLListsCmd cmd);
Pair<List<? extends NetworkACL>, Integer> listNetworkACLs(ListNetworkACLListsCmd cmd);
/**
* Delete specified network ACL. Deletion fails if the list is not empty

View File

@ -25,7 +25,8 @@ public interface StaticRoute extends ControlledEntity, Identity, InternalIdentit
Staged, // route been created but has never got through network rule conflict detection. Routes in this state can not be sent to VPC virtual router.
Add, // Add means the route has been created and has gone through network rule conflict detection.
Active, // Route has been sent to the VPC router and reported to be active.
Revoke // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database.
Revoke, // Revoke means this route has been revoked. If this route has been sent to the VPC router, the route will be deleted from database.
Deleting // rule has been revoked and is scheduled for deletion
}
/**

View File

@ -36,7 +36,7 @@ public interface DiskOffering extends InfrastructureEntity, Identity, InternalId
public enum DiskCacheMode {
NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
private final String _diskCacheMode;
DiskCacheMode(String cacheMode) {

View File

@ -53,8 +53,8 @@ public interface GlobalLoadBalancerRule extends Identity, InternalIdentity, Cont
tcp, udp, http;
public static boolean isValidServiceType(String serviceType) {
if (tcp.name().equalsIgnoreCase(serviceType) ||
udp.name().equalsIgnoreCase(serviceType) ||
http.name().equalsIgnoreCase(serviceType)) {
udp.name().equalsIgnoreCase(serviceType) ||
http.name().equalsIgnoreCase(serviceType)) {
return true;
}
return false;

View File

@ -46,22 +46,28 @@ public interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
ServiceOffering(false, true),
Storage(false, true),
PrivateGateway(false, true),
NetworkACLList(false, true);
NetworkACLList(false, true),
VpnGateway(false, true),
CustomerGateway(false, true),
VpnConnection(false, true),
User(true, true),
DiskOffering(false, true),
AutoScaleVmProfile(false, true);
ResourceObjectType(boolean resourceTagsSupport, boolean resourceMetadataSupport) {
this.resourceTagsSupport = resourceTagsSupport;
this.metadataSupport = resourceMetadataSupport;
metadataSupport = resourceMetadataSupport;
}
private final boolean resourceTagsSupport;
private final boolean metadataSupport;
public boolean resourceTagsSupport() {
return this.resourceTagsSupport;
return resourceTagsSupport;
}
public boolean resourceMetadataSupport() {
return this.metadataSupport;
return metadataSupport;
}
}

View File

@ -24,13 +24,13 @@ public enum DataStoreRole {
Primary("primary"), Image("image"), ImageCache("imagecache"), Backup("backup");
public boolean isImageStore() {
return (this.role.equalsIgnoreCase("image") || this.role.equalsIgnoreCase("imagecache")) ? true : false;
return (role.equalsIgnoreCase("image") || role.equalsIgnoreCase("imagecache")) ? true : false;
}
private final String role;
DataStoreRole(String type) {
this.role = type;
role = type;
}
public static DataStoreRole getRole(String role) {

View File

@ -28,6 +28,8 @@ public class Storage {
OVA(true, true, true, "ova"),
VHDX(true, true, true, "vhdx"),
BAREMETAL(false, false, false, "BAREMETAL"),
VMDK(true, true, false, "vmdk"),
VDI(true, true, false, "vdi"),
TAR(false, false, false, "tar");
private final boolean thinProvisioned;

View File

@ -17,8 +17,8 @@
package com.cloud.storage;
import java.net.UnknownHostException;
import java.util.Map;
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.CreateSecondaryStagingStoreCmd;
import org.apache.cloudstack.api.command.admin.storage.CreateStoragePoolCmd;
@ -92,19 +92,23 @@ public interface StorageService {
boolean deleteSecondaryStagingStore(DeleteSecondaryStagingStoreCmd cmd);
ImageStore discoverImageStore(AddImageStoreCmd cmd) throws IllegalArgumentException, DiscoveryException, InvalidParameterValueException;
public ImageStore discoverImageStore(String name, String url, String providerName, Long dcId, Map details) throws IllegalArgumentException, DiscoveryException,
InvalidParameterValueException;
/**
* Prepare NFS secondary storage for object store migration
*
* @param cmd
* - the command specifying secondaryStorageId
* @return the storage pool
* @throws ResourceUnavailableException
* TODO
* @throws InsufficientCapacityException
* TODO
/**
* Migrate existing NFS to use object store.
* @param name object store name.
* @param url object store url.
* @param providerName object store provider Name.
* @param details object store other details
* @return Object store created.
* @throws IllegalArgumentException
* @throws DiscoveryException
* @throws InvalidParameterValueException
*/
public ImageStore prepareSecondaryStorageForObjectStoreMigration(Long storeId) throws ResourceUnavailableException, InsufficientCapacityException;
public ImageStore migrateToObjectStore(String name, String url, String providerName, Map details) throws IllegalArgumentException, DiscoveryException,
InvalidParameterValueException;
}

View File

@ -189,7 +189,5 @@ public interface Volume extends ControlledEntity, Identity, InternalIdentity, Ba
Long getVmSnapshotChainSize();
void setHypervisorSnapshotReserve(Integer hypervisorSnapshotReserve);
Integer getHypervisorSnapshotReserve();
}

View File

@ -18,8 +18,6 @@
*/
package com.cloud.storage;
import java.net.URISyntaxException;
import org.apache.cloudstack.api.command.user.volume.AttachVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.CreateVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.DetachVolumeCmd;
@ -29,8 +27,6 @@ import org.apache.cloudstack.api.command.user.volume.ResizeVolumeCmd;
import org.apache.cloudstack.api.command.user.volume.UploadVolumeCmd;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.InternalErrorException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.user.Account;
@ -42,7 +38,6 @@ public interface VolumeApiService {
* the API command wrapping the criteria (account/domainId [admin only], zone, diskOffering, snapshot,
* name)
* @return the volume object
* @throws PermissionDeniedException
*/
Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
@ -96,9 +91,6 @@ public interface VolumeApiService {
* the command specifying url (where the volume needs to be extracted to), zoneId (zone where the volume
* exists),
* id (the id of the volume)
* @throws URISyntaxException
* @throws InternalErrorException
* @throws PermissionDeniedException
*
*/
String extractVolume(ExtractVolumeCmd cmd);

View File

@ -24,7 +24,6 @@ import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotPoliciesCmd;
import org.apache.cloudstack.api.command.user.snapshot.ListSnapshotsCmd;
import com.cloud.api.commands.ListRecurringSnapshotScheduleCmd;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.storage.Snapshot;
import com.cloud.storage.Volume;
@ -39,7 +38,6 @@ public interface SnapshotApiService {
* @param cmd
* the command containing the search criteria (order by, limit, etc.)
* @return list of snapshots
* @throws PermissionDeniedException
*/
Pair<List<? extends Snapshot>, Integer> listSnapshots(ListSnapshotsCmd cmd);

View File

@ -139,9 +139,8 @@ public interface ResourceLimitService {
*/
public long getResourceCount(Account account, ResourceType type);
/**
* Checks if a limit has been exceeded for an account depending on the displayResource flag
* Checks if a limit has been exceeded for an account if displayResource flag is on
*
* @param account
* @param type
@ -153,9 +152,8 @@ public interface ResourceLimitService {
*/
void checkResourceLimit(Account account, ResourceType type, Boolean displayResource, long... count) throws ResourceAllocationException;
/**
* Increments the resource count depending on the displayResource flag
* Increments the resource count if displayResource flag is on
*
* @param accountId
* @param type
@ -165,7 +163,7 @@ public interface ResourceLimitService {
void incrementResourceCount(long accountId, ResourceType type, Boolean displayResource, Long... delta);
/**
* Increments/Decrements the resource count depending on the displayResource flag
* Increments/Decrements the resource count depending on the displayResource flag is turned on or off respectively
*
* @param accountId
* @param type
@ -174,5 +172,13 @@ public interface ResourceLimitService {
*/
void changeResourceCount(long accountId, ResourceType type, Boolean displayResource, Long... delta);
/**
* Decrements the resource count if displayResource flag is on
*
* @param accountId
* @param type
* @param displayResource
* @param delta
*/
void decrementResourceCount(long accountId, ResourceType type, Boolean displayResource, Long... delta);
}

View File

@ -71,9 +71,9 @@ public class DiskProfile {
null);
this.hyperType = hyperType;
}
public DiskProfile(DiskProfile dp) {
}
/**
@ -156,17 +156,17 @@ public class DiskProfile {
public HypervisorType getHypervisorType() {
return this.hyperType;
}
public void setPath(String path) {
this.path = path;
this.path = path;
}
public String getPath() {
return this.path;
return this.path;
}
public void setSize(long size) {
this.size = size;
this.size = size;
}
public void setBytesReadRate(Long bytesReadRate) {

View File

@ -16,6 +16,7 @@
// under the License.
package com.cloud.vm;
import java.io.Serializable;
import java.net.URI;
import org.apache.cloudstack.api.InternalIdentity;
@ -27,7 +28,9 @@ import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.vm.Nic.ReservationStrategy;
public class NicProfile implements InternalIdentity {
public class NicProfile implements InternalIdentity, Serializable {
private static final long serialVersionUID = 4997005771736090304L;
long id;
long networkId;
BroadcastDomainType broadcastType;
@ -57,6 +60,7 @@ public class NicProfile implements InternalIdentity {
String name;
String requestedIpv4;
String requestedIpv6;
String uuid;
public String getDns1() {
return dns1;
@ -142,6 +146,10 @@ public class NicProfile implements InternalIdentity {
this.format = format;
}
public void setUuid(String uuid) {
this.uuid = uuid;
}
public void setTrafficType(TrafficType trafficType) {
this.trafficType = trafficType;
}
@ -215,29 +223,34 @@ public class NicProfile implements InternalIdentity {
return strategy;
}
public String getUuid() {
return uuid;
}
public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri, Integer networkRate, boolean isSecurityGroupEnabled, String name) {
this.id = nic.getId();
this.networkId = network.getId();
this.gateway = nic.getGateway();
this.mode = network.getMode();
this.broadcastType = network.getBroadcastDomainType();
this.trafficType = network.getTrafficType();
this.ip4Address = nic.getIp4Address();
this.format = nic.getAddressFormat();
this.ip6Address = nic.getIp6Address();
this.macAddress = nic.getMacAddress();
this.reservationId = nic.getReservationId();
this.strategy = nic.getReservationStrategy();
this.deviceId = nic.getDeviceId();
this.defaultNic = nic.isDefaultNic();
id = nic.getId();
networkId = network.getId();
gateway = nic.getGateway();
mode = network.getMode();
broadcastType = network.getBroadcastDomainType();
trafficType = network.getTrafficType();
ip4Address = nic.getIp4Address();
format = nic.getAddressFormat();
ip6Address = nic.getIp6Address();
macAddress = nic.getMacAddress();
reservationId = nic.getReservationId();
strategy = nic.getReservationStrategy();
deviceId = nic.getDeviceId();
defaultNic = nic.isDefaultNic();
this.broadcastUri = broadcastUri;
this.isolationUri = isolationUri;
this.netmask = nic.getNetmask();
netmask = nic.getNetmask();
this.isSecurityGroupEnabled = isSecurityGroupEnabled;
this.vmId = nic.getInstanceId();
vmId = nic.getInstanceId();
this.name = name;
this.ip6Cidr = nic.getIp6Cidr();
this.ip6Gateway = nic.getIp6Gateway();
ip6Cidr = nic.getIp6Cidr();
ip6Gateway = nic.getIp6Gateway();
uuid = nic.getUuid();
if (networkRate != null) {
this.networkRate = networkRate;
@ -245,7 +258,7 @@ public class NicProfile implements InternalIdentity {
}
public NicProfile(ReservationStrategy strategy, String ip4Address, String macAddress, String gateway, String netmask) {
this.format = AddressFormat.Ip4;
format = AddressFormat.Ip4;
this.ip4Address = ip4Address;
this.macAddress = macAddress;
this.gateway = gateway;
@ -274,11 +287,11 @@ public class NicProfile implements InternalIdentity {
}
public boolean isSecurityGroupEnabled() {
return this.isSecurityGroupEnabled;
return isSecurityGroupEnabled;
}
public void setSecurityGroupEnabled(boolean enabled) {
this.isSecurityGroupEnabled = enabled;
isSecurityGroupEnabled = enabled;
}
public String getRequestedIpv4() {
@ -286,36 +299,36 @@ public class NicProfile implements InternalIdentity {
}
public void deallocate() {
this.gateway = null;
this.mode = null;
this.format = null;
this.broadcastType = null;
this.trafficType = null;
this.ip4Address = null;
this.ip6Address = null;
this.macAddress = null;
this.reservationId = null;
this.strategy = null;
this.deviceId = null;
this.broadcastUri = null;
this.isolationUri = null;
this.netmask = null;
this.dns1 = null;
this.dns2 = null;
gateway = null;
mode = null;
format = null;
broadcastType = null;
trafficType = null;
ip4Address = null;
ip6Address = null;
macAddress = null;
reservationId = null;
strategy = null;
deviceId = null;
broadcastUri = null;
isolationUri = null;
netmask = null;
dns1 = null;
dns2 = null;
}
@Override
public String toString() {
return new StringBuilder("NicProfile[").append(id)
.append("-")
.append(vmId)
.append("-")
.append(reservationId)
.append("-")
.append(ip4Address)
.append("-")
.append(broadcastUri)
.toString();
.append("-")
.append(vmId)
.append("-")
.append(reservationId)
.append("-")
.append(ip4Address)
.append("-")
.append(broadcastUri)
.toString();
}
public String getIp6Gateway() {

View File

@ -19,8 +19,6 @@ package com.cloud.vm;
import java.util.List;
import java.util.Map;
import javax.naming.InsufficientResourcesException;
import org.apache.cloudstack.api.BaseCmd.HTTPMethod;
import org.apache.cloudstack.api.command.admin.vm.AssignVMCmd;
import org.apache.cloudstack.api.command.admin.vm.ExpungeVMCmd;
@ -197,12 +195,11 @@ public interface UserVmService {
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> securityGroupIdList,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId) throws InsufficientCapacityException,
Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod,
String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@ -271,12 +268,11 @@ public interface UserVmService {
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList,
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId) throws InsufficientCapacityException,
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@ -343,14 +339,13 @@ public interface UserVmService {
* @throws ResourceUnavailableException
* if the resources required to deploy the VM is not currently
* available.
* @throws InsufficientResourcesException
*/
UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffering, VirtualMachineTemplate template, List<Long> networkIdList, Account owner,
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
Map<String, String> customParameters, String customId)
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
String sshKeyPair, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
Map<String, String> customParameters, String customId)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Starts the virtual machine created from createVirtualMachine.
@ -466,4 +461,12 @@ public interface UserVmService {
UserVm expungeVm(long vmId) throws ResourceUnavailableException, ConcurrentOperationException;
/**
* Finds and returns an encrypted password for a VM.
*
* @param userVmId
* @return Base64 encoded userdata
*/
String getVmUserData(long vmId);
}

View File

@ -29,11 +29,11 @@ import com.cloud.utils.fsm.StateObject;
/**
* VirtualMachine describes the properties held by a virtual machine
*
*
*/
public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, InternalIdentity, StateObject<VirtualMachine.State> {
public enum PowerState {
public enum PowerState {
PowerUnknown, PowerOn, PowerOff,
}
@ -115,7 +115,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
s_fsm.addTransition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging);
s_fsm.addTransition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging);
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running);
@ -124,8 +124,9 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
s_fsm.addTransition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
s_fsm.addTransition(State.Running, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
s_fsm.addTransition(State.Migrating, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
s_fsm.addTransition(State.Stopped, VirtualMachine.Event.FollowAgentPowerOffReport, State.Stopped);
}
public static boolean isVmStarted(State oldState, Event e, State newState) {
if (oldState == State.Starting && newState == State.Running) {
return true;
@ -192,10 +193,10 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
AgentReportMigrated,
RevertRequested,
SnapshotRequested,
// added for new VMSync logic
FollowAgentPowerOnReport,
FollowAgentPowerOffReport,
FollowAgentPowerOffReport,
};
public enum Type {
@ -206,7 +207,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
* VM with this type. UserBareMetal should treat exactly as User.
*/
UserBareMetal(false),
/*
* General VM type for queuing VM orchestration work
*/
@ -264,7 +265,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
/**
* returns the guest OS ID
*
*
* @return guestOSId
*/
long getGuestOSId();
@ -303,7 +304,7 @@ public interface VirtualMachine extends RunningOn, ControlledEntity, Identity, I
Date getCreated();
long getServiceOfferingId();
Long getDiskOfferingId();
Type getType();

View File

@ -26,6 +26,19 @@ import com.cloud.dc.Vlan;
public class VirtualMachineName {
public static final String SEPARATOR = "-";
public static boolean isValidCloudStackVmName(String name, String instance) {
String[] parts = name.split(SEPARATOR);
if (parts.length <= 1) {
return false;
}
if (!parts[parts.length - 1].equals(instance)) {
return false;
}
return true;
}
public static String getVnetName(long vnetId) {
StringBuilder vnet = new StringBuilder();
Formatter formatter = new Formatter(vnet);

View File

@ -1,4 +1,3 @@
// 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
@ -28,7 +27,7 @@ public interface AlertService {
private static Set<AlertType> defaultAlertTypes = new HashSet<AlertType>();
private final String name;
private final short type;
private AlertType(short type, String name, boolean isDefault) {
this.name = name;
this.type = type;
@ -36,12 +35,13 @@ public interface AlertService {
defaultAlertTypes.add(this);
}
}
public static final AlertType ALERT_TYPE_MEMORY = new AlertType(Capacity.CAPACITY_TYPE_MEMORY, "ALERT.MEMORY", true);
public static final AlertType ALERT_TYPE_CPU = new AlertType(Capacity.CAPACITY_TYPE_CPU, "ALERT.CPU", true);
public static final AlertType ALERT_TYPE_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_STORAGE, "ALERT.STORAGE", true);
public static final AlertType ALERT_TYPE_STORAGE_ALLOCATED = new AlertType(Capacity.CAPACITY_TYPE_STORAGE_ALLOCATED, "ALERT.STORAGE.ALLOCATED", true);
public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = new AlertType(Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP, "ALERT.NETWORK.PUBLICIP", true);
public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_PUBLIC_IP = new AlertType(Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_PUBLIC_IP, "ALERT.NETWORK.PUBLICIP",
true);
public static final AlertType ALERT_TYPE_PRIVATE_IP = new AlertType(Capacity.CAPACITY_TYPE_PRIVATE_IP, "ALERT.NETWORK.PRIVATEIP", true);
public static final AlertType ALERT_TYPE_SECONDARY_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_SECONDARY_STORAGE, "ALERT.STORAGE.SECONDARY", true);
public static final AlertType ALERT_TYPE_HOST = new AlertType((short)7, "ALERT.COMPUTE.HOST", true);
@ -51,10 +51,10 @@ public interface AlertService {
public static final AlertType ALERT_TYPE_ROUTING = new AlertType((short)11, "ALERT.NETWORK.ROUTING", true);
public static final AlertType ALERT_TYPE_STORAGE_MISC = new AlertType((short)12, "ALERT.STORAGE.MISC", true);
public static final AlertType ALERT_TYPE_USAGE_SERVER = new AlertType((short)13, "ALERT.USAGE", true);
public static final AlertType ALERT_TYPE_MANAGMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true);
public static final AlertType ALERT_TYPE_MANAGMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true);
public static final AlertType ALERT_TYPE_DOMAIN_ROUTER_MIGRATE = new AlertType((short)15, "ALERT.NETWORK.DOMAINROUTERMIGRATE", true);
public static final AlertType ALERT_TYPE_CONSOLE_PROXY_MIGRATE = new AlertType((short)16, "ALERT.SERVICE.CONSOLEPROXYMIGRATE", true);
public static final AlertType ALERT_TYPE_USERVM_MIGRATE = new AlertType((short)17, "ALERT.USERVM.MIGRATE", true);
public static final AlertType ALERT_TYPE_USERVM_MIGRATE = new AlertType((short)17, "ALERT.USERVM.MIGRATE", true);
public static final AlertType ALERT_TYPE_VLAN = new AlertType((short)18, "ALERT.NETWORK.VLAN", true);
public static final AlertType ALERT_TYPE_SSVM = new AlertType((short)19, "ALERT.SERVICE.SSVM", true);
public static final AlertType ALERT_TYPE_USAGE_SERVER_RESULT = new AlertType((short)20, "ALERT.USAGE.RESULT", true);
@ -69,7 +69,7 @@ public interface AlertService {
public short getType() {
return type;
}
public String getName() {
return name;
}
@ -82,7 +82,7 @@ public interface AlertService {
}
return null;
}
@Override
public String toString() {
return String.valueOf(this.getType());
@ -97,7 +97,7 @@ public interface AlertService {
}
}
}
boolean generateAlert(AlertType alertType, long dataCenterId, Long podId, String msg);
}

View File

@ -72,7 +72,6 @@ public class ApiConstants {
public static final String DISPLAY_VM = "displayvm";
public static final String DISPLAY_OFFERING = "displayoffering";
public static final String DISPLAY_VOLUME = "displayvolume";
public static final String CUSTOM_PARAMETERS = "customparameters";
public static final String DNS1 = "dns1";
public static final String DNS2 = "dns2";
public static final String IP6_DNS1 = "ip6dns1";
@ -210,6 +209,7 @@ public class ApiConstants {
public static final String SENT_BYTES = "sentbytes";
public static final String SERVICE_OFFERING_ID = "serviceofferingid";
public static final String SHOW_CAPACITIES = "showcapacities";
public static final String SHOW_REMOVED = "showremoved";
public static final String SIZE = "size";
public static final String SNAPSHOT_ID = "snapshotid";
public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
@ -344,6 +344,7 @@ public class ApiConstants {
public static final String CAPACITY_IOPS = "capacityiops";
public static final String NETWORK_SPEED = "networkspeed";
public static final String BROADCAST_DOMAIN_RANGE = "broadcastdomainrange";
public static final String ISOLATION_METHOD = "isolationmethod";
public static final String ISOLATION_METHODS = "isolationmethods";
public static final String PHYSICAL_NETWORK_ID = "physicalnetworkid";
public static final String DEST_PHYSICAL_NETWORK_ID = "destinationphysicalnetworkid";
@ -412,11 +413,11 @@ public class ApiConstants {
// Ovs controller
public static final String OVS_DEVICE_ID = "ovsdeviceid";
public static final String OVS_DEVICE_NAME = "ovsdevicename";
// OpenDaylight controller
public static final String ODL_DEVICE_ID = "odldeviceid";
public static final String ODL_DEVICE_NAME = "odldevicename";
public static final String ODL_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String ODL_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
// OpenDaylight controller
public static final String ODL_DEVICE_ID = "odldeviceid";
public static final String ODL_DEVICE_NAME = "odldevicename";
public static final String ODL_TRANSPORT_ZONE_UUID = "transportzoneuuid";
public static final String ODL_GATEWAYSERVICE_UUID = "l3gatewayserviceuuid";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_ID = "vsmdeviceid";
public static final String EXTERNAL_SWITCH_MGMT_DEVICE_NAME = "vsmdevicename";
@ -554,6 +555,6 @@ public class ApiConstants {
}
public enum VMDetails {
all, group, nics, stats, secgrp, tmpl, servoff, iso, volume, min, affgrp;
all, group, nics, stats, secgrp, tmpl, servoff, diskoff, iso, volume, min, affgrp;
}
}

View File

@ -16,9 +16,10 @@
// under the License.
package org.apache.cloudstack.api;
public abstract class BaseAsyncCreateCustomIdCmd extends BaseAsyncCreateCmd{
@Parameter(name=ApiConstants.CUSTOM_ID, type=CommandType.STRING, description="an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
public abstract class BaseAsyncCreateCustomIdCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.CUSTOM_ID,
type = CommandType.STRING,
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
private String customId;
public String getCustomId() {

View File

@ -16,9 +16,10 @@
// under the License.
package org.apache.cloudstack.api;
public abstract class BaseAsyncCustomIdCmd extends BaseAsyncCmd {
@Parameter(name=ApiConstants.CUSTOM_ID, type=CommandType.STRING, description="an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
@Parameter(name = ApiConstants.CUSTOM_ID,
type = CommandType.STRING,
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
private String customId;
public String getCustomId() {

View File

@ -26,6 +26,8 @@ import java.util.regex.Pattern;
import javax.inject.Inject;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.alert.AlertService;
import org.apache.cloudstack.network.element.InternalLoadBalancerElementService;
@ -33,7 +35,6 @@ import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
import org.apache.cloudstack.network.lb.InternalLoadBalancerVMService;
import org.apache.cloudstack.query.QueryService;
import org.apache.cloudstack.usage.UsageService;
import org.apache.log4j.Logger;
import com.cloud.configuration.ConfigurationService;
import com.cloud.domain.Domain;
@ -94,7 +95,7 @@ public abstract class BaseCmd {
public static final DateFormat INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd");
public static final DateFormat NEW_INPUT_FORMAT = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public static Pattern newInputDateFormat = Pattern.compile("[\\d]+-[\\d]+-[\\d]+ [\\d]+:[\\d]+:[\\d]+");
private static final DateFormat _outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
private static final DateFormat s_outputFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ");
private Object _responseObject = null;
private Map<String, String> fullUrlParams;
@ -153,8 +154,6 @@ public abstract class BaseCmd {
@Inject
public ResourceLimitService _resourceLimitService;
@Inject
public IdentityService _identityService;
@Inject
public StorageNetworkService _storageNetworkService;
@Inject
public TaggedResourceService _taggedResourceService;
@ -191,12 +190,11 @@ public abstract class BaseCmd {
public InternalLoadBalancerVMService _internalLbSvc;
@Inject
public NetworkModel _ntwkModel;
@Inject
@Inject
public AlertService _alertSvc;
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException;
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException;
public void configure() {
}
@ -258,8 +256,8 @@ public abstract class BaseCmd {
return "";
}
String formattedString = null;
synchronized (_outputFormat) {
formattedString = _outputFormat.format(date);
synchronized (s_outputFormat) {
formattedString = s_outputFormat.format(date);
}
return formattedString;
}
@ -359,11 +357,11 @@ public abstract class BaseCmd {
}
public void setFullUrlParams(Map<String, String> map) {
this.fullUrlParams = map;
fullUrlParams = map;
}
public Map<String, String> getFullUrlParams() {
return this.fullUrlParams;
return fullUrlParams;
}
public Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly) {

View File

@ -18,7 +18,9 @@ package org.apache.cloudstack.api;
public abstract class BaseCustomIdCmd extends BaseCmd {
@Parameter(name=ApiConstants.CUSTOM_ID, type=CommandType.STRING, description="an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
@Parameter(name = ApiConstants.CUSTOM_ID,
type = CommandType.STRING,
description = "an optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
private String customId;
public String getCustomId() {

View File

@ -20,8 +20,8 @@ import com.cloud.exception.InvalidParameterValueException;
public abstract class BaseListCmd extends BaseCmd {
private static Long MAX_PAGESIZE = null;
public static Long PAGESIZE_UNLIMITED = -1L;
private static Long s_maxPageSize = null;
public static Long s_pageSizeUnlimited = -1L;
// ///////////////////////////////////////////////////
// ///////// BaseList API parameters /////////////////
@ -53,11 +53,11 @@ public abstract class BaseListCmd extends BaseCmd {
}
public Integer getPageSize() {
if (pageSize != null && MAX_PAGESIZE.longValue() != PAGESIZE_UNLIMITED && pageSize.longValue() > MAX_PAGESIZE.longValue()) {
throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + MAX_PAGESIZE.longValue());
if (pageSize != null && s_maxPageSize.longValue() != s_pageSizeUnlimited && pageSize.longValue() > s_maxPageSize.longValue()) {
throw new InvalidParameterValueException("Page size can't exceed max allowed page size value: " + s_maxPageSize.longValue());
}
if (pageSize != null && pageSize.longValue() == PAGESIZE_UNLIMITED && page != null) {
if (pageSize != null && pageSize.longValue() == s_pageSizeUnlimited && page != null) {
throw new InvalidParameterValueException("Can't specify page parameter when pagesize is -1 (Unlimited)");
}
@ -66,11 +66,11 @@ public abstract class BaseListCmd extends BaseCmd {
@Override
public void configure() {
if (MAX_PAGESIZE == null) {
if (_configService.getDefaultPageSize().longValue() != PAGESIZE_UNLIMITED) {
MAX_PAGESIZE = _configService.getDefaultPageSize();
if (s_maxPageSize == null) {
if (_configService.getDefaultPageSize().longValue() != s_pageSizeUnlimited) {
s_maxPageSize = _configService.getDefaultPageSize();
} else {
MAX_PAGESIZE = PAGESIZE_UNLIMITED;
s_maxPageSize = s_pageSizeUnlimited;
}
}
}
@ -82,12 +82,12 @@ public abstract class BaseListCmd extends BaseCmd {
}
public Long getPageSizeVal() {
Long defaultPageSize = MAX_PAGESIZE;
Long defaultPageSize = s_maxPageSize;
Integer pageSizeInt = getPageSize();
if (pageSizeInt != null) {
defaultPageSize = pageSizeInt.longValue();
}
if (defaultPageSize.longValue() == PAGESIZE_UNLIMITED) {
if (defaultPageSize.longValue() == s_pageSizeUnlimited) {
defaultPageSize = null;
}

View File

@ -27,8 +27,8 @@ import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
public Logger s_logger = getLogger();
protected String s_name = "listtemplatepermissionsresponse";
public Logger logger = getLogger();
protected static final String s_name = "listtemplatepermissionsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -58,6 +58,10 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
protected Logger getLogger() {
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class);
}
@Override
public String getCommandName() {
return s_name;
@ -71,10 +75,6 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
return "templateOrIso";
}
protected Logger getLogger() {
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class.getName());
}
@Override
public void execute() {
List<String> accountNames = _templateService.listTemplatePermissions(this);
@ -84,6 +84,6 @@ public class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd {
TemplatePermissionsResponse response = _responseGenerator.createTemplatePermissionsResponse(accountNames, id, isAdmin);
response.setResponseName(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
}
}

View File

@ -27,13 +27,21 @@ import org.apache.cloudstack.api.response.TemplateResponse;
import com.cloud.exception.InvalidParameterValueException;
public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
public Logger s_logger = getLogger();
protected String s_name = getResponseName();
public Logger _logger = getLogger();
protected String _name = getResponseName();
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
protected Logger getLogger() {
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class);
}
protected String getResponseName() {
return "updatetemplateorisopermissionsresponse";
}
@Parameter(name = ApiConstants.ACCOUNTS,
type = CommandType.LIST,
collectionType = CommandType.STRING,
@ -109,15 +117,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
@Override
public String getCommandName() {
return s_name;
}
protected String getResponseName() {
return "updatetemplateorisopermissionsresponse";
}
protected Logger getLogger() {
return Logger.getLogger(BaseUpdateTemplateOrIsoPermissionsCmd.class.getName());
return _name;
}
@Override
@ -125,7 +125,7 @@ public abstract class BaseUpdateTemplateOrIsoPermissionsCmd extends BaseCmd {
boolean result = _templateService.updateTemplateOrIsoPermissions(this);
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions");
}

View File

@ -290,7 +290,7 @@ public interface ResponseGenerator {
//ListResponse<SecurityGroupResponse> createSecurityGroupResponses(List<? extends SecurityGroupRules> networkGroups);
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> SecurityRules);
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List<? extends SecurityRule> securityRules);
SecurityGroupResponse createSecurityGroupResponse(SecurityGroup group);
@ -355,7 +355,7 @@ public interface ResponseGenerator {
VirtualRouterProviderResponse createVirtualRouterProviderResponse(VirtualRouterProvider result);
OvsProviderResponse createOvsProviderResponse(OvsProvider result);
OvsProviderResponse createOvsProviderResponse(OvsProvider result);
StorageNetworkIpRangeResponse createStorageNetworkIpRangeResponse(StorageNetworkIpRange result);

View File

@ -82,4 +82,8 @@ public class ServerApiException extends CloudRuntimeException {
_description = description;
}
@Override
public String getMessage() {
return _description;
}
}

View File

@ -31,7 +31,7 @@ import org.apache.log4j.Logger;
import com.cloud.event.EventTypes;
@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since="4.3")
@APICommand(name = "generateAlert", description = "Generates an alert", responseObject = SuccessResponse.class, since = "4.3")
public class GenerateAlertCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(GenerateAlertCmd.class.getName());
@ -42,19 +42,19 @@ public class GenerateAlertCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.TYPE, type = CommandType.SHORT, description = "Type of the alert", required=true)
@Parameter(name = ApiConstants.TYPE, type = CommandType.SHORT, description = "Type of the alert", required = true)
private Short type;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the alert", required=true)
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "Name of the alert", required = true)
private String name;
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Alert description", required=true)
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, description = "Alert description", required = true)
private String description;
@Parameter(name=ApiConstants.ZONE_ID, type=CommandType.UUID, entityType=ZoneResponse.class, description="Zone id for which alert is generated")
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "Zone id for which alert is generated")
private Long zoneId;
@Parameter(name=ApiConstants.POD_ID, type=CommandType.UUID, entityType=PodResponse.class, description="Pod id for which alert is generated")
@Parameter(name = ApiConstants.POD_ID, type = CommandType.UUID, entityType = PodResponse.class, description = "Pod id for which alert is generated")
private Long podId;
// ///////////////////////////////////////////////////
@ -87,14 +87,11 @@ public class GenerateAlertCmd extends BaseAsyncCmd {
public Long getPodId() {
return podId;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public void execute() {
AlertType alertType = AlertService.AlertType.generateAlert(getType(), getName());

View File

@ -55,25 +55,25 @@ public class ListCfgsByCmd extends BaseListCmd {
type = CommandType.UUID,
entityType = ZoneResponse.class,
description = "the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
private Long zoneId;
@Parameter(name = ApiConstants.CLUSTER_ID,
type = CommandType.UUID,
entityType = ClusterResponse.class,
description = "the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
private Long clusterId;
@Parameter(name = ApiConstants.STORAGE_ID,
type = CommandType.UUID,
entityType = StoragePoolResponse.class,
description = "the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
private Long storagePoolId;
@Parameter(name = ApiConstants.ACCOUNT_ID,
type = CommandType.UUID,
entityType = AccountResponse.class,
description = "the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
private Long accountId;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
@ -88,19 +88,19 @@ public class ListCfgsByCmd extends BaseListCmd {
}
public Long getZoneId() {
return zone_id;
return zoneId;
}
public Long getClusterId() {
return cluster_id;
return clusterId;
}
public Long getStoragepoolId() {
return storagepool_id;
return storagePoolId;
}
public Long getAccountId() {
return account_id;
return accountId;
}
@Override
@ -108,7 +108,7 @@ public class ListCfgsByCmd extends BaseListCmd {
Long defaultPageSize = 500L;
Integer pageSizeInt = getPageSize();
if (pageSizeInt != null) {
if (pageSizeInt.longValue() == PAGESIZE_UNLIMITED) {
if (pageSizeInt.longValue() == s_pageSizeUnlimited) {
defaultPageSize = null;
} else {
defaultPageSize = pageSizeInt.longValue();
@ -151,6 +151,6 @@ public class ListCfgsByCmd extends BaseListCmd {
response.setResponses(configResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
}
}

View File

@ -52,25 +52,25 @@ public class UpdateCfgCmd extends BaseCmd {
type = CommandType.UUID,
entityType = ZoneResponse.class,
description = "the ID of the Zone to update the parameter value for corresponding zone")
private Long zone_id;
private Long zoneId;
@Parameter(name = ApiConstants.CLUSTER_ID,
type = CommandType.UUID,
entityType = ClusterResponse.class,
description = "the ID of the Cluster to update the parameter value for corresponding cluster")
private Long cluster_id;
private Long clusterId;
@Parameter(name = ApiConstants.STORAGE_ID,
type = CommandType.UUID,
entityType = StoragePoolResponse.class,
description = "the ID of the Storage pool to update the parameter value for corresponding storage pool")
private Long storagepool_id;
private Long storagePoolId;
@Parameter(name = ApiConstants.ACCOUNT_ID,
type = CommandType.UUID,
entityType = AccountResponse.class,
description = "the ID of the Account to update the parameter value for corresponding account")
private Long account_id;
private Long accountId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -85,19 +85,19 @@ public class UpdateCfgCmd extends BaseCmd {
}
public Long getZoneId() {
return zone_id;
return zoneId;
}
public Long getClusterId() {
return cluster_id;
return clusterId;
}
public Long getStoragepoolId() {
return storagepool_id;
return storagePoolId;
}
public Long getAccountId() {
return account_id;
return accountId;
}
/////////////////////////////////////////////////////

View File

@ -24,7 +24,6 @@ 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.cloudstack.api.response.ZoneResponse;
@ -74,20 +73,15 @@ public class AddSecondaryStorageCmd extends BaseCmd {
}
@Override
public void execute() {
AddImageStoreCmd cmd = new AddImageStoreCmd();
cmd.setUrl(this.getUrl());
cmd.setZoneId(this.getZoneId());
cmd.setProviderName("NFS");
try {
ImageStore result = _storageService.discoverImageStore(cmd);
public void execute(){
try{
ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), null);
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}

View File

@ -45,7 +45,7 @@ import com.cloud.network.VirtualRouterProvider;
since = "4.2.0")
public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListInternalLoadBalancerElementsCmd.class.getName());
private static final String _name = "listinternalloadbalancerelementsresponse";
private static final String Name = "listinternalloadbalancerelementsresponse";
@Inject
private InternalLoadBalancerElementService _service;
@ -86,7 +86,7 @@ public class ListInternalLoadBalancerElementsCmd extends BaseListCmd {
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -44,7 +44,7 @@ import com.cloud.user.Account;
@APICommand(name = "createNetworkOffering", description = "Creates a network offering.", responseObject = NetworkOfferingResponse.class, since = "3.0.0")
public class CreateNetworkOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateNetworkOfferingCmd.class.getName());
private static final String _name = "createnetworkofferingresponse";
private static final String Name = "createnetworkofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -164,7 +164,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
}
public static String getName() {
return _name;
return Name;
}
public Long getServiceOfferingId() {
@ -281,7 +281,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override
@ -295,7 +295,7 @@ public class CreateNetworkOfferingCmd extends BaseCmd {
if (result != null) {
NetworkOfferingResponse response = _responseGenerator.createNetworkOfferingResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create network offering");
}

View File

@ -39,7 +39,7 @@ import com.cloud.utils.Pair;
since = "3.0.0")
public class ListNetworkServiceProvidersCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkServiceProvidersCmd.class.getName());
private static final String _name = "listnetworkserviceprovidersresponse";
private static final String Name = "listnetworkserviceprovidersresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -79,7 +79,7 @@ public class ListNetworkServiceProvidersCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -43,7 +43,7 @@ import com.cloud.user.Account;
public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListStorageNetworkIpRangeCmd.class);
String s_name = "liststoragenetworkiprangeresponse";
String _name = "liststoragenetworkiprangeresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -105,7 +105,7 @@ public class ListStorageNetworkIpRangeCmd extends BaseListCmd {
@Override
public String getCommandName() {
return s_name;
return _name;
}
@Override

View File

@ -39,7 +39,7 @@ import com.cloud.user.Account;
since = "3.0.0")
public class ListSupportedNetworkServicesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListSupportedNetworkServicesCmd.class.getName());
private static final String _name = "listsupportednetworkservicesresponse";
private static final String Name = "listsupportednetworkservicesresponse";
@Parameter(name = ApiConstants.PROVIDER, type = CommandType.STRING, description = "network service provider name")
private String providerName;
@ -72,7 +72,7 @@ public class ListSupportedNetworkServicesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -32,7 +32,7 @@ import com.cloud.user.Account;
@APICommand(name = "updateNetworkOffering", description = "Updates a network offering.", responseObject = NetworkOfferingResponse.class)
public class UpdateNetworkOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateNetworkOfferingCmd.class.getName());
private static final String _name = "updatenetworkofferingresponse";
private static final String Name = "updatenetworkofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -109,7 +109,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -36,7 +36,7 @@ import com.cloud.user.Account;
@APICommand(name = "createServiceOffering", description = "Creates a service offering.", responseObject = ServiceOfferingResponse.class)
public class CreateServiceOfferingCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(CreateServiceOfferingCmd.class.getName());
private static final String _name = "createserviceofferingresponse";
private static final String Name = "createserviceofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -220,7 +220,7 @@ public class CreateServiceOfferingCmd extends BaseCmd {
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -46,8 +46,8 @@ public class ListAlertsCmd extends BaseListCmd {
@Parameter(name = ApiConstants.TYPE, type = CommandType.STRING, description = "list by alert type")
private String type;
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list by alert name", since="4.3")
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "list by alert name", since = "4.3")
private String name;
// ///////////////////////////////////////////////////
@ -61,7 +61,7 @@ public class ListAlertsCmd extends BaseListCmd {
public String getType() {
return type;
}
public String getName() {
return name;
}

View File

@ -41,92 +41,92 @@ import com.cloud.user.Account;
@APICommand(name = "configureOvsElement", responseObject = OvsProviderResponse.class, description = "Configures an ovs element.")
public class ConfigureOvsElementCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger
.getLogger(ConfigureOvsElementCmd.class.getName());
private static final String s_name = "configureovselementresponse";
@Inject
private List<VirtualRouterElementService> _service;
public static final Logger s_logger = Logger
.getLogger(ConfigureOvsElementCmd.class.getName());
private static final String s_name = "configureovselementresponse";
@Inject
private List<VirtualRouterElementService> _service;
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, required = true, description = "the ID of the ovs provider")
private Long id;
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, required = true, description = "the ID of the ovs provider")
private Long id;
@Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "Enabled/Disabled the service provider")
private Boolean enabled;
@Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, required = true, description = "Enabled/Disabled the service provider")
private Boolean enabled;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public void setId(Long id) {
this.id = id;
}
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public Long getId() {
return id;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
public Boolean getEnabled() {
return enabled;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public String getCommandName() {
return s_name;
}
public static String getResultObjectName() {
return "boolean";
}
public static String getResultObjectName() {
return "boolean";
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
}
@Override
public String getEventType() {
return EventTypes.EVENT_NETWORK_ELEMENT_CONFIGURE;
}
@Override
public String getEventDescription() {
return "configuring ovs provider: " + id;
}
@Override
public String getEventDescription() {
return "configuring ovs provider: " + id;
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.None;
}
@Override
public ApiCommandJobType getInstanceType() {
return ApiCommandJobType.None;
}
@Override
public Long getInstanceId() {
return id;
}
@Override
public Long getInstanceId() {
return id;
}
@Override
public void execute() throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Ovs element: " + id);
OvsProvider result = _service.get(0).configure(this);
if (result != null) {
OvsProviderResponse ovsResponse = _responseGenerator
.createOvsProviderResponse(result);
ovsResponse.setResponseName(getCommandName());
this.setResponseObject(ovsResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
"Failed to configure the ovs provider");
}
}
@Override
public void execute() throws ConcurrentOperationException,
ResourceUnavailableException, InsufficientCapacityException {
CallContext.current().setEventDetails("Ovs element: " + id);
OvsProvider result = _service.get(0).configure(this);
if (result != null) {
OvsProviderResponse ovsResponse = _responseGenerator
.createOvsProviderResponse(result);
ovsResponse.setResponseName(getCommandName());
this.setResponseObject(ovsResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR,
"Failed to configure the ovs provider");
}
}
}

View File

@ -41,62 +41,64 @@ import com.cloud.network.element.VirtualRouterElementService;
@APICommand(name = "listOvsElements", description = "Lists all available ovs elements.", responseObject = OvsProviderResponse.class)
public class ListOvsElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger
.getLogger(ListNetworkOfferingsCmd.class.getName());
private static final String _name = "listovselementsresponse";
@Inject
private List<VirtualRouterElementService> _service;
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, description = "list ovs elements by id")
private Long id;
public static final Logger s_logger = Logger
.getLogger(ListNetworkOfferingsCmd.class.getName());
private static final String Name = "listovselementsresponse";
@Inject
private List<VirtualRouterElementService> _service;
// ///////////////////////////////////////////////////
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = OvsProviderResponse.class, description = "list ovs elements by id")
private Long id;
@Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, description = "list ovs elements by network service provider id")
private Long nspId;
@Parameter(name = ApiConstants.NSP_ID, type = CommandType.UUID, entityType = ProviderResponse.class, description = "list ovs elements by network service provider id")
private Long nspId;
@Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "list network offerings by enabled state")
private Boolean enabled;
@Parameter(name = ApiConstants.ENABLED, type = CommandType.BOOLEAN, description = "list network offerings by enabled state")
private Boolean enabled;
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
// ///////////////////////////////////////////////////
// ///////////////// Accessors ///////////////////////
// ///////////////////////////////////////////////////
public void setId(Long id) {
this.id = id;
}
public void setId(Long id) {
this.id = id;
}
public Long getId() {
return id;
}
public Long getId() {
return id;
}
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public void setNspId(Long nspId) {
this.nspId = nspId;
}
public Long getNspId() {
return nspId;
}
public Long getNspId() {
return nspId;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public void setEnabled(Boolean enabled) {
this.enabled = enabled;
}
public Boolean getEnabled() {
return enabled;
}
public Boolean getEnabled() {
return enabled;
}
@Override
public String getCommandName() {
return _name;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException {
@Override
public String getCommandName() {
return Name;
}
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException {
List<? extends OvsProvider> providers = _service.get(0).searchForOvsElement(this);
ListResponse<OvsProviderResponse> response = new ListResponse<OvsProviderResponse>();
List<OvsProviderResponse> providerResponses = new ArrayList<OvsProviderResponse>();
for (OvsProvider provider : providers) {
OvsProviderResponse providerResponse = _responseGenerator.createOvsProviderResponse(provider);
OvsProviderResponse providerResponse = _responseGenerator.createOvsProviderResponse(provider);
providerResponses.add(providerResponse);
}
response.setResponses(providerResponses);

View File

@ -43,7 +43,7 @@ import com.cloud.network.element.VirtualRouterElementService;
@APICommand(name = "listVirtualRouterElements", description = "Lists all available virtual router elements.", responseObject = VirtualRouterProviderResponse.class)
public class ListVirtualRouterElementsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListNetworkOfferingsCmd.class.getName());
private static final String _name = "listvirtualrouterelementsresponse";
private static final String Name = "listvirtualrouterelementsresponse";
// TODO, VirtualRouterElementServer is not singleton in system!
@Inject
@ -94,7 +94,7 @@ public class ListVirtualRouterElementsCmd extends BaseListCmd {
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -26,7 +26,6 @@ import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseResponse;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.DomainRouterResponse;
@ -65,11 +64,9 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "upgrades all routers within the specified zone")
private Long zoneId;
@Parameter(name = ApiConstants.ACCOUNT_ID,
type = CommandType.UUID,
entityType = AccountResponse.class,
description = "upgrades all routers owned by the specified account")
private Long accountId;
@Parameter(name=ApiConstants.ACCOUNT, type=CommandType.STRING,
description="upgrades all routers owned by the specified account")
private String account;
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
@ -97,8 +94,8 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
return zoneId;
}
public Long getAccountId() {
return accountId;
public String getAccount() {
return account;
}
public Long getDomainId() {
@ -134,7 +131,7 @@ public class UpgradeRouterTemplateCmd extends org.apache.cloudstack.api.BaseCmd
if (result != null) {
ListResponse<UpgradeRouterTemplateResponse> response = _responseGenerator.createUpgradeRouterTemplateResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to upgrade router template");
}

View File

@ -95,7 +95,7 @@ public class AddImageStoreCmd extends BaseCmd {
}
public String getProviderName() {
return this.providerName;
return providerName;
}
public void setUrl(String url) {
@ -129,15 +129,15 @@ public class AddImageStoreCmd extends BaseCmd {
}
@Override
public void execute() {
try {
ImageStore result = _storageService.discoverImageStore(this);
public void execute(){
try{
ImageStore result = _storageService.discoverImageStore(getName(), getUrl(), getProviderName(), getZoneId(), getDetails());
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("imagestore");
this.setResponseObject(storeResponse);
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}

View File

@ -56,7 +56,7 @@ import com.cloud.storage.ImageStore;
public final class AddS3Cmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(AddS3Cmd.class.getName());
private static String COMMAND_NAME = "adds3response";
private static final String COMMAND_NAME = "adds3response";
@Parameter(name = S3_ACCESS_KEY, type = STRING, required = true, description = "S3 access key")
private String accessKey;
@ -65,60 +65,54 @@ public final class AddS3Cmd extends BaseCmd {
private String secretKey;
@Parameter(name = S3_END_POINT, type = STRING, required = false, description = "S3 host name")
private String endPoint = null;
private final String endPoint = null;
@Parameter(name = S3_BUCKET_NAME, type = STRING, required = true, description = "name of the template storage bucket")
private String bucketName;
@Parameter(name = S3_HTTPS_FLAG, type = BOOLEAN, required = false, description = "connect to the S3 endpoint via HTTPS?")
private Boolean httpsFlag = null;
private final Boolean httpsFlag = null;
@Parameter(name = S3_CONNECTION_TIMEOUT, type = INTEGER, required = false, description = "connection timeout (milliseconds)")
private Integer connectionTimeout = null;
private final Integer connectionTimeout = null;
@Parameter(name = S3_MAX_ERROR_RETRY, type = INTEGER, required = false, description = "maximum number of times to retry on error")
private Integer maxErrorRetry = null;
private final Integer maxErrorRetry = null;
@Parameter(name = S3_SOCKET_TIMEOUT, type = INTEGER, required = false, description = "socket timeout (milliseconds)")
private Integer socketTimeout = null;
private final Integer socketTimeout = null;
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException {
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");
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());
}
try {
ImageStore result = _storageService.discoverImageStore(cmd);
try{
ImageStore result = _storageService.discoverImageStore(null, null, "S3", null, dm);
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add S3 secondary storage");
}
@ -141,35 +135,35 @@ public final class AddS3Cmd extends BaseCmd {
final AddS3Cmd thatAddS3Cmd = (AddS3Cmd)thatObject;
if (this.httpsFlag != null ? !this.httpsFlag.equals(thatAddS3Cmd.httpsFlag) : thatAddS3Cmd.httpsFlag != null) {
if (httpsFlag != null ? !httpsFlag.equals(thatAddS3Cmd.httpsFlag) : thatAddS3Cmd.httpsFlag != null) {
return false;
}
if (this.accessKey != null ? !this.accessKey.equals(thatAddS3Cmd.accessKey) : thatAddS3Cmd.accessKey != null) {
if (accessKey != null ? !accessKey.equals(thatAddS3Cmd.accessKey) : thatAddS3Cmd.accessKey != null) {
return false;
}
if (this.connectionTimeout != null ? !this.connectionTimeout.equals(thatAddS3Cmd.connectionTimeout) : thatAddS3Cmd.connectionTimeout != null) {
if (connectionTimeout != null ? !connectionTimeout.equals(thatAddS3Cmd.connectionTimeout) : thatAddS3Cmd.connectionTimeout != null) {
return false;
}
if (this.endPoint != null ? !this.endPoint.equals(thatAddS3Cmd.endPoint) : thatAddS3Cmd.endPoint != null) {
if (endPoint != null ? !endPoint.equals(thatAddS3Cmd.endPoint) : thatAddS3Cmd.endPoint != null) {
return false;
}
if (this.maxErrorRetry != null ? !this.maxErrorRetry.equals(thatAddS3Cmd.maxErrorRetry) : thatAddS3Cmd.maxErrorRetry != null) {
if (maxErrorRetry != null ? !maxErrorRetry.equals(thatAddS3Cmd.maxErrorRetry) : thatAddS3Cmd.maxErrorRetry != null) {
return false;
}
if (this.secretKey != null ? !this.secretKey.equals(thatAddS3Cmd.secretKey) : thatAddS3Cmd.secretKey != null) {
if (secretKey != null ? !secretKey.equals(thatAddS3Cmd.secretKey) : thatAddS3Cmd.secretKey != null) {
return false;
}
if (this.socketTimeout != null ? !this.socketTimeout.equals(thatAddS3Cmd.socketTimeout) : thatAddS3Cmd.socketTimeout != null) {
if (socketTimeout != null ? !socketTimeout.equals(thatAddS3Cmd.socketTimeout) : thatAddS3Cmd.socketTimeout != null) {
return false;
}
if (this.bucketName != null ? !this.bucketName.equals(thatAddS3Cmd.bucketName) : thatAddS3Cmd.bucketName != null) {
if (bucketName != null ? !bucketName.equals(thatAddS3Cmd.bucketName) : thatAddS3Cmd.bucketName != null) {
return false;
}
@ -180,14 +174,14 @@ public final class AddS3Cmd extends BaseCmd {
@Override
public int hashCode() {
int 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 == true ? 1 : 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);
int result = accessKey != null ? accessKey.hashCode() : 0;
result = 31 * result + (secretKey != null ? secretKey.hashCode() : 0);
result = 31 * result + (endPoint != null ? endPoint.hashCode() : 0);
result = 31 * result + (bucketName != null ? bucketName.hashCode() : 0);
result = 31 * result + (httpsFlag != null && httpsFlag == true ? 1 : 0);
result = 31 * result + (connectionTimeout != null ? connectionTimeout.hashCode() : 0);
result = 31 * result + (maxErrorRetry != null ? maxErrorRetry.hashCode() : 0);
result = 31 * result + (socketTimeout != null ? socketTimeout.hashCode() : 0);
return result;
@ -204,35 +198,35 @@ public final class AddS3Cmd extends BaseCmd {
}
public String getAccessKey() {
return this.accessKey;
return accessKey;
}
public String getSecretKey() {
return this.secretKey;
return secretKey;
}
public String getEndPoint() {
return this.endPoint;
return endPoint;
}
public String getBucketName() {
return this.bucketName;
return bucketName;
}
public Boolean getHttpsFlag() {
return this.httpsFlag;
return httpsFlag;
}
public Integer getConnectionTimeout() {
return this.connectionTimeout;
return connectionTimeout;
}
public Integer getMaxErrorRetry() {
return this.maxErrorRetry;
return maxErrorRetry;
}
public Integer getSocketTimeout() {
return this.socketTimeout;
return socketTimeout;
}
}

View File

@ -0,0 +1,142 @@
// 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 java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.log4j.Logger;
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 com.cloud.exception.DiscoveryException;
import com.cloud.storage.ImageStore;
import com.cloud.user.Account;
@APICommand(name = "updateCloudToUseObjectStore", description = "Migrate current NFS secondary storages to use object store.", responseObject = ImageStoreResponse.class, since = "4.3.0")
public class UpdateCloudToUseObjectStoreCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpdateCloudToUseObjectStoreCmd.class.getName());
private static final String s_name = "updatecloudtouseobjectstoreresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, description="the name for the image store")
private String name;
@Parameter(name=ApiConstants.URL, type=CommandType.STRING, description="the URL for the image store")
private String url;
@Parameter(name=ApiConstants.PROVIDER, type=CommandType.STRING,
required=true, description="the image store provider name")
private String providerName;
@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 details;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public String getUrl() {
return url;
}
public String getName() {
return name;
}
public Map<String, String> getDetails() {
Map<String, String> detailsMap = null;
if (details != null && !details.isEmpty()) {
detailsMap = new HashMap<String, String>();
Collection<?> props = details.values();
Iterator<?> iter = props.iterator();
while (iter.hasNext()) {
HashMap<String, String> detail = (HashMap<String, String>) iter.next();
String key = detail.get("key");
String value = detail.get("value");
detailsMap.put(key, value);
}
}
return detailsMap;
}
public String getProviderName() {
return providerName;
}
public void setUrl(String url) {
this.url = url;
}
public void setProviderName(String providerName) {
this.providerName = providerName;
}
public void setDetails(Map<String, String> details) {
this.details = details;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return s_name;
}
@Override
public long getEntityOwnerId() {
return Account.ACCOUNT_ID_SYSTEM;
}
@Override
public void execute(){
try{
ImageStore result = _storageService.migrateToObjectStore(getName(), getUrl(), getProviderName(), getDetails());
ImageStoreResponse storeResponse = null;
if (result != null ) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("imagestore");
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add secondary storage");
}
} catch (DiscoveryException ex) {
s_logger.warn("Exception: ", ex);
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, ex.getMessage());
}
}
}

View File

@ -27,7 +27,6 @@ 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 com.cloud.exception.DiscoveryException;
@ -91,27 +90,19 @@ public class AddSwiftCmd extends BaseCmd {
@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());
Map<String, String> dm = new HashMap<String, String>();
dm.put(ApiConstants.ACCOUNT, getAccount());
dm.put(ApiConstants.USERNAME, getUsername());
dm.put(ApiConstants.KEY, getKey());
try {
ImageStore result = _storageService.discoverImageStore(cmd);
try{
ImageStore result = _storageService.discoverImageStore(null, getUrl(), "Swift", null, dm);
ImageStoreResponse storeResponse = null;
if (result != null) {
storeResponse = _responseGenerator.createImageStoreResponse(result);
storeResponse.setResponseName(getCommandName());
storeResponse.setObjectName("secondarystorage");
this.setResponseObject(storeResponse);
setResponseObject(storeResponse);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Swift secondary storage");
}

View File

@ -16,7 +16,10 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@ -28,6 +31,7 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
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.exception.ConcurrentOperationException;
@ -39,15 +43,8 @@ import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@APICommand(name = "scaleSystemVm",
responseObject = SystemVmResponse.class,
description = "Scale the service offering for a system vm (console proxy or secondary storage). " + "The system vm must be in a \"Stopped\" state for "
+ "this command to take effect.")
@APICommand(name = "scaleSystemVm", responseObject = SystemVmResponse.class, description = "Scale the service offering for a system vm (console proxy or secondary storage). "
+ "The system vm must be in a \"Stopped\" state for " + "this command to take effect.")
public class ScaleSystemVMCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
private static final String s_name = "changeserviceforsystemvmresponse";
@ -59,17 +56,11 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm")
private Long id;
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID,
type = CommandType.UUID,
entityType = ServiceOfferingResponse.class,
required = true,
description = "the service offering ID to apply to the system vm")
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the service offering ID to apply to the system vm")
private Long serviceOfferingId;
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS,
type = CommandType.MAP,
description = "name value pairs of custom parameters for cpu, memory and cpunumber. example customparameters[i].name=value")
private Map<String, String> customParameters;
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
private Map<String, String> details;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -83,13 +74,13 @@ public class ScaleSystemVMCmd extends BaseAsyncCmd {
return serviceOfferingId;
}
public Map<String, String> getCustomParameters() {
Map<String,String> customparameterMap = new HashMap<String, String>();
if (customParameters != null && customParameters.size() != 0) {
Collection parameterCollection = customParameters.values();
public Map<String, String> getDetails() {
Map<String, String> customparameterMap = new HashMap<String, String>();
if (details != null && details.size() != 0) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>) iter.next();
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (String key : value.keySet()) {
customparameterMap.put(key, value.get(key));
}

View File

@ -16,7 +16,10 @@
// under the License.
package org.apache.cloudstack.api.command.admin.systemvm;
import org.apache.log4j.Logger;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
@ -28,21 +31,15 @@ import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.SystemVmResponse;
import org.apache.cloudstack.context.CallContext;
import org.apache.log4j.Logger;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.offering.ServiceOffering;
import com.cloud.user.Account;
import com.cloud.vm.VirtualMachine;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@APICommand(name = "changeServiceForSystemVm",
responseObject = SystemVmResponse.class,
description = "Changes the service offering for a system vm (console proxy or secondary storage). " + "The system vm must be in a \"Stopped\" state for "
+ "this command to take effect.")
@APICommand(name = "changeServiceForSystemVm", responseObject = SystemVmResponse.class, description = "Changes the service offering for a system vm (console proxy or secondary storage). "
+ "The system vm must be in a \"Stopped\" state for " + "this command to take effect.")
public class UpgradeSystemVMCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(UpgradeVMCmd.class.getName());
private static final String s_name = "changeserviceforsystemvmresponse";
@ -54,17 +51,11 @@ public class UpgradeSystemVMCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = SystemVmResponse.class, required = true, description = "The ID of the system vm")
private Long id;
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID,
type = CommandType.UUID,
entityType = ServiceOfferingResponse.class,
required = true,
description = "the service offering ID to apply to the system vm")
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, required = true, description = "the service offering ID to apply to the system vm")
private Long serviceOfferingId;
@Parameter(name=ApiConstants.CUSTOM_PARAMETERS,
type = CommandType.MAP,
description = "name value pairs of custom parameters for cpu, memory and cpunumber. example customparameters[i].name=value")
private Map<String, String> customParameters;
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "name value pairs of custom parameters for cpu, memory and cpunumber. example details[i].name=value")
private Map<String, String> details;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
@ -78,13 +69,13 @@ public class UpgradeSystemVMCmd extends BaseCmd {
return serviceOfferingId;
}
public Map<String, String> getCustomParameters() {
Map<String,String> customparameterMap = new HashMap<String, String>();
if (customParameters != null && customParameters.size() !=0){
Collection parameterCollection = customParameters.values();
public Map<String, String> getDetails() {
Map<String, String> customparameterMap = new HashMap<String, String>();
if (details != null && details.size() != 0) {
Collection parameterCollection = details.values();
Iterator iter = parameterCollection.iterator();
while (iter.hasNext()) {
HashMap<String, String> value = (HashMap<String, String>) iter.next();
HashMap<String, String> value = (HashMap<String, String>)iter.next();
for (String key : value.keySet()) {
customparameterMap.put(key, value.get(key));
}

View File

@ -77,6 +77,10 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
@Parameter(name = ApiConstants.VLAN, type = CommandType.STRING, description = "The VLAN id to be used for Management traffic by VMware host")
private String vlan;
@Parameter(name=ApiConstants.ISOLATION_METHOD, type=CommandType.STRING, description="Used if physical network has multiple isolation types and traffic type is public."
+ " Choose which isolation method. Valid options currently 'vlan' or 'vxlan', defaults to 'vlan'.")
private String isolationMethod;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -118,6 +122,14 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
return vlan;
}
public String getIsolationMethod() {
if (isolationMethod != null && !isolationMethod.isEmpty()) {
return isolationMethod;
} else {
return "vlan";
}
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -148,7 +160,7 @@ public class AddTrafficTypeCmd extends BaseAsyncCreateCmd {
@Override
public void create() throws ResourceAllocationException {
PhysicalNetworkTrafficType result =
_networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getXenLabel(), getKvmLabel(), getVmwareLabel(),
_networkService.addTrafficTypeToPhysicalNetwork(getPhysicalNetworkId(), getTrafficType(), getIsolationMethod(), getXenLabel(), getKvmLabel(), getVmwareLabel(),
getSimulatorLabel(), getVlan(), getHypervLabel());
if (result != null) {
setEntityId(result.getId());

View File

@ -43,7 +43,7 @@ import com.cloud.utils.Pair;
since = "3.0.0")
public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListTrafficTypeImplementorsCmd.class);
private static final String _name = "listtraffictypeimplementorsresponse";
private static final String Name = "listtraffictypeimplementorsresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -87,6 +87,6 @@ public class ListTrafficTypeImplementorsCmd extends BaseListCmd {
@Override
public String getCommandName() {
return _name;
return Name;
}
}

View File

@ -37,7 +37,7 @@ import com.cloud.utils.Pair;
@APICommand(name = "listTrafficTypes", description = "Lists traffic types of a given physical network.", responseObject = ProviderResponse.class, since = "3.0.0")
public class ListTrafficTypesCmd extends BaseListCmd {
public static final Logger s_logger = Logger.getLogger(ListTrafficTypesCmd.class.getName());
private static final String _name = "listtraffictypesresponse";
private static final String Name = "listtraffictypesresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -66,7 +66,7 @@ public class ListTrafficTypesCmd extends BaseListCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -147,6 +147,9 @@ public class CreateVlanIpRangeCmd extends BaseCmd {
}
public String getVlan() {
if (vlan == null || vlan.isEmpty()) {
vlan = "untagged";
}
return vlan;
}

View File

@ -0,0 +1,81 @@
/*
* 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.vm;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.UserVmResponse;
import org.apache.cloudstack.api.response.VMUserDataResponse;
import org.apache.log4j.Logger;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
@APICommand(name = "getVirtualMachineUserData", description = "Returns user data associated with the VM", responseObject = VMUserDataResponse.class, since = "4.4")
public class GetVMUserDataCmd extends BaseCmd {
public static final Logger s_logger = Logger.getLogger(GetVMUserDataCmd.class);
private static final String s_name = "getvirtualmachineuserdataresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID, type = CommandType.UUID, entityType = UserVmResponse.class, required = true, description = "The ID of the virtual machine")
private Long vmId;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
public long getId() {
return vmId;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
String userData = _userVmService.getVmUserData(getId());
VMUserDataResponse resp = new VMUserDataResponse();
resp.setVmId(_entityMgr.findById(UserVm.class, getId()).getUuid());
resp.setUserData(userData);
resp.setObjectName("virtualmachineuserdata");
resp.setResponseName(getCommandName());
this.setResponseObject(resp);
}
@Override
public long getEntityOwnerId() {
UserVm userVm = _entityMgr.findById(UserVm.class, getId());
if (userVm != null) {
return userVm.getAccountId();
}
return Account.ACCOUNT_ID_SYSTEM; // no account info given, parent this command to SYSTEM so ERROR events are tracked
}
@Override
public String getCommandName() {
return s_name;
}
}

View File

@ -42,7 +42,7 @@ import com.cloud.user.Account;
@APICommand(name = "createVPCOffering", description = "Creates VPC offering", responseObject = VpcOfferingResponse.class)
public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
public static final Logger s_logger = Logger.getLogger(CreateVPCOfferingCmd.class.getName());
private static final String _name = "createvpcofferingresponse";
private static final String Name = "createvpcofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -150,7 +150,7 @@ public class CreateVPCOfferingCmd extends BaseAsyncCreateCmd {
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -33,7 +33,7 @@ import com.cloud.user.Account;
@APICommand(name = "updateVPCOffering", description = "Updates VPC offering", responseObject = VpcOfferingResponse.class)
public class UpdateVPCOfferingCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(UpdateVPCOfferingCmd.class.getName());
private static final String _name = "updatevpcofferingresponse";
private static final String Name = "updatevpcofferingresponse";
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
@ -76,7 +76,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd {
/////////////////////////////////////////////////////
@Override
public String getCommandName() {
return _name;
return Name;
}
@Override

View File

@ -17,7 +17,6 @@
package org.apache.cloudstack.api.command.user.affinitygroup;
import org.apache.log4j.Logger;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandJobType;
@ -79,9 +78,9 @@ public class ListAffinityGroupsCmd extends BaseListAccountResourcesCmd {
@Override
public void execute() {
ListResponse<AffinityGroupResponse> response =
_queryService.listAffinityGroups(id, affinityGroupName, affinityGroupType, virtualMachineId, this.getAccountName(), this.getDomainId(), this.isRecursive(),
this.listAll(), this.getStartIndex(), this.getPageSizeVal());
ListResponse<AffinityGroupResponse> response = _queryService.listAffinityGroups(id, affinityGroupName,
affinityGroupType, virtualMachineId, this.getAccountName(), this.getDomainId(), this.isRecursive(),
this.listAll(), this.getStartIndex(), this.getPageSizeVal(), this.getKeyword());
response.setResponseName(getCommandName());
this.setResponseObject(response);

View File

@ -19,15 +19,15 @@ package org.apache.cloudstack.api.command.user.autoscale;
import java.util.ArrayList;
import java.util.List;
import org.apache.log4j.Logger;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.BaseListProjectAndAccountResourcesCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.response.AutoScaleVmProfileResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ServiceOfferingResponse;
import org.apache.cloudstack.api.response.TemplateResponse;
import org.apache.log4j.Logger;
import com.cloud.network.as.AutoScaleVmProfile;
@ -47,6 +47,9 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "the templateid of the autoscale vm profile")
private Long templateId;
@Parameter(name = ApiConstants.SERVICE_OFFERING_ID, type = CommandType.UUID, entityType = ServiceOfferingResponse.class, description = "list profiles by service offering id")
private Long serviceOffId;
@Parameter(name = ApiConstants.OTHER_DEPLOY_PARAMS, type = CommandType.STRING, description = "the otherdeployparameters of the autoscale vm profile")
private String otherDeployParams;
@ -66,6 +69,10 @@ public class ListAutoScaleVmProfilesCmd extends BaseListProjectAndAccountResourc
return otherDeployParams;
}
public Long getServiceOfferingId() {
return serviceOffId;
}
// ///////////////////////////////////////////////////
// ///////////// API Implementation///////////////////
// ///////////////////////////////////////////////////

View File

@ -73,6 +73,9 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "the ID of the zone")
private Long zoneId;
@Parameter(name=ApiConstants.SHOW_REMOVED, type=CommandType.BOOLEAN, description="show removed ISOs as well")
private Boolean showRemoved;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -109,6 +112,10 @@ public class ListIsosCmd extends BaseListTaggedResourcesCmd {
return zoneId;
}
public Boolean getShowRemoved() {
return (showRemoved != null ? showRemoved : false);
}
public boolean listInReadyState() {
Account account = CallContext.current().getCallingAccount();
// It is account specific if account is admin type and domainId and accountName are not null

View File

@ -1,3 +1,4 @@
// 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
@ -42,7 +43,7 @@ public class AssignCertToLoadBalancerCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(AssignCertToLoadBalancerCmd.class.getName());
private static final String s_name = "assignCertToLoadBalancer";
private static final String s_name = "assigncerttoloadbalancerresponse";
@Parameter(name = ApiConstants.LBID,
type = CommandType.UUID,

View File

@ -41,7 +41,7 @@ public class RemoveCertFromLoadBalancerCmd extends BaseAsyncCmd {
public static final Logger s_logger = Logger.getLogger(RemoveCertFromLoadBalancerCmd.class.getName());
private static final String s_name = "removeCertFromLoadBalancer";
private static final String s_name = "removecertfromloadbalancerresponse";
@Parameter(name = ApiConstants.LBID,
type = CommandType.UUID,

View File

@ -45,6 +45,10 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = NetworkResponse.class, required = true, description = "the ID of the network")
private Long id;
@Parameter(name = ApiConstants.FORCED, type = CommandType.BOOLEAN, required = false, description = "Force delete a network." +
" Network will be marked as 'Destroy' even when commands to shutdown and cleanup to the backend fails.")
private Boolean forced;
/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
@ -53,6 +57,10 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
return id;
}
public boolean isForced() {
return (forced != null) ? forced : false;
}
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@ -65,7 +73,7 @@ public class DeleteNetworkCmd extends BaseAsyncCmd {
@Override
public void execute() {
CallContext.current().setEventDetails("Network Id: " + id);
boolean result = _networkService.deleteNetwork(id);
boolean result = _networkService.deleteNetwork(id, isForced());
if (result) {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);

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