("Advanced", Integer.class,
diff --git a/api/src/main/java/com/cloud/network/Network.java b/api/src/main/java/com/cloud/network/Network.java
index dc94932e31f5..2f0bcdd5ef9a 100644
--- a/api/src/main/java/com/cloud/network/Network.java
+++ b/api/src/main/java/com/cloud/network/Network.java
@@ -116,6 +116,7 @@ class Service {
public static final Service NetworkACL = new Service("NetworkACL", Capability.SupportedProtocols);
public static final Service Connectivity = new Service("Connectivity", Capability.DistributedRouter, Capability.RegionLevelVpc, Capability.StretchedL2Subnet,
Capability.NoVlan, Capability.PublicAccess);
+ public static final Service CustomAction = new Service("CustomAction");
private final String name;
private final Capability[] caps;
@@ -207,6 +208,7 @@ public static class Provider {
public static final Provider Nsx = new Provider("Nsx", false);
public static final Provider Netris = new Provider("Netris", false);
+ public static final Provider NetworkExtension = new Provider("NetworkExtension", false, true);
private final String name;
private final boolean isExternal;
@@ -250,11 +252,47 @@ public static Provider getProvider(String providerName) {
return null;
}
+ /** Private constructor for transient (non-registered) providers. */
+ private Provider(String name) {
+ this.name = name;
+ this.isExternal = false;
+ this.needCleanupOnShutdown = true;
+ // intentionally NOT added to supportedProviders
+ }
+
+ /**
+ * Creates a transient (non-registered) {@link Provider} with the given name.
+ *
+ * The new instance is not added to {@code supportedProviders}, so it
+ * will never be returned by {@link #getProvider(String)} and will not pollute the
+ * global provider registry. Use this for dynamic / extension-backed providers
+ * whose names are only known at runtime (e.g. NetworkOrchestrator extensions).
+ *
+ * @param name the provider name (typically the extension name)
+ * @return a transient {@link Provider} instance with the given name
+ */
+ public static Provider createTransientProvider(String name) {
+ return new Provider(name);
+ }
+
@Override public String toString() {
return new ToStringBuilder(this, ToStringStyle.SHORT_PREFIX_STYLE)
.append("name", name)
.toString();
}
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (!(obj instanceof Provider)) return false;
+ Provider provider = (Provider) obj;
+ return this.name.equals(provider.name);
+ }
+
+ @Override
+ public int hashCode() {
+ return name.hashCode();
+ }
}
public static class Capability {
@@ -325,9 +363,9 @@ enum Event {
public enum State {
- 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");
+ 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");
protected static final StateMachine2 s_fsm = new StateMachine2();
@@ -510,4 +548,6 @@ public void setIp6Address(String ip6Address) {
Integer getPrivateMtu();
Integer getNetworkCidrSize();
+
+ boolean getKeepMacAddressOnPublicNic();
}
diff --git a/api/src/main/java/com/cloud/network/NetworkModel.java b/api/src/main/java/com/cloud/network/NetworkModel.java
index eb496ac4e0b9..7e1a07ebeb69 100644
--- a/api/src/main/java/com/cloud/network/NetworkModel.java
+++ b/api/src/main/java/com/cloud/network/NetworkModel.java
@@ -125,6 +125,10 @@ public interface NetworkModel {
*/
String getNextAvailableMacAddressInNetwork(long networkConfigurationId) throws InsufficientAddressCapacityException;
+ String getUniqueMacAddress(long macAddress, long networkId, long datacenterId) throws InsufficientAddressCapacityException;
+
+ boolean isMACUnique(String mac, long networkId);
+
PublicIpAddress getPublicIpAddress(long ipAddressId);
List extends Vlan> listPodVlans(long podId);
@@ -183,6 +187,8 @@ public interface NetworkModel {
boolean canElementEnableIndividualServices(Provider provider);
+ boolean canElementEnableIndividualServicesByName(String providerName);
+
boolean areServicesSupportedInNetwork(long networkId, Service... services);
boolean isNetworkSystem(Network network);
@@ -233,6 +239,18 @@ public interface NetworkModel {
String getDefaultGuestTrafficLabel(long dcId, HypervisorType vmware);
+ /**
+ * Resolves a provider name to a {@link Provider} instance.
+ * For known static providers, delegates to {@link Provider#getProvider(String)}.
+ * For dynamically-registered NetworkOrchestrator extension providers whose names
+ * are not in the static registry, returns a transient {@link Provider} with the
+ * given name so callers can still dispatch correctly.
+ *
+ * @param providerName the provider name from {@code ntwk_service_map} or similar
+ * @return a {@link Provider} instance, or {@code null} if not resolvable
+ */
+ Provider resolveProvider(String providerName);
+
/**
* @param providerName
* @return
@@ -364,4 +382,8 @@ List generateVmData(String userData, String userDataDetails, String se
boolean checkSecurityGroupSupportForNetwork(Account account, DataCenter zone, List networkIds,
List securityGroupsIds);
+
+ default long getMacIdentifier(Long dataCenterId) {
+ return 0;
+ }
}
diff --git a/api/src/main/java/com/cloud/network/NetworkProfile.java b/api/src/main/java/com/cloud/network/NetworkProfile.java
index 2e8efb489308..d690344a0e38 100644
--- a/api/src/main/java/com/cloud/network/NetworkProfile.java
+++ b/api/src/main/java/com/cloud/network/NetworkProfile.java
@@ -385,6 +385,11 @@ public Integer getNetworkCidrSize() {
return networkCidrSize;
}
+ @Override
+ public boolean getKeepMacAddressOnPublicNic() {
+ return true;
+ }
+
@Override
public String toString() {
return String.format("NetworkProfile %s",
diff --git a/api/src/main/java/com/cloud/network/NetworkRuleApplier.java b/api/src/main/java/com/cloud/network/NetworkRuleApplier.java
index b9942e71eb26..69b712bc6ca2 100644
--- a/api/src/main/java/com/cloud/network/NetworkRuleApplier.java
+++ b/api/src/main/java/com/cloud/network/NetworkRuleApplier.java
@@ -21,8 +21,13 @@
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.vpc.Vpc;
public interface NetworkRuleApplier {
- public boolean applyRules(Network network, FirewallRule.Purpose purpose, List extends FirewallRule> rules) throws ResourceUnavailableException;
+ default boolean applyRules(Network network, FirewallRule.Purpose purpose, List extends FirewallRule> rules) throws ResourceUnavailableException {
+ return applyRules(network, null, purpose, rules);
+ }
+
+ boolean applyRules(Network network, Vpc vpc, FirewallRule.Purpose purpose, List extends FirewallRule> rules) throws ResourceUnavailableException;
}
diff --git a/api/src/main/java/com/cloud/network/NetworkService.java b/api/src/main/java/com/cloud/network/NetworkService.java
index 196e1f9aab86..c32bb711c0f2 100644
--- a/api/src/main/java/com/cloud/network/NetworkService.java
+++ b/api/src/main/java/com/cloud/network/NetworkService.java
@@ -81,7 +81,7 @@ public interface NetworkService {
true, ConfigKey.Scope.Zone);
public static final ConfigKey AllowUsersToSpecifyVRMtu = new ConfigKey<>("Advanced", Boolean.class,
- "allow.end.users.to.specify.vr.mtu", "false", "Allow end users to specify VR MTU",
+ "allow.end.users.to.specify.vr.mtu", "false", "Allow end Users to specify VR MTU",
true, ConfigKey.Scope.Zone);
List extends Network> getIsolatedNetworksOwnedByAccountInZone(long zoneId, Account owner);
@@ -108,6 +108,10 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
+ Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
+ PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair vrIfaceMTUs) throws
+ InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
+
Pair, Integer> searchForNetworks(ListNetworksCmd cmd);
boolean deleteNetwork(long networkId, boolean forced);
@@ -228,7 +232,7 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
/**
* Requests an IP address for the guest NIC
*/
- NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair) throws InsufficientAddressCapacityException;
+ NicSecondaryIp allocateSecondaryGuestIP(long nicId, IpAddresses requestedIpPair, String description) throws InsufficientAddressCapacityException;
boolean releaseSecondaryIpFromNic(long ipAddressId);
@@ -275,4 +279,6 @@ Network createPrivateNetwork(String networkName, String displayText, long physic
IpAddresses getIpAddressesFromIps(String ipAddress, String ip6Address, String macAddress);
String getNicVlanValueForExternalVm(NicTO nic);
+
+ Long getPreferredNetworkIdForPublicIpRuleAssignment(IpAddress ip, Long networkId);
}
diff --git a/api/src/main/java/com/cloud/network/Networks.java b/api/src/main/java/com/cloud/network/Networks.java
index 9f06a0441118..61a1c820723f 100644
--- a/api/src/main/java/com/cloud/network/Networks.java
+++ b/api/src/main/java/com/cloud/network/Networks.java
@@ -78,10 +78,14 @@ public URI toUri(T value) {
}
@Override
public String getValueFrom(URI uri) {
- return uri.getAuthority();
+ return uri == null ? null : uri.getAuthority();
}
},
- Vswitch("vs", String.class), LinkLocal(null, null), Vnet("vnet", Long.class), Storage("storage", Integer.class), Lswitch("lswitch", String.class) {
+ Vswitch("vs", String.class),
+ LinkLocal(null, null),
+ Vnet("vnet", Long.class),
+ Storage("storage", Integer.class),
+ Lswitch("lswitch", String.class) {
@Override
public URI toUri(T value) {
try {
@@ -96,10 +100,11 @@ public URI toUri(T value) {
*/
@Override
public String getValueFrom(URI uri) {
- return uri.getSchemeSpecificPart();
+ return uri == null ? null : uri.getSchemeSpecificPart();
}
},
- Mido("mido", String.class), Pvlan("pvlan", String.class),
+ Mido("mido", String.class),
+ Pvlan("pvlan", String.class),
Vxlan("vxlan", Long.class) {
@Override
public URI toUri(T value) {
@@ -177,7 +182,7 @@ public URI toUri(T value) {
* @return the scheme as BroadcastDomainType
*/
public static BroadcastDomainType getSchemeValue(URI uri) {
- return toEnumValue(uri.getScheme());
+ return toEnumValue(uri == null ? null : uri.getScheme());
}
/**
@@ -191,7 +196,7 @@ public static BroadcastDomainType getTypeOf(String str) throws URISyntaxExceptio
if (com.cloud.dc.Vlan.UNTAGGED.equalsIgnoreCase(str)) {
return Native;
}
- return getSchemeValue(new URI(str));
+ return getSchemeValue(str == null ? null : new URI(str));
}
/**
@@ -220,7 +225,7 @@ public static BroadcastDomainType toEnumValue(String scheme) {
* @return the host part as String
*/
public String getValueFrom(URI uri) {
- return uri.getHost();
+ return uri == null ? null : uri.getHost();
}
/**
@@ -243,7 +248,7 @@ public static String getValue(URI uri) {
* @throws URISyntaxException the string is not even an uri
*/
public static String getValue(String uriString) throws URISyntaxException {
- return getValue(new URI(uriString));
+ return getValue(uriString == null ? null : new URI(uriString));
}
/**
diff --git a/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java b/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java
index 9676badb4e90..d3804cd29daf 100644
--- a/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java
+++ b/api/src/main/java/com/cloud/network/PhysicalNetworkTrafficType.java
@@ -41,4 +41,6 @@ public interface PhysicalNetworkTrafficType extends InternalIdentity, Identity {
String getHypervNetworkLabel();
String getOvm3NetworkLabel();
+
+ String getVlan();
}
diff --git a/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java b/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java
index eb65ae9088ec..22a46ce9ecdf 100644
--- a/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java
+++ b/api/src/main/java/com/cloud/network/RouterHealthCheckResult.java
@@ -26,7 +26,7 @@ public interface RouterHealthCheckResult {
String getCheckType();
- boolean getCheckResult();
+ VirtualNetworkApplianceService.RouterHealthStatus getCheckResult();
Date getLastUpdateTime();
diff --git a/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java b/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java
index cb92739d2837..a60f1d49336a 100644
--- a/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java
+++ b/api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java
@@ -87,4 +87,8 @@ void startRouterForHA(VirtualMachine vm, Map performRouterHealthChecks(long routerId);
void collectNetworkStatistics(T router, Nic nic);
+
+ enum RouterHealthStatus{
+ SUCCESS, FAILED, WARNING, UNKNOWN;
+ }
}
diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleService.java b/api/src/main/java/com/cloud/network/as/AutoScaleService.java
index ceca4de68428..4aef10f8de9e 100644
--- a/api/src/main/java/com/cloud/network/as/AutoScaleService.java
+++ b/api/src/main/java/com/cloud/network/as/AutoScaleService.java
@@ -70,6 +70,8 @@ public interface AutoScaleService {
Counter createCounter(CreateCounterCmd cmd);
+ Counter getCounter(long counterId);
+
boolean deleteCounter(long counterId) throws ResourceInUseException;
List extends Counter> listCounters(ListCountersCmd cmd);
diff --git a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java
index c265c1f36a0a..c05b3bda3db5 100644
--- a/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java
+++ b/api/src/main/java/com/cloud/network/as/AutoScaleVmGroup.java
@@ -43,7 +43,7 @@ public static State fromValue(String state) {
} else if (state.equalsIgnoreCase("scaling")) {
return SCALING;
} else {
- throw new IllegalArgumentException("Unexpected AutoScale VM group state : " + state);
+ throw new IllegalArgumentException("Unexpected AutoScale Instance group state : " + state);
}
}
}
diff --git a/api/src/main/java/com/cloud/network/element/DnsServiceProvider.java b/api/src/main/java/com/cloud/network/element/DnsServiceProvider.java
index 7abce537221c..2942e76965a7 100644
--- a/api/src/main/java/com/cloud/network/element/DnsServiceProvider.java
+++ b/api/src/main/java/com/cloud/network/element/DnsServiceProvider.java
@@ -33,4 +33,6 @@ boolean configDnsSupportForSubnet(Network network, NicProfile nic, VirtualMachin
throws ConcurrentOperationException, InsufficientCapacityException, ResourceUnavailableException;
boolean removeDnsSupportForSubnet(Network network) throws ResourceUnavailableException;
+
+ default boolean removeDnsEntry(Network network, NicProfile nic, VirtualMachineProfile vmProfile) throws ResourceUnavailableException { return true; }
}
diff --git a/api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java b/api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java
index c091142d9353..6b0f932e8c22 100644
--- a/api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java
+++ b/api/src/main/java/com/cloud/network/element/FirewallServiceProvider.java
@@ -21,14 +21,20 @@
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.Network;
import com.cloud.network.rules.FirewallRule;
+import com.cloud.network.vpc.Vpc;
public interface FirewallServiceProvider extends NetworkElement {
/**
- * Apply rules
- * @param network
- * @param rules
- * @return
- * @throws ResourceUnavailableException
+ * Apply firewall rules in a network context.
*/
- boolean applyFWRules(Network network, List extends FirewallRule> rules) throws ResourceUnavailableException;
+ default boolean applyFWRules(Network network, List extends FirewallRule> rules) throws ResourceUnavailableException {
+ return false;
+ }
+
+ /**
+ * Apply firewall rules in a VPC context.
+ */
+ default boolean applyFWRulesInVPC(Vpc vpc, List extends FirewallRule> rules) throws ResourceUnavailableException {
+ return false;
+ }
}
diff --git a/api/src/main/java/com/cloud/network/element/NetworkElement.java b/api/src/main/java/com/cloud/network/element/NetworkElement.java
index cb0fc2fca981..67be7b9ba2e2 100644
--- a/api/src/main/java/com/cloud/network/element/NetworkElement.java
+++ b/api/src/main/java/com/cloud/network/element/NetworkElement.java
@@ -146,4 +146,8 @@ boolean shutdownProviderInstances(PhysicalNetworkServiceProvider provider, Reser
* @return true/false
*/
boolean verifyServicesCombination(Set services);
+
+ default boolean rollingRestartSupported() {
+ return true;
+ }
}
diff --git a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java
index 3fc6028b9771..b7fe3b26761c 100644
--- a/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java
+++ b/api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java
@@ -41,13 +41,23 @@
public interface LoadBalancingRulesService {
/**
* Create a load balancer rule from the given ipAddress/port to the given private port
+ * @param xId an existing UUID for this rule (for instance a device generated one)
+ * @param name
+ * @param description
+ * @param srcPortStart
+ * @param srcPortEnd
+ * @param defPortStart
+ * @param defPortEnd
+ * @param ipAddrId
+ * @param protocol
+ * @param algorithm
+ * @param networkId
+ * @param lbOwnerId
* @param openFirewall
- * TODO
- * @param forDisplay TODO
- * @param cmd
- * the command specifying the ip address, public port, protocol, private port, and algorithm
- *
+ * @param lbProtocol
+ * @param forDisplay
* @return the newly created LoadBalancerVO if successful, null otherwise
+ * @throws NetworkRuleConflictException
* @throws InsufficientAddressCapacityException
*/
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,
@@ -98,7 +108,7 @@ LoadBalancer createPublicLoadBalancerRule(String xId, String name, String descri
/**
* Assign a virtual machine or list of virtual machines, or Map of to a load balancer.
*/
- boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, boolean isAutoScaleVM);
+ boolean assignToLoadBalancer(long lbRuleId, List vmIds, Map> vmIdIpMap, Map vmIdNetworkMap, boolean isAutoScaleVM);
boolean assignSSLCertToLoadBalancerRule(Long lbRuleId, String certName, String publicCert, String privateKey);
diff --git a/api/src/main/java/com/cloud/network/rules/FirewallRule.java b/api/src/main/java/com/cloud/network/rules/FirewallRule.java
index 369c6aa57eb8..38ba009163ce 100644
--- a/api/src/main/java/com/cloud/network/rules/FirewallRule.java
+++ b/api/src/main/java/com/cloud/network/rules/FirewallRule.java
@@ -69,7 +69,9 @@ enum TrafficType {
State getState();
- long getNetworkId();
+ Long getNetworkId();
+
+ Long getVpcId();
Long getSourceIpAddressId();
diff --git a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
index 56a0622a52ba..5143611ee828 100644
--- a/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
+++ b/api/src/main/java/com/cloud/network/rules/LbStickinessMethod.java
@@ -108,8 +108,7 @@ public LbStickinessMethod(StickinessMethodType methodType, String description) {
}
public void addParam(String name, Boolean required, String description, Boolean isFlag) {
- /* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
- // LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, description);
+ /* is this still a valid comment: FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
LbStickinessMethodParam param = new LbStickinessMethodParam(name, required, " ", isFlag);
_paramList.add(param);
return;
@@ -133,7 +132,6 @@ public String getDescription() {
public void setDescription(String description) {
/* FIXME : UI is breaking if the capability string length is larger , temporarily description is commented out */
- //this.description = description;
this._description = " ";
}
}
diff --git a/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java
index 40aee1f08f1d..84e48d5d5b8a 100644
--- a/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java
+++ b/api/src/main/java/com/cloud/network/vpc/NetworkACLService.java
@@ -19,6 +19,7 @@
import java.util.List;
import org.apache.cloudstack.api.command.user.network.CreateNetworkACLCmd;
+import org.apache.cloudstack.api.command.user.network.ImportNetworkACLCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkACLListsCmd;
import org.apache.cloudstack.api.command.user.network.ListNetworkACLsCmd;
import org.apache.cloudstack.api.command.user.network.MoveNetworkAclItemCmd;
@@ -98,4 +99,6 @@ public interface NetworkACLService {
NetworkACLItem moveNetworkAclRuleToNewPosition(MoveNetworkAclItemCmd moveNetworkAclItemCmd);
NetworkACLItem moveRuleToTheTopInACLList(NetworkACLItem ruleBeingMoved);
+
+ List importNetworkACLRules(ImportNetworkACLCmd cmd) throws ResourceUnavailableException;
}
diff --git a/api/src/main/java/com/cloud/network/vpc/Vpc.java b/api/src/main/java/com/cloud/network/vpc/Vpc.java
index b94089d2d433..a0686e2bf7d0 100644
--- a/api/src/main/java/com/cloud/network/vpc/Vpc.java
+++ b/api/src/main/java/com/cloud/network/vpc/Vpc.java
@@ -107,4 +107,6 @@ public enum State {
String getIp6Dns2();
boolean useRouterIpAsResolver();
+
+ boolean getKeepMacAddressOnPublicNic();
}
diff --git a/api/src/main/java/com/cloud/network/vpc/VpcOffering.java b/api/src/main/java/com/cloud/network/vpc/VpcOffering.java
index 17f49bb36521..f84602232159 100644
--- a/api/src/main/java/com/cloud/network/vpc/VpcOffering.java
+++ b/api/src/main/java/com/cloud/network/vpc/VpcOffering.java
@@ -84,4 +84,6 @@ public enum State {
NetworkOffering.RoutingMode getRoutingMode();
Boolean isSpecifyAsNumber();
+
+ boolean isConserveMode();
}
diff --git a/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java b/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java
index 97b95339ecf3..891cfb02d9df 100644
--- a/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java
+++ b/api/src/main/java/com/cloud/network/vpc/VpcProvisioningService.java
@@ -20,6 +20,7 @@
import java.util.List;
import java.util.Map;
+import org.apache.cloudstack.api.command.admin.vpc.CloneVPCOfferingCmd;
import org.apache.cloudstack.api.command.admin.vpc.CreateVPCOfferingCmd;
import org.apache.cloudstack.api.command.admin.vpc.UpdateVPCOfferingCmd;
import org.apache.cloudstack.api.command.user.vpc.ListVPCOfferingsCmd;
@@ -34,12 +35,14 @@ public interface VpcProvisioningService {
VpcOffering createVpcOffering(CreateVPCOfferingCmd cmd);
+ VpcOffering cloneVPCOffering(CloneVPCOfferingCmd cmd);
+
VpcOffering createVpcOffering(String name, String displayText, List supportedServices,
Map> serviceProviders,
Map serviceCapabilitystList, NetUtils.InternetProtocol internetProtocol,
Long serviceOfferingId, String externalProvider, NetworkOffering.NetworkMode networkMode,
List domainIds, List zoneIds, VpcOffering.State state,
- NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber);
+ NetworkOffering.RoutingMode routingMode, boolean specifyAsNumber, boolean conserveMode);
Pair,Integer> listVpcOfferings(ListVPCOfferingsCmd cmd);
diff --git a/api/src/main/java/com/cloud/network/vpc/VpcService.java b/api/src/main/java/com/cloud/network/vpc/VpcService.java
index c1546609d2b7..3d0ba43263f5 100644
--- a/api/src/main/java/com/cloud/network/vpc/VpcService.java
+++ b/api/src/main/java/com/cloud/network/vpc/VpcService.java
@@ -58,7 +58,7 @@ public interface VpcService {
*/
Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, String displayText, String cidr, String networkDomain,
String ip4Dns1, String ip4Dns2, String ip6Dns1, String ip6Dns2, Boolean displayVpc, Integer publicMtu, Integer cidrSize,
- Long asNumber, List bgpPeerIds, Boolean useVrIpResolver) throws ResourceAllocationException;
+ Long asNumber, List bgpPeerIds, Boolean useVrIpResolver, boolean keepMacAddressOnPublicNic) throws ResourceAllocationException;
/**
* Persists VPC record in the database
@@ -104,7 +104,7 @@ Vpc createVpc(long zoneId, long vpcOffId, long vpcOwnerId, String vpcName, Strin
* @throws ResourceUnavailableException if during restart some resources may not be available
* @throws InsufficientCapacityException if for instance no address space, compute or storage is sufficiently available
*/
- Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp) throws ResourceUnavailableException, InsufficientCapacityException;
+ Vpc updateVpc(long vpcId, String vpcName, String displayText, String customId, Boolean displayVpc, Integer mtu, String sourceNatIp, Boolean keepMacAddressOnPublicNic) throws ResourceUnavailableException, InsufficientCapacityException;
/**
* Lists VPC(s) based on the parameters passed to the API call
diff --git a/api/src/main/java/com/cloud/offering/DiskOffering.java b/api/src/main/java/com/cloud/offering/DiskOffering.java
index e1c41f77cbf5..d74f5703cc99 100644
--- a/api/src/main/java/com/cloud/offering/DiskOffering.java
+++ b/api/src/main/java/com/cloud/offering/DiskOffering.java
@@ -37,7 +37,7 @@ enum State {
State getState();
enum DiskCacheMode {
- NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough");
+ NONE("none"), WRITEBACK("writeback"), WRITETHROUGH("writethrough"), HYPERVISOR_DEFAULT("hypervisor_default");
private final String _diskCacheMode;
@@ -69,6 +69,8 @@ public String toString() {
boolean isCustomized();
+ boolean isShared();
+
void setDiskSize(long diskSize);
long getDiskSize();
@@ -99,7 +101,6 @@ public String toString() {
Long getBytesReadRateMaxLength();
-
void setBytesWriteRate(Long bytesWriteRate);
Long getBytesWriteRate();
@@ -112,7 +113,6 @@ public String toString() {
Long getBytesWriteRateMaxLength();
-
void setIopsReadRate(Long iopsReadRate);
Long getIopsReadRate();
@@ -133,7 +133,6 @@ public String toString() {
Long getIopsWriteRateMax();
-
void setIopsWriteRateMaxLength(Long iopsWriteRateMaxLength);
Long getIopsWriteRateMaxLength();
diff --git a/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java b/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
index 12dcf423e34f..197565a1fccb 100644
--- a/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
+++ b/api/src/main/java/com/cloud/offering/DiskOfferingInfo.java
@@ -23,6 +23,7 @@ public class DiskOfferingInfo {
private Long _size;
private Long _minIops;
private Long _maxIops;
+ private Long _kmsKeyId;
public DiskOfferingInfo() {
}
@@ -38,6 +39,14 @@ public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long
_maxIops = maxIops;
}
+ public DiskOfferingInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops, Long kmsKeyId) {
+ _diskOffering = diskOffering;
+ _size = size;
+ _minIops = minIops;
+ _maxIops = maxIops;
+ _kmsKeyId = kmsKeyId;
+ }
+
public void setDiskOffering(DiskOffering diskOffering) {
_diskOffering = diskOffering;
}
@@ -69,4 +78,12 @@ public void setMaxIops(Long maxIops) {
public Long getMaxIops() {
return _maxIops;
}
+
+ public void setKmsKeyId(Long kmsKeyId) {
+ _kmsKeyId = kmsKeyId;
+ }
+
+ public Long getKmsKeyId() {
+ return _kmsKeyId;
+ }
}
diff --git a/api/src/main/java/com/cloud/projects/ProjectService.java b/api/src/main/java/com/cloud/projects/ProjectService.java
index 5080cb5a7812..d11e9ae0446d 100644
--- a/api/src/main/java/com/cloud/projects/ProjectService.java
+++ b/api/src/main/java/com/cloud/projects/ProjectService.java
@@ -82,7 +82,7 @@ public interface ProjectService {
Project updateProject(long id, String name, String displayText, String newOwnerName, Long userId, Role newRole) throws ResourceAllocationException;
- boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType);
+ boolean addAccountToProject(long projectId, String accountName, String email, Long projectRoleId, Role projectRoleType) throws ResourceAllocationException;
boolean deleteAccountFromProject(long projectId, String accountName);
@@ -100,6 +100,6 @@ public interface ProjectService {
Project findByProjectAccountIdIncludingRemoved(long projectAccountId);
- boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole);
+ boolean addUserToProject(Long projectId, String username, String email, Long projectRoleId, Role projectRole) throws ResourceAllocationException;
}
diff --git a/api/src/main/java/com/cloud/server/ManagementService.java b/api/src/main/java/com/cloud/server/ManagementService.java
index f7b2456ce5cc..bcca229c06bc 100644
--- a/api/src/main/java/com/cloud/server/ManagementService.java
+++ b/api/src/main/java/com/cloud/server/ManagementService.java
@@ -20,7 +20,6 @@
import java.util.List;
import java.util.Map;
-import com.cloud.user.UserData;
import org.apache.cloudstack.api.command.admin.cluster.ListClustersCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgGroupsByCmd;
import org.apache.cloudstack.api.command.admin.config.ListCfgsByCmd;
@@ -77,6 +76,8 @@
import com.cloud.capacity.Capacity;
import com.cloud.dc.Pod;
import com.cloud.dc.Vlan;
+import com.cloud.deploy.DeploymentPlan;
+import com.cloud.deploy.DeploymentPlanner.ExcludeList;
import com.cloud.exception.ConcurrentOperationException;
import com.cloud.exception.ManagementServerException;
import com.cloud.exception.ResourceUnavailableException;
@@ -91,11 +92,13 @@
import com.cloud.storage.GuestOsCategory;
import com.cloud.storage.StoragePool;
import com.cloud.user.SSHKeyPair;
+import com.cloud.user.UserData;
import com.cloud.utils.Pair;
import com.cloud.utils.Ternary;
import com.cloud.vm.InstanceGroup;
import com.cloud.vm.VirtualMachine;
import com.cloud.vm.VirtualMachine.Type;
+import com.cloud.vm.VirtualMachineProfile;
/**
* Hopefully this is temporary.
@@ -469,6 +472,19 @@ public interface ManagementService {
Ternary, Integer>, List extends Host>, Map> listHostsForMigrationOfVM(VirtualMachine vm, Long startIndex, Long pageSize, String keyword, List vmList);
+ /**
+ * Apply affinity group constraints and other exclusion rules for VM migration.
+ * This is a helper method that can be used independently for per-iteration affinity checks in DRS.
+ *
+ * @param vm The virtual machine to migrate
+ * @param vmProfile The VM profile
+ * @param plan The deployment plan
+ * @param vmList List of VMs with current/simulated placements for affinity processing
+ * @return ExcludeList containing hosts to avoid
+ */
+ ExcludeList applyAffinityConstraints(VirtualMachine vm, VirtualMachineProfile vmProfile,
+ DeploymentPlan plan, List vmList);
+
/**
* List storage pools for live migrating of a volume. The API returns list of all pools in the cluster to which the
* volume can be migrated. Current pool is not included in the list. In case of vSphere datastore cluster storage pools,
diff --git a/api/src/main/java/com/cloud/server/ResourceManagerUtil.java b/api/src/main/java/com/cloud/server/ResourceManagerUtil.java
index 9a3b51a70d56..f5081cbe307b 100644
--- a/api/src/main/java/com/cloud/server/ResourceManagerUtil.java
+++ b/api/src/main/java/com/cloud/server/ResourceManagerUtil.java
@@ -18,6 +18,7 @@
public interface ResourceManagerUtil {
long getResourceId(String resourceId, ResourceTag.ResourceObjectType resourceType);
+ long getResourceId(String resourceId, ResourceTag.ResourceObjectType resourceType, boolean checkAccess);
String getUuid(String resourceId, ResourceTag.ResourceObjectType resourceType);
ResourceTag.ResourceObjectType getResourceType(String resourceTypeStr);
void checkResourceAccessible(Long accountId, Long domainId, String exceptionMessage);
diff --git a/api/src/main/java/com/cloud/server/ResourceTag.java b/api/src/main/java/com/cloud/server/ResourceTag.java
index b3026deceff8..32305753f1ae 100644
--- a/api/src/main/java/com/cloud/server/ResourceTag.java
+++ b/api/src/main/java/com/cloud/server/ResourceTag.java
@@ -16,14 +16,14 @@
// under the License.
package com.cloud.server;
-import org.apache.cloudstack.acl.ControlledEntity;
-import org.apache.cloudstack.api.Identity;
-import org.apache.cloudstack.api.InternalIdentity;
-
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
public interface ResourceTag extends ControlledEntity, Identity, InternalIdentity {
// FIXME - extract enum to another interface as its used both by resourceTags and resourceMetaData code
@@ -70,7 +70,7 @@ public enum ResourceObjectType {
GuestOs(false, true),
NetworkOffering(false, true),
VpcOffering(true, false),
- Domain(false, false, true),
+ Domain(true, false, true),
ObjectStore(false, false, true);
diff --git a/api/src/main/java/com/cloud/storage/Storage.java b/api/src/main/java/com/cloud/storage/Storage.java
index 1ad3731b9eaa..3511b4e88cb9 100644
--- a/api/src/main/java/com/cloud/storage/Storage.java
+++ b/api/src/main/java/com/cloud/storage/Storage.java
@@ -35,7 +35,8 @@ public static enum ImageFormat {
VDI(true, true, false, "vdi"),
TAR(false, false, false, "tar"),
ZIP(false, false, false, "zip"),
- DIR(false, false, false, "dir");
+ DIR(false, false, false, "dir"),
+ PNG(false, false, false, "png");
private final boolean supportThinProvisioning;
private final boolean supportSparse;
@@ -128,7 +129,7 @@ public static enum FileSystem {
public static enum TemplateType {
ROUTING, // Router template
SYSTEM, /* routing, system vm template */
- BUILTIN, /* buildin template */
+ BUILTIN, /* builtin template */
PERHOST, /* every host has this template, don't need to install it in secondary storage */
USER, /* User supplied template/iso */
VNF, /* VNFs (virtual network functions) template */
@@ -170,6 +171,7 @@ public static enum StoragePoolType {
ISO(false, false, EncryptionSupport.Unsupported), // for iso image
LVM(false, false, EncryptionSupport.Unsupported), // XenServer local LVM SR
CLVM(true, false, EncryptionSupport.Unsupported),
+ CLVM_NG(true, false, EncryptionSupport.Hypervisor),
RBD(true, true, EncryptionSupport.Unsupported), // http://libvirt.org/storage.html#StorageBackendRBD
SharedMountPoint(true, true, EncryptionSupport.Hypervisor),
VMFS(true, true, EncryptionSupport.Unsupported), // VMware VMFS storage
diff --git a/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java b/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java
index db702a61f2bc..7d5b2d7c57d7 100644
--- a/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java
+++ b/api/src/main/java/com/cloud/storage/VMTemplateStorageResourceAssoc.java
@@ -23,9 +23,10 @@
public interface VMTemplateStorageResourceAssoc extends InternalIdentity {
public static enum Status {
- UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
+ UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, LIMIT_REACHED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
}
+ List ERROR_DOWNLOAD_STATES = List.of(Status.DOWNLOAD_ERROR, Status.ABANDONED, Status.LIMIT_REACHED, Status.UNKNOWN);
List PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS);
String getInstallPath();
diff --git a/api/src/main/java/com/cloud/storage/Volume.java b/api/src/main/java/com/cloud/storage/Volume.java
index c7fbdb0a5445..89298e04587f 100644
--- a/api/src/main/java/com/cloud/storage/Volume.java
+++ b/api/src/main/java/com/cloud/storage/Volume.java
@@ -60,7 +60,9 @@ enum State {
UploadError(false, "Volume upload encountered some error"),
UploadAbandoned(false, "Volume upload is abandoned since the upload was never initiated within a specified time"),
Attaching(true, "The volume is attaching to a VM from Ready state."),
- Restoring(true, "The volume is being restored from backup.");
+ Restoring(true, "The volume is being restored from backup."),
+ Consolidating(true, "The volume is being flattened."),
+ RestoreError(false, "The volume restore encountered an error.");
boolean _transitional;
@@ -153,6 +155,10 @@ public String getDescription() {
s_fsm.addTransition(new StateMachine2.Transition(Destroy, Event.RestoreRequested, Restoring, null));
s_fsm.addTransition(new StateMachine2.Transition(Restoring, Event.RestoreSucceeded, Ready, null));
s_fsm.addTransition(new StateMachine2.Transition(Restoring, Event.RestoreFailed, Ready, null));
+ s_fsm.addTransition(new StateMachine2.Transition<>(Ready, Event.ConsolidationRequested, Consolidating, null));
+ s_fsm.addTransition(new StateMachine2.Transition<>(Consolidating, Event.OperationSucceeded, Ready, null));
+ s_fsm.addTransition(new StateMachine2.Transition<>(Consolidating, Event.OperationFailed, RestoreError, null));
+ s_fsm.addTransition(new StateMachine2.Transition<>(RestoreError, Event.RestoreFailed, RestoreError, null));
}
}
@@ -179,7 +185,8 @@ enum Event {
OperationTimeout,
RestoreRequested,
RestoreSucceeded,
- RestoreFailed;
+ RestoreFailed,
+ ConsolidationRequested
}
/**
@@ -275,6 +282,14 @@ enum Event {
void setPassphraseId(Long id);
+ Long getKmsKeyId();
+
+ void setKmsKeyId(Long id);
+
+ Long getKmsWrappedKeyId();
+
+ void setKmsWrappedKeyId(Long id);
+
String getEncryptFormat();
void setEncryptFormat(String encryptFormat);
diff --git a/api/src/main/java/com/cloud/storage/VolumeApiService.java b/api/src/main/java/com/cloud/storage/VolumeApiService.java
index 4140d51a800d..372eb0385618 100644
--- a/api/src/main/java/com/cloud/storage/VolumeApiService.java
+++ b/api/src/main/java/com/cloud/storage/VolumeApiService.java
@@ -22,6 +22,7 @@
import java.util.List;
import java.util.Map;
+import com.cloud.dc.DataCenter;
import com.cloud.exception.ResourceAllocationException;
import com.cloud.offering.DiskOffering;
import com.cloud.user.Account;
@@ -56,9 +57,9 @@ public interface VolumeApiService {
Boolean.class,
"use.https.to.upload",
"true",
- "Determines the protocol (HTTPS or HTTP) ACS will use to generate links to upload ISOs, volumes, and templates. When set as 'true', ACS will use protocol HTTPS, otherwise, it will use protocol HTTP. Default value is 'true'.",
+ "Controls whether upload links for ISOs, volumes, and templates use HTTPS (true, default) or HTTP (false). After changing this setting, the Secondary Storage VM (SSVM) must be recreated",
true,
- ConfigKey.Scope.StoragePool);
+ ConfigKey.Scope.Zone);
/**
* Creates the database object for a volume based on the given criteria
@@ -70,6 +71,10 @@ public interface VolumeApiService {
*/
Volume allocVolume(CreateVolumeCmd cmd) throws ResourceAllocationException;
+ Volume allocVolume(long ownerId, Long zoneId, Long diskOfferingId, Long vmId, Long snapshotId, String name,
+ Long cmdSize, Boolean displayVolume, Long cmdMinIops, Long cmdMaxIops, String customId, Long kmsKeyId)
+ throws ResourceAllocationException;
+
/**
* Creates the volume based on the given criteria
*
@@ -80,6 +85,8 @@ public interface VolumeApiService {
*/
Volume createVolume(CreateVolumeCmd cmd);
+ Volume createVolume(long volumeId, Long vmId, Long snapshotId, Long storageId, Boolean display);
+
/**
* Resizes the volume based on the given criteria
*
@@ -107,7 +114,7 @@ public interface VolumeApiService {
Volume attachVolumeToVM(AttachVolumeCmd command);
- Volume attachVolumeToVM(Long vmId, Long volumeId, Long deviceId, Boolean allowAttachForSharedFS);
+ Volume attachVolumeToVM(Long vmId, Long volumeId, Long deviceId, Boolean allowAttachForSharedFS, boolean allowAttachOnRestoring);
Volume detachVolumeViaDestroyVM(long vmId, long volumeId);
@@ -180,7 +187,9 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
*/
boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags);
- Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);
+ boolean validateConditionsToReplaceDiskOfferingOfVolume(Volume volume, DiskOffering newDiskOffering, StoragePool destPool);
+
+ Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge, Boolean countDisplayFalseInResourceCount);
void destroyVolume(long volumeId);
@@ -201,4 +210,6 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
Pair checkAndRepairVolume(CheckAndRepairVolumeCmd cmd) throws ResourceAllocationException;
Long getVolumePhysicalSize(Storage.ImageFormat format, String path, String chainInfo);
+
+ Long getCustomDiskOfferingIdForVolumeUpload(Account owner, DataCenter zone, boolean encryptEnabledOnly);
}
diff --git a/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java
index 67afd6aa4e24..d52e645ec799 100644
--- a/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java
+++ b/api/src/main/java/com/cloud/storage/snapshot/SnapshotApiService.java
@@ -85,7 +85,7 @@ public interface SnapshotApiService {
* the command that specifies the volume criteria
* @return list of snapshot policies
*/
- Pair, Integer> listPoliciesforVolume(ListSnapshotPoliciesCmd cmd);
+ Pair, Integer> listSnapshotPolicies(ListSnapshotPoliciesCmd cmd);
boolean deleteSnapshotPolicies(DeleteSnapshotPoliciesCmd cmd);
diff --git a/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java b/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java
index 22d5dfb9c1b8..13009a9808aa 100644
--- a/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java
+++ b/api/src/main/java/com/cloud/storage/snapshot/SnapshotPolicy.java
@@ -16,11 +16,12 @@
// under the License.
package com.cloud.storage.snapshot;
+import org.apache.cloudstack.acl.ControlledEntity;
import org.apache.cloudstack.api.Displayable;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
-public interface SnapshotPolicy extends Identity, InternalIdentity, Displayable {
+public interface SnapshotPolicy extends ControlledEntity, Identity, InternalIdentity, Displayable {
long getVolumeId();
diff --git a/api/src/main/java/com/cloud/user/AccountService.java b/api/src/main/java/com/cloud/user/AccountService.java
index c0ebcf09f59b..fc450e9179c5 100644
--- a/api/src/main/java/com/cloud/user/AccountService.java
+++ b/api/src/main/java/com/cloud/user/AccountService.java
@@ -21,12 +21,13 @@
import com.cloud.utils.Pair;
import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.acl.RolePermissionEntity;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.SecurityChecker.AccessType;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPair;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission;
+import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.command.admin.account.CreateAccountCmd;
-import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
-import org.apache.cloudstack.api.command.admin.user.RegisterCmd;
-import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
import com.cloud.dc.DataCenter;
import com.cloud.domain.Domain;
@@ -35,7 +36,16 @@
import com.cloud.offering.DiskOffering;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.ServiceOffering;
+import org.apache.cloudstack.api.command.admin.user.DeleteUserKeysCmd;
+import org.apache.cloudstack.api.command.admin.user.GetUserKeysCmd;
+import org.apache.cloudstack.api.command.admin.user.ListUserKeyRulesCmd;
+import org.apache.cloudstack.api.command.admin.user.ListUserKeysCmd;
+import org.apache.cloudstack.api.command.admin.user.RegisterUserKeysCmd;
+import org.apache.cloudstack.api.command.admin.user.UpdateUserCmd;
+import org.apache.cloudstack.api.response.ApiKeyPairResponse;
+import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.auth.UserTwoFactorAuthenticator;
+import org.apache.cloudstack.backup.BackupOffering;
public interface AccountService {
@@ -58,7 +68,8 @@ UserAccount createUserAccount(String userName, String password, String firstName
User getSystemUser();
- User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID);
+ User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone,
+ String accountName, Long domainId, String userUUID, boolean isPasswordChangeRequired);
User createUser(String userName, String password, String firstName, String lastName, String email, String timeZone, String accountName, Long domainId, String userUUID,
User.Source source);
@@ -77,10 +88,16 @@ User createUser(String userName, String password, String firstName, String lastN
Account getActiveAccountById(long accountId);
+ Account getActiveAccountByUuid(String accountUuid);
+
Account getAccount(long accountId);
+ Account getAccountByUuid(String accountUuid);
+
User getActiveUser(long userId);
+ User getOneActiveUserForAccount(Account account);
+
User getUserIncludingRemoved(long userId);
boolean isRootAdmin(Long accountId);
@@ -95,7 +112,7 @@ User createUser(String userName, String password, String firstName, String lastN
void markUserRegistered(long userId);
- public String[] createApiKeyAndSecretKey(RegisterCmd cmd);
+ ApiKeyPair createApiKeyAndSecretKey(RegisterUserKeysCmd cmd);
public String[] createApiKeyAndSecretKey(final long userId);
@@ -115,13 +132,19 @@ User createUser(String userName, String password, String firstName, String lastN
void checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException;
+ void checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException;
+
void checkAccess(User user, ControlledEntity entity);
void checkAccess(Account account, AccessType accessType, boolean sameOwner, String apiName, ControlledEntity... entities) throws PermissionDeniedException;
void validateAccountHasAccessToResource(Account account, AccessType accessType, Object resource);
- Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
+ void validateCallingUserHasAccessToDesiredUser(Long userId);
+
+ Long finalizeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
+
+ Long finalizeAccountId(Long accountId, String accountName, Long domainId, Long projectId);
/**
* returns the user account object for a given user id
@@ -130,9 +153,15 @@ User createUser(String userName, String password, String firstName, String lastN
*/
UserAccount getUserAccountById(Long userId);
- public Pair> getKeys(GetUserKeysCmd cmd);
+ Pair> getKeys(GetUserKeysCmd cmd);
+
+ ListResponse listKeys(ListUserKeysCmd cmd);
+
+ List listKeyRules(ListUserKeyRulesCmd cmd);
+
+ void deleteApiKey(DeleteUserKeysCmd cmd);
- public Pair> getKeys(Long userId);
+ void deleteApiKey(ApiKeyPair id);
/**
* Lists user two-factor authentication provider plugins
@@ -147,4 +176,13 @@ User createUser(String userName, String password, String firstName, String lastN
*/
UserTwoFactorAuthenticator getUserTwoFactorAuthenticationProvider(final Long domainId);
+ ApiKeyPair getLatestUserKeyPair(Long userId);
+
+ ApiKeyPair getKeyPairById(Long id);
+
+ ApiKeyPair getKeyPairByApiKey(String apiKey);
+
+ String getAccessingApiKey(BaseCmd cmd);
+
+ List getAllKeypairPermissions(String apiKey);
}
diff --git a/api/src/main/java/com/cloud/user/ApiKeyPairState.java b/api/src/main/java/com/cloud/user/ApiKeyPairState.java
new file mode 100644
index 000000000000..63405c62e320
--- /dev/null
+++ b/api/src/main/java/com/cloud/user/ApiKeyPairState.java
@@ -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.user;
+
+public enum ApiKeyPairState {
+ ENABLED, REMOVED, EXPIRED
+}
diff --git a/api/src/main/java/com/cloud/user/ResourceLimitService.java b/api/src/main/java/com/cloud/user/ResourceLimitService.java
index 49b20fe2fefc..89128f87829e 100644
--- a/api/src/main/java/com/cloud/user/ResourceLimitService.java
+++ b/api/src/main/java/com/cloud/user/ResourceLimitService.java
@@ -30,11 +30,12 @@
import com.cloud.offering.DiskOffering;
import com.cloud.offering.ServiceOffering;
import com.cloud.template.VirtualMachineTemplate;
+import org.apache.cloudstack.resourcelimit.Reserver;
public interface ResourceLimitService {
static final ConfigKey MaxAccountSecondaryStorage = new ConfigKey<>("Account Defaults", Long.class, "max.account.secondary.storage", "400",
- "The default maximum secondary storage space (in GiB) that can be used for an account", false);
+ "The default maximum secondary storage space (in GiB) that can be used for an Account", false);
static final ConfigKey MaxProjectSecondaryStorage = new ConfigKey<>("Project Defaults", Long.class, "max.project.secondary.storage", "400",
"The default maximum secondary storage space (in GiB) that can be used for a project", false);
static final ConfigKey ResourceCountCheckInterval = new ConfigKey<>("Advanced", Long.class, "resourcecount.check.interval", "300",
@@ -191,6 +192,7 @@ public interface ResourceLimitService {
*/
public void checkResourceLimit(Account account, ResourceCount.ResourceType type, long... count) throws ResourceAllocationException;
public void checkResourceLimitWithTag(Account account, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
+ public void checkResourceLimitWithTag(Account account, Long domainId, boolean considerSystemAccount, ResourceCount.ResourceType type, String tag, long... count) throws ResourceAllocationException;
/**
* Gets the count of resources for a resource type and account
@@ -251,15 +253,15 @@ public interface ResourceLimitService {
List getResourceLimitStorageTags(DiskOffering diskOffering);
void updateTaggedResourceLimitsAndCountsForAccounts(List responses, String tag);
void updateTaggedResourceLimitsAndCountsForDomains(List responses, String tag);
- void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
-
+ void checkVolumeResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List reservations) throws ResourceAllocationException;
+ List getResourceLimitStorageTagsForResourceCountOperation(Boolean display, DiskOffering diskOffering, Boolean enforceResourceLimitOnDisplayFalse);
void checkVolumeResourceLimitForDiskOfferingChange(Account owner, Boolean display, Long currentSize, Long newSize,
- DiskOffering currentOffering, DiskOffering newOffering) throws ResourceAllocationException;
+ DiskOffering currentOffering, DiskOffering newOffering, List reservations) throws ResourceAllocationException;
- void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering) throws ResourceAllocationException;
+ void checkPrimaryStorageResourceLimit(Account owner, Boolean display, Long size, DiskOffering diskOffering, List reservations) throws ResourceAllocationException;
void incrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
- void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
+ void decrementVolumeResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering, Boolean countDisplayFalseInResourceCount);
void updateVmResourceCountForTemplateChange(long accountId, Boolean display, ServiceOffering offering, VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate);
@@ -273,25 +275,23 @@ void updateVolumeResourceCountForDiskOfferingChange(long accountId, Boolean disp
void incrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
void decrementVolumePrimaryStorageResourceCount(long accountId, Boolean display, Long size, DiskOffering diskOffering);
- void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
- void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
- void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template);
+ void checkVmResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, List reservations) throws ResourceAllocationException;
+ void incrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceLimit);
+ void decrementVmResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Boolean countDisplayFalseInResourceCount);
void checkVmResourceLimitsForServiceOfferingChange(Account owner, Boolean display, Long currentCpu, Long newCpu,
- Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template) throws ResourceAllocationException;
+ Long currentMemory, Long newMemory, ServiceOffering currentOffering, ServiceOffering newOffering, VirtualMachineTemplate template, List reservations) throws ResourceAllocationException;
void checkVmResourceLimitsForTemplateChange(Account owner, Boolean display, ServiceOffering offering,
- VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate) throws ResourceAllocationException;
+ VirtualMachineTemplate currentTemplate, VirtualMachineTemplate newTemplate, List reservations) throws ResourceAllocationException;
- void checkVmCpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu) throws ResourceAllocationException;
void incrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
void decrementVmCpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long cpu);
- void checkVmMemoryResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory) throws ResourceAllocationException;
void incrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
void decrementVmMemoryResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long memory);
- void checkVmGpuResourceLimit(Account owner, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu) throws ResourceAllocationException;
void incrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
void decrementVmGpuResourceCount(long accountId, Boolean display, ServiceOffering serviceOffering, VirtualMachineTemplate template, Long gpu);
+ long recalculateDomainResourceCount(final long domainId, final ResourceType type, String tag);
}
diff --git a/api/src/main/java/com/cloud/user/User.java b/api/src/main/java/com/cloud/user/User.java
index 041b39ad2729..da7245a47980 100644
--- a/api/src/main/java/com/cloud/user/User.java
+++ b/api/src/main/java/com/cloud/user/User.java
@@ -65,14 +65,6 @@ public enum Source {
public void setState(Account.State state);
- public String getApiKey();
-
- public void setApiKey(String apiKey);
-
- public String getSecretKey();
-
- public void setSecretKey(String secretKey);
-
public String getTimezone();
public void setTimezone(String timezone);
diff --git a/api/src/main/java/com/cloud/user/UserAccount.java b/api/src/main/java/com/cloud/user/UserAccount.java
index e6b07fb371eb..5736244e3259 100644
--- a/api/src/main/java/com/cloud/user/UserAccount.java
+++ b/api/src/main/java/com/cloud/user/UserAccount.java
@@ -39,10 +39,6 @@ public interface UserAccount extends InternalIdentity {
String getState();
- String getApiKey();
-
- String getSecretKey();
-
Date getCreated();
Date getRemoved();
diff --git a/api/src/main/java/com/cloud/vm/DiskProfile.java b/api/src/main/java/com/cloud/vm/DiskProfile.java
index 971ebde496e4..766573d4d40b 100644
--- a/api/src/main/java/com/cloud/vm/DiskProfile.java
+++ b/api/src/main/java/com/cloud/vm/DiskProfile.java
@@ -82,7 +82,7 @@ public DiskProfile(Volume vol, DiskOffering offering, HypervisorType hyperType)
null);
this.hyperType = hyperType;
this.provisioningType = offering.getProvisioningType();
- this.requiresEncryption = offering.getEncrypt() || vol.getPassphraseId() != null;
+ this.requiresEncryption = offering.getEncrypt() || vol.getPassphraseId() != null || vol.getKmsKeyId() != null;
}
public DiskProfile(DiskProfile dp) {
diff --git a/api/src/main/java/com/cloud/vm/Nic.java b/api/src/main/java/com/cloud/vm/Nic.java
index afc44b8d39fa..3722e5769c92 100644
--- a/api/src/main/java/com/cloud/vm/Nic.java
+++ b/api/src/main/java/com/cloud/vm/Nic.java
@@ -33,6 +33,11 @@
* Nic represents one nic on the VM.
*/
public interface Nic extends Identity, InternalIdentity {
+
+ interface Topics {
+ String NIC_LIFECYCLE = "nic.lifecycle";
+ }
+
enum Event {
ReservationRequested, ReleaseRequested, CancelRequested, OperationCompleted, OperationFailed,
}
@@ -162,4 +167,6 @@ public enum ReservationStrategy {
String getIPv6Address();
Integer getMtu();
+
+ boolean isEnabled();
}
diff --git a/api/src/main/java/com/cloud/vm/NicProfile.java b/api/src/main/java/com/cloud/vm/NicProfile.java
index a0c80ceb1bfb..54a32bbcb181 100644
--- a/api/src/main/java/com/cloud/vm/NicProfile.java
+++ b/api/src/main/java/com/cloud/vm/NicProfile.java
@@ -52,6 +52,7 @@ public class NicProfile implements InternalIdentity, Serializable {
boolean defaultNic;
Integer networkRate;
boolean isSecurityGroupEnabled;
+ boolean enabled;
Integer orderIndex;
@@ -87,6 +88,7 @@ public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri,
broadcastType = network.getBroadcastDomainType();
trafficType = network.getTrafficType();
format = nic.getAddressFormat();
+ enabled = nic.isEnabled();
iPv4Address = nic.getIPv4Address();
iPv4Netmask = nic.getIPv4Netmask();
@@ -414,6 +416,14 @@ public void setIpv4AllocationRaceCheck(boolean ipv4AllocationRaceCheck) {
this.ipv4AllocationRaceCheck = ipv4AllocationRaceCheck;
}
+ public boolean isEnabled() {
+ return enabled;
+ }
+
+ public void setEnabled(boolean enabled) {
+ this.enabled = enabled;
+ }
+
//
// OTHER METHODS
//
@@ -453,6 +463,6 @@ public String toString() {
return String.format("NicProfile %s",
ReflectionToStringBuilderUtils.reflectOnlySelectedFields(
this, "id", "uuid", "vmId", "deviceId",
- "broadcastUri", "reservationId", "iPv4Address"));
+ "broadcastType", "broadcastUri", "reservationId", "iPv4Address"));
}
}
diff --git a/api/src/main/java/com/cloud/vm/NicSecondaryIp.java b/api/src/main/java/com/cloud/vm/NicSecondaryIp.java
index 2856e0aea756..d25627c1782d 100644
--- a/api/src/main/java/com/cloud/vm/NicSecondaryIp.java
+++ b/api/src/main/java/com/cloud/vm/NicSecondaryIp.java
@@ -38,6 +38,8 @@ public interface NicSecondaryIp extends ControlledEntity, Identity, InternalIden
String getIp6Address();
+ String getDescription();
+
long getNetworkId();
long getVmId();
diff --git a/api/src/main/java/com/cloud/vm/UserVmService.java b/api/src/main/java/com/cloud/vm/UserVmService.java
index 6f1aba4613da..5864e91cd7f4 100644
--- a/api/src/main/java/com/cloud/vm/UserVmService.java
+++ b/api/src/main/java/com/cloud/vm/UserVmService.java
@@ -40,6 +40,7 @@
import org.apache.cloudstack.api.command.user.vm.StartVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpdateDefaultNicForVMCmd;
import org.apache.cloudstack.api.command.user.vm.UpdateVMCmd;
+import org.apache.cloudstack.api.command.user.vm.UpdateVmNicCmd;
import org.apache.cloudstack.api.command.user.vm.UpdateVmNicIpCmd;
import org.apache.cloudstack.api.command.user.vm.UpgradeVMCmd;
import org.apache.cloudstack.api.command.user.vmgroup.CreateVMGroupCmd;
@@ -64,6 +65,7 @@
import com.cloud.template.VirtualMachineTemplate;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
+import com.cloud.utils.Pair;
import com.cloud.utils.exception.ExecutionException;
public interface UserVmService {
@@ -73,10 +75,11 @@ public interface UserVmService {
* Destroys one virtual machine
*
* @param cmd the API Command Object containg the parameters to use for this service action
+ * @param checkExpunge
* @throws ConcurrentOperationException
* @throws ResourceUnavailableException
*/
- UserVm destroyVm(DestroyVMCmd cmd) throws ResourceUnavailableException, ConcurrentOperationException;
+ UserVm destroyVm(DestroyVMCmd cmd, boolean checkExpunge) throws ResourceUnavailableException, ConcurrentOperationException;
/**
* Destroys one virtual machine
@@ -151,6 +154,8 @@ void startVirtualMachineForHA(VirtualMachine vm, Map sshKeyPairs, Map requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
List affinityGroupIdList, Map customParameter, String customId, Map> dhcpOptionMap,
Map dataDiskTemplateToDiskOfferingMap,
- Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException,
+ Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Long rootDiskKmsKeyId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException,
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
@@ -301,7 +306,7 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
List securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, List dataDiskInfoList, String group, HypervisorType hypervisor,
HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
List affinityGroupIdList, Map customParameters, String customId, Map> dhcpOptionMap,
- Map dataDiskTemplateToDiskOfferingMap, Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
+ Map dataDiskTemplateToDiskOfferingMap, Map userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Long rootDiskKmsKeyId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
/**
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
@@ -373,7 +378,7 @@ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
String hostName, String displayName, Long diskOfferingId, Long diskSize, List dataDiskInfoList, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
Long userDataId, String userDataDetails, List sshKeyPairs, Map requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List affinityGroupIdList,
Map customParameters, String customId, Map> dhcpOptionMap, Map dataDiskTemplateToDiskOfferingMap,
- Map templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot)
+ Map templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Long rootDiskKmsKeyId, Volume volume, Snapshot snapshot)
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
@@ -507,16 +512,42 @@ UserVm upgradeVirtualMachine(ScaleVMCmd cmd) throws ResourceUnavailableException
void collectVmNetworkStatistics (UserVm userVm);
- UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceName, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
- final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey,
+ /**
+ * Import VM into CloudStack
+ * @param zone importing zone
+ * @param host importing host
+ * @param template template for the imported VM
+ * @param instanceNameInternal set to null to CloudStack to autogenerate from the next available VM ID on database
+ * @param displayName display name for the imported VM
+ * @param owner owner of the imported VM
+ * @param userData user data for the imported VM
+ * @param caller caller account
+ * @param isDisplayVm true to display the imported VM
+ * @param keyboard keyboard distribution for the imported VM
+ * @param accountId account ID
+ * @param userId user ID
+ * @param serviceOffering service offering for the imported VM
+ * @param sshPublicKey ssh key for the imported VM
+ * @param guestOsId guest OS ID for the imported VM (if not passed, then the guest OS of the template will be used)
+ * @param hostName the name for the imported VM
+ * @param hypervisorType hypervisor type for the imported VM
+ * @param customParameters details for the imported VM
+ * @param powerState power state of the imported VM
+ * @param networkNicMap network to nic mapping
+ * @return the imported VM
+ * @throws InsufficientCapacityException in case of errors
+ */
+ UserVm importVM(final DataCenter zone, final Host host, final VirtualMachineTemplate template, final String instanceNameInternal, final String displayName, final Account owner, final String userData, final Account caller, final Boolean isDisplayVm, final String keyboard,
+ final long accountId, final long userId, final ServiceOffering serviceOffering, final String sshPublicKey, final Long guestOsId,
final String hostName, final HypervisorType hypervisorType, final Map customParameters,
final VirtualMachine.PowerState powerState, final LinkedHashMap> networkNicMap) throws InsufficientCapacityException;
/**
* Unmanage a guest VM from CloudStack
- * @return true if the VM is successfully unmanaged, false if not.
+ *
+ * @return (true if successful, false if not, hostUuid) if the VM is successfully unmanaged.
*/
- boolean unmanageUserVM(Long vmId);
+ Pair unmanageUserVM(Long vmId, Long targetHostId);
UserVm allocateVMFromBackup(CreateVMFromBackupCmd cmd) throws InsufficientCapacityException, ResourceAllocationException, ResourceUnavailableException;
diff --git a/api/src/main/java/com/cloud/vm/VirtualMachine.java b/api/src/main/java/com/cloud/vm/VirtualMachine.java
index d244de7115e8..3adcc85d28a1 100644
--- a/api/src/main/java/com/cloud/vm/VirtualMachine.java
+++ b/api/src/main/java/com/cloud/vm/VirtualMachine.java
@@ -58,7 +58,10 @@ public enum State {
Error(false, "VM is in error"),
Unknown(false, "VM state is unknown."),
Shutdown(false, "VM state is shutdown from inside"),
- Restoring(true, "VM is being restored from backup");
+ Restoring(true, "VM is being restored from backup"),
+ BackingUp(true, "VM is being backed up"),
+ BackupError(false, "VM backup is in an inconsistent state. Operator should analyse the logs and restore the VM"),
+ RestoreError(false, "VM restore left the VM in an inconsistent state. Operator should analyse the logs and restore the VM");
private final boolean _transitional;
String _description;
@@ -124,6 +127,9 @@ public static StateMachine2 getStat
s_fsm.addTransition(new Transition(State.Stopping, VirtualMachine.Event.StopRequested, State.Stopping, null));
s_fsm.addTransition(new Transition(State.Stopping, VirtualMachine.Event.AgentReportShutdowned, State.Stopped, Arrays.asList(new Impact[]{Impact.USAGE})));
s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.OperationFailed, State.Expunging,null));
+ // Note: In addition to the Stopped -> Error transition for failed VM creation,
+ // a VM can also transition from Expunging to Error on OperationFailedToError.
+ s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.OperationFailedToError, State.Error, null));
s_fsm.addTransition(new Transition(State.Expunging, VirtualMachine.Event.ExpungeOperation, State.Expunging,null));
s_fsm.addTransition(new Transition(State.Error, VirtualMachine.Event.DestroyRequested, State.Expunging, null));
s_fsm.addTransition(new Transition(State.Error, VirtualMachine.Event.ExpungeOperation, State.Expunging, null));
@@ -131,6 +137,14 @@ public static StateMachine2 getStat
s_fsm.addTransition(new Transition(State.Destroyed, Event.RestoringRequested, State.Restoring, null));
s_fsm.addTransition(new Transition(State.Restoring, Event.RestoringSuccess, State.Stopped, null));
s_fsm.addTransition(new Transition(State.Restoring, Event.RestoringFailed, State.Stopped, null));
+ s_fsm.addTransition(new Transition<>(State.Running, Event.BackupRequested, State.BackingUp, null));
+ s_fsm.addTransition(new Transition<>(State.Stopped, Event.BackupRequested, State.BackingUp, null));
+ s_fsm.addTransition(new Transition<>(State.BackingUp, Event.BackupSucceededRunning, State.Running, null));
+ s_fsm.addTransition(new Transition<>(State.BackingUp, Event.BackupSucceededStopped, State.Stopped, null));
+ s_fsm.addTransition(new Transition<>(State.BackingUp, Event.OperationFailedToError, State.BackupError, null));
+ s_fsm.addTransition(new Transition<>(State.BackingUp, Event.OperationFailedToRunning, State.Running, null));
+ s_fsm.addTransition(new Transition<>(State.BackingUp, Event.OperationFailedToStopped, State.Stopped, null));
+ s_fsm.addTransition(new Transition(State.RestoreError, Event.RestoringFailed, State.RestoreError, null));
s_fsm.addTransition(new Transition(State.Starting, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running, Arrays.asList(new Impact[]{Impact.USAGE})));
s_fsm.addTransition(new Transition(State.Stopping, VirtualMachine.Event.FollowAgentPowerOnReport, State.Running, null));
@@ -209,6 +223,8 @@ public enum Event {
ExpungeOperation,
OperationSucceeded,
OperationFailed,
+ OperationFailedToRunning,
+ OperationFailedToStopped,
OperationFailedToError,
OperationRetry,
AgentReportShutdowned,
@@ -218,6 +234,10 @@ public enum Event {
RestoringRequested,
RestoringFailed,
RestoringSuccess,
+ BackupRequested,
+ BackupSucceededStopped,
+ BackupSucceededRunning,
+ FinalizedBackupChain,
// added for new VMSync logic
FollowAgentPowerOnReport,
diff --git a/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java b/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java
index c67ee4eabc28..5c78d6bedd64 100644
--- a/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java
+++ b/api/src/main/java/com/cloud/vm/VirtualMachineProfile.java
@@ -78,6 +78,7 @@ public static class Param {
public static final Param BootIntoSetup = new Param("enterHardwareSetup");
public static final Param PreserveNics = new Param("PreserveNics");
public static final Param ConsiderLastHost = new Param("ConsiderLastHost");
+ public static final Param ReturnAfterVolumePrepare = new Param("ReturnAfterVolumePrepare");
private String name;
diff --git a/api/src/main/java/com/cloud/vm/VmDetailConstants.java b/api/src/main/java/com/cloud/vm/VmDetailConstants.java
index ea5d209a5d41..877df55c6d67 100644
--- a/api/src/main/java/com/cloud/vm/VmDetailConstants.java
+++ b/api/src/main/java/com/cloud/vm/VmDetailConstants.java
@@ -41,6 +41,7 @@ public interface VmDetailConstants {
String KVM_VNC_PORT = "kvm.vnc.port";
String KVM_VNC_ADDRESS = "kvm.vnc.address";
String KVM_VNC_PASSWORD = "kvm.vnc.password";
+ String KVM_GUEST_OS_MACHINE_TYPE = "kvm.guest.os.machine.type";
// KVM specific, custom virtual GPU hardware
String VIDEO_HARDWARE = "video.hardware";
@@ -54,6 +55,9 @@ public interface VmDetailConstants {
String NIC_MULTIQUEUE_NUMBER = "nic.multiqueue.number";
String NIC_PACKED_VIRTQUEUES_ENABLED = "nic.packed.virtqueues.enabled";
+ // KVM specific, disk controllers
+ String KVM_SKIP_FORCE_DISK_CONTROLLER = "skip.force.disk.controller";
+
// Mac OSX guest specific (internal)
String SMC_PRESENT = "smc.present";
String FIRMWARE = "firmware";
@@ -92,6 +96,7 @@ public interface VmDetailConstants {
String CKS_NODE_TYPE = "node";
String OFFERING = "offering";
String TEMPLATE = "template";
+ String AFFINITY_GROUP = "affinitygroup";
// VMware to KVM VM migrations specific
String VMWARE_TO_KVM_PREFIX = "vmware-to-kvm";
@@ -125,4 +130,20 @@ public interface VmDetailConstants {
String EXTERNAL_DETAIL_PREFIX = "External:";
String CLOUDSTACK_VM_DETAILS = "cloudstack.vm.details";
String CLOUDSTACK_VLAN = "cloudstack.vlan";
+
+ // KVM Checkpoints related
+ String ACTIVE_CHECKPOINT_ID = "active.checkpoint.id";
+ String ACTIVE_CHECKPOINT_CREATE_TIME = "active.checkpoint.create.time";
+ String LAST_CHECKPOINT_ID = "last.checkpoint.id";
+ String LAST_CHECKPOINT_CREATE_TIME = "last.checkpoint.create.time";
+
+ // KBOSS specific
+ String LINKED_VOLUMES_SECONDARY_STORAGE_UUIDS = "linkedVolumesSecondaryStorageUuids";
+ String VALIDATION_COMMAND = "backupValidationCommand";
+ String VALIDATION_COMMAND_ARGUMENTS = "backupValidationCommandArguments";
+ String VALIDATION_COMMAND_EXPECTED_RESULT = "backupValidationCommandExpectedResult";
+ String VALIDATION_COMMAND_TIMEOUT = "backupValidationCommandTimeout";
+ String VALIDATION_SCREENSHOT_WAIT = "backupValidationScreenshotWait";
+ String VALIDATION_BOOT_TIMEOUT = "backupValidationBootTimeout";
+ String LAST_KNOWN_STATE = "last_known_state";
}
diff --git a/api/src/main/java/com/cloud/vm/VmDiskInfo.java b/api/src/main/java/com/cloud/vm/VmDiskInfo.java
index b8779a8d77c6..97683e8397fa 100644
--- a/api/src/main/java/com/cloud/vm/VmDiskInfo.java
+++ b/api/src/main/java/com/cloud/vm/VmDiskInfo.java
@@ -33,6 +33,11 @@ public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIo
_deviceId = deviceId;
}
+ public VmDiskInfo(DiskOffering diskOffering, Long size, Long minIops, Long maxIops, Long deviceId, Long kmsKeyId) {
+ super(diskOffering, size, minIops, maxIops, kmsKeyId);
+ _deviceId = deviceId;
+ }
+
public Long getDeviceId() {
return _deviceId;
}
diff --git a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java
index 24e93af15621..b4b144e2f8af 100644
--- a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java
+++ b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshot.java
@@ -29,10 +29,10 @@
public interface VMSnapshot extends ControlledEntity, Identity, InternalIdentity, StateObject {
enum State {
- Allocated("The VM snapshot is allocated but has not been created yet."), Creating("The VM snapshot is being created."), Ready(
- "The VM snapshot is ready to be used."), Reverting("The VM snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed(
+ Allocated("The Instance Snapshot is allocated but has not been created yet."), Creating("The Instance Snapshot is being created."), Ready(
+ "The Instance Snapshot is ready to be used."), Reverting("The Instance Snapshot is being used to revert"), Expunging("The volume is being expunging"), Removed(
"The volume is destroyed, and can't be recovered."), Error("The volume is in error state, and can't be recovered"),
- Hidden("The VM snapshot is hidden from the user and cannot be recovered.");
+ Hidden("The Instance snapshot is hidden from the user and cannot be recovered.");
String _description;
diff --git a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java
index 84a56aaedd34..754e463e7101 100644
--- a/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java
+++ b/api/src/main/java/com/cloud/vm/snapshot/VMSnapshotService.java
@@ -19,6 +19,7 @@
import java.util.List;
+import com.cloud.utils.fsm.NoTransitionException;
import org.apache.cloudstack.api.command.user.vmsnapshot.ListVMSnapshotCmd;
import com.cloud.exception.ConcurrentOperationException;
@@ -53,4 +54,6 @@ UserVm revertToSnapshot(Long vmSnapshotId) throws InsufficientServerCapacityExce
* @param id vm id
*/
boolean deleteVMSnapshotsFromDB(Long vmId, boolean unmanage);
+
+ void updateOperationFailed(VMSnapshot vmSnapshot) throws NoTransitionException;
}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java b/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java
index 660f64f43ef2..286a3598e4fb 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/APIChecker.java
@@ -20,6 +20,7 @@
import com.cloud.user.Account;
import com.cloud.user.User;
import com.cloud.utils.component.Adapter;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission;
import java.util.List;
@@ -31,8 +32,8 @@ public interface APIChecker extends Adapter {
// If true, apiChecker has checked the operation
// If false, apiChecker is unable to handle the operation or not implemented
// On exception, checkAccess failed don't allow
- boolean checkAccess(User user, String apiCommandName) throws PermissionDeniedException;
- boolean checkAccess(Account account, String apiCommandName) throws PermissionDeniedException;
+ boolean checkAccess(User user, String apiCommandName, ApiKeyPairPermission... apiKeyPairPermissions) throws PermissionDeniedException;
+ boolean checkAccess(Account account, String apiCommandName, ApiKeyPairPermission... apiKeyPairPermissions) throws PermissionDeniedException;
/**
* Verifies if the account has permission for the given list of APIs and returns only the allowed ones.
*
@@ -43,4 +44,5 @@ public interface APIChecker extends Adapter {
*/
List getApisAllowedToUser(Role role, User user, List apiNames) throws PermissionDeniedException;
boolean isEnabled();
+ List getImplicitRolePermissions(RoleType roleType);
}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java b/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java
index 251c6b6d3f9e..f382b1c6964f 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/RolePermissionEntity.java
@@ -21,7 +21,7 @@
import org.apache.cloudstack.api.InternalIdentity;
public interface RolePermissionEntity extends InternalIdentity, Identity {
- public enum Permission {
+ enum Permission {
ALLOW, DENY
}
Rule getRule();
diff --git a/api/src/main/java/org/apache/cloudstack/acl/RoleService.java b/api/src/main/java/org/apache/cloudstack/acl/RoleService.java
index f041c8342aec..14e0a608a925 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/RoleService.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/RoleService.java
@@ -104,5 +104,26 @@ public interface RoleService {
List findAllPermissionsBy(Long roleId);
+ List findAllRolePermissionsEntityBy(Long roleId, boolean considerImplicitRules);
+
Permission getRolePermission(String permission);
+
+ int removeRolesIfNeeded(List extends Role> roles);
+
+ /**
+ * Checks if the role of the caller account has compatible permissions of the specified role permissions.
+ * For each permission of the {@param rolePermissionsToAccess}, the role of the caller needs to contain the same permission.
+ *
+ * @param rolePermissions the permissions of the caller role.
+ * @param rolePermissionsToAccess the permissions for the role that the caller role wants to access.
+ * @return True if the role can be accessed with the given permissions; false otherwise.
+ */
+ boolean roleHasPermission(Map rolePermissions, List rolePermissionsToAccess);
+
+ /**
+ * Given a list of role permissions, returns a {@link Map} containing the API name as the key and the {@link RolePermissionEntity} for the API as the value.
+ *
+ * @param rolePermissions Permissions for the role from role.
+ */
+ Map getRoleRulesAndPermissions(List rolePermissions);
}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/RoleType.java b/api/src/main/java/org/apache/cloudstack/acl/RoleType.java
index 46e4f1bc510d..c33488cd9239 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/RoleType.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/RoleType.java
@@ -132,10 +132,10 @@ public static Set fromCombinedMask(int combinedMask) {
* */
public static Account.Type getAccountTypeByRole(final Role role, final Account.Type defautAccountType) {
if (role != null) {
- LOGGER.debug(String.format("Role [%s] is not null; therefore, we use its account type [%s].", role, defautAccountType));
+ LOGGER.debug("Role [{}] is not null; therefore, we use its Account type [{}].", role, defautAccountType);
return role.getRoleType().getAccountType();
}
- LOGGER.debug(String.format("Role is null; therefore, we use the default account type [%s] value.", defautAccountType));
+ LOGGER.debug("Role is null; therefore, we use the default Account type [{}] value.", defautAccountType);
return defautAccountType;
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/Rule.java b/api/src/main/java/org/apache/cloudstack/acl/Rule.java
index a4ef7773f67b..ad01825a95f1 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/Rule.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/Rule.java
@@ -25,16 +25,18 @@
public final class Rule {
private final String rule;
+ private final Pattern matchingPattern;
private final static Pattern ALLOWED_PATTERN = Pattern.compile("^[a-zA-Z0-9*]+$");
public Rule(final String rule) {
validate(rule);
this.rule = rule;
+ matchingPattern = Pattern.compile(rule.toLowerCase().replace("*", "(\\w*\\*?)+"));
}
public boolean matches(final String commandName) {
- return StringUtils.isNotEmpty(commandName)
- && commandName.toLowerCase().matches(rule.toLowerCase().replace("*", "\\w*"));
+ return StringUtils.isNotEmpty(commandName) &&
+ matchingPattern.matcher(commandName.toLowerCase()).matches();
}
public String getRuleString() {
diff --git a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
index 82a8ec5fe932..fa17df7c6ed4 100644
--- a/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
+++ b/api/src/main/java/org/apache/cloudstack/acl/SecurityChecker.java
@@ -27,6 +27,8 @@
import com.cloud.user.User;
import com.cloud.utils.component.Adapter;
+import org.apache.cloudstack.backup.BackupOffering;
+
/**
* SecurityChecker checks the ownership and access control to objects within
*/
@@ -145,4 +147,6 @@ boolean checkAccess(Account caller, AccessType accessType, String action, Contro
boolean checkAccess(Account account, NetworkOffering nof, DataCenter zone) throws PermissionDeniedException;
boolean checkAccess(Account account, VpcOffering vof, DataCenter zone) throws PermissionDeniedException;
+
+ boolean checkAccess(Account account, BackupOffering bof) throws PermissionDeniedException;
}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java
new file mode 100644
index 000000000000..ecce0ae50824
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPair.java
@@ -0,0 +1,38 @@
+// 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.acl.apikeypair;
+
+import org.apache.cloudstack.acl.ControlledEntity;
+import org.apache.cloudstack.api.Identity;
+import org.apache.cloudstack.api.InternalIdentity;
+
+import java.util.Date;
+
+public interface ApiKeyPair extends ControlledEntity, InternalIdentity, Identity {
+ Long getUserId();
+ Date getStartDate();
+ Date getEndDate();
+ Date getCreated();
+ String getDescription();
+ String getApiKey();
+ String getSecretKey();
+ String getName();
+ Date getRemoved();
+ void setRemoved(Date date);
+ void validateDate();
+ boolean hasEndDatePassed();
+}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java
new file mode 100644
index 000000000000..60b3834cc073
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairPermission.java
@@ -0,0 +1,23 @@
+// 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.acl.apikeypair;
+
+import org.apache.cloudstack.acl.RolePermissionEntity;
+
+public interface ApiKeyPairPermission extends RolePermissionEntity {
+ long getApiKeyPairId();
+}
diff --git a/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java
new file mode 100644
index 000000000000..de9c829b17dc
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/acl/apikeypair/ApiKeyPairService.java
@@ -0,0 +1,27 @@
+// 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.acl.apikeypair;
+
+import java.util.List;
+
+public interface ApiKeyPairService {
+ List findAllPermissionsByKeyPairId(Long apiKeyPairId, Long roleId);
+
+ ApiKeyPair findByApiKey(String apiKey);
+
+ ApiKeyPair findById(Long id);
+}
diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java
index 69f391a5656a..f5a71b994525 100644
--- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupResponse.java
@@ -34,27 +34,27 @@
public class AffinityGroupResponse extends BaseResponse implements ControlledViewEntityResponse {
@SerializedName(ApiConstants.ID)
- @Param(description = "the ID of the affinity group")
+ @Param(description = "The ID of the affinity group")
private String id;
@SerializedName(ApiConstants.NAME)
- @Param(description = "the name of the affinity group")
+ @Param(description = "The name of the affinity group")
private String name;
@SerializedName(ApiConstants.DESCRIPTION)
- @Param(description = "the description of the affinity group")
+ @Param(description = "The description of the affinity group")
private String description;
@SerializedName(ApiConstants.ACCOUNT)
- @Param(description = "the account owning the affinity group")
+ @Param(description = "The account owning the affinity group")
private String accountName;
@SerializedName(ApiConstants.DOMAIN_ID)
- @Param(description = "the domain ID of the affinity group")
+ @Param(description = "The domain ID of the affinity group")
private String domainId;
@SerializedName(ApiConstants.DOMAIN)
- @Param(description = "the domain name of the affinity group")
+ @Param(description = "The domain name of the affinity group")
private String domainName;
@SerializedName(ApiConstants.DOMAIN_PATH)
@@ -62,19 +62,19 @@ public class AffinityGroupResponse extends BaseResponse implements ControlledVie
private String domainPath;
@SerializedName(ApiConstants.PROJECT_ID)
- @Param(description = "the project ID of the affinity group")
+ @Param(description = "The project ID of the affinity group")
private String projectId;
@SerializedName(ApiConstants.PROJECT)
- @Param(description = "the project name of the affinity group")
+ @Param(description = "The project name of the affinity group")
private String projectName;
@SerializedName(ApiConstants.TYPE)
- @Param(description = "the type of the affinity group")
+ @Param(description = "The type of the affinity group")
private String type;
@SerializedName("virtualmachineIds")
- @Param(description = "virtual machine IDs associated with this affinity group")
+ @Param(description = "Instance IDs associated with this affinity group")
private List vmIdList;
@SerializedName("dedicatedresources")
diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java
index 018e5f5bab5a..03992c0c1c7c 100644
--- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java
+++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupService.java
@@ -66,5 +66,4 @@ public interface AffinityGroupService {
boolean isAffinityGroupAvailableInDomain(long affinityGroupId, long domainId);
-
}
diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
index 6f5fb23d159e..7ddf6dd9f73f 100644
--- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityGroupTypeResponse.java
@@ -29,7 +29,7 @@
public class AffinityGroupTypeResponse extends BaseResponse {
@SerializedName(ApiConstants.TYPE)
- @Param(description = "the type of the affinity group")
+ @Param(description = "The type of the affinity group")
private String type;
public AffinityGroupTypeResponse() {
diff --git a/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java b/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java
index 9995d8039e1f..96ca35f264ca 100644
--- a/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java
+++ b/api/src/main/java/org/apache/cloudstack/affinity/AffinityProcessorBase.java
@@ -29,6 +29,9 @@
public class AffinityProcessorBase extends AdapterBase implements AffinityGroupProcessor {
+ public static final String AFFINITY_TYPE_HOST = "host affinity";
+ public static final String AFFINITY_TYPE_HOST_ANTI = "host anti-affinity";
+
protected String _type;
@Override
diff --git a/api/src/main/java/org/apache/cloudstack/alert/AlertService.java b/api/src/main/java/org/apache/cloudstack/alert/AlertService.java
index d8e471756a02..a9c2abc11ce7 100644
--- a/api/src/main/java/org/apache/cloudstack/alert/AlertService.java
+++ b/api/src/main/java/org/apache/cloudstack/alert/AlertService.java
@@ -24,18 +24,24 @@
public interface AlertService {
public static class AlertType {
- private static Set defaultAlertTypes = new HashSet();
+ private static final Set defaultAlertTypes = new HashSet<>();
private final String name;
private final short type;
+ private final boolean repetitionAllowed;
- private AlertType(short type, String name, boolean isDefault) {
+ private AlertType(short type, String name, boolean isDefault, boolean repetitionAllowed) {
this.name = name;
this.type = type;
+ this.repetitionAllowed = repetitionAllowed;
if (isDefault) {
defaultAlertTypes.add(this);
}
}
+ private AlertType(short type, String name, boolean isDefault) {
+ this(type, name, isDefault, false);
+ }
+
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);
@@ -45,37 +51,41 @@ private AlertType(short type, String name, boolean isDefault) {
public static final AlertType ALERT_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET = new AlertType(Capacity.CAPACITY_TYPE_VIRTUAL_NETWORK_IPV6_SUBNET, "ALERT.NETWORK.IPV6SUBNET", 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);
- public static final AlertType ALERT_TYPE_USERVM = new AlertType((short)8, "ALERT.USERVM", true);
- public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType((short)9, "ALERT.SERVICE.DOMAINROUTER", true);
- public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType((short)10, "ALERT.SERVICE.CONSOLEPROXY", true);
+ public static final AlertType ALERT_TYPE_HOST = new AlertType((short)7, "ALERT.COMPUTE.HOST", true, true);
+ public static final AlertType ALERT_TYPE_USERVM = new AlertType((short)8, "ALERT.USERVM", true, true);
+ public static final AlertType ALERT_TYPE_DOMAIN_ROUTER = new AlertType((short)9, "ALERT.SERVICE.DOMAINROUTER", true, true);
+ public static final AlertType ALERT_TYPE_CONSOLE_PROXY = new AlertType((short)10, "ALERT.SERVICE.CONSOLEPROXY", true, true);
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_STORAGE_MISC = new AlertType((short)12, "ALERT.STORAGE.MISC", true, true);
public static final AlertType ALERT_TYPE_USAGE_SERVER = new AlertType((short)13, "ALERT.USAGE", true);
- public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true);
+ public static final AlertType ALERT_TYPE_MANAGEMENT_NODE = new AlertType((short)14, "ALERT.MANAGEMENT", true, 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_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_SSVM = new AlertType((short)19, "ALERT.SERVICE.SSVM", true, true);
public static final AlertType ALERT_TYPE_USAGE_SERVER_RESULT = new AlertType((short)20, "ALERT.USAGE.RESULT", true);
public static final AlertType ALERT_TYPE_STORAGE_DELETE = new AlertType((short)21, "ALERT.STORAGE.DELETE", true);
public static final AlertType ALERT_TYPE_UPDATE_RESOURCE_COUNT = new AlertType((short)22, "ALERT.RESOURCE.COUNT", true);
public static final AlertType ALERT_TYPE_USAGE_SANITY_RESULT = new AlertType((short)23, "ALERT.USAGE.SANITY", true);
public static final AlertType ALERT_TYPE_DIRECT_ATTACHED_PUBLIC_IP = new AlertType((short)24, "ALERT.NETWORK.DIRECTPUBLICIP", true);
public static final AlertType ALERT_TYPE_LOCAL_STORAGE = new AlertType((short)25, "ALERT.STORAGE.LOCAL", true);
- public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType((short)26, "ALERT.RESOURCE.EXCEED", true);
+ public static final AlertType ALERT_TYPE_RESOURCE_LIMIT_EXCEEDED = new AlertType((short)26, "ALERT.RESOURCE.EXCEED", true, true);
public static final AlertType ALERT_TYPE_SYNC = new AlertType((short)27, "ALERT.TYPE.SYNC", true);
- public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType((short)28, "ALERT.UPLOAD.FAILED", true);
- public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType((short)29, "ALERT.OOBM.AUTHERROR", true);
- public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true);
- public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true);
+ public static final AlertType ALERT_TYPE_UPLOAD_FAILED = new AlertType((short)28, "ALERT.UPLOAD.FAILED", true, true);
+ public static final AlertType ALERT_TYPE_OOBM_AUTH_ERROR = new AlertType((short)29, "ALERT.OOBM.AUTHERROR", true, true);
+ public static final AlertType ALERT_TYPE_HA_ACTION = new AlertType((short)30, "ALERT.HA.ACTION", true, true);
+ public static final AlertType ALERT_TYPE_CA_CERT = new AlertType((short)31, "ALERT.CA.CERT", true, true);
public static final AlertType ALERT_TYPE_VM_SNAPSHOT = new AlertType((short)32, "ALERT.VM.SNAPSHOT", true);
- public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PUBLIC.IFACE.MTU", true);
- public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)32, "ALERT.VR.PRIVATE.IFACE.MTU", true);
- public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true);
+ public static final AlertType ALERT_TYPE_VR_PUBLIC_IFACE_MTU = new AlertType((short)33, "ALERT.VR.PUBLIC.IFACE.MTU", true);
+ public static final AlertType ALERT_TYPE_VR_PRIVATE_IFACE_MTU = new AlertType((short)34, "ALERT.VR.PRIVATE.IFACE.MTU", true);
+ public static final AlertType ALERT_TYPE_EXTENSION_PATH_NOT_READY = new AlertType((short)33, "ALERT.TYPE.EXTENSION.PATH.NOT.READY", true, true);
+ public static final AlertType ALERT_TYPE_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", true, true);
public static final AlertType ALERT_TYPE_BACKUP_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_BACKUP_STORAGE, "ALERT.STORAGE.BACKUP", true);
public static final AlertType ALERT_TYPE_OBJECT_STORAGE = new AlertType(Capacity.CAPACITY_TYPE_OBJECT_STORAGE, "ALERT.STORAGE.OBJECT", true);
+ public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_FAILED = new AlertType((short)35, "ALERT.BACKUP.VALIDATION.FAILED", true, true);
+ public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_UNABLE_TO_VALIDATE = new AlertType((short)36, "ALERT.BACKUP.VALIDATION.UNABLE.TO.VALIDATE", true, true);
+ public static final AlertType ALERT_TYPE_BACKUP_VALIDATION_CLEANUP_FAILED = new AlertType((short)37, "ALERT.BACKUP.VALIDATION.CLEANUP_FAILED", true, true);
public short getType() {
return type;
@@ -85,6 +95,10 @@ public String getName() {
return name;
}
+ public boolean isRepetitionAllowed() {
+ return repetitionAllowed;
+ }
+
private static AlertType getAlertType(short type) {
for (AlertType alertType : defaultAlertTypes) {
if (alertType.getType() == type) {
@@ -108,7 +122,7 @@ public static AlertType generateAlert(short type, String name) {
if (defaultAlert != null && !defaultAlert.getName().equalsIgnoreCase(name)) {
throw new InvalidParameterValueException("There is a default alert having type " + type + " and name " + defaultAlert.getName());
} else {
- return new AlertType(type, name, false);
+ return new AlertType(type, name, false, false);
}
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/APICommand.java b/api/src/main/java/org/apache/cloudstack/api/APICommand.java
index c559be081165..b77649046ca9 100644
--- a/api/src/main/java/org/apache/cloudstack/api/APICommand.java
+++ b/api/src/main/java/org/apache/cloudstack/api/APICommand.java
@@ -50,4 +50,6 @@
RoleType[] authorized() default {};
Class>[] entityType() default {};
+
+ String httpMethod() default "";
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
index 083a1be00f56..13f351f3a27f 100644
--- a/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/AbstractGetUploadParamsCmd.java
@@ -29,28 +29,28 @@
public abstract class AbstractGetUploadParamsCmd extends BaseCmd {
- @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "the name of the volume/template/iso")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the Volume/Template/ISO")
private String name;
- @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "the format for the volume/template/iso. Possible values include QCOW2, OVA, "
+ @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, required = true, description = "The format for the Volume/Template/ISO. Possible values include QCOW2, OVA, "
+ "and VHD.")
private String format;
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "the ID of the zone the volume/template/iso is "
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, required = true, description = "The ID of the zone the Volume/Template/ISO is "
+ "to be hosted on")
private Long zoneId;
- @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "the checksum value of this volume/template/iso " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION)
+ @Parameter(name = ApiConstants.CHECKSUM, type = CommandType.STRING, description = "The checksum value of this Volume/Template/ISO " + ApiConstants.CHECKSUM_PARAMETER_PREFIX_DESCRIPTION)
private String checksum;
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "an optional accountName. Must be used with domainId.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "An optional accountName. Must be used with domainId.")
private String accountName;
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "an optional domainId. If the account parameter is used, "
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "An optional domainId. If the Account parameter is used, "
+ "domainId must also be used.")
private Long domainId;
- @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload volume/template/iso for the project")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Upload Volume/Template/ISO for the project")
private Long projectId;
public String getName() {
@@ -81,6 +81,34 @@ public Long getProjectId() {
return projectId;
}
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setFormat(String format) {
+ this.format = format;
+ }
+
+ public void setZoneId(Long zoneId) {
+ this.zoneId = zoneId;
+ }
+
+ public void setChecksum(String checksum) {
+ this.checksum = checksum;
+ }
+
+ public void setAccountName(String accountName) {
+ this.accountName = accountName;
+ }
+
+ public void setDomainId(Long domainId) {
+ this.domainId = domainId;
+ }
+
+ public void setProjectId(Long projectId) {
+ this.projectId = projectId;
+ }
+
public GetUploadParamsResponse createGetUploadParamsResponse(UUID id, URL postURL, String metadata, String timeout, String signature) {
return new GetUploadParamsResponse(id, postURL, metadata, timeout, signature);
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java b/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java
index 4d33ba859a5b..2aa97b65a3d5 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiCommandResourceType.java
@@ -89,7 +89,9 @@ public enum ApiCommandResourceType {
KubernetesSupportedVersion(null),
SharedFS(org.apache.cloudstack.storage.sharedfs.SharedFS.class),
Extension(org.apache.cloudstack.extension.Extension.class),
- ExtensionCustomAction(org.apache.cloudstack.extension.ExtensionCustomAction.class);
+ ExtensionCustomAction(org.apache.cloudstack.extension.ExtensionCustomAction.class),
+ KmsKey(org.apache.cloudstack.kms.KMSKey.class),
+ HsmProfile(org.apache.cloudstack.kms.HSMProfile.class);
private final Class> clazz;
@@ -127,8 +129,8 @@ public String toString() {
}
public static ApiCommandResourceType fromString(String value) {
- if (StringUtils.isNotEmpty(value) && EnumUtils.isValidEnum(ApiCommandResourceType.class, value)) {
- return valueOf(value);
+ if (StringUtils.isNotBlank(value) && EnumUtils.isValidEnumIgnoreCase(ApiCommandResourceType.class, value)) {
+ return EnumUtils.getEnumIgnoreCase(ApiCommandResourceType.class, value);
}
return null;
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
index 489d737b5bb9..ac6acdf42516 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
@@ -19,6 +19,8 @@
public class ApiConstants {
public static final String ACCOUNT = "account";
public static final String ACCOUNTS = "accounts";
+ public static final String ACCOUNT_NAME = "accountname";
+ public static final String ACCOUNT_STATE_TO_SHOW = "accountstatetoshow";
public static final String ACCOUNT_TYPE = "accounttype";
public static final String ACCOUNT_ID = "accountid";
public static final String ACCOUNT_IDS = "accountids";
@@ -27,6 +29,7 @@ public class ApiConstants {
public static final String ACTIVATION_RULE = "activationrule";
public static final String ACTIVITY = "activity";
public static final String ADAPTER_TYPE = "adaptertype";
+ public static final String ADDITONAL_CONFIG_ENABLED = "additionalconfigenabled";
public static final String ADDRESS = "address";
public static final String ALGORITHM = "algorithm";
public static final String ALIAS = "alias";
@@ -45,6 +48,7 @@ public class ApiConstants {
public static final String AS_NUMBER_ID = "asnumberid";
public static final String ASN_RANGE = "asnrange";
public static final String ASN_RANGE_ID = "asnrangeid";
+ public static final String API_KEY_FILTER = "apikeyfilter";
public static final String ASYNC_BACKUP = "asyncbackup";
public static final String AUTO_SELECT = "autoselect";
public static final String USER_API_KEY = "userapikey";
@@ -59,11 +63,15 @@ public class ApiConstants {
public static final String BACKUP_LIMIT = "backuplimit";
public static final String BACKUP_OFFERING_NAME = "backupofferingname";
public static final String BACKUP_OFFERING_ID = "backupofferingid";
+ public static final String BACKUP_OFFERING_DETAILS = "backupofferingdetails";
public static final String BACKUP_STORAGE_AVAILABLE = "backupstorageavailable";
public static final String BACKUP_STORAGE_LIMIT = "backupstoragelimit";
public static final String BACKUP_STORAGE_TOTAL = "backupstoragetotal";
public static final String BACKUP_VM_OFFERING_REMOVED = "vmbackupofferingremoved";
+ public static final String IS_BACKUP_VM_EXPUNGED = "isbackupvmexpunged";
public static final String BACKUP_TOTAL = "backuptotal";
+ public static final String BALANCE = "balance";
+ public static final String BALANCES = "balances";
public static final String BASE64_IMAGE = "base64image";
public static final String BGP_PEERS = "bgppeers";
public static final String BGP_PEER_IDS = "bgppeerids";
@@ -72,6 +80,7 @@ public class ApiConstants {
public static final String BOOTABLE = "bootable";
public static final String BIND_DN = "binddn";
public static final String BIND_PASSWORD = "bindpass";
+ public static final String BLANK_INSTANCE = "blankinstance";
public static final String BUS_ADDRESS = "busaddress";
public static final String BYTES_READ_RATE = "bytesreadrate";
public static final String BYTES_READ_RATE_MAX = "bytesreadratemax";
@@ -80,6 +89,7 @@ public class ApiConstants {
public static final String BYTES_WRITE_RATE_MAX = "byteswriteratemax";
public static final String BYTES_WRITE_RATE_MAX_LENGTH = "byteswriteratemaxlength";
public static final String BYPASS_VLAN_OVERLAP_CHECK = "bypassvlanoverlapcheck";
+ public static final String CALLER = "caller";
public static final String CAPACITY = "capacity";
public static final String CATEGORY = "category";
public static final String CAN_REVERT = "canrevert";
@@ -132,6 +142,7 @@ public class ApiConstants {
public static final String CNI_CONFIG_ID = "cniconfigurationid";
public static final String CNI_CONFIG_DETAILS = "cniconfigdetails";
public static final String CNI_CONFIG_NAME = "cniconfigname";
+ public static final String CSI_ENABLED = "csienabled";
public static final String COMPONENT = "component";
public static final String CPU = "CPU";
public static final String CPU_CORE_PER_SOCKET = "cpucorepersocket";
@@ -139,6 +150,7 @@ public class ApiConstants {
public static final String CPU_SPEED = "cpuspeed";
public static final String CPU_LOAD_AVERAGE = "cpuloadaverage";
public static final String CREATED = "created";
+ public static final String CROSS_ZONE_INSTANCE_CREATION = "crosszoneinstancecreation";
public static final String CTX_ACCOUNT_ID = "ctxaccountid";
public static final String CTX_DETAILS = "ctxDetails";
public static final String CTX_USER_ID = "ctxuserid";
@@ -149,6 +161,7 @@ public class ApiConstants {
public static final String CUSTOM_ID = "customid";
public static final String CUSTOM_ACTION_ID = "customactionid";
public static final String CUSTOM_JOB_ID = "customjobid";
+ public static final String CURRENCY = "currency";
public static final String CURRENT_START_IP = "currentstartip";
public static final String CURRENT_END_IP = "currentendip";
public static final String ENCRYPT = "encrypt";
@@ -162,6 +175,7 @@ public class ApiConstants {
public static final String DATACENTER_NAME = "datacentername";
public static final String DATADISKS_DETAILS = "datadisksdetails";
public static final String DATADISK_OFFERING_LIST = "datadiskofferinglist";
+ public static final String DATE = "date";
public static final String DEFAULT_VALUE = "defaultvalue";
public static final String DELETE_PROTECTION = "deleteprotection";
public static final String DESCRIPTION = "description";
@@ -189,6 +203,7 @@ public class ApiConstants {
public static final String UTILIZATION = "utilization";
public static final String DRIVER = "driver";
public static final String ROOT_DISK_SIZE = "rootdisksize";
+ public static final String ROOT_DISK_KMS_KEY_ID = "rootdiskkmskeyid";
public static final String DHCP_OPTIONS_NETWORK_LIST = "dhcpoptionsnetworklist";
public static final String DHCP_OPTIONS = "dhcpoptions";
public static final String DHCP_PREFIX = "dhcp:";
@@ -208,9 +223,11 @@ public class ApiConstants {
public static final String DOMAIN_PATH = "domainpath";
public static final String DOMAIN_ID = "domainid";
public static final String DOMAIN__ID = "domainId";
+ public static final String DUMMY = "dummy";
public static final String DURATION = "duration";
public static final String ELIGIBLE = "eligible";
public static final String EMAIL = "email";
+ public static final String ENABLE_CSI = "enablecsi";
public static final String END_ASN = "endasn";
public static final String END_DATE = "enddate";
public static final String END_IP = "endip";
@@ -222,6 +239,7 @@ public class ApiConstants {
public static final String EVENT_TYPE = "eventtype";
public static final String EXPIRES = "expires";
public static final String EXTRA_CONFIG = "extraconfig";
+ public static final String EXTRA_PARAMS = "extraparams";
public static final String EXTRA_DHCP_OPTION = "extradhcpoption";
public static final String EXTRA_DHCP_OPTION_NAME = "extradhcpoptionname";
public static final String EXTRA_DHCP_OPTION_CODE = "extradhcpoptioncode";
@@ -240,6 +258,8 @@ public class ApiConstants {
public static final String FIRSTNAME = "firstname";
public static final String FORCED = "forced";
public static final String FORCED_DESTROY_LOCAL_STORAGE = "forcedestroylocalstorage";
+ public static final String FORCE_CONVERT_TO_POOL = "forceconverttopool";
+
public static final String FORCE_DELETE_HOST = "forcedeletehost";
public static final String FORCE_MS_TO_IMPORT_VM_FILES = "forcemstoimportvmfiles";
public static final String FORCE_UPDATE_OS_TYPE = "forceupdateostype";
@@ -247,6 +267,7 @@ public class ApiConstants {
public static final String FOR_VIRTUAL_NETWORK = "forvirtualnetwork";
public static final String FOR_SYSTEM_VMS = "forsystemvms";
public static final String FOR_PROVIDER = "forprovider";
+ public static final String FROM_CHECKPOINT_ID = "fromcheckpointid";
public static final String FULL_PATH = "fullpath";
public static final String GATEWAY = "gateway";
public static final String IP6_GATEWAY = "ip6gateway";
@@ -266,6 +287,7 @@ public class ApiConstants {
public static final String HEALTH = "health";
public static final String HEADERS = "headers";
public static final String HIDE_IP_ADDRESS_USAGE = "hideipaddressusage";
+ public static final String HISTORY = "history";
public static final String HOST_ID = "hostid";
public static final String HOST_IDS = "hostids";
public static final String HOST_IP = "hostip";
@@ -273,6 +295,7 @@ public class ApiConstants {
public static final String HOST = "host";
public static final String HOST_CONTROL_STATE = "hostcontrolstate";
public static final String HOSTS_MAP = "hostsmap";
+ public static final String HTTP_REQUEST_TYPE = "httprequesttype";
public static final String HYPERVISOR = "hypervisor";
public static final String INLINE = "inline";
public static final String INSTANCE = "instance";
@@ -318,6 +341,7 @@ public class ApiConstants {
public static final String IS_2FA_VERIFIED = "is2faverified";
public static final String IS_2FA_MANDATED = "is2famandated";
+ public static final String IS_ACTIVE = "isactive";
public static final String IS_ASYNC = "isasync";
public static final String IP_AVAILABLE = "ipavailable";
public static final String IP_LIMIT = "iplimit";
@@ -346,6 +370,7 @@ public class ApiConstants {
public static final String JOB_STATUS = "jobstatus";
public static final String KEEPALIVE_ENABLED = "keepaliveenabled";
public static final String KERNEL_VERSION = "kernelversion";
+ public static final String KEYPAIR_ID = "keypairid";
public static final String KEY = "key";
public static final String LABEL = "label";
public static final String LASTNAME = "lastname";
@@ -366,6 +391,7 @@ public class ApiConstants {
public static final String MAC_ADDRESS = "macaddress";
public static final String MAC_ADDRESSES = "macaddresses";
public static final String MANUAL_UPGRADE = "manualupgrade";
+ public static final String MATCH_TYPE = "matchtype";
public static final String MAX = "max";
public static final String MAX_SNAPS = "maxsnaps";
public static final String MAX_BACKUPS = "maxbackups";
@@ -426,6 +452,7 @@ public class ApiConstants {
public static final String MAX_VGPU_PER_PHYSICAL_GPU = "maxvgpuperphysicalgpu";
public static final String GUEST_OS_LIST = "guestoslist";
public static final String GUEST_OS_COUNT = "guestoscount";
+ public static final String GUEST_OS_RULE = "guestosrule";
public static final String OS_MAPPING_CHECK_ENABLED = "osmappingcheckenabled";
public static final String OUTOFBANDMANAGEMENT_POWERSTATE = "outofbandmanagementpowerstate";
public static final String OUTOFBANDMANAGEMENT_ENABLED = "outofbandmanagementenabled";
@@ -492,7 +519,9 @@ public class ApiConstants {
public static final String RECONNECT = "reconnect";
public static final String RECOVER = "recover";
public static final String REPAIR = "repair";
+ public static final String REPETITION_ALLOWED = "repetitionallowed";
public static final String REQUIRES_HVM = "requireshvm";
+ public static final String RESERVED_RESOURCE_DETAILS = "reservedresourcedetails";
public static final String RESOURCES = "resources";
public static final String RESOURCE_COUNT = "resourcecount";
public static final String RESOURCE_NAME = "resourcename";
@@ -506,12 +535,12 @@ public class ApiConstants {
public static final String QUALIFIERS = "qualifiers";
public static final String QUERY_FILTER = "queryfilter";
public static final String QUIESCE_VM = "quiescevm";
+ public static final String QUICK_RESTORE = "quickrestore";
public static final String SCHEDULE = "schedule";
public static final String SCHEDULE_ID = "scheduleid";
public static final String SCOPE = "scope";
public static final String SEARCH_BASE = "searchbase";
public static final String SECONDARY_IP = "secondaryip";
- public static final String SECRET_KEY = "secretkey";
public static final String SECURITY_GROUP_IDS = "securitygroupids";
public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
public static final String SECURITY_GROUP_NAME = "securitygroupname";
@@ -525,9 +554,11 @@ public class ApiConstants {
public static final String SESSIONKEY = "sessionkey";
public static final String SHOW_CAPACITIES = "showcapacities";
public static final String SHOW_REMOVED = "showremoved";
+ public static final String SHOW_RESOURCES = "showresources";
public static final String SHOW_RESOURCE_ICON = "showicon";
public static final String SHOW_INACTIVE = "showinactive";
public static final String SHOW_UNIQUE = "showunique";
+ public static final String SHOW_PERMISSIONS = "showpermissions";
public static final String SIGNATURE = "signature";
public static final String SIGNATURE_VERSION = "signatureversion";
public static final String SINCE = "since";
@@ -543,6 +574,7 @@ public class ApiConstants {
public static final String USE_STORAGE_REPLICATION = "usestoragereplication";
public static final String SOURCE_CIDR_LIST = "sourcecidrlist";
+ public static final String SOURCE_OFFERING_ID = "sourceofferingid";
public static final String SOURCE_ZONE_ID = "sourcezoneid";
public static final String SSL_VERIFICATION = "sslverification";
public static final String START_ASN = "startasn";
@@ -554,6 +586,8 @@ public class ApiConstants {
public static final String STATE = "state";
public static final String STATS = "stats";
public static final String STATUS = "status";
+ public static final String COMPRESSION_STATUS = "compressionstatus";
+ public static final String VALIDATION_STATUS = "validationstatus";
public static final String STORAGE_TYPE = "storagetype";
public static final String STORAGE_POLICY = "storagepolicy";
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
@@ -575,6 +609,9 @@ public class ApiConstants {
public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine";
public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot";
public static final String TARGET_IQN = "targetiqn";
+ public static final String TARIFF_ID = "tariffid";
+ public static final String TARIFF_NAME = "tariffname";
+ public static final String TASKS_FILTER = "tasksfilter";
public static final String TEMPLATE_FILTER = "templatefilter";
public static final String TEMPLATE_ID = "templateid";
public static final String TEMPLATE_IDS = "templateids";
@@ -587,9 +624,12 @@ public class ApiConstants {
public static final String TENANT_NAME = "tenantname";
public static final String TOTAL = "total";
public static final String TOTAL_SUBNETS = "totalsubnets";
+ public static final String TO_CHECKPOINT_ID = "tocheckpointid";
+ public static final String TOTAL_QUOTA = "totalquota";
public static final String TYPE = "type";
public static final String TRUST_STORE = "truststore";
public static final String TRUST_STORE_PASSWORD = "truststorepass";
+ public static final String UNIT = "unit";
public static final String URL = "url";
public static final String USAGE_INTERFACE = "usageinterface";
public static final String USED = "used";
@@ -611,6 +651,7 @@ public class ApiConstants {
public static final String USER_CONFIGURABLE = "userconfigurable";
public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
public static final String USER_SECRET_KEY = "usersecretkey";
+ public static final String USE_VDDK = "usevddk";
public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
public static final String USE_VIRTUAL_ROUTER_IP_RESOLVER = "userouteripresolver";
public static final String UPDATE_IN_SEQUENCE = "updateinsequence";
@@ -631,6 +672,7 @@ public class ApiConstants {
public static final String VIRTUAL_MACHINE_STATE = "vmstate";
public static final String VIRTUAL_MACHINES = "virtualmachines";
public static final String USAGE_ID = "usageid";
+ public static final String USAGE_NAME = "usagename";
public static final String USAGE_TYPE = "usagetype";
public static final String INCLUDE_TAGS = "includetags";
@@ -644,6 +686,7 @@ public class ApiConstants {
public static final String ETCD_SERVICE_OFFERING_NAME = "etcdofferingname";
public static final String REMOVE_VLAN = "removevlan";
public static final String VLAN_ID = "vlanid";
+ public static final String ISOLATED = "isolated";
public static final String ISOLATED_PVLAN = "isolatedpvlan";
public static final String ISOLATED_PVLAN_TYPE = "isolatedpvlantype";
public static final String ISOLATION_URI = "isolationuri";
@@ -752,6 +795,7 @@ public class ApiConstants {
public static final String ROLE_TYPE = "roletype";
public static final String ROLE_NAME = "rolename";
public static final String PERMISSION = "permission";
+ public static final String PERMISSIONS = "permissions";
public static final String RULE = "rule";
public static final String RULES = "rules";
public static final String RULE_ID = "ruleid";
@@ -846,9 +890,17 @@ public class ApiConstants {
public static final String IS_SOURCE_NAT = "issourcenat";
public static final String IS_STATIC_NAT = "isstaticnat";
public static final String ITERATIONS = "iterations";
+ public static final String ITEMS = "items";
public static final String SORT_BY = "sortby";
public static final String CHANGE_CIDR = "changecidr";
+ public static final String HSM_PROFILE = "hsmprofile";
+ public static final String HSM_PROFILE_ID = "hsmprofileid";
public static final String PURPOSE = "purpose";
+ public static final String KMS_KEY = "kmskey";
+ public static final String KMS_KEY_ID = "kmskeyid";
+ public static final String KMS_KEY_VERSION = "kmskeyversion";
+ public static final String KEK_LABEL = "keklabel";
+ public static final String KEY_BITS = "keybits";
public static final String IS_TAGGED = "istagged";
public static final String INSTANCE_NAME = "instancename";
public static final String CONSIDER_LAST_HOST = "considerlasthost";
@@ -969,6 +1021,7 @@ public class ApiConstants {
public static final String REGION_ID = "regionid";
public static final String VPC_OFF_ID = "vpcofferingid";
public static final String VPC_OFF_NAME = "vpcofferingname";
+ public static final String VPC_OFFERING_CONSERVE_MODE = "vpcofferingconservemode";
public static final String NETWORK = "network";
public static final String VPC_ID = "vpcid";
public static final String VPC_NAME = "vpcname";
@@ -1015,7 +1068,7 @@ public class ApiConstants {
public static final String NSX_PROVIDER_PORT = "nsxproviderport";
public static final String NSX_CONTROLLER_ID = "nsxcontrollerid";
public static final String S3_ACCESS_KEY = "accesskey";
- public static final String S3_SECRET_KEY = "secretkey";
+ public static final String SECRET_KEY = "secretkey";
public static final String S3_END_POINT = "endpoint";
public static final String S3_BUCKET_NAME = "bucket";
public static final String S3_SIGNER = "s3signer";
@@ -1154,8 +1207,11 @@ public class ApiConstants {
public static final String OVM3_CLUSTER = "ovm3cluster";
public static final String OVM3_VIP = "ovm3vip";
public static final String CLEAN_UP_DETAILS = "cleanupdetails";
+ public static final String CLEAN_UP_EXTERNAL_DETAILS = "cleanupexternaldetails";
+ public static final String CLEAN_UP_EXTRA_CONFIG = "cleanupextraconfig";
public static final String CLEAN_UP_PARAMETERS = "cleanupparameters";
public static final String VIRTUAL_SIZE = "virtualsize";
+ public static final String UNCOMPRESSED_SIZE = "uncompressedsize";
public static final String NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid";
public static final String NETSCALER_SERVICEPACKAGE_ID = "netscalerservicepackageid";
public static final String FETCH_ROUTER_HEALTH_CHECK_RESULTS = "fetchhealthcheckresults";
@@ -1204,6 +1260,7 @@ public class ApiConstants {
public static final String DOCKER_REGISTRY_EMAIL = "dockerregistryemail";
public static final String ISO_NAME = "isoname";
public static final String ISO_STATE = "isostate";
+ public static final String ISO_URL = "isourl";
public static final String SEMANTIC_VERSION = "semanticversion";
public static final String KUBERNETES_VERSION_ID = "kubernetesversionid";
public static final String KUBERNETES_VERSION_NAME = "kubernetesversionname";
@@ -1224,6 +1281,13 @@ public class ApiConstants {
public static final String MAX_SIZE = "maxsize";
public static final String NODE_TYPE_OFFERING_MAP = "nodeofferings";
public static final String NODE_TYPE_TEMPLATE_MAP = "nodetemplates";
+ public static final String NODE_TYPE_AFFINITY_GROUP_MAP = "nodeaffinitygroups";
+ public static final String CONTROL_AFFINITY_GROUP_IDS = "controlaffinitygroupids";
+ public static final String CONTROL_AFFINITY_GROUP_NAMES = "controlaffinitygroupnames";
+ public static final String WORKER_AFFINITY_GROUP_IDS = "workeraffinitygroupids";
+ public static final String WORKER_AFFINITY_GROUP_NAMES = "workeraffinitygroupnames";
+ public static final String ETCD_AFFINITY_GROUP_IDS = "etcdaffinitygroupids";
+ public static final String ETCD_AFFINITY_GROUP_NAMES = "etcdaffinitygroupnames";
public static final String BOOT_TYPE = "boottype";
public static final String BOOT_MODE = "bootmode";
@@ -1245,6 +1309,7 @@ public class ApiConstants {
public static final String PROVIDER_FOR_2FA = "providerfor2fa";
public static final String ISSUER_FOR_2FA = "issuerfor2fa";
public static final String MANDATE_2FA = "mandate2fa";
+ public static final String PASSWORD_CHANGE_REQUIRED = "passwordchangerequired";
public static final String SECRET_CODE = "secretcode";
public static final String LOGIN = "login";
public static final String LOGOUT = "logout";
@@ -1267,6 +1332,8 @@ public class ApiConstants {
public static final String OBJECT_LOCKING = "objectlocking";
public static final String ENCRYPTION = "encryption";
public static final String QUOTA = "quota";
+ public static final String QUOTA_CONSUMED = "quotaconsumed";
+ public static final String QUOTA_USAGE = "quotausage";
public static final String ACCESS_KEY = "accesskey";
public static final String SOURCE_NAT_IP = "sourcenatipaddress";
@@ -1281,7 +1348,7 @@ public class ApiConstants {
public static final String IMPORT_SOURCE = "importsource";
public static final String TEMP_PATH = "temppath";
public static final String HEURISTIC_RULE = "heuristicrule";
- public static final String HEURISTIC_TYPE_VALID_OPTIONS = "Valid options are: ISO, SNAPSHOT, TEMPLATE and VOLUME.";
+ public static final String HEURISTIC_TYPE_VALID_OPTIONS = "Valid options are: ISO, SNAPSHOT, BACKUP, TEMPLATE and VOLUME.";
public static final String MANAGEMENT = "management";
public static final String IS_VNF = "isvnf";
public static final String VNF_NICS = "vnfnics";
@@ -1291,8 +1358,10 @@ public class ApiConstants {
public static final String VNF_CONFIGURE_MANAGEMENT = "vnfconfiguremanagement";
public static final String VNF_CIDR_LIST = "vnfcidrlist";
+ public static final String AUTHORIZE_URL = "authorizeurl";
public static final String CLIENT_ID = "clientid";
public static final String REDIRECT_URI = "redirecturi";
+ public static final String TOKEN_URL = "tokenurl";
public static final String IS_TAG_A_RULE = "istagarule";
@@ -1317,6 +1386,45 @@ public class ApiConstants {
public static final String OBJECT_STORAGE_LIMIT = "objectstoragelimit";
public static final String OBJECT_STORAGE_TOTAL = "objectstoragetotal";
+ public static final String KEEP_MAC_ADDRESS_ON_PUBLIC_NIC = "keepmacaddressonpublicnic";
+
+ public static final String PARAMETER_DESCRIPTION_KEEP_MAC_ADDRESS_ON_PUBLIC_NIC =
+ "Indicates whether to use the same MAC address for the public NIC of VRs on the same network. If \"true\", when creating redundant routers or recreating" +
+ " a VR, CloudStack will use the same MAC address for the public NIC of all VRs. Otherwise, if \"false\", new public NICs will always have " +
+ " a new MAC address.";
+
+ // DNS provider related
+ public static final String NAME_SERVERS = "nameservers";
+ public static final String DNS_USER_NAME = "dnsusername";
+ public static final String DNS_API_KEY = "dnsapikey";
+ public static final String DNS_ZONE_ID = "dnszoneid";
+ public static final String DNS_ZONE = "dnszone";
+ public static final String DNS_RECORD = "dnsrecord";
+ public static final String DNS_SUB_DOMAIN = "dnssubdomain";
+ public static final String DNS_SERVER_ID = "dnsserverid";
+ public static final String CONTENT = "content";
+ public static final String CONTENTS = "contents";
+ public static final String PUBLIC_DOMAIN_SUFFIX = "publicdomainsuffix";
+ public static final String AUTHORITATIVE = "authoritative";
+ public static final String KIND = "kind";
+ public static final String DNS_SEC = "dnssec";
+ public static final String TTL = "ttl";
+ public static final String CHANGE_TYPE = "changetype";
+ public static final String RECORDS = "records";
+ public static final String RR_SETS = "rrsets";
+ public static final String X_API_KEY = "X-API-Key";
+ public static final String DISABLED = "disabled";
+ public static final String CONTENT_TYPE = "Content-Type";
+ public static final String NATIVE_ZONE = "Native";
+ public static final String NIC_DNS_NAME = "nicdnsname";
+ public static final String TIME_STAMP = "timestamp";
+ public static final String INSTANCE_ID = "instanceId";
+ public static final String OLD_STATE = "oldState";
+ public static final String NEW_STATE = "newState";
+ public static final String OLD_HOST_NAME = "oldHostName";
+ public static final String EXISTING = "existing";
+ public static final String UNMANAGE = "unmanage";
+
public static final String PARAMETER_DESCRIPTION_ACTIVATION_RULE = "Quota tariff's activation rule. It can receive a JS script that results in either " +
"a boolean or a numeric value: if it results in a boolean value, the tariff value will be applied according to the result; if it results in a numeric value, the " +
"numeric value will be applied; if the result is neither a boolean nor a numeric value, the tariff will not be applied. If the rule is not informed, the tariff " +
@@ -1336,9 +1444,14 @@ public class ApiConstants {
public static final String VMWARE_DC = "vmwaredc";
+ public static final String PARAMETER_DESCRIPTION_ISOLATED_BACKUPS = "Whether the backup will be isolated, defaults to false. " +
+ "Isolated backups are always created as full backups in independent chains. Therefore, they will never depend on any existing backup chain " +
+ "and no backup chain will depend on them. Currently only supported for the KBOSS provider.";
+
public static final String CSS = "css";
public static final String JSON_CONFIGURATION = "jsonconfiguration";
+ public static final String LOGIN_BASE_DOMAIN = "loginbasedomain";
public static final String COMMON_NAMES = "commonnames";
@@ -1352,6 +1465,31 @@ public class ApiConstants {
public static final String RECURSIVE_DOMAINS = "recursivedomains";
+ public static final String VPN_CUSTOMER_GATEWAY_PARAMETERS = "vpncustomergatewayparameters";
+ public static final String OBSOLETE_PARAMETERS = "obsoleteparameters";
+ public static final String EXCLUDED_PARAMETERS = "excludedparameters";
+
+ public static final String COMPRESS = "compress";
+
+ public static final String VALIDATE = "validate";
+
+ public static final String VALIDATION_STEPS = "validationsteps";
+
+ public static final String ALLOW_QUICK_RESTORE = "allowquickrestore";
+
+ public static final String ALLOW_EXTRACT_FILE = "allowextractfile";
+
+ public static final String BACKUP_CHAIN_SIZE = "backupchainsize";
+
+ public static final String COMPRESSION_LIBRARY = "compressionlibrary";
+ public static final String ATTEMPTS = "attempts";
+
+ public static final String EXECUTING = "executing";
+
+ public static final String SCHEDULED = "scheduled";
+ public static final String SCHEDULED_DATE = "scheduleddate";
+ public static final String BACKUP_PROVIDER = "backupprovider";
+
/**
* This enum specifies IO Drivers, each option controls specific policies on I/O.
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
@@ -1393,7 +1531,7 @@ public String toString() {
}
public enum HostDetails {
- all, capacity, events, stats, min;
+ all, capacity, core, events, stats, min;
}
public enum VMDetails {
diff --git a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
index cb75939d6bc5..1ee41ac86c22 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ApiServerService.java
@@ -21,8 +21,11 @@
import javax.servlet.http.HttpSession;
+import org.apache.cloudstack.context.CallContext;
+
import com.cloud.domain.Domain;
import com.cloud.exception.CloudAuthenticationException;
+import com.cloud.user.Account;
import com.cloud.user.UserAccount;
public interface ApiServerService {
@@ -49,5 +52,23 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
boolean resetPassword(UserAccount userAccount, String token, String password);
+ String getDomainId(Map params);
+
boolean isPostRequestsAndTimestampsEnforced();
+
+ AsyncCmdResult processAsyncCmd(BaseAsyncCmd cmdObj, Map params, CallContext ctx, Long callerUserId, Account caller) throws Exception;
+
+ class AsyncCmdResult {
+ public final Long objectId;
+ public final String objectUuid;
+ public final BaseAsyncCmd asyncCmd;
+ public final long jobId;
+
+ public AsyncCmdResult(Long objectId, String objectUuid, BaseAsyncCmd asyncCmd, long jobId) {
+ this.objectId = objectId;
+ this.objectUuid = objectUuid;
+ this.asyncCmd = asyncCmd;
+ this.jobId = jobId;
+ }
+ }
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java
index 6859b0a7f406..c67c5a023e09 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCmd.java
@@ -29,6 +29,7 @@ public abstract class BaseAsyncCmd extends BaseCmd {
public static final String migrationSyncObject = "migration";
public static final String snapshotHostSyncObject = "snapshothost";
public static final String gslbSyncObject = "globalserverloadbalancer";
+ public static final String user = "user";
private Object job;
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
index 8680d7f11de3..b9b13dcfd884 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCreateCustomIdCmd.java
@@ -19,8 +19,8 @@
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;
+ description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only")
+ protected String customId;
public String getCustomId() {
return customId;
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
index b251c6ef2ec2..c1777d3b8f84 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseAsyncCustomIdCmd.java
@@ -21,7 +21,7 @@
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", since = "4.4", authorized = {RoleType.Admin})
+ description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin})
private String customId;
public String getCustomId() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
index 0aa8366bcd5c..2a64a1fb6fd8 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseBackupListCmd.java
@@ -25,7 +25,7 @@
import org.apache.cloudstack.backup.BackupOffering;
import org.apache.cloudstack.context.CallContext;
-public abstract class BaseBackupListCmd extends BaseListCmd {
+public abstract class BaseBackupListCmd extends BaseListAccountResourcesCmd {
protected void setupResponseBackupOfferingsList(final List offerings, final Integer count) {
final ListResponse response = new ListResponse<>();
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
index 8f47d51b19d4..483fa83630ad 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseCmd.java
@@ -35,10 +35,12 @@
import org.apache.cloudstack.acl.ProjectRoleService;
import org.apache.cloudstack.acl.RoleService;
import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPairService;
import org.apache.cloudstack.affinity.AffinityGroupService;
import org.apache.cloudstack.alert.AlertService;
import org.apache.cloudstack.annotation.AnnotationService;
import org.apache.cloudstack.context.CallContext;
+import org.apache.cloudstack.dns.DnsProviderManager;
import org.apache.cloudstack.gpu.GpuService;
import org.apache.cloudstack.network.RoutedIpv4Manager;
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerService;
@@ -220,6 +222,8 @@ public static enum CommandType {
@Inject
public Ipv6Service ipv6Service;
@Inject
+ public ApiKeyPairService apiKeyPairService;
+ @Inject
public VnfTemplateManager vnfTemplateManager;
@Inject
public BucketApiService _bucketService;
@@ -229,6 +233,9 @@ public static enum CommandType {
@Inject
public RoutedIpv4Manager routedIpv4Manager;
+ @Inject
+ public DnsProviderManager dnsProviderManager;
+
public abstract void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException,
ResourceAllocationException, NetworkRuleConflictException;
@@ -382,7 +389,7 @@ public List getParamFields() {
if (roleIsAllowed) {
validFields.add(field);
} else {
- logger.debug("Ignoring parameter " + parameterAnnotation.name() + " as the caller is not authorized to pass it in");
+ logger.debug("Ignoring parameter {} as the caller is not authorized to pass it in", parameterAnnotation.name());
}
}
@@ -498,4 +505,8 @@ public Map convertExternalDetailsToMap(Map externalDetails) {
}
return details;
}
+
+ public String getResourceUuid(String parameterName) {
+ return CallContext.current().getApiResourceUuid(parameterName);
+ }
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java
index 7ca9f1efe7ef..8a2292eadd07 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseCustomIdCmd.java
@@ -22,7 +22,7 @@ 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", since = "4.4", authorized = {RoleType.Admin})
+ description = "An optional field, in case you want to set a custom id to the resource. Allowed to Root Admins only", since = "4.4", authorized = {RoleType.Admin})
private String customId;
public String getCustomId() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
index aa5273ace3bc..bb18080dfcc4 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseListAccountResourcesCmd.java
@@ -19,7 +19,7 @@
public abstract class BaseListAccountResourcesCmd extends BaseListDomainResourcesCmd implements IBaseListAccountResourcesCmd {
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "list resources by account. Must be used with the domainId parameter.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "List resources by Account. Must be used with the domainId parameter.")
private String accountName;
@Override
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
index 7a8cee337705..640caa935425 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseListDomainResourcesCmd.java
@@ -27,10 +27,10 @@ public abstract class BaseListDomainResourcesCmd extends BaseListCmd implements
@Parameter(name = ApiConstants.DOMAIN_ID,
type = CommandType.UUID,
entityType = DomainResponse.class,
- description = "list only resources belonging to the domain specified")
+ description = "List only resources belonging to the domain specified")
private Long domainId;
- @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "defaults to false,"
+ @Parameter(name = ApiConstants.IS_RECURSIVE, type = CommandType.BOOLEAN, description = "Defaults to false,"
+ " but if true, lists all resources from the parent specified by the domainId till leaves.")
private Boolean recursive;
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
index 0bcfba15ea6e..d3c999ddb048 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseListProjectAndAccountResourcesCmd.java
@@ -20,7 +20,7 @@
public abstract class BaseListProjectAndAccountResourcesCmd extends BaseListAccountResourcesCmd implements IBaseListProjectAndAccountResourcesCmd {
- @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "list objects by project; if projectid=-1 lists All VMs")
+ @Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "List objects by project; if projectid=-1 lists All Instances")
private Long projectId;
@Override
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java
index 0e8e136a6c19..20c270c30b21 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseListRetrieveOnlyResourceCountCmd.java
@@ -19,7 +19,7 @@
import org.apache.commons.lang3.BooleanUtils;
public abstract class BaseListRetrieveOnlyResourceCountCmd extends BaseListTaggedResourcesCmd {
- @Parameter(name = ApiConstants.RETRIEVE_ONLY_RESOURCE_COUNT, type = CommandType.BOOLEAN, description = "makes the API's response contains only the resource count")
+ @Parameter(name = ApiConstants.RETRIEVE_ONLY_RESOURCE_COUNT, type = CommandType.BOOLEAN, description = "Makes the API's response contains only the resource count")
private Boolean retrieveOnlyResourceCount;
public Boolean getRetrieveOnlyResourceCount() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
index be95547a8a73..27e58233b249 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseListTemplateOrIsoPermissionsCmd.java
@@ -33,7 +33,7 @@ public abstract class BaseListTemplateOrIsoPermissionsCmd extends BaseCmd implem
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplatePermissionsResponse.class, required = true, description = "the template ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplatePermissionsResponse.class, required = true, description = "The Template ID")
private Long id;
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
index 45016c1a2a26..ebf0c4b19a00 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
@@ -25,11 +25,11 @@ public abstract class BaseResponse implements ResponseObject {
private transient String objectName;
@SerializedName(ApiConstants.JOB_ID)
- @Param(description = "the UUID of the latest async job acting on this object")
+ @Param(description = "The UUID of the latest async job acting on this object")
protected String jobId;
@SerializedName(ApiConstants.JOB_STATUS)
- @Param(description = "the current status of the latest async job acting on this object")
+ @Param(description = "The current status of the latest async job acting on this object")
private Integer jobStatus;
public BaseResponse() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java
index f7c0c21395f8..19d88382ce78 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAnnotations.java
@@ -22,7 +22,7 @@
public abstract class BaseResponseWithAnnotations extends BaseResponse {
@SerializedName(ApiConstants.HAS_ANNOTATIONS)
- @Param(description = "true if the entity/resource has annotations")
+ @Param(description = "True if the entity/resource has annotations")
private Boolean hasAnnotation;
public Boolean hasAnnotation() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java
index 1ffe4657bd98..48be5c6b4de0 100755
--- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithAssociatedNetwork.java
@@ -22,11 +22,11 @@
public abstract class BaseResponseWithAssociatedNetwork extends BaseResponseWithAnnotations {
@SerializedName(ApiConstants.ASSOCIATED_NETWORK_ID)
- @Param(description = "the ID of the Network associated with this private gateway")
+ @Param(description = "The ID of the Network associated with this private gateway")
private String associatedNetworkId;
@SerializedName(ApiConstants.ASSOCIATED_NETWORK)
- @Param(description = "the name of the Network associated with this private gateway")
+ @Param(description = "The name of the Network associated with this private gateway")
private String associatedNetworkName;
public void setAssociatedNetworkId(String associatedNetworkId) {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
index 710b9f0b9ecf..a01cd5677bac 100755
--- a/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseResponseWithTagInformation.java
@@ -26,7 +26,7 @@
public abstract class BaseResponseWithTagInformation extends BaseResponseWithAnnotations {
@SerializedName(ApiConstants.TAGS)
- @Param(description = "the list of resource tags associated", responseObject = ResourceTagResponse.class)
+ @Param(description = "The list of resource tags associated", responseObject = ResourceTagResponse.class)
protected Set tags;
public void addTag(ResourceTagResponse tag) {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
index 8489bf05ec78..94c5d8ff39fc 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java
@@ -30,49 +30,49 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "true if image is bootable, false otherwise; available only for updateIso API")
+ @Parameter(name = ApiConstants.BOOTABLE, type = CommandType.BOOLEAN, description = "True if image is bootable, false otherwise; available only for updateIso API")
private Boolean bootable;
- @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "true if the template requires HVM, false otherwise; available only for updateTemplate API")
+ @Parameter(name = ApiConstants.REQUIRES_HVM, type = CommandType.BOOLEAN, description = "True if the Template requires HVM, false otherwise; available only for updateTemplate API")
private Boolean requiresHvm;
- @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "the display text of the image", length = 4096)
+ @Parameter(name = ApiConstants.DISPLAY_TEXT, type = CommandType.STRING, description = "The display text of the image", length = 4096)
private String displayText;
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the ID of the image file")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The ID of the image file")
private Long id;
- @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the image file")
+ @Parameter(name = ApiConstants.NAME, type = CommandType.STRING, length = 251, description = "The name of the image file")
private String templateName;
@Parameter(name = ApiConstants.OS_TYPE_ID,
type = CommandType.UUID,
entityType = GuestOSResponse.class,
- description = "the ID of the OS type that best represents the OS of this image.")
+ description = "The ID of the OS type that best represents the OS of this image.")
private Long osTypeId;
@Parameter(name = ApiConstants.FORCE_UPDATE_OS_TYPE, type = CommandType.BOOLEAN, since = "4.21", description = "Force OS type update. Warning: Updating OS type will " +
"update the guest OS configuration for all the existing Instances deployed with this template/iso, which may affect their behavior.")
private Boolean forceUpdateOsType;
- @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "the format for the image")
+ @Parameter(name = ApiConstants.FORMAT, type = CommandType.STRING, description = "The format for the image")
private String format;
- @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "true if the image supports the password reset feature; default is false")
+ @Parameter(name = ApiConstants.PASSWORD_ENABLED, type = CommandType.BOOLEAN, description = "True if the image supports the password reset feature; default is false")
private Boolean passwordEnabled;
- @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "true if the template supports the sshkey upload feature; default is false")
+ @Parameter(name = ApiConstants.SSHKEY_ENABLED, type = CommandType.BOOLEAN, description = "True if the Template supports the SSHkey upload feature; default is false")
private Boolean sshKeyEnabled;
- @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "sort key of the template, integer")
+ @Parameter(name = ApiConstants.SORT_KEY, type = CommandType.INTEGER, description = "Sort key of the Template, integer")
private Integer sortKey;
@Parameter(name = ApiConstants.IS_DYNAMICALLY_SCALABLE,
type = CommandType.BOOLEAN,
- description = "true if template/ISO contains XS/VMWare tools inorder to support dynamic scaling of VM cpu/memory")
+ description = "True if Template/ISO contains XS/VMWare tools in order to support dynamic scaling of Instance CPU/memory")
private Boolean isDynamicallyScalable;
- @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "true if the template type is routing i.e., if template is used to deploy router")
+ @Parameter(name = ApiConstants.ROUTING, type = CommandType.BOOLEAN, description = "True if the Template type is routing i.e., if Template is used to deploy router")
protected Boolean isRoutingType;
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].hypervisortoolsversion=xenserver61")
@@ -80,11 +80,11 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
@Parameter(name = ApiConstants.CLEAN_UP_DETAILS,
type = CommandType.BOOLEAN,
- description = "optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)")
+ description = "Optional boolean field, which indicates if details should be cleaned up or not (if set to true, details removed for this resource, details field ignored; if false or not set, no action)")
private Boolean cleanupDetails;
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
- description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64",
+ description = "the CPU arch of the template/ISO. Valid options are: x86_64, aarch64, s390x",
since = "4.20")
private String arch;
@@ -153,8 +153,8 @@ public Map getDetails() {
return (Map) (paramsCollection.toArray())[0];
}
- public boolean isCleanupDetails(){
- return cleanupDetails == null ? false : cleanupDetails.booleanValue();
+ public boolean isCleanupDetails() {
+ return cleanupDetails != null && cleanupDetails;
}
public CPU.CPUArch getCPUArch() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
index e6ee0897db02..0a62591ddc24 100644
--- a/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoPermissionsCmd.java
@@ -40,31 +40,31 @@ protected String getResponseName() {
@Parameter(name = ApiConstants.ACCOUNTS,
type = CommandType.LIST,
collectionType = CommandType.STRING,
- description = "a comma delimited list of accounts within caller's domain. If specified, \"op\" parameter has to be passed in.")
+ description = "A comma delimited list of Accounts within caller's domain. If specified, \"op\" parameter has to be passed in.")
private List accountNames;
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "the template ID")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = TemplateResponse.class, required = true, description = "The Template ID")
private Long id;
- @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "true for featured template/iso, false otherwise")
+ @Parameter(name = ApiConstants.IS_FEATURED, type = CommandType.BOOLEAN, description = "True for featured Template/ISO, false otherwise")
private Boolean featured;
- @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "true for public template/iso, false for private templates/isos")
+ @Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "True for public Template/ISO, false for private Templates/ISOs")
private Boolean isPublic;
@Parameter(name = ApiConstants.IS_EXTRACTABLE,
type = CommandType.BOOLEAN,
- description = "true if the template/iso is extractable, false other wise. Can be set only by root admin")
+ description = "True if the Template/ISO is extractable, false otherwise. Can be set only by root admin")
private Boolean isExtractable;
- @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "permission operator (add, remove, reset)")
+ @Parameter(name = ApiConstants.OP, type = CommandType.STRING, description = "Permission operator (add, remove, reset)")
private String operation;
@Parameter(name = ApiConstants.PROJECT_IDS,
type = CommandType.LIST,
collectionType = CommandType.UUID,
entityType = ProjectResponse.class,
- description = "a comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
+ description = "A comma delimited list of projects. If specified, \"op\" parameter has to be passed in.")
private List projectIds;
// ///////////////////////////////////////////////////
@@ -121,7 +121,7 @@ public void execute() {
SuccessResponse response = new SuccessResponse(getCommandName());
setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update template/iso permissions");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Template/ISO permissions");
}
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java b/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
index 8e92e877f5ca..6e880c89432f 100644
--- a/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
+++ b/api/src/main/java/org/apache/cloudstack/api/ResponseGenerator.java
@@ -24,6 +24,8 @@
import org.apache.cloudstack.api.response.ConsoleSessionResponse;
import org.apache.cloudstack.consoleproxy.ConsoleSession;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPair;
+import org.apache.cloudstack.acl.apikeypair.ApiKeyPairPermission;
import org.apache.cloudstack.affinity.AffinityGroup;
import org.apache.cloudstack.affinity.AffinityGroupResponse;
import org.apache.cloudstack.api.ApiConstants.HostDetails;
@@ -41,6 +43,7 @@
import org.apache.cloudstack.api.response.BackupOfferingResponse;
import org.apache.cloudstack.api.response.BackupRepositoryResponse;
import org.apache.cloudstack.api.response.BackupScheduleResponse;
+import org.apache.cloudstack.api.response.BaseRolePermissionResponse;
import org.apache.cloudstack.api.response.BucketResponse;
import org.apache.cloudstack.api.response.CapacityResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
@@ -77,6 +80,7 @@
import org.apache.cloudstack.api.response.IpForwardingRuleResponse;
import org.apache.cloudstack.api.response.IpQuarantineResponse;
import org.apache.cloudstack.api.response.IsolationMethodResponse;
+import org.apache.cloudstack.api.response.ApiKeyPairResponse;
import org.apache.cloudstack.api.response.LBHealthCheckResponse;
import org.apache.cloudstack.api.response.LBStickinessResponse;
import org.apache.cloudstack.api.response.ListResponse;
@@ -277,7 +281,8 @@ public interface ResponseGenerator {
List createUserVmResponse(ResponseView view, String objectName, UserVm... userVms);
- List createUserVmResponse(ResponseView view, String objectName, EnumSet details, UserVm... userVms);
+ List createUserVmResponse(ResponseView view, String objectName, EnumSet details,
+ UserVm... userVms);
SystemVmResponse createSystemVmResponse(VirtualMachine systemVM);
@@ -303,11 +308,13 @@ public interface ResponseGenerator {
LoadBalancerResponse createLoadBalancerResponse(LoadBalancer loadBalancer);
- LBStickinessResponse createLBStickinessPolicyResponse(List extends StickinessPolicy> stickinessPolicies, LoadBalancer lb);
+ LBStickinessResponse createLBStickinessPolicyResponse(List extends StickinessPolicy> stickinessPolicies,
+ LoadBalancer lb);
LBStickinessResponse createLBStickinessPolicyResponse(StickinessPolicy stickinessPolicy, LoadBalancer lb);
- LBHealthCheckResponse createLBHealthCheckPolicyResponse(List extends HealthCheckPolicy> healthcheckPolicies, LoadBalancer lb);
+ LBHealthCheckResponse createLBHealthCheckPolicyResponse(List extends HealthCheckPolicy> healthcheckPolicies,
+ LoadBalancer lb);
LBHealthCheckResponse createLBHealthCheckPolicyResponse(HealthCheckPolicy healthcheckPolicy, LoadBalancer lb);
@@ -315,7 +322,8 @@ public interface ResponseGenerator {
PodResponse createMinimalPodResponse(Pod pod);
- ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities, Boolean showResourceIcon);
+ ZoneResponse createZoneResponse(ResponseView view, DataCenter dataCenter, Boolean showCapacities,
+ Boolean showResourceIcon);
DataCenterGuestIpv6PrefixResponse createDataCenterGuestIpv6PrefixResponse(DataCenterGuestIpv6Prefix prefix);
@@ -339,6 +347,8 @@ public interface ResponseGenerator {
UserVm findUserVmById(Long vmId);
+ UserVm findUserVmByNicId(Long nicId);
+
Volume findVolumeById(Long volumeId);
Account findAccountByNameDomain(String accountName, Long domainId);
@@ -355,7 +365,8 @@ public interface ResponseGenerator {
List createTemplateResponses(ResponseView view, long templateId, Long zoneId, boolean readyOnly);
- List createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId, boolean readyOnly);
+ List createTemplateResponses(ResponseView view, long templateId, Long snapshotId, Long volumeId,
+ boolean readyOnly);
SecurityGroupResponse createSecurityGroupResponseFromSecurityGroupRule(List extends SecurityRule> securityRules);
@@ -374,14 +385,15 @@ public interface ResponseGenerator {
TemplateResponse createTemplateUpdateResponse(ResponseView view, VirtualMachineTemplate result);
List createTemplateResponses(ResponseView view, VirtualMachineTemplate result,
- Long zoneId, boolean readyOnly);
+ Long zoneId, boolean readyOnly);
List createTemplateResponses(ResponseView view, VirtualMachineTemplate result,
- List zoneIds, boolean readyOnly);
+ List zoneIds, boolean readyOnly);
List createCapacityResponse(List extends Capacity> result, DecimalFormat format);
- TemplatePermissionsResponse createTemplatePermissionsResponse(ResponseView view, List accountNames, Long id);
+ TemplatePermissionsResponse createTemplatePermissionsResponse(ResponseView view, List accountNames,
+ Long id);
AsyncJobResponse queryJobResult(QueryAsyncJobResultCmd cmd);
@@ -395,7 +407,8 @@ List createTemplateResponses(ResponseView view, VirtualMachine
Long getSecurityGroupId(String groupName, long accountId);
- List createIsoResponses(ResponseView view, VirtualMachineTemplate iso, Long zoneId, boolean readyOnly);
+ List createIsoResponses(ResponseView view, VirtualMachineTemplate iso, Long zoneId,
+ boolean readyOnly);
ProjectResponse createProjectResponse(Project project);
@@ -496,13 +509,15 @@ List createTemplateResponses(ResponseView view, VirtualMachine
GuestOsMappingResponse createGuestOSMappingResponse(GuestOSHypervisor osHypervisor);
- HypervisorGuestOsNamesResponse createHypervisorGuestOSNamesResponse(List> hypervisorGuestOsNames);
+ HypervisorGuestOsNamesResponse createHypervisorGuestOSNamesResponse(
+ List> hypervisorGuestOsNames);
SnapshotScheduleResponse createSnapshotScheduleResponse(SnapshotSchedule sched);
UsageRecordResponse createUsageResponse(Usage usageRecord);
- UsageRecordResponse createUsageResponse(Usage usageRecord, Map> resourceTagResponseMap, boolean oldFormat);
+ UsageRecordResponse createUsageResponse(Usage usageRecord,
+ Map> resourceTagResponseMap, boolean oldFormat);
public Map> getUsageResourceTags();
@@ -514,7 +529,8 @@ List createTemplateResponses(ResponseView view, VirtualMachine
public NicResponse createNicResponse(Nic result);
- ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb, Map lbInstances);
+ ApplicationLoadBalancerResponse createLoadBalancerContainerReponse(ApplicationLoadBalancerRule lb,
+ Map lbInstances);
AffinityGroupResponse createAffinityGroupResponse(AffinityGroup group);
@@ -540,9 +556,12 @@ List createTemplateResponses(ResponseView view, VirtualMachine
ManagementServerResponse createManagementResponse(ManagementServerHost mgmt);
- List createHealthCheckResponse(VirtualMachine router, List healthCheckResults);
+ List createHealthCheckResponse(VirtualMachine router,
+ List healthCheckResults);
- RollingMaintenanceResponse createRollingMaintenanceResponse(Boolean success, String details, List hostsUpdated, List hostsSkipped);
+ RollingMaintenanceResponse createRollingMaintenanceResponse(Boolean success, String details,
+ List hostsUpdated,
+ List hostsSkipped);
ResourceIconResponse createResourceIconResponse(ResourceIcon resourceIcon);
@@ -552,11 +571,14 @@ List createTemplateResponses(ResponseView view, VirtualMachine
DirectDownloadCertificateResponse createDirectDownloadCertificateResponse(DirectDownloadCertificate certificate);
- List createDirectDownloadCertificateHostMapResponse(List hostMappings);
+ List createDirectDownloadCertificateHostMapResponse(
+ List hostMappings);
- DirectDownloadCertificateHostStatusResponse createDirectDownloadCertificateHostStatusResponse(DirectDownloadManager.HostCertificateStatus status);
+ DirectDownloadCertificateHostStatusResponse createDirectDownloadCertificateHostStatusResponse(
+ DirectDownloadManager.HostCertificateStatus status);
- DirectDownloadCertificateHostStatusResponse createDirectDownloadCertificateProvisionResponse(Long certificateId, Long hostId, Pair result);
+ DirectDownloadCertificateHostStatusResponse createDirectDownloadCertificateProvisionResponse(Long certificateId,
+ Long hostId, Pair result);
FirewallResponse createIpv6FirewallRuleResponse(FirewallRule acl);
@@ -583,4 +605,8 @@ List createTemplateResponses(ResponseView view, VirtualMachine
GuiThemeResponse createGuiThemeResponse(GuiThemeJoin guiThemeJoin);
ConsoleSessionResponse createConsoleSessionResponse(ConsoleSession consoleSession, ResponseView responseView);
+
+ ApiKeyPairResponse createKeyPairResponse(ApiKeyPair keyPair);
+
+ ListResponse createKeypairPermissionsResponse(List permissions);
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
index 6dbc6acc59a9..cc154ed964b3 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/CreateAccountCmd.java
@@ -50,12 +50,12 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.ACCOUNT,
type = CommandType.STRING,
- description = "Name of the account to be created. The user will be added to this newly created account. If no account is specified, the username will be used as the account name.")
+ description = "Name of the Account to be created. The user will be added to this newly created account. If no Account is specified, the username will be used as the Account name.")
private String accountName;
@Parameter(name = ApiConstants.ACCOUNT_TYPE,
type = CommandType.INTEGER,
- description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
+ description = "Type of the account. Specify 0 for user, 1 for root admin, and 2 for domain admin")
private Integer accountType;
@Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "Creates the account under the specified role.")
@@ -64,13 +64,13 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Creates the user under the specified domain.")
private Long domainId;
- @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "email")
+ @Parameter(name = ApiConstants.EMAIL, type = CommandType.STRING, required = true, description = "E-mail")
private String email;
- @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "firstname")
+ @Parameter(name = ApiConstants.FIRSTNAME, type = CommandType.STRING, required = true, description = "First name")
private String firstName;
- @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "lastname")
+ @Parameter(name = ApiConstants.LASTNAME, type = CommandType.STRING, required = true, description = "Last name")
private String lastName;
@Parameter(name = ApiConstants.PASSWORD,
@@ -87,16 +87,16 @@ public class CreateAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.USERNAME, type = CommandType.STRING, required = true, description = "Unique username.")
private String userName;
- @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the account's networks")
+ @Parameter(name = ApiConstants.NETWORK_DOMAIN, type = CommandType.STRING, description = "Network domain for the Account's Networks")
private String networkDomain;
- @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "details for account used to store specific parameters")
+ @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for Account used to store specific parameters")
private Map details;
- @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding account from external provisioning system")
+ @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.STRING, description = "Account UUID, required for adding Account from external provisioning system")
private String accountUUID;
- @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding account from external provisioning system")
+ @Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, description = "User UUID, required for adding Account from external provisioning system")
private String userUUID;
/////////////////////////////////////////////////////
@@ -177,7 +177,7 @@ public long getEntityOwnerId() {
@Override
public void execute() {
validateParams();
- CallContext.current().setEventDetails("Account Name: " + getUsername() + ", Domain Id:" + getDomainId());
+ CallContext.current().setEventDetails("Account Name: " + getUsername() + ", Domain ID:" + getResourceUuid(ApiConstants.DOMAIN_ID));
UserAccount userAccount =
_accountService.createUserAccount(this);
if (userAccount != null) {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
index a90fc4aebe9c..c207801e3640 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DeleteAccountCmd.java
@@ -35,7 +35,7 @@
import com.cloud.event.EventTypes;
import com.cloud.user.Account;
-@APICommand(name = "deleteAccount", description = "Deletes a account, and all users associated with this account", responseObject = SuccessResponse.class, entityType = {Account.class},
+@APICommand(name = "deleteAccount", description = "Deletes an Account and all Users associated with this Account", responseObject = SuccessResponse.class, entityType = {Account.class},
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteAccountCmd extends BaseAsyncCmd {
@@ -79,8 +79,8 @@ public String getEventType() {
@Override
public String getEventDescription() {
Account account = _accountService.getAccount(getId());
- return (account != null ? "Deleting user account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users"
- : "Account delete, but this account does not exist in the system");
+ return (account != null ? "Deleting user Account " + account.getAccountName() + " (ID: " + account.getUuid() + ") and all corresponding users"
+ : "Cannot delete Account - it does not exist in the system");
}
@Override
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
index 55293eca619e..f7f8bd974272 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/DisableAccountCmd.java
@@ -50,13 +50,13 @@ public class DisableAccountCmd extends BaseAsyncCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
private Long id;
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Disables specified account.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Disables specified Account.")
private String accountName;
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Disables specified account in this domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Disables specified Account in this domain.")
private Long domainId;
- @Parameter(name = ApiConstants.LOCK, type = CommandType.BOOLEAN, required = true, description = "If true, only lock the account; else disable the account")
+ @Parameter(name = ApiConstants.LOCK, type = CommandType.BOOLEAN, required = true, description = "If true, only lock the Account; else disable the Account")
private Boolean lockRequested;
@Inject
@@ -108,19 +108,27 @@ public long getEntityOwnerId() {
@Override
public String getEventDescription() {
- return "disabling account: " + getAccountName() + " in domain: " + getDomainId();
+ String message = "Disabling Account ";
+
+ if (getId() != null) {
+ message += "with ID: " + getResourceUuid(ApiConstants.ID);
+ } else {
+ message += getAccountName() + " in Domain: " + getResourceUuid(ApiConstants.DOMAIN_ID);
+ }
+
+ return message;
}
@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException {
- CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getDomainId());
+ CallContext.current().setEventDetails("Account Name: " + getAccountName() + ", Domain Id:" + getResourceUuid(ApiConstants.DOMAIN_ID));
Account result = _regionService.disableAccount(this);
if (result != null){
AccountResponse response = _responseGenerator.createAccountResponse(ResponseView.Full, result);
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock account" : "Failed to disable account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, lockRequested == true ? "Failed to lock Account" : "Failed to disable Account");
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
index da96383f1345..7478bc8b8116 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/EnableAccountCmd.java
@@ -46,10 +46,10 @@ public class EnableAccountCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account id")
private Long id;
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Enables specified account.")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Enables specified Account.")
private String accountName;
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Enables specified account in this domain.")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "Enables specified Account in this domain.")
private Long domainId;
@Inject
@@ -98,7 +98,7 @@ public void execute() {
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to enable Account");
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
index 09a626ac9547..50e9ba4989cd 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/ListAccountsCmdByAdmin.java
@@ -23,7 +23,7 @@
import com.cloud.user.Account;
-@APICommand(name = "listAccounts", description = "Lists accounts and provides detailed account information for listed accounts", responseObject = AccountResponse.class, responseView = ResponseView.Full, entityType = {Account.class},
+@APICommand(name = "listAccounts", description = "Lists Accounts and provides detailed Account information for listed Accounts", responseObject = AccountResponse.class, responseView = ResponseView.Full, entityType = {Account.class},
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class ListAccountsCmdByAdmin extends ListAccountsCmd {
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
index d7847373e927..3ec191acf846 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/LockAccountCmd.java
@@ -28,7 +28,7 @@
import com.cloud.utils.exception.CloudRuntimeException;
@APICommand(name = "lockAccount",
- description = "This deprecated function used to locks an account. Look for the API DisableAccount instead",
+ description = "This deprecated function used to lock an Account. Look for the API DisableAccount instead",
responseObject = AccountResponse.class,
entityType = {Account.class},
requestHasSensitiveInfo = false,
@@ -47,7 +47,7 @@ public class LockAccountCmd extends BaseCmd {
type = CommandType.UUID,
entityType = DomainResponse.class,
required = true,
- description = "Locks the specified account on this domain.")
+ description = "Locks the specified Account on this domain.")
private Long domainId;
/////////////////////////////////////////////////////
@@ -78,6 +78,6 @@ public long getEntityOwnerId() {
@Override
public void execute() {
- throw new CloudRuntimeException("LockAccount does not lock accounts. Its implementation is disabled. Use DisableAccount instead");
+ throw new CloudRuntimeException("LockAccount does not lock Accounts. Its implementation is disabled. Use DisableAccount instead.");
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
index 3347a0d09f37..b6b975ae1ce7 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/account/UpdateAccountCmd.java
@@ -41,7 +41,7 @@
import com.cloud.user.Account;
-@APICommand(name = "updateAccount", description = "Updates account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class},
+@APICommand(name = "updateAccount", description = "Updates Account information for the authenticated user", responseObject = AccountResponse.class, entityType = {Account.class},
responseView = ResponseView.Restricted, requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
public class UpdateAccountCmd extends BaseCmd implements UserCmd {
@@ -52,24 +52,24 @@ public class UpdateAccountCmd extends BaseCmd implements UserCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID")
private Long id;
- @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Current account name")
+ @Parameter(name = ApiConstants.ACCOUNT, type = CommandType.STRING, description = "Current Account name")
private String accountName;
- @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The UUID of the domain where the account exists")
+ @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, entityType = DomainResponse.class, description = "The UUID of the domain where the Account exists")
private Long domainId;
- @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "The UUID of the dynamic role to set for the account")
+ @Parameter(name = ApiConstants.ROLE_ID, type = CommandType.UUID, entityType = RoleResponse.class, description = "The UUID of the dynamic role to set for the Account")
private Long roleId;
- @Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, description = "New name for the account")
+ @Parameter(name = ApiConstants.NEW_NAME, type = CommandType.STRING, description = "New name for the Account")
private String newName;
@Parameter(name = ApiConstants.NETWORK_DOMAIN,
type = CommandType.STRING,
- description = "Network domain for the account's networks; empty string will update domainName with NULL value")
+ description = "Network domain for the Account's networks; empty string will update domainName with NULL value")
private String networkDomain;
- @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the account used to store specific parameters")
+ @Parameter(name = ApiConstants.ACCOUNT_DETAILS, type = CommandType.MAP, description = "Details for the Account used to store specific parameters")
private Map details;
@Parameter(name = ApiConstants.API_KEY_ACCESS, type = CommandType.STRING, description = "Determines if Api key access for this user is enabled, disabled or inherits the value from its parent, the domain level setting api.key.access", since = "4.20.1.0", authorized = {RoleType.Admin})
@@ -144,7 +144,7 @@ public void execute() {
response.setResponseName(getCommandName());
setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update account");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update Account");
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
index e67a3e2c0a00..59a09ef7a486 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRoleCmd.java
@@ -109,7 +109,7 @@ private void validateRoleParameters() {
}
if (getRoleId() != null && getRoleId() < 1L) {
- throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role ID provided");
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
index 232c4760e1e6..13405431f63e 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/CreateRolePermissionCmd.java
@@ -81,7 +81,7 @@ public void execute() {
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role id provided");
}
- CallContext.current().setEventDetails("Role id: " + role.getId() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription());
+ CallContext.current().setEventDetails("Role ID: " + role.getUuid() + ", rule:" + getRule() + ", permission: " + getPermission() + ", description: " + getDescription());
final RolePermission rolePermission = roleService.createRolePermission(role, getRule(), getPermission(), getDescription());
if (rolePermission == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create role permission");
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
index fd2d11aeda0a..80ec08260ab2 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRoleCmd.java
@@ -70,7 +70,7 @@ public void execute() {
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
}
- CallContext.current().setEventDetails("Role id: " + role.getId());
+ CallContext.current().setEventDetails("Role ID: " + role.getUuid());
boolean result = roleService.deleteRole(role);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
index bedaca9e23af..cf4a62bf6c43 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DeleteRolePermissionCmd.java
@@ -68,7 +68,7 @@ public void execute() {
if (rolePermission == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided");
}
- CallContext.current().setEventDetails("Role permission id: " + rolePermission.getId());
+ CallContext.current().setEventDetails("Role permission ID: " + rolePermission.getUuid());
boolean result = roleService.deleteRolePermission(rolePermission);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java
index 80cb92c8362f..2c5659b2bc4b 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/DisableRoleCmd.java
@@ -55,7 +55,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
}
- CallContext.current().setEventDetails("Role id: " + role.getId());
+ CallContext.current().setEventDetails("Role ID: " + role.getUuid());
boolean result = roleService.disableRole(role);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java
index c4a6505d52f6..05dfbe1270fa 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/EnableRoleCmd.java
@@ -55,7 +55,7 @@ public void execute() throws ResourceUnavailableException, InsufficientCapacityE
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find the role with provided id");
}
- CallContext.current().setEventDetails("Role id: " + role.getId());
+ CallContext.current().setEventDetails("Role ID: " + role.getUuid());
boolean result = roleService.enableRole(role);
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
index 7d002cd889b6..78fe062ac43e 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRoleCmd.java
@@ -46,7 +46,7 @@ public class UpdateRoleCmd extends RoleCmd {
description = "ID of the role", validations = {ApiArgValidator.PositiveNumber})
private Long roleId;
- @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "creates a role with this unique name")
+ @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, description = "Creates a role with this unique name")
private String roleName;
@Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, description = "The description of the role")
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
index 3f926092ec3e..992564413f6b 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/UpdateRolePermissionCmd.java
@@ -53,7 +53,7 @@ public class UpdateRolePermissionCmd extends BaseCmd {
private Long roleId;
@Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = RolePermissionResponse.class,
- description = "The parent role permission uuid, use 0 to move this rule at the top of the list")
+ description = "The parent role permission UUID, use 0 to move this rule at the top of the list")
private List rulePermissionOrder;
@Parameter(name = ApiConstants.RULE_ID, type = CommandType.UUID, entityType = RolePermissionResponse.class,
@@ -111,7 +111,7 @@ public void execute() {
if (getRuleId() != null || getRulePermission() != null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder");
}
- CallContext.current().setEventDetails("Reordering permissions for role id: " + role.getId());
+ CallContext.current().setEventDetails("Reordering permissions for role with ID: " + role.getUuid());
final List rolePermissionsOrder = new ArrayList<>();
for (Long rolePermissionId : getRulePermissionOrder()) {
final RolePermission rolePermission = roleService.findRolePermission(rolePermissionId);
@@ -129,7 +129,7 @@ public void execute() {
if (rolePermission == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid rule id provided");
}
- CallContext.current().setEventDetails("Updating permission for rule id: " + getRuleId() + " to: " + getRulePermission().toString());
+ CallContext.current().setEventDetails("Updating permission for rule with ID: " + getResourceUuid(ApiConstants.RULE_ID) + " to: " + getRulePermission().toString());
result = roleService.updateRolePermission(role, rolePermission, getRulePermission());
}
SuccessResponse response = new SuccessResponse(getCommandName());
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java
index ed17a876b248..f71daee5b531 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRoleCmd.java
@@ -41,7 +41,7 @@ public class CreateProjectRoleCmd extends ProjectRoleCmd {
/////////////////////////////////////////////////////
@Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true,
- description = "creates a project role with this unique name")
+ description = "Creates a project role with this unique name")
private String projectRoleName;
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java
index d39c2312aa91..e085c10cee0b 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/CreateProjectRolePermissionCmd.java
@@ -72,7 +72,7 @@ public void execute() {
if (projectRole == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid project role ID provided");
}
- CallContext.current().setEventDetails("Project Role ID: " + projectRole.getId() + ", Rule:" + getRule() + ", Permission: " + getPermission() + ", Description: " + getDescription());
+ CallContext.current().setEventDetails("Project Role ID: " + projectRole.getUuid() + ", Rule:" + getRule() + ", Permission: " + getPermission() + ", Description: " + getDescription());
final ProjectRolePermission projectRolePermission = projRoleService.createProjectRolePermission(this);
if (projectRolePermission == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create project role permission");
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java
index 9f8d82489584..84f73e7a1a32 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRoleCmd.java
@@ -69,7 +69,7 @@ public void execute() {
if (role == null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Cannot find project role with provided id");
}
- CallContext.current().setEventDetails("Deleting Project Role with id: " + role.getId());
+ CallContext.current().setEventDetails("Deleting Project Role with ID: " + role.getUuid());
boolean result = projRoleService.deleteProjectRole(role, getProjectId());
SuccessResponse response = new SuccessResponse(getCommandName());
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java
index ac68278535e2..d7941a6a4cc3 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/DeleteProjectRolePermissionCmd.java
@@ -70,7 +70,7 @@ public void execute() {
if (rolePermission == null || rolePermission.getProjectId() != getProjectId()) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Invalid role permission id provided for the project");
}
- CallContext.current().setEventDetails("Deleting Project Role permission with id: " + rolePermission.getId());
+ CallContext.current().setEventDetails("Deleting Project Role permission with ID: " + rolePermission.getUuid());
boolean result = projRoleService.deleteProjectRolePermission(rolePermission);
SuccessResponse response = new SuccessResponse();
response.setSuccess(result);
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java
index 3bc8b3d61868..80dbfd71275f 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRoleCmd.java
@@ -43,7 +43,7 @@ public class UpdateProjectRoleCmd extends ProjectRoleCmd {
private Long id;
@Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING,
- description = "creates a project role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
+ description = "Creates a project role with this unique name", validations = {ApiArgValidator.NotNullOrEmpty})
private String projectRoleName;
/////////////////////////////////////////////////////
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java
index dd59310c66ae..fd0c043f2321 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/acl/project/UpdateProjectRolePermissionCmd.java
@@ -57,7 +57,7 @@ public class UpdateProjectRolePermissionCmd extends BaseCmd {
private Long projectId;
@Parameter(name = ApiConstants.RULE_ORDER, type = CommandType.LIST, collectionType = CommandType.UUID, entityType = ProjectRolePermissionResponse.class,
- description = "The parent role permission uuid, use 0 to move this rule at the top of the list")
+ description = "ID of the parent role permission, use 0 to move this rule at the top of the list")
private List projectRulePermissionOrder;
@Parameter(name = ApiConstants.PROJECT_ROLE_PERMISSION_ID, type = CommandType.UUID, entityType = ProjectRolePermissionResponse.class,
@@ -115,7 +115,7 @@ public void execute() {
if (getProjectRuleId() != null || getProjectRolePermission() != null) {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder");
}
- CallContext.current().setEventDetails("Reordering permissions for role id: " + projectRole.getId());
+ CallContext.current().setEventDetails("Reordering permissions for role with ID: " + projectRole.getUuid());
result = updateProjectRolePermissionOrder(projectRole);
} else if (getProjectRuleId() != null || getProjectRolePermission() != null ) {
@@ -123,7 +123,7 @@ public void execute() {
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Parameters permission and ruleid must be mutually exclusive with ruleorder");
}
ProjectRolePermission rolePermission = getValidProjectRolePermission();
- CallContext.current().setEventDetails("Updating project role permission for rule id: " + getProjectRuleId() + " to: " + getProjectRolePermission().toString());
+ CallContext.current().setEventDetails("Updating project role permission for rule ID: " + getProjectRuleId() + " to: " + getProjectRolePermission().toString());
result = projRoleService.updateProjectRolePermission(projectId, projectRole, rolePermission, getProjectRolePermission());
}
SuccessResponse response = new SuccessResponse(getCommandName());
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
index 7397697bd2cc..88c48103c1b4 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AcquirePodIpCmdByAdmin.java
@@ -40,7 +40,7 @@ public class AcquirePodIpCmdByAdmin extends BaseCmd {
//////////////// API parameters /////////////////////
/////////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "the ID of the zone")
+ @Parameter(name = ApiConstants.ZONE_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = true, description = "The ID of the zone")
private String zoneId;
@Parameter(name = ApiConstants.POD_ID, type = CommandType.STRING, entityType = ZoneResponse.class, required = false, description = "Pod ID")
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
index 672691ffbd8f..a34de31f78e1 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/AssociateIPAddrCmdByAdmin.java
@@ -23,7 +23,7 @@
import org.apache.cloudstack.api.command.user.address.AssociateIPAddrCmd;
import org.apache.cloudstack.api.response.IPAddressResponse;
-@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
+@APICommand(name = "associateIpAddress", description = "Acquires and associates a public IP to an Account.", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class AssociateIPAddrCmdByAdmin extends AssociateIPAddrCmd implements AdminCmd {
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
index 4bd6aa7227c8..9976747e1b62 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ListPublicIpAddressesCmdByAdmin.java
@@ -24,6 +24,6 @@
import com.cloud.network.IpAddress;
-@APICommand(name = "listPublicIpAddresses", description = "Lists all public ip addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
+@APICommand(name = "listPublicIpAddresses", description = "Lists all public IP addresses", responseObject = IPAddressResponse.class, responseView = ResponseView.Full,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, entityType = {IpAddress.class})
public class ListPublicIpAddressesCmdByAdmin extends ListPublicIpAddressesCmd implements AdminCmd {}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
index 7d4cab6a0ac4..266c8eecd58c 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/address/ReleasePodIpCmdByAdmin.java
@@ -70,7 +70,7 @@ public void execute() {
response.setDisplayText("IP is released successfully");
setResponseObject(response);
} else {
- throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod ip ");
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to release Pod IP");
}
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
index 43e70838e18f..fbe2d3cc0bd2 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/affinitygroup/UpdateVMAffinityGroupCmdByAdmin.java
@@ -26,7 +26,7 @@
import com.cloud.vm.VirtualMachine;
-@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of a virtual machine. The VM has to be stopped and restarted for the "
+@APICommand(name = "updateVMAffinityGroup", description = "Updates the affinity/anti-affinity group associations of an Instance. The Instance has to be stopped and restarted for the "
+ "new properties to take effect.", responseObject = UserVmResponse.class, responseView = ResponseView.Full,
entityType = {VirtualMachine.class},
requestHasSensitiveInfo = false,
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
index c2ded921c401..834fda1834bb 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/AddAnnotationCmd.java
@@ -33,22 +33,22 @@
import org.apache.cloudstack.context.CallContext;
import org.apache.commons.lang3.BooleanUtils;
-@APICommand(name = "addAnnotation", description = "add an annotation.", responseObject = AnnotationResponse.class,
+@APICommand(name = "addAnnotation", description = "Add an annotation.", responseObject = AnnotationResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.11", authorized = {RoleType.Admin})
public class AddAnnotationCmd extends BaseCmd {
- @Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "the annotation text")
+ @Parameter(name = ApiConstants.ANNOTATION, type = CommandType.STRING, description = "The annotation text")
private String annotation;
@Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "The following entity types are allowed VM, VOLUME, SNAPSHOT, VM_SNAPSHOT, INSTANCE_GROUP, SSH_KEYPAIR, USER_DATA, NETWORK, VPC, PUBLIC_IP_ADDRESS, VPN_CUSTOMER_GATEWAY, TEMPLATE, ISO, KUBERNETES_CLUSTER, SERVICE_OFFERING, DISK_OFFERING, NETWORK_OFFERING, ZONE, POD, CLUSTER, HOST, DOMAIN, PRIMARY_STORAGE, SECONDARY_STORAGE, VR, SYSTEM_VM, AUTOSCALE_VM_GROUP, MANAGEMENT_SERVER")
private String entityType;
- @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "the id of the entity to annotate")
+ @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "The ID of the entity to annotate")
private String entityUuid;
@Parameter(name = ApiConstants.ADMINS_ONLY, type = CommandType.BOOLEAN, since = "4.16.0",
- description = "the annotation is visible for admins only")
+ description = "The annotation is visible for admins only")
private Boolean adminsOnly;
public String getAnnotation() {
@@ -77,7 +77,7 @@ public boolean isAdminsOnly() {
public void execute()
throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException,
NetworkRuleConflictException {
- Preconditions.checkNotNull(getEntityUuid(),"I have to have an entity to set an annotation on!");
+ Preconditions.checkNotNull(getEntityUuid(),"I need to have an entity to set an annotation on!");
Preconditions.checkState(AnnotationService.EntityType.contains(entityType),(java.lang.String)"'%s' is not a valid EntityType to put annotations on", entityType);
AnnotationResponse annotationResponse = annotationService.addAnnotation(this);
annotationResponse.setResponseName(getCommandName());
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
index 3df4536786f4..fcaba5154e1f 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/ListAnnotationsCmd.java
@@ -37,22 +37,22 @@
public class ListAnnotationsCmd extends BaseListCmd {
- @Parameter(name = ApiConstants.ID, type = CommandType.STRING, description = "the id of the annotation")
+ @Parameter(name = ApiConstants.ID, type = CommandType.STRING, description = "The ID of the annotation")
private String uuid;
- @Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "the entity type")
+ @Parameter(name = ApiConstants.ENTITY_TYPE, type = CommandType.STRING, description = "The entity type")
private String entityType;
- @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "the id of the entity for which to show annotations")
+ @Parameter(name = ApiConstants.ENTITY_ID, type = CommandType.STRING, description = "The ID of the entity for which to show annotations")
private String entityUuid;
@Parameter(name = ApiConstants.USER_ID, type = CommandType.STRING, since = "4.16.0",
- description = "optional: the id of the user of the annotation", required = false)
+ description = "Optional: The ID of the user of the annotation", required = false)
private String userUuid;
@Parameter(name = ApiConstants.ANNOTATION_FILTER,
type = CommandType.STRING, since = "4.16.0",
- description = "possible values are \"self\" and \"all\". "
+ description = "Possible values are \"self\" and \"all\". "
+ "* self : annotations that have been created by the calling user. "
+ "* all : all the annotations the calling user can access")
private String annotationFilter;
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
index 693ad09bfa9b..d173c35289f2 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/RemoveAnnotationCmd.java
@@ -30,12 +30,12 @@
import org.apache.cloudstack.api.response.AnnotationResponse;
import org.apache.cloudstack.context.CallContext;
-@APICommand(name = "removeAnnotation", description = "remove an annotation.", responseObject = AnnotationResponse.class,
+@APICommand(name = "removeAnnotation", description = "Remove an annotation.", responseObject = AnnotationResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, since = "4.11", authorized = {RoleType.Admin})
public class RemoveAnnotationCmd extends BaseCmd {
- @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "the id of the annotation")
+ @Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true, description = "The ID of the annotation")
private String uuid;
public String getUuid() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java
index b1b7295510cd..d0bd7042ead8 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/annotation/UpdateAnnotationVisibilityCmd.java
@@ -30,7 +30,7 @@
import org.apache.cloudstack.api.response.AnnotationResponse;
import org.apache.cloudstack.context.CallContext;
-@APICommand(name = "updateAnnotationVisibility", description = "update an annotation visibility.",
+@APICommand(name = "updateAnnotationVisibility", description = "Update an annotation visibility.",
responseObject = AnnotationResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
since = "4.16", authorized = {RoleType.Admin})
@@ -38,11 +38,11 @@ public class UpdateAnnotationVisibilityCmd extends BaseCmd {
@Parameter(name = ApiConstants.ID, type = CommandType.STRING, required = true,
- description = "the id of the annotation")
+ description = "The ID of the annotation")
private String uuid;
@Parameter(name = ApiConstants.ADMINS_ONLY, type = CommandType.BOOLEAN, required = true,
- description = "the annotation is visible for admins only")
+ description = "The annotation is visible for admins only")
private Boolean adminsOnly;
public String getUuid() {
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
index 7fa66ffff1f4..d7be56bf3f46 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/CreateCounterCmd.java
@@ -17,6 +17,7 @@
package org.apache.cloudstack.api.command.admin.autoscale;
+import org.apache.cloudstack.context.CallContext;
import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiCommandResourceType;
@@ -31,7 +32,7 @@
import com.cloud.network.as.Counter;
import com.cloud.user.Account;
-@APICommand(name = "createCounter", description = "Adds metric counter for VM auto scaling", responseObject = CounterResponse.class,
+@APICommand(name = "createCounter", description = "Adds metric counter for Instance auto scaling", responseObject = CounterResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class CreateCounterCmd extends BaseAsyncCreateCmd {
private static final String s_name = "counterresponse";
@@ -89,9 +90,6 @@ public void create() {
if (ctr != null) {
this.setEntityId(ctr.getId());
this.setEntityUuid(ctr.getUuid());
- CounterResponse response = _responseGenerator.createCounterResponse(ctr);
- response.setResponseName(getCommandName());
- this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Counter with name " + getName());
}
@@ -99,6 +97,11 @@ public void create() {
@Override
public void execute() {
+ CallContext.current().setEventDetails("Counter ID: " + getEntityUuid());
+ Counter ctr = _autoScaleService.getCounter(getEntityId());
+ CounterResponse response = _responseGenerator.createCounterResponse(ctr);
+ response.setResponseName(getCommandName());
+ this.setResponseObject(response);
}
@Override
@@ -113,7 +116,7 @@ public String getEventType() {
@Override
public String getEventDescription() {
- return "creating a new Counter";
+ return "Creating a new Counter";
}
@Override
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
index b7b2ce5cb70d..8e941965e84b 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/autoscale/DeleteCounterCmd.java
@@ -32,7 +32,7 @@
import com.cloud.exception.ResourceInUseException;
import com.cloud.user.Account;
-@APICommand(name = "deleteCounter", description = "Deletes a counter for VM auto scaling", responseObject = SuccessResponse.class,
+@APICommand(name = "deleteCounter", description = "Deletes a counter for Instance auto scaling", responseObject = SuccessResponse.class,
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
public class DeleteCounterCmd extends BaseAsyncCmd {
@@ -40,7 +40,7 @@ public class DeleteCounterCmd extends BaseAsyncCmd {
// ////////////// API parameters /////////////////////
// ///////////////////////////////////////////////////
- @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "the ID of the counter")
+ @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = CounterResponse.class, required = true, description = "The ID of the counter")
private Long id;
// ///////////////////////////////////////////////////
@@ -61,7 +61,7 @@ public void execute() {
SuccessResponse response = new SuccessResponse(getCommandName());
this.setResponseObject(response);
} else {
- logger.warn("Failed to delete counter with Id: " + getId());
+ logger.warn("Failed to delete counter with Id: {}", getId());
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete counter.");
}
}
@@ -91,6 +91,6 @@ public String getEventType() {
@Override
public String getEventDescription() {
- return "Deleting a counter.";
+ return "Deleting auto scaling counter with ID: " + getResourceUuid(ApiConstants.ID);
}
}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java
new file mode 100644
index 000000000000..500a77f3d4fc
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CloneBackupOfferingCmd.java
@@ -0,0 +1,166 @@
+// 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.backup;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.BaseCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.offering.DomainAndZoneIdResolver;
+import org.apache.cloudstack.api.response.BackupOfferingResponse;
+import org.apache.cloudstack.api.response.ZoneResponse;
+import org.apache.cloudstack.backup.BackupManager;
+import org.apache.cloudstack.backup.BackupOffering;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+import com.cloud.exception.ConcurrentOperationException;
+import com.cloud.exception.InsufficientCapacityException;
+import com.cloud.exception.InvalidParameterValueException;
+import com.cloud.exception.NetworkRuleConflictException;
+import com.cloud.exception.ResourceAllocationException;
+import com.cloud.exception.ResourceUnavailableException;
+import com.cloud.utils.exception.CloudRuntimeException;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.function.LongFunction;
+
+@APICommand(name = "cloneBackupOffering",
+ description = "Clones a backup offering from an existing offering",
+ responseObject = BackupOfferingResponse.class, since = "4.23.0",
+ authorized = {RoleType.Admin})
+public class CloneBackupOfferingCmd extends BaseAsyncCmd implements DomainAndZoneIdResolver {
+
+ @Inject
+ protected BackupManager backupManager;
+
+ /////////////////////////////////////////////////////
+ //////////////// API parameters /////////////////////
+ ////////////////////////////////////////////////////
+
+ @Parameter(name = ApiConstants.SOURCE_OFFERING_ID, type = BaseCmd.CommandType.UUID, entityType = BackupOfferingResponse.class,
+ required = true, description = "The ID of the source backup offering to clone from")
+ private Long sourceOfferingId;
+
+ @Parameter(name = ApiConstants.NAME, type = BaseCmd.CommandType.STRING, required = true,
+ description = "The name of the cloned offering")
+ private String name;
+
+ @Parameter(name = ApiConstants.DESCRIPTION, type = BaseCmd.CommandType.STRING, required = false,
+ description = "The description of the cloned offering")
+ private String description;
+
+ @Parameter(name = ApiConstants.EXTERNAL_ID, type = BaseCmd.CommandType.STRING, required = false,
+ description = "The backup offering ID (from backup provider side)")
+ private String externalId;
+
+ @Parameter(name = ApiConstants.ZONE_ID, type = BaseCmd.CommandType.UUID, entityType = ZoneResponse.class,
+ description = "The zone ID", required = false)
+ private Long zoneId;
+
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.STRING,
+ description = "the ID of the containing domain(s) as comma separated string, public for public offerings",
+ length = 4096)
+ private String domainIds;
+
+ @Parameter(name = ApiConstants.ALLOW_USER_DRIVEN_BACKUPS, type = BaseCmd.CommandType.BOOLEAN,
+ description = "Whether users are allowed to create adhoc backups and backup schedules", required = false)
+ private Boolean userDrivenBackups;
+
+ /////////////////////////////////////////////////////
+ /////////////////// Accessors ///////////////////////
+ /////////////////////////////////////////////////////
+
+ public Long getSourceOfferingId() {
+ return sourceOfferingId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getExternalId() {
+ return externalId;
+ }
+
+ public Long getZoneId() {
+ return zoneId;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public Boolean getUserDrivenBackups() {
+ return userDrivenBackups;
+ }
+
+ public List getDomainIds() {
+ if (domainIds != null && !domainIds.isEmpty()) {
+ return Arrays.asList(Arrays.stream(domainIds.split(",")).map(domainId -> Long.parseLong(domainId.trim())).toArray(Long[]::new));
+ }
+ LongFunction> defaultDomainsProvider = null;
+ if (backupManager != null) {
+ defaultDomainsProvider = backupManager::getBackupOfferingDomains;
+ }
+ return resolveDomainIds(domainIds, sourceOfferingId, defaultDomainsProvider, "backup offering");
+ }
+
+ /////////////////////////////////////////////////////
+ /////////////// API Implementation///////////////////
+ /////////////////////////////////////////////////////
+
+ @Override
+ public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
+ try {
+ BackupOffering policy = backupManager.cloneBackupOffering(this);
+ if (policy == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to clone backup offering");
+ }
+ BackupOfferingResponse response = _responseGenerator.createBackupOfferingResponse(policy);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ } catch (InvalidParameterValueException e) {
+ throw new ServerApiException(ApiErrorCode.PARAM_ERROR, e.getMessage());
+ } catch (CloudRuntimeException e) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, e.getMessage());
+ }
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccount().getId();
+ }
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_BACKUP_OFFERING_CLONE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Cloning backup offering: " + name + " from source offering: " + (sourceOfferingId == null ? "" : sourceOfferingId.toString());
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java
new file mode 100644
index 000000000000..c98bfb850529
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/CreateImageTransferCmd.java
@@ -0,0 +1,100 @@
+//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
+//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.backup;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.acl.RoleType;
+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.command.admin.AdminCmd;
+import org.apache.cloudstack.api.response.BackupResponse;
+import org.apache.cloudstack.api.response.ImageTransferResponse;
+import org.apache.cloudstack.api.response.VolumeResponse;
+import org.apache.cloudstack.backup.ImageTransfer;
+import org.apache.cloudstack.backup.KVMBackupExportService;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.utils.EnumUtils;
+
+@APICommand(name = "createImageTransfer",
+ description = "Create image transfer for a disk in backup. This API is intended for testing only and is disabled by default.",
+ responseObject = ImageTransferResponse.class,
+ since = "4.23.0",
+ authorized = {RoleType.Admin})
+public class CreateImageTransferCmd extends BaseCmd implements AdminCmd {
+
+ @Inject
+ private KVMBackupExportService kvmBackupExportService;
+
+ @Parameter(name = ApiConstants.BACKUP_ID,
+ type = CommandType.UUID,
+ entityType = BackupResponse.class,
+ description = "ID of the backup")
+ private Long backupId;
+
+ @Parameter(name = ApiConstants.VOLUME_ID,
+ type = CommandType.UUID,
+ entityType = VolumeResponse.class,
+ required = true,
+ description = "ID of the disk/volume")
+ private Long volumeId;
+
+ @Parameter(name = ApiConstants.DIRECTION,
+ type = CommandType.STRING,
+ required = true,
+ description = "Direction of the transfer: upload, download")
+ private String direction;
+
+ @Parameter(name = ApiConstants.FORMAT,
+ type = CommandType.STRING,
+ description = "Format for the image transfer: raw/cow. 'raw' will create an NBD backend. 'cow' will use the File backend." +
+ "For download, only the 'raw' format is supported. Default: raw")
+ private String format;
+
+ public Long getBackupId() {
+ return backupId;
+ }
+
+ public Long getVolumeId() {
+ return volumeId;
+ }
+
+ public ImageTransfer.Direction getDirection() {
+ return ImageTransfer.Direction.valueOf(direction);
+ }
+
+ public ImageTransfer.Format getFormat() {
+ return EnumUtils.getEnum(ImageTransfer.Format.class, format);
+ }
+
+ @Override
+ public void execute() {
+ ImageTransferResponse response = kvmBackupExportService.createImageTransfer(this);
+ response.setObjectName(ImageTransfer.class.getSimpleName().toLowerCase());
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccount().getId();
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java
new file mode 100644
index 000000000000..d0e17e86d427
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/DeleteVmCheckpointCmd.java
@@ -0,0 +1,85 @@
+//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
+//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.backup;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.acl.RoleType;
+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.command.admin.AdminCmd;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.backup.KVMBackupExportService;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = "deleteVirtualMachineCheckpoint",
+ description = "Delete a VM checkpoint. This API is intended for testing only and is disabled by default.",
+ responseObject = SuccessResponse.class,
+ since = "4.23.0",
+ authorized = {RoleType.Admin})
+public class DeleteVmCheckpointCmd extends BaseCmd implements AdminCmd {
+
+ @Inject
+ private KVMBackupExportService kvmBackupExportService;
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ required = true,
+ description = "ID of the VM")
+ private Long vmId;
+
+ @Parameter(name = "checkpointid",
+ type = CommandType.STRING,
+ required = true,
+ description = "Checkpoint ID")
+ private String checkpointId;
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public String getCheckpointId() {
+ return checkpointId;
+ }
+
+ public void setVmId(Long vmId) {
+ this.vmId = vmId;
+ }
+
+ public void setCheckpointId(String checkpointId) {
+ this.checkpointId = checkpointId;
+ }
+
+ @Override
+ public void execute() {
+ boolean result = kvmBackupExportService.deleteVmCheckpoint(this);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ response.setSuccess(result);
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccount().getId();
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java
new file mode 100644
index 000000000000..45173f8668ee
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeBackupCmd.java
@@ -0,0 +1,103 @@
+//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
+//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.backup;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.ApiErrorCode;
+import org.apache.cloudstack.api.BaseAsyncCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.ServerApiException;
+import org.apache.cloudstack.api.command.admin.AdminCmd;
+import org.apache.cloudstack.api.response.BackupResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.backup.Backup;
+import org.apache.cloudstack.backup.BackupManager;
+import org.apache.cloudstack.backup.KVMBackupExportService;
+import org.apache.cloudstack.context.CallContext;
+
+import com.cloud.event.EventTypes;
+
+@APICommand(name = "finalizeBackup",
+ description = "Finalize a VM backup session. This API is intended for testing only and is disabled by default.",
+ responseObject = BackupResponse.class,
+ since = "4.23.0",
+ authorized = {RoleType.Admin})
+public class FinalizeBackupCmd extends BaseAsyncCmd implements AdminCmd {
+
+ @Inject
+ private KVMBackupExportService kvmBackupExportService;
+
+ @Inject
+ private BackupManager backupManager;
+
+ @Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
+ type = CommandType.UUID,
+ entityType = UserVmResponse.class,
+ required = true,
+ description = "ID of the VM")
+ private Long vmId;
+
+ @Parameter(name = ApiConstants.ID,
+ type = CommandType.UUID,
+ entityType = BackupResponse.class,
+ required = true,
+ description = "ID of the backup")
+ private Long backupId;
+
+ public Long getVmId() {
+ return vmId;
+ }
+
+ public Long getBackupId() {
+ return backupId;
+ }
+
+ @Override
+ public void execute() {
+ Backup backup = kvmBackupExportService.finalizeBackup(this);
+
+ if (backup == null) {
+ throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create Backup");
+ }
+
+ BackupResponse response = backupManager.createBackupResponse(backup, null);
+
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccount().getId();
+ }
+
+
+ @Override
+ public String getEventType() {
+ return EventTypes.EVENT_VM_BACKUP_CREATE;
+ }
+
+ @Override
+ public String getEventDescription() {
+ return "Finalizing backup " + backupId;
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java
new file mode 100644
index 000000000000..dfc43e233bf2
--- /dev/null
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/FinalizeImageTransferCmd.java
@@ -0,0 +1,69 @@
+//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
+//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.backup;
+
+import javax.inject.Inject;
+
+import org.apache.cloudstack.acl.RoleType;
+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.command.admin.AdminCmd;
+import org.apache.cloudstack.api.response.ImageTransferResponse;
+import org.apache.cloudstack.api.response.SuccessResponse;
+import org.apache.cloudstack.backup.ImageTransfer;
+import org.apache.cloudstack.backup.KVMBackupExportService;
+import org.apache.cloudstack.context.CallContext;
+
+@APICommand(name = "finalizeImageTransfer",
+ description = "Finalize an image transfer. This API is intended for testing only and is disabled by default.",
+ responseObject = SuccessResponse.class,
+ since = "4.23.0",
+ authorized = {RoleType.Admin})
+public class FinalizeImageTransferCmd extends BaseCmd implements AdminCmd {
+
+ @Inject
+ private KVMBackupExportService kvmBackupExportService;
+
+ @Parameter(name = ApiConstants.ID,
+ type = CommandType.UUID,
+ entityType = ImageTransferResponse.class,
+ required = true,
+ description = "ID of the image transfer")
+ private Long imageTransferId;
+
+ public Long getImageTransferId() {
+ return imageTransferId;
+ }
+
+ @Override
+ public void execute() {
+ boolean result = kvmBackupExportService.finalizeImageTransfer(this);
+ SuccessResponse response = new SuccessResponse(getCommandName());
+ response.setSuccess(result);
+ response.setObjectName(ImageTransfer.class.getSimpleName().toLowerCase());
+ response.setResponseName(getCommandName());
+ setResponseObject(response);
+ }
+
+ @Override
+ public long getEntityOwnerId() {
+ return CallContext.current().getCallingAccount().getId();
+ }
+}
diff --git a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
index 7d3902bc4902..4cf27c561508 100644
--- a/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
+++ b/api/src/main/java/org/apache/cloudstack/api/command/admin/backup/ImportBackupOfferingCmd.java
@@ -27,6 +27,7 @@
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.BackupOfferingResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.backup.BackupManager;
import org.apache.cloudstack.backup.BackupOffering;
@@ -40,6 +41,11 @@
import com.cloud.exception.ResourceAllocationException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.utils.exception.CloudRuntimeException;
+import org.apache.commons.collections.CollectionUtils;
+
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Set;
@APICommand(name = "importBackupOffering",
description = "Imports a backup offering using a backup provider",
@@ -48,18 +54,18 @@
public class ImportBackupOfferingCmd extends BaseAsyncCmd {
@Inject
- private BackupManager backupManager;
+ protected BackupManager backupManager;
/////////////////////////////////////////////////////
//////////////// API parameters /////////////////////
////////////////////////////////////////////////////
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true,
- description = "the name of the backup offering")
+ description = "The name of the backup offering")
private String name;
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, required = true,
- description = "the description of the backup offering")
+ description = "The description of the backup offering")
private String description;
@Parameter(name = ApiConstants.EXTERNAL_ID,
@@ -76,6 +82,14 @@ public class ImportBackupOfferingCmd extends BaseAsyncCmd {
description = "Whether users are allowed to create adhoc backups and backup schedules", required = true)
private Boolean userDrivenBackups;
+ @Parameter(name = ApiConstants.DOMAIN_ID,
+ type = CommandType.LIST,
+ collectionType = CommandType.UUID,
+ entityType = DomainResponse.class,
+ description = "the ID of the containing domain(s), null for public offerings",
+ since = "4.23.0")
+ private List