mirror of https://github.com/apache/cloudstack.git
Merge branch 'main' of https://github.com/apache/cloudstack into clone-edit-existing-offerings
This commit is contained in:
commit
09cdd31cb4
|
|
@ -41,3 +41,9 @@ jobs:
|
|||
days-before-pr-close: 240
|
||||
exempt-issue-labels: 'gsoc,good-first-issue,long-term-plan'
|
||||
exempt-pr-labels: 'status:ready-for-merge,status:needs-testing,status:on-hold'
|
||||
- uses: actions/stale@v10
|
||||
with:
|
||||
stale-issue-label: 'archive'
|
||||
days-before-stale: 240
|
||||
exempt-issue-labels: 'gsoc,good-first-issue,long-term-plan'
|
||||
days-before-close: -1
|
||||
|
|
|
|||
|
|
@ -52,6 +52,16 @@ repos:
|
|||
args: ['644']
|
||||
files: \.md$
|
||||
stages: [manual]
|
||||
- id: insert-license
|
||||
name: add license for all cfg files
|
||||
description: automatically adds a licence header to all cfg files that don't have a license header
|
||||
files: \.cfg$
|
||||
args:
|
||||
- --comment-style
|
||||
- '|#|'
|
||||
- --license-filepath
|
||||
- .github/workflows/license-templates/LICENSE.txt
|
||||
- --fuzzy-match-generates-todo
|
||||
- id: insert-license
|
||||
name: add license for all Markdown files
|
||||
files: \.md$
|
||||
|
|
|
|||
|
|
@ -331,7 +331,7 @@ public class ConsoleProxyResource extends ServerResourceBase implements ServerRe
|
|||
final Object resource = this;
|
||||
logger.info("Building class loader for com.cloud.consoleproxy.ConsoleProxy");
|
||||
if (consoleProxyMain == null) {
|
||||
logger.info("Running com.cloud.consoleproxy.ConsoleProxy with encryptor password={}", encryptorPassword);
|
||||
logger.info("Running com.cloud.consoleproxy.ConsoleProxy");
|
||||
consoleProxyMain = new Thread(new ManagedContextRunnable() {
|
||||
@Override
|
||||
protected void runInContext() {
|
||||
|
|
|
|||
|
|
@ -584,6 +584,7 @@ public class EventTypes {
|
|||
|
||||
// Network ACL
|
||||
public static final String EVENT_NETWORK_ACL_CREATE = "NETWORK.ACL.CREATE";
|
||||
public static final String EVENT_NETWORK_ACL_IMPORT = "NETWORK.ACL.IMPORT";
|
||||
public static final String EVENT_NETWORK_ACL_DELETE = "NETWORK.ACL.DELETE";
|
||||
public static final String EVENT_NETWORK_ACL_REPLACE = "NETWORK.ACL.REPLACE";
|
||||
public static final String EVENT_NETWORK_ACL_UPDATE = "NETWORK.ACL.UPDATE";
|
||||
|
|
|
|||
|
|
@ -108,6 +108,10 @@ public interface NetworkService {
|
|||
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<Integer, Integer> vrIfaceMTUs) throws
|
||||
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
|
||||
|
||||
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
|
||||
|
||||
boolean deleteNetwork(long networkId, boolean forced);
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package com.cloud.network.vpc;
|
|||
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<NetworkACLItem> importNetworkACLRules(ImportNetworkACLCmd cmd) throws ResourceUnavailableException;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 interface ResourceTag extends ControlledEntity, Identity, InternalIdentit
|
|||
GuestOs(false, true),
|
||||
NetworkOffering(false, true),
|
||||
VpcOffering(true, false),
|
||||
Domain(false, false, true),
|
||||
Domain(true, false, true),
|
||||
ObjectStore(false, false, true);
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -56,9 +56,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
|
||||
|
|
|
|||
|
|
@ -124,7 +124,7 @@ public interface AccountService {
|
|||
|
||||
void validateAccountHasAccessToResource(Account account, AccessType accessType, Object resource);
|
||||
|
||||
Long finalyzeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
|
||||
Long finalizeAccountId(String accountName, Long domainId, Long projectId, boolean enabledOnly);
|
||||
|
||||
/**
|
||||
* returns the user account object for a given user id
|
||||
|
|
|
|||
|
|
@ -24,18 +24,24 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||
|
||||
public interface AlertService {
|
||||
public static class AlertType {
|
||||
private static Set<AlertType> defaultAlertTypes = new HashSet<AlertType>();
|
||||
private static final Set<AlertType> 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,36 +51,36 @@ public interface AlertService {
|
|||
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_VPN_GATEWAY_OBSOLETE_PARAMETERS = new AlertType((short)34, "ALERT.S2S.VPN.GATEWAY.OBSOLETE.PARAMETERS", 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);
|
||||
|
||||
|
|
@ -86,6 +92,10 @@ public interface AlertService {
|
|||
return name;
|
||||
}
|
||||
|
||||
public boolean isRepetitionAllowed() {
|
||||
return repetitionAllowed;
|
||||
}
|
||||
|
||||
private static AlertType getAlertType(short type) {
|
||||
for (AlertType alertType : defaultAlertTypes) {
|
||||
if (alertType.getType() == type) {
|
||||
|
|
@ -109,7 +119,7 @@ public interface AlertService {
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,4 +50,6 @@ public @interface APICommand {
|
|||
RoleType[] authorized() default {};
|
||||
|
||||
Class<?>[] entityType() default {};
|
||||
|
||||
String httpMethod() default "";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -282,6 +282,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";
|
||||
|
|
@ -502,6 +503,7 @@ 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 RESOURCES = "resources";
|
||||
public static final String RESOURCE_COUNT = "resourcecount";
|
||||
|
|
@ -1167,6 +1169,7 @@ public class ApiConstants {
|
|||
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 NETSCALER_CONTROLCENTER_ID = "netscalercontrolcenterid";
|
||||
|
|
@ -1217,6 +1220,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";
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ public abstract class BaseUpdateTemplateOrIsoCmd extends BaseCmd {
|
|||
@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,
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ import java.util.List;
|
|||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiConstants.DomainDetails;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.BaseListTaggedResourcesCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.UserCmd;
|
||||
|
|
@ -39,7 +39,7 @@ import com.cloud.server.ResourceTag;
|
|||
|
||||
@APICommand(name = "listDomains", description = "Lists domains and provides detailed information for listed domains", responseObject = DomainResponse.class, responseView = ResponseView.Restricted, entityType = {Domain.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
public class ListDomainsCmd extends BaseListCmd implements UserCmd {
|
||||
public class ListDomainsCmd extends BaseListTaggedResourcesCmd implements UserCmd {
|
||||
|
||||
private static final String s_name = "listdomainsresponse";
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,11 @@ import org.apache.cloudstack.api.response.ZoneResponse;
|
|||
import com.cloud.exception.DiscoveryException;
|
||||
import com.cloud.storage.ImageStore;
|
||||
import com.cloud.user.Account;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@APICommand(name = "addSecondaryStorage", description = "Adds secondary storage.", responseObject = ImageStoreResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
|
|
@ -44,6 +49,9 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
@Parameter(name = ApiConstants.ZONE_ID, type = CommandType.UUID, entityType = ZoneResponse.class, description = "The Zone ID for the secondary storage")
|
||||
protected Long zoneId;
|
||||
|
||||
@Parameter(name = ApiConstants.DETAILS, type = CommandType.MAP, description = "Details in key/value pairs using format details[i].keyname=keyvalue. Example: details[0].copytemplatesfromothersecondarystorages=true")
|
||||
protected Map details;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -56,6 +64,20 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
return zoneId;
|
||||
}
|
||||
|
||||
public Map<String, String> getDetails() {
|
||||
Map<String, String> detailsMap = new HashMap<>();
|
||||
if (MapUtils.isNotEmpty(details)) {
|
||||
Collection<?> props = details.values();
|
||||
for (Object prop : props) {
|
||||
HashMap<String, String> detail = (HashMap<String, String>) prop;
|
||||
for (Map.Entry<String, String> entry: detail.entrySet()) {
|
||||
detailsMap.put(entry.getKey(),entry.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
return detailsMap;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -68,7 +90,7 @@ public class AddSecondaryStorageCmd extends BaseCmd {
|
|||
@Override
|
||||
public void execute(){
|
||||
try{
|
||||
ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), null);
|
||||
ImageStore result = _storageService.discoverImageStore(null, getUrl(), "NFS", getZoneId(), getDetails());
|
||||
ImageStoreResponse storeResponse = null;
|
||||
if (result != null ) {
|
||||
storeResponse = _responseGenerator.createImageStoreResponse(result);
|
||||
|
|
|
|||
|
|
@ -118,6 +118,9 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
since = "4.21.0")
|
||||
private String storageAccessGroup;
|
||||
|
||||
@Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, description = "the host version", since = "4.20.3")
|
||||
private String version;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -222,6 +225,10 @@ public class ListHostsCmd extends BaseListCmd {
|
|||
this.storageAccessGroup = storageAccessGroup;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -45,6 +45,10 @@ public class ListMgmtsCmd extends BaseListCmd {
|
|||
since = "4.20.1.0")
|
||||
private Boolean peers;
|
||||
|
||||
@Parameter(name = ApiConstants.VERSION, type = CommandType.STRING,
|
||||
description = "the version of the management server", since = "4.20.3")
|
||||
private String version;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
@ -61,6 +65,10 @@ public class ListMgmtsCmd extends BaseListCmd {
|
|||
return BooleanUtils.toBooleanDefaultIfNull(peers, false);
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd implements DomainAndZoneId
|
|||
|
||||
@Parameter(name = ApiConstants.DOMAIN_ID,
|
||||
type = CommandType.STRING,
|
||||
length = 4096,
|
||||
description = "The ID of the containing domain(s) as comma separated string, public for public offerings")
|
||||
private String domainIds;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,8 @@ import org.apache.cloudstack.api.response.AccountResponse;
|
|||
import org.apache.cloudstack.api.response.IsAccountAllowedToCreateOfferingsWithTagsResponse;
|
||||
|
||||
@APICommand(name = "isAccountAllowedToCreateOfferingsWithTags", description = "Return true if the specified account is allowed to create offerings with tags.",
|
||||
responseObject = IsAccountAllowedToCreateOfferingsWithTagsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
responseObject = IsAccountAllowedToCreateOfferingsWithTagsResponse.class, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||
httpMethod = "GET")
|
||||
public class IsAccountAllowedToCreateOfferingsWithTagsCmd extends BaseCmd {
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = AccountResponse.class, description = "Account UUID", required = true)
|
||||
|
|
|
|||
|
|
@ -73,6 +73,7 @@ public class UpdateDiskOfferingCmd extends BaseCmd implements DomainAndZoneIdRes
|
|||
@Parameter(name = ApiConstants.ZONE_ID,
|
||||
type = CommandType.STRING,
|
||||
description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings",
|
||||
length = 4096,
|
||||
since = "4.13")
|
||||
private String zoneIds;
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ public class UpdateServiceOfferingCmd extends BaseCmd implements DomainAndZoneId
|
|||
@Parameter(name = ApiConstants.ZONE_ID,
|
||||
type = CommandType.STRING,
|
||||
description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings",
|
||||
length = 4096,
|
||||
since = "4.13")
|
||||
private String zoneIds;
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,10 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.command.admin.resource;
|
||||
|
||||
import com.cloud.user.Account;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.alert.AlertService;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
|
|
@ -24,9 +27,7 @@ import org.apache.cloudstack.api.response.AlertResponse;
|
|||
import org.apache.cloudstack.api.response.AlertTypeResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "listAlertTypes", description = "Lists all alerts types", responseObject = AlertResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false)
|
||||
|
|
@ -43,7 +44,8 @@ public class ListAlertTypesCmd extends BaseCmd {
|
|||
ListResponse<AlertTypeResponse> response = new ListResponse<>();
|
||||
List<AlertTypeResponse> typeResponseList = new ArrayList<>();
|
||||
for (AlertService.AlertType alertType : result) {
|
||||
AlertTypeResponse alertResponse = new AlertTypeResponse(alertType.getType(), alertType.getName());
|
||||
AlertTypeResponse alertResponse = new AlertTypeResponse(alertType.getType(), alertType.getName(),
|
||||
alertType.isRepetitionAllowed());
|
||||
alertResponse.setObjectName("alerttype");
|
||||
typeResponseList.add(alertResponse);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -292,7 +292,7 @@ public class ImportUnmanagedInstanceCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
if (account != null) {
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ public class ImportVolumeCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,6 +61,7 @@ public class UpdateVPCOfferingCmd extends BaseAsyncCmd implements DomainAndZoneI
|
|||
@Parameter(name = ApiConstants.ZONE_ID,
|
||||
type = CommandType.STRING,
|
||||
description = "The ID of the containing zone(s) as comma separated string, all for all zones offerings",
|
||||
length = 4096,
|
||||
since = "4.13")
|
||||
private String zoneIds;
|
||||
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ public class CreateAutoScaleVmProfileCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ public class CreateConditionCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,6 @@ public class ListBackupScheduleCmd extends BaseListProjectAndAccountResourcesCmd
|
|||
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = UserVmResponse.class,
|
||||
required = true,
|
||||
description = "ID of the Instance")
|
||||
private Long vmId;
|
||||
|
||||
|
|
|
|||
|
|
@ -150,7 +150,7 @@ public class CreateBucketCmd extends BaseAsyncCreateCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,7 @@ public class ListCapabilitiesCmd extends BaseCmd {
|
|||
response.setDiskOffMaxSize((Long)capabilities.get("customDiskOffMaxSize"));
|
||||
response.setRegionSecondaryEnabled((Boolean)capabilities.get("regionSecondaryEnabled"));
|
||||
response.setKVMSnapshotEnabled((Boolean)capabilities.get("KVMSnapshotEnabled"));
|
||||
response.setSnapshotShowChainSize((Boolean)capabilities.get("SnapshotShowChainSize"));
|
||||
response.setAllowUserViewDestroyedVM((Boolean)capabilities.get("allowUserViewDestroyedVM"));
|
||||
response.setAllowUserExpungeRecoverVM((Boolean)capabilities.get("allowUserExpungeRecoverVM"));
|
||||
response.setAllowUserExpungeRecoverVolume((Boolean)capabilities.get("allowUserExpungeRecoverVolume"));
|
||||
|
|
|
|||
|
|
@ -158,7 +158,7 @@ public class GetUploadParamsForIsoCmd extends AbstractGetUploadParamsCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class RegisterIsoCmd extends BaseCmd implements UserCmd {
|
|||
@Parameter(name = ApiConstants.IS_EXTRACTABLE, type = CommandType.BOOLEAN, description = "True if the ISO or its derivatives are extractable; default is false")
|
||||
private Boolean extractable;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, description = "The name of the ISO")
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, required = true, length = 251, description = "The name of the ISO")
|
||||
private String isoName;
|
||||
|
||||
@Parameter(name = ApiConstants.OS_TYPE_ID,
|
||||
|
|
@ -254,7 +254,7 @@ public class RegisterIsoCmd extends BaseCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
|
|||
private Integer publicEndPort;
|
||||
|
||||
@Parameter(name = ApiConstants.CIDR_LIST, type = CommandType.LIST, collectionType = CommandType.STRING, description = "The CIDR list to allow traffic from/to. Multiple entries must be separated by a single comma character (,).")
|
||||
private List<String> cidrlist;
|
||||
private List<String> cidrList;
|
||||
|
||||
@Parameter(name = ApiConstants.ICMP_TYPE, type = CommandType.INTEGER, description = "Type of the ICMP message being sent")
|
||||
private Integer icmpType;
|
||||
|
|
@ -118,8 +118,8 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
public List<String> getSourceCidrList() {
|
||||
if (cidrlist != null) {
|
||||
return cidrlist;
|
||||
if (cidrList != null) {
|
||||
return cidrList;
|
||||
} else {
|
||||
List<String> oneCidrList = new ArrayList<String>();
|
||||
oneCidrList.add(NetUtils.ALL_IP4_CIDRS);
|
||||
|
|
@ -238,6 +238,30 @@ public class CreateNetworkACLCmd extends BaseAsyncCreateCmd {
|
|||
return reason;
|
||||
}
|
||||
|
||||
public void setCidrList(List<String> cidrList) {
|
||||
this.cidrList = cidrList;
|
||||
}
|
||||
|
||||
public void setIcmpType(Integer icmpType) {
|
||||
this.icmpType = icmpType;
|
||||
}
|
||||
|
||||
public void setIcmpCode(Integer icmpCode) {
|
||||
this.icmpCode = icmpCode;
|
||||
}
|
||||
|
||||
public void setNumber(Integer number) {
|
||||
this.number = number;
|
||||
}
|
||||
|
||||
public void setDisplay(Boolean display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public void setReason(String reason) {
|
||||
this.reason = reason;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void create() {
|
||||
NetworkACLItem result = _networkACLService.createNetworkACLItem(this);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ public class CreateNetworkCmd extends BaseCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,132 @@
|
|||
// 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.user.network;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.ApiErrorCode;
|
||||
import org.apache.cloudstack.api.BaseAsyncCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.ServerApiException;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLItemResponse;
|
||||
import org.apache.cloudstack.api.response.NetworkACLResponse;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.commons.collections.MapUtils;
|
||||
|
||||
import com.cloud.event.EventTypes;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.network.vpc.NetworkACLItem;
|
||||
import com.cloud.user.Account;
|
||||
|
||||
@APICommand(name = "importNetworkACL", description = "Imports Network ACL rules.",
|
||||
responseObject = NetworkACLItemResponse.class,
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||
since = "4.22.1")
|
||||
public class ImportNetworkACLCmd extends BaseAsyncCmd {
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ////////////// API parameters /////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
@Parameter(
|
||||
name = ApiConstants.ACL_ID,
|
||||
type = CommandType.UUID,
|
||||
entityType = NetworkACLResponse.class,
|
||||
required = true,
|
||||
description = "The ID of the Network ACL to which the rules will be imported"
|
||||
)
|
||||
private Long aclId;
|
||||
|
||||
@Parameter(name = ApiConstants.RULES, type = CommandType.MAP, required = true,
|
||||
description = "Rules param list, id and protocol are must. Invalid rules will be discarded. Example: " +
|
||||
"rules[0].id=101&rules[0].protocol=tcp&rules[0].traffictype=ingress&rules[0].state=active&rules[0].cidrlist=192.168.1.0/24" +
|
||||
"&rules[0].tags=web&rules[0].aclid=acl-001&rules[0].aclname=web-acl&rules[0].number=1&rules[0].action=allow&rules[0].fordisplay=true" +
|
||||
"&rules[0].description=allow%20web%20traffic&rules[1].id=102&rules[1].protocol=udp&rules[1].traffictype=egress&rules[1].state=enabled" +
|
||||
"&rules[1].cidrlist=10.0.0.0/8&rules[1].tags=db&rules[1].aclid=acl-002&rules[1].aclname=db-acl&rules[1].number=2&rules[1].action=deny" +
|
||||
"&rules[1].fordisplay=false&rules[1].description=deny%20database%20traffic")
|
||||
private Map rules;
|
||||
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////////// Accessors ///////////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
// Returns map, corresponds to a rule with the details in the keys:
|
||||
// id, protocol, startport, endport, traffictype, state, cidrlist, tags, aclid, aclname, number, action, fordisplay, description
|
||||
public Map getRules() {
|
||||
return rules;
|
||||
}
|
||||
|
||||
public Long getAclId() {
|
||||
return aclId;
|
||||
}
|
||||
|
||||
// ///////////////////////////////////////////////////
|
||||
// ///////////// API Implementation///////////////////
|
||||
// ///////////////////////////////////////////////////
|
||||
|
||||
|
||||
@Override
|
||||
public void execute() throws ResourceUnavailableException {
|
||||
validateParams();
|
||||
List<NetworkACLItem> importedRules = _networkACLService.importNetworkACLRules(this);
|
||||
ListResponse<NetworkACLItemResponse> response = new ListResponse<>();
|
||||
List<NetworkACLItemResponse> aclResponse = new ArrayList<>();
|
||||
for (NetworkACLItem acl : importedRules) {
|
||||
NetworkACLItemResponse ruleData = _responseGenerator.createNetworkACLItemResponse(acl);
|
||||
aclResponse.add(ruleData);
|
||||
}
|
||||
response.setResponses(aclResponse, importedRules.size());
|
||||
response.setResponseName(getCommandName());
|
||||
setResponseObject(response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Account account = CallContext.current().getCallingAccount();
|
||||
if (account != null) {
|
||||
return account.getId();
|
||||
}
|
||||
return Account.ACCOUNT_ID_SYSTEM;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventType() {
|
||||
return EventTypes.EVENT_NETWORK_ACL_IMPORT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEventDescription() {
|
||||
return "Importing ACL rules for ACL ID: " + getAclId();
|
||||
}
|
||||
|
||||
|
||||
private void validateParams() {
|
||||
if(MapUtils.isEmpty(rules)) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Rules parameter is empty or null");
|
||||
}
|
||||
|
||||
if (getAclId() == null || _networkACLService.getNetworkACL(getAclId()) == null) {
|
||||
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find Network ACL with provided ACL ID");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ public class CreateGlobalLoadBalancerRuleCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class ListResourceLimitsCmd extends BaseListProjectAndAccountResourcesCmd
|
|||
@Override
|
||||
public void execute() {
|
||||
List<? extends ResourceLimit> result =
|
||||
_resourceLimitService.searchForLimits(id, _accountService.finalyzeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(),
|
||||
_resourceLimitService.searchForLimits(id, _accountService.finalizeAccountId(this.getAccountName(), this.getDomainId(), this.getProjectId(), false), this.getDomainId(),
|
||||
getResourceTypeEnum(), getTag(), this.getStartIndex(), this.getPageSizeVal());
|
||||
ListResponse<ResourceLimitResponse> response = new ListResponse<ResourceLimitResponse>();
|
||||
List<ResourceLimitResponse> limitResponses = new ArrayList<ResourceLimitResponse>();
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public class UpdateResourceCountCmd extends BaseCmd {
|
|||
@Override
|
||||
public void execute() {
|
||||
List<? extends ResourceCount> result =
|
||||
_resourceLimitService.recalculateResourceCount(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType(), getTag());
|
||||
_resourceLimitService.recalculateResourceCount(_accountService.finalizeAccountId(accountName, domainId, projectId, true), getDomainId(), getResourceType(), getTag());
|
||||
|
||||
if ((result != null) && (result.size() > 0)) {
|
||||
ListResponse<ResourceCountResponse> response = new ListResponse<ResourceCountResponse>();
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
@ -110,7 +110,7 @@ public class UpdateResourceLimitCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public void execute() {
|
||||
ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalyzeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max, getTag());
|
||||
ResourceLimit result = _resourceLimitService.updateResourceLimit(_accountService.finalizeAccountId(accountName, domainId, projectId, true), getDomainId(), resourceType, max, getTag());
|
||||
if (result != null || (result == null && max != null && max.longValue() == -1L)) {
|
||||
ResourceLimitResponse response = _responseGenerator.createResourceLimitResponse(result);
|
||||
response.setResponseName(getCommandName());
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public class AuthorizeSecurityGroupEgressCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -166,7 +166,7 @@ public class AuthorizeSecurityGroupIngressCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ public class DeleteSecurityGroupCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -274,8 +274,7 @@ public class CreateSnapshotCmd extends BaseAsyncCreateCmd {
|
|||
}
|
||||
|
||||
public Snapshot.LocationType getLocationType() {
|
||||
|
||||
if (Snapshot.LocationType.values() == null || Snapshot.LocationType.values().length == 0 || locationType == null) {
|
||||
if (locationType == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ public class CreateSSHKeyPairCmd extends BaseCmd {
|
|||
/////////////////////////////////////////////////////
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ public class RegisterSSHKeyPairCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -230,7 +230,7 @@ public class CreateSharedFSCmd extends BaseAsyncCreateCmd implements UserCmd {
|
|||
}
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -354,7 +354,7 @@ public class CreateTemplateCmd extends BaseAsyncCreateCmd implements UserCmd {
|
|||
private Long findAccountIdToUse(Account callingAccount) {
|
||||
Long accountIdToUse = null;
|
||||
try {
|
||||
accountIdToUse = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
accountIdToUse = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
} catch (InvalidParameterValueException | PermissionDeniedException ex) {
|
||||
logger.error("Unable to find accountId associated with accountName={} and domainId={} or projectId={}" +
|
||||
", using callingAccountId={}", accountName, domainId, projectId, callingAccount.getUuid());
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ public class GetUploadParamsForTemplateCmd extends AbstractGetUploadParamsCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -344,7 +344,7 @@ public class RegisterTemplateCmd extends BaseCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ public class RegisterCniConfigurationCmd extends BaseRegisterUserDataCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ public class RegisterUserDataCmd extends BaseRegisterUserDataCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -808,7 +808,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.apache.cloudstack.api.command.user.vm;
|
|||
import java.util.Objects;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import org.apache.cloudstack.api.ACL;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
|
|
@ -39,7 +40,6 @@ import com.cloud.exception.InsufficientServerCapacityException;
|
|||
import com.cloud.exception.ResourceAllocationException;
|
||||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
||||
@APICommand(name = "deployVirtualMachine", description = "Creates and automatically starts an Instance based on a service offering, disk offering, and Template.", responseObject = UserVmResponse.class, responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ import java.util.List;
|
|||
public class DeployVnfApplianceCmd extends DeployVMCmd implements UserCmd {
|
||||
|
||||
@Parameter(name = ApiConstants.VNF_CONFIGURE_MANAGEMENT, type = CommandType.BOOLEAN, required = false,
|
||||
description = "True by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. False otherwise. " +
|
||||
description = "False by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. True otherwise. " +
|
||||
"Network rules are configured if management network is an isolated network or shared network with security groups.")
|
||||
private Boolean vnfConfigureManagement;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ import com.cloud.exception.InvalidParameterValueException;
|
|||
import com.cloud.exception.ResourceUnavailableException;
|
||||
import com.cloud.user.Account;
|
||||
import com.cloud.uservm.UserVm;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.Dhcp;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
|
|
@ -44,7 +45,6 @@ import org.apache.cloudstack.api.response.UserVmResponse;
|
|||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.vm.lease.VMLeaseManager;
|
||||
import org.apache.commons.lang3.EnumUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
|
|
@ -163,11 +163,20 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
|
|||
description = "Lease expiry action, valid values are STOP and DESTROY")
|
||||
private String leaseExpiryAction;
|
||||
|
||||
@Parameter(name = ApiConstants.CLEAN_UP_EXTRA_CONFIG, type = CommandType.BOOLEAN, since = "4.23.0",
|
||||
description = "Optional boolean field, which indicates if extraconfig for the instance should be " +
|
||||
"cleaned up or not (If set to true, extraconfig removed for this instance, extraconfig field " +
|
||||
"ignored; if false or not set, no action)")
|
||||
private Boolean cleanupExtraConfig;
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////////// Accessors ///////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public String getDisplayName() {
|
||||
if (StringUtils.isBlank(displayName)) {
|
||||
displayName = name;
|
||||
}
|
||||
return displayName;
|
||||
}
|
||||
|
||||
|
|
@ -271,14 +280,18 @@ public class UpdateVMCmd extends BaseCustomIdCmd implements SecurityGroupAction,
|
|||
return extraConfig;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
public Long getOsTypeId() {
|
||||
return osTypeId;
|
||||
}
|
||||
|
||||
public boolean isCleanupExtraConfig() {
|
||||
return Boolean.TRUE.equals(cleanupExtraConfig);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////
|
||||
/////////////// API Implementation///////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Override
|
||||
public String getCommandName() {
|
||||
return s_name;
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class CreateVMGroupCmd extends BaseCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -188,7 +188,7 @@ public class CreateVolumeCmd extends BaseAsyncCreateCustomIdCmd implements UserC
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public class GetUploadParamsForVolumeCmd extends AbstractGetUploadParamsCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
Long accountId = _accountService.finalizeAccountId(getAccountName(), getDomainId(), getProjectId(), true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,7 +159,7 @@ public class UploadVolumeCmd extends BaseAsyncCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ public class CreateVPCCmd extends BaseAsyncCreateCmd implements UserCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ public class AddVpnUserCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public class CreateVpnCustomerGatewayCmd extends BaseAsyncCreateCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
accountId = CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ public class RemoveVpnUserCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, projectId, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, projectId, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ public class ResetVpnConnectionCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true);
|
||||
if (accountId == null) {
|
||||
return CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ public class UpdateVpnCustomerGatewayCmd extends BaseAsyncCmd {
|
|||
|
||||
@Override
|
||||
public long getEntityOwnerId() {
|
||||
Long accountId = _accountService.finalyzeAccountId(accountName, domainId, null, true);
|
||||
Long accountId = _accountService.finalizeAccountId(accountName, domainId, null, true);
|
||||
if (accountId == null) {
|
||||
accountId = CallContext.current().getCallingAccount().getId();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,11 +16,12 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
public class AlertTypeResponse extends BaseResponse {
|
||||
|
||||
@SerializedName("alerttypeid")
|
||||
|
|
@ -31,6 +32,10 @@ public class AlertTypeResponse extends BaseResponse {
|
|||
@Param(description = "description of alert type")
|
||||
private String name;
|
||||
|
||||
@SerializedName(ApiConstants.REPETITION_ALLOWED)
|
||||
@Param(description = "Whether repetitive alerts allowed for the alert type", since = "4.22.0")
|
||||
private boolean repetitionAllowed = true;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
|
@ -47,9 +52,10 @@ public class AlertTypeResponse extends BaseResponse {
|
|||
this.alertType = alertType;
|
||||
}
|
||||
|
||||
public AlertTypeResponse(short alertType, String name) {
|
||||
public AlertTypeResponse(short alertType, String name, boolean repetitionAllowed) {
|
||||
this.alertType = alertType;
|
||||
this.name = name;
|
||||
this.repetitionAllowed = repetitionAllowed;
|
||||
setObjectName("alerttype");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -75,6 +75,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||
@Param(description = "True if Snapshot is supported for KVM host, false otherwise")
|
||||
private boolean kvmSnapshotEnabled;
|
||||
|
||||
@SerializedName("snapshotshowchainsize")
|
||||
@Param(description = "True to show the parent and chain size (sum of physical size of snapshot and all its parents) for incremental snapshots", since = "4.22.1")
|
||||
private boolean snapshotShowChainSize;
|
||||
|
||||
@SerializedName("apilimitmax")
|
||||
@Param(description = "Max allowed number of api requests within the specified interval")
|
||||
private Integer apiLimitMax;
|
||||
|
|
@ -203,6 +207,10 @@ public class CapabilitiesResponse extends BaseResponse {
|
|||
this.kvmSnapshotEnabled = kvmSnapshotEnabled;
|
||||
}
|
||||
|
||||
public void setSnapshotShowChainSize(boolean snapshotShowChainSize) {
|
||||
this.snapshotShowChainSize = snapshotShowChainSize;
|
||||
}
|
||||
|
||||
public void setApiLimitInterval(Integer apiLimitInterval) {
|
||||
this.apiLimitInterval = apiLimitInterval;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,21 +16,21 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponseWithAnnotations;
|
||||
import org.apache.cloudstack.api.BaseResponseWithTagInformation;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.domain.Domain;
|
||||
import com.cloud.serializer.Param;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value = Domain.class)
|
||||
public class DomainResponse extends BaseResponseWithAnnotations implements ResourceLimitAndCountResponse, SetResourceIconResponse {
|
||||
public class DomainResponse extends BaseResponseWithTagInformation implements ResourceLimitAndCountResponse, SetResourceIconResponse {
|
||||
@SerializedName(ApiConstants.ID)
|
||||
@Param(description = "The ID of the domain")
|
||||
private String id;
|
||||
|
|
@ -589,4 +589,8 @@ public class DomainResponse extends BaseResponseWithAnnotations implements Resou
|
|||
public void setTaggedResourceLimitsAndCounts(List<TaggedResourceLimitAndCountResponse> taggedResourceLimitsAndCounts) {
|
||||
this.taggedResources = taggedResourceLimitsAndCounts;
|
||||
}
|
||||
|
||||
public void setTags(Set<ResourceTagResponse> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -155,6 +155,14 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
|
|||
@Param(description = "download progress of a snapshot", since = "4.19.0")
|
||||
private Map<String, String> downloadDetails;
|
||||
|
||||
@SerializedName("parent")
|
||||
@Param(description = "The parent ID of the Snapshot", since = "4.22.1")
|
||||
private String parent;
|
||||
|
||||
@SerializedName("parentname")
|
||||
@Param(description = "The parent name of the Snapshot", since = "4.22.1")
|
||||
private String parentName;
|
||||
|
||||
public SnapshotResponse() {
|
||||
tags = new LinkedHashSet<ResourceTagResponse>();
|
||||
}
|
||||
|
|
@ -313,4 +321,12 @@ public class SnapshotResponse extends BaseResponseWithTagInformation implements
|
|||
public void setDownloadDetails(Map<String, String> downloadDetails) {
|
||||
this.downloadDetails = downloadDetails;
|
||||
}
|
||||
|
||||
public void setParent(String parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public void setParentName(String parentName) {
|
||||
this.parentName = parentName;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -126,6 +126,10 @@ public class SystemVmResponse extends BaseResponseWithAnnotations {
|
|||
@Param(description = "The public netmask for the System VM")
|
||||
private String publicNetmask;
|
||||
|
||||
@SerializedName("storageip")
|
||||
@Param(description = "the ip address for the system VM on the storage network")
|
||||
private String storageIp;
|
||||
|
||||
@SerializedName("templateid")
|
||||
@Param(description = "The Template ID for the System VM")
|
||||
private String templateId;
|
||||
|
|
@ -355,6 +359,14 @@ public class SystemVmResponse extends BaseResponseWithAnnotations {
|
|||
this.publicNetmask = publicNetmask;
|
||||
}
|
||||
|
||||
public String getStorageIp() {
|
||||
return storageIp;
|
||||
}
|
||||
|
||||
public void setStorageIp(String storageIp) {
|
||||
this.storageIp = storageIp;
|
||||
}
|
||||
|
||||
public String getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -120,7 +120,7 @@ public interface QueryService {
|
|||
|
||||
ConfigKey<String> UserVMReadOnlyDetails = new ConfigKey<>(String.class,
|
||||
"user.vm.readonly.details", "Advanced", "dataDiskController, rootDiskController",
|
||||
"List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null);
|
||||
"List of read-only VM settings/details as comma separated string", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.CSV, null, "");
|
||||
|
||||
ConfigKey<Boolean> SortKeyAscending = new ConfigKey<>("Advanced", Boolean.class, "sortkey.algorithm", "true",
|
||||
"Sort algorithm - ascending or descending - to use. For entities that use sort key(template, disk offering, service offering, " +
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ import org.apache.cloudstack.api.command.user.template.UpdateVnfTemplateCmd;
|
|||
import org.apache.cloudstack.api.command.user.vm.DeployVnfApplianceCmd;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface VnfTemplateManager {
|
||||
|
||||
|
|
@ -42,11 +43,12 @@ public interface VnfTemplateManager {
|
|||
|
||||
void updateVnfTemplate(long templateId, UpdateVnfTemplateCmd cmd);
|
||||
|
||||
void validateVnfApplianceNics(VirtualMachineTemplate template, List<Long> networkIds);
|
||||
void validateVnfApplianceNics(VirtualMachineTemplate template, List<Long> networkIds, Map<Integer, Long> vmNetworkMap);
|
||||
|
||||
SecurityGroup createSecurityGroupForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner, DeployVnfApplianceCmd cmd);
|
||||
|
||||
void createIsolatedNetworkRulesForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner,
|
||||
UserVm vm, DeployVnfApplianceCmd cmd)
|
||||
throws InsufficientAddressCapacityException, ResourceAllocationException, ResourceUnavailableException;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@
|
|||
// under the License.
|
||||
package org.apache.cloudstack.storage.template;
|
||||
|
||||
import com.cloud.agent.api.to.deployasis.OVFNetworkTO;
|
||||
import com.cloud.exception.InvalidParameterValueException;
|
||||
import com.cloud.network.VNF;
|
||||
import com.cloud.storage.Storage;
|
||||
|
|
@ -124,6 +125,9 @@ public class VnfTemplateUtils {
|
|||
public static void validateApiCommandParams(BaseCmd cmd, VirtualMachineTemplate template) {
|
||||
if (cmd instanceof RegisterVnfTemplateCmd) {
|
||||
RegisterVnfTemplateCmd registerCmd = (RegisterVnfTemplateCmd) cmd;
|
||||
if (registerCmd.isDeployAsIs() && CollectionUtils.isNotEmpty(registerCmd.getVnfNics())) {
|
||||
throw new InvalidParameterValueException("VNF nics cannot be specified when register a deploy-as-is Template. Please wait until Template settings are read from OVA.");
|
||||
}
|
||||
validateApiCommandParams(registerCmd.getVnfDetails(), registerCmd.getVnfNics(), registerCmd.getTemplateType());
|
||||
} else if (cmd instanceof UpdateVnfTemplateCmd) {
|
||||
UpdateVnfTemplateCmd updateCmd = (UpdateVnfTemplateCmd) cmd;
|
||||
|
|
@ -149,4 +153,18 @@ public class VnfTemplateUtils {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void validateDeployAsIsTemplateVnfNics(List<OVFNetworkTO> ovfNetworks, List<VNF.VnfNic> vnfNics) {
|
||||
if (CollectionUtils.isEmpty(vnfNics)) {
|
||||
return;
|
||||
}
|
||||
if (CollectionUtils.isEmpty(ovfNetworks)) {
|
||||
throw new InvalidParameterValueException("The list of networks read from OVA is empty. Please wait until the template is fully downloaded and processed.");
|
||||
}
|
||||
for (VNF.VnfNic vnfNic : vnfNics) {
|
||||
if (vnfNic.getDeviceId() < ovfNetworks.size() && !vnfNic.isRequired()) {
|
||||
throw new InvalidParameterValueException(String.format("The VNF nic [device ID: %s ] is required as it is defined in the OVA template.", vnfNic.getDeviceId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ public class ImportVolumeCmdTest {
|
|||
Long projectId = 5L;
|
||||
long accountId = 6L;
|
||||
|
||||
Mockito.when(accountService.finalyzeAccountId(accountName, domainId, projectId, true)).thenReturn(accountId);
|
||||
Mockito.when(accountService.finalizeAccountId(accountName, domainId, projectId, true)).thenReturn(accountId);
|
||||
|
||||
ImportVolumeCmd cmd = new ImportVolumeCmd();
|
||||
ReflectionTestUtils.setField(cmd, "path", path);
|
||||
|
|
|
|||
|
|
@ -97,7 +97,7 @@ public class RegisterUserDataCmdTest {
|
|||
ReflectionTestUtils.setField(cmd, "name", "testUserdataName");
|
||||
ReflectionTestUtils.setField(cmd, "userData", "testUserdata");
|
||||
|
||||
when(_accountService.finalyzeAccountId(ACCOUNT_NAME, DOMAIN_ID, PROJECT_ID, true)).thenReturn(200L);
|
||||
when(_accountService.finalizeAccountId(ACCOUNT_NAME, DOMAIN_ID, PROJECT_ID, true)).thenReturn(200L);
|
||||
|
||||
Assert.assertEquals("testUserdataName", cmd.getName());
|
||||
Assert.assertEquals("testUserdata", cmd.getUserData());
|
||||
|
|
|
|||
|
|
@ -666,16 +666,22 @@
|
|||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>ru.concerteza.buildnumber</groupId>
|
||||
<artifactId>maven-jgit-buildnumber-plugin</artifactId>
|
||||
<version>1.2.6</version>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>3.2.0</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>git-buildnumber</id>
|
||||
<goals>
|
||||
<goal>extract-buildnumber</goal>
|
||||
<goal>create</goal>
|
||||
</goals>
|
||||
<phase>prepare-package</phase>
|
||||
<configuration>
|
||||
<doCheck>false</doCheck>
|
||||
<doUpdate>false</doUpdate>
|
||||
<getRevisionOnlyOnce>true</getRevisionOnlyOnce>
|
||||
<revisionOnScmFailure>unknown</revisionOnScmFailure>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
|
@ -688,11 +694,11 @@
|
|||
<mainClass>org.apache.cloudstack.ServerDaemon</mainClass>
|
||||
</manifest>
|
||||
<manifestEntries>
|
||||
<X-Git-Branch>${git.branch}</X-Git-Branch>
|
||||
<X-Git-Tag>${git.tag}</X-Git-Tag>
|
||||
<X-Git-Revision>${git.revision}</X-Git-Revision>
|
||||
<Implementation-Revision>${git.revision}</Implementation-Revision>
|
||||
<Implementation-Branch>${git.branch}</Implementation-Branch>
|
||||
<X-Git-Branch>${scmBranch}</X-Git-Branch>
|
||||
<X-Git-Tag>${project.version}</X-Git-Tag>
|
||||
<X-Git-Revision>${buildNumber}</X-Git-Revision>
|
||||
<Implementation-Revision>${buildNumber}</Implementation-Revision>
|
||||
<Implementation-Branch>${scmBranch}</Implementation-Branch>
|
||||
</manifestEntries>
|
||||
</archive>
|
||||
</configuration>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@
|
|||
//
|
||||
package org.apache.cloudstack;
|
||||
|
||||
import com.cloud.api.ApiServlet;
|
||||
import com.cloud.utils.StringUtils;
|
||||
import org.eclipse.jetty.server.NCSARequestLog;
|
||||
import org.eclipse.jetty.server.Request;
|
||||
|
|
@ -25,6 +26,7 @@ import org.eclipse.jetty.server.Response;
|
|||
import org.eclipse.jetty.util.DateCache;
|
||||
import org.eclipse.jetty.util.component.LifeCycle;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Locale;
|
||||
import java.util.TimeZone;
|
||||
|
||||
|
|
@ -51,9 +53,8 @@ public class ACSRequestLog extends NCSARequestLog {
|
|||
StringBuilder sb = buffers.get();
|
||||
sb.setLength(0);
|
||||
|
||||
sb.append(request.getHttpChannel().getEndPoint()
|
||||
.getRemoteAddress().getAddress()
|
||||
.getHostAddress())
|
||||
InetAddress remoteAddress = ApiServlet.getClientAddress(request);
|
||||
sb.append(remoteAddress.getHostAddress())
|
||||
.append(" - - [")
|
||||
.append(dateCache.format(request.getTimeStamp()))
|
||||
.append("] \"")
|
||||
|
|
|
|||
|
|
@ -24,15 +24,12 @@ import java.io.IOException;
|
|||
import java.io.InputStream;
|
||||
import java.lang.management.ManagementFactory;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
import java.util.Properties;
|
||||
|
||||
import com.cloud.api.ApiServer;
|
||||
import org.apache.commons.daemon.Daemon;
|
||||
import org.apache.commons.daemon.DaemonContext;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.eclipse.jetty.jmx.MBeanContainer;
|
||||
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
|
||||
import org.eclipse.jetty.server.HttpConfiguration;
|
||||
import org.eclipse.jetty.server.HttpConnectionFactory;
|
||||
import org.eclipse.jetty.server.RequestLog;
|
||||
|
|
@ -74,11 +71,6 @@ public class ServerDaemon implements Daemon {
|
|||
private static final String BIND_INTERFACE = "bind.interface";
|
||||
private static final String CONTEXT_PATH = "context.path";
|
||||
private static final String SESSION_TIMEOUT = "session.timeout";
|
||||
private static final String HTTP_ENABLE = "http.enable";
|
||||
private static final String HTTP_PORT = "http.port";
|
||||
private static final String HTTPS_ENABLE = "https.enable";
|
||||
private static final String HTTPS_PORT = "https.port";
|
||||
private static final String KEYSTORE_FILE = "https.keystore";
|
||||
private static final String KEYSTORE_PASSWORD = "https.keystore.password";
|
||||
private static final String WEBAPP_DIR = "webapp.dir";
|
||||
private static final String ACCESS_LOG = "access.log";
|
||||
|
|
@ -140,11 +132,11 @@ public class ServerDaemon implements Daemon {
|
|||
}
|
||||
setBindInterface(properties.getProperty(BIND_INTERFACE, null));
|
||||
setContextPath(properties.getProperty(CONTEXT_PATH, "/client"));
|
||||
setHttpEnable(Boolean.valueOf(properties.getProperty(HTTP_ENABLE, "true")));
|
||||
setHttpPort(Integer.valueOf(properties.getProperty(HTTP_PORT, "8080")));
|
||||
setHttpsEnable(Boolean.valueOf(properties.getProperty(HTTPS_ENABLE, "false")));
|
||||
setHttpsPort(Integer.valueOf(properties.getProperty(HTTPS_PORT, "8443")));
|
||||
setKeystoreFile(properties.getProperty(KEYSTORE_FILE));
|
||||
setHttpEnable(Boolean.valueOf(properties.getProperty(ServerProperties.HTTP_ENABLE, "true")));
|
||||
setHttpPort(Integer.valueOf(properties.getProperty(ServerProperties.HTTP_PORT, "8080")));
|
||||
setHttpsEnable(Boolean.valueOf(properties.getProperty(ServerProperties.HTTPS_ENABLE, "false")));
|
||||
setHttpsPort(Integer.valueOf(properties.getProperty(ServerProperties.HTTPS_PORT, "8443")));
|
||||
setKeystoreFile(properties.getProperty(ServerProperties.KEYSTORE_FILE));
|
||||
setKeystorePassword(properties.getProperty(KEYSTORE_PASSWORD));
|
||||
setWebAppLocation(properties.getProperty(WEBAPP_DIR));
|
||||
setAccessLogFile(properties.getProperty(ACCESS_LOG, "access.log"));
|
||||
|
|
@ -193,7 +185,6 @@ public class ServerDaemon implements Daemon {
|
|||
httpConfig.setResponseHeaderSize(8192);
|
||||
httpConfig.setSendServerVersion(false);
|
||||
httpConfig.setSendDateHeader(false);
|
||||
addForwardingCustomiser(httpConfig);
|
||||
|
||||
// HTTP Connector
|
||||
createHttpConnector(httpConfig);
|
||||
|
|
@ -216,21 +207,6 @@ public class ServerDaemon implements Daemon {
|
|||
server.join();
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a ForwardedRequestCustomizer to the HTTP configuration to handle forwarded headers.
|
||||
* The header used for forwarding is determined by the ApiServer.listOfForwardHeaders property.
|
||||
* Only non empty headers are considered and only the first of the comma-separated list is used.
|
||||
* @param httpConfig the HTTP configuration to which the customizer will be added
|
||||
*/
|
||||
private static void addForwardingCustomiser(HttpConfiguration httpConfig) {
|
||||
ForwardedRequestCustomizer customiser = new ForwardedRequestCustomizer();
|
||||
String header = Arrays.stream(ApiServer.listOfForwardHeaders.value().split(",")).findFirst().orElse(null);
|
||||
if (com.cloud.utils.StringUtils.isNotEmpty(header)) {
|
||||
customiser.setForwardedForHeader(header);
|
||||
}
|
||||
httpConfig.addCustomizer(customiser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
server.stop();
|
||||
|
|
|
|||
|
|
@ -57,8 +57,10 @@ public class TemplateOrVolumePostUploadCommand {
|
|||
|
||||
private String nfsVersion;
|
||||
|
||||
public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum, String type, String name, String imageFormat, String dataTo,
|
||||
String dataToRole) {
|
||||
private long zoneId;
|
||||
|
||||
public TemplateOrVolumePostUploadCommand(long entityId, String entityUUID, String absolutePath, String checksum,
|
||||
String type, String name, String imageFormat, String dataTo, String dataToRole, long zoneId) {
|
||||
this.entityId = entityId;
|
||||
this.entityUUID = entityUUID;
|
||||
this.absolutePath = absolutePath;
|
||||
|
|
@ -68,9 +70,7 @@ public class TemplateOrVolumePostUploadCommand {
|
|||
this.imageFormat = imageFormat;
|
||||
this.dataTo = dataTo;
|
||||
this.dataToRole = dataToRole;
|
||||
}
|
||||
|
||||
public TemplateOrVolumePostUploadCommand() {
|
||||
this.zoneId = zoneId;
|
||||
}
|
||||
|
||||
public String getRemoteEndPoint() {
|
||||
|
|
@ -216,4 +216,8 @@ public class TemplateOrVolumePostUploadCommand {
|
|||
public long getProcessTimeout() {
|
||||
return processTimeout;
|
||||
}
|
||||
|
||||
public long getZoneId() {
|
||||
return zoneId;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,9 +48,7 @@ public class SnapshotObjectTO extends DownloadableObjectTO implements DataTO {
|
|||
private Long physicalSize = (long) 0;
|
||||
private long accountId;
|
||||
|
||||
|
||||
public SnapshotObjectTO() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ Priority: extra
|
|||
Maintainer: The Apache CloudStack Team <dev@cloudstack.apache.org>
|
||||
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
|
||||
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3, maven (>= 3) | maven3,
|
||||
python (>= 2.7) | python2 (>= 2.7), python3 (>= 3), python-setuptools, python3-setuptools,
|
||||
python3 (>= 3), python3-setuptools,
|
||||
nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13)
|
||||
Standards-Version: 3.8.1
|
||||
Homepage: http://www.cloudstack.org/
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@
|
|||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>properties-maven-plugin</artifactId>
|
||||
<version>1.0-alpha-2</version>
|
||||
<version>1.2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>initialize</phase>
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import java.util.concurrent.Future;
|
|||
|
||||
import org.apache.cloudstack.api.response.MigrationResponse;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataStore;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult;
|
||||
import org.apache.cloudstack.storage.ImageStoreService.MigrationPolicy;
|
||||
|
||||
|
|
@ -31,5 +30,5 @@ public interface StorageOrchestrationService {
|
|||
|
||||
MigrationResponse migrateResources(Long srcImgStoreId, Long destImgStoreId, List<Long> templateIdList, List<Long> snapshotIdList);
|
||||
|
||||
Future<TemplateApiResult> orchestrateTemplateCopyToImageStore(TemplateInfo source, DataStore destStore);
|
||||
Future<TemplateApiResult> orchestrateTemplateCopyFromSecondaryStores(long templateId, DataStore destStore);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,6 @@ public interface TemplateService {
|
|||
List<DatadiskTO> getTemplateDatadisksOnImageStore(TemplateInfo templateInfo, String configurationId);
|
||||
|
||||
AsyncCallFuture<TemplateApiResult> copyTemplateToImageStore(DataObject source, DataStore destStore);
|
||||
}
|
||||
|
||||
void handleTemplateCopyFromSecondaryStores(long templateId, DataStore destStore);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,10 +49,13 @@ public interface AlertManager extends Manager, AlertService {
|
|||
"Percentage (as a value between 0 and 1) of guest network IPv6 subnet utilization above which alerts will be sent.",
|
||||
true);
|
||||
|
||||
ConfigKey<String> AllowedRepetitiveAlertTypes = new ConfigKey<>(ConfigKey.CATEGORY_ALERT, String.class,
|
||||
"alert.allowed.repetitive.types", "",
|
||||
"Comma-separated list of alert types (by name) that can be sent multiple times", true);
|
||||
|
||||
void clearAlert(AlertType alertType, long dataCenterId, long podId);
|
||||
|
||||
void recalculateCapacity();
|
||||
|
||||
void sendAlert(AlertType alertType, long dataCenterId, Long podId, String subject, String body);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,8 @@ public interface ResourceManager extends ResourceService, Configurable {
|
|||
|
||||
ConfigKey<Boolean> KvmSshToAgentEnabled = new ConfigKey<>("Advanced", Boolean.class,
|
||||
"kvm.ssh.to.agent","true",
|
||||
"Number of retries when preparing a host into Maintenance Mode is faulty before failing",
|
||||
false);
|
||||
"True if the management server will restart the agent service via SSH into the KVM hosts after or during maintenance operations",
|
||||
true);
|
||||
|
||||
ConfigKey<String> HOST_MAINTENANCE_LOCAL_STRATEGY = new ConfigKey<>(String.class,
|
||||
"host.maintenance.local.storage.strategy", "Advanced","Error",
|
||||
|
|
@ -79,6 +79,11 @@ public interface ResourceManager extends ResourceService, Configurable {
|
|||
ConfigKey.Kind.Select,
|
||||
"," + CPU.CPUArch.getTypesAsCSV());
|
||||
|
||||
ConfigKey<String> SystemVMDefaultHypervisor = new ConfigKey<String>(String.class,
|
||||
"system.vm.default.hypervisor", "Advanced", "Any", "Hypervisor type used to create System VMs. Valid values are: XenServer, KVM, VMware, Hyperv, VirtualBox, " +
|
||||
"Parralels, BareMetal, Ovm, LXC, Any", true, ConfigKey.Scope.Global, null, null, null, null, null, ConfigKey.Kind.Select, "XenServer, KVM, VMware, Hyperv, " +
|
||||
"VirtualBox, Parralels, BareMetal, Ovm, LXC, Any");
|
||||
|
||||
/**
|
||||
* Register a listener for different types of resource life cycle events.
|
||||
* There can only be one type of listener per type of host.
|
||||
|
|
|
|||
|
|
@ -228,8 +228,9 @@ public interface StorageManager extends StorageService {
|
|||
ConfigKey.Scope.Global,
|
||||
null);
|
||||
|
||||
ConfigKey<Boolean> COPY_PUBLIC_TEMPLATES_FROM_OTHER_STORAGES = new ConfigKey<>(Boolean.class, "copy.public.templates.from.other.storages",
|
||||
"Storage", "true", "Allow SSVMs to try copying public templates from one secondary storage to another instead of downloading them from the source.",
|
||||
ConfigKey<Boolean> COPY_TEMPLATES_FROM_OTHER_SECONDARY_STORAGES = new ConfigKey<>(Boolean.class, "copy.templates.from.other.secondary.storages",
|
||||
"Storage", "true", "When enabled, this feature allows templates to be copied from existing Secondary Storage servers (within the same zone or across zones) " +
|
||||
"while adding a new Secondary Storage. If the copy operation fails, the system falls back to downloading the template from the source URL.",
|
||||
true, ConfigKey.Scope.Zone, null);
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -153,6 +153,8 @@ public interface TemplateManager {
|
|||
|
||||
TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean isCrossZones, Hypervisor.HypervisorType hypervisorType);
|
||||
|
||||
DataStore verifyHeuristicRulesForZone(VMTemplateVO template, Long zoneId);
|
||||
|
||||
List<DatadiskTO> getTemplateDisksOnImageStore(VirtualMachineTemplate template, DataStoreRole role, String configurationId);
|
||||
|
||||
static Boolean getValidateUrlIsResolvableBeforeRegisteringTemplateValue() {
|
||||
|
|
|
|||
|
|
@ -31,7 +31,7 @@ public interface VMSnapshotManager extends VMSnapshotService, Manager {
|
|||
static final ConfigKey<Integer> VMSnapshotExpireInterval = new ConfigKey<Integer>("Advanced", Integer.class, "vmsnapshot.expire.interval", "-1",
|
||||
"VM Snapshot expire interval in hours", true, ConfigKey.Scope.Account);
|
||||
|
||||
ConfigKey<Integer> VMSnapshotMax = new ConfigKey<Integer>("Advanced", Integer.class, "vmsnapshot.max", "10", "Maximum vm snapshots for a single vm", true, ConfigKey.Scope.Global);
|
||||
ConfigKey<Integer> VMSnapshotMax = new ConfigKey<Integer>("Advanced", Integer.class, "vmsnapshot.max", "10", "Maximum VM snapshots for a single VM", true, ConfigKey.Scope.Account);
|
||||
|
||||
/**
|
||||
* Delete all VM snapshots belonging to one VM
|
||||
|
|
|
|||
|
|
@ -935,7 +935,11 @@ public class VirtualMachineManagerImpl extends ManagerBase implements VirtualMac
|
|||
throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid);
|
||||
} catch (final ResourceUnavailableException e) {
|
||||
if (e.getScope() != null && e.getScope().equals(VirtualRouter.class)){
|
||||
throw new CloudRuntimeException("Network is unavailable. Please contact administrator", e).add(VirtualMachine.class, vmUuid);
|
||||
Account callingAccount = CallContext.current().getCallingAccount();
|
||||
String errorSuffix = (callingAccount != null && callingAccount.getType() == Account.Type.ADMIN) ?
|
||||
String.format("Failure: %s", e.getMessage()) :
|
||||
"Please contact administrator.";
|
||||
throw new CloudRuntimeException(String.format("The Network for VM %s is unavailable. %s", vmUuid, errorSuffix), e).add(VirtualMachine.class, vmUuid);
|
||||
}
|
||||
throw new CloudRuntimeException(String.format("Unable to start a VM [%s] due to [%s].", vmUuid, e.getMessage()), e).add(VirtualMachine.class, vmUuid);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
|
|||
return;
|
||||
}
|
||||
for (Long vmId : vmIds) {
|
||||
if (!notUpdated.containsKey(vmId)) {
|
||||
if (MapUtils.isEmpty(notUpdated) || !notUpdated.containsKey(vmId)) {
|
||||
logger.debug("VM state report is updated. {}, {}, power state: {}",
|
||||
() -> hostCache.get(hostId), () -> vmCache.get(vmId), () -> instancePowerStates.get(vmId));
|
||||
_messageBus.publish(null, VirtualMachineManager.Topics.VM_POWER_STATE,
|
||||
|
|
@ -158,8 +158,8 @@ public class VirtualMachinePowerStateSyncImpl implements VirtualMachinePowerStat
|
|||
// an update might have occurred that we should not override in case of out of band migration
|
||||
instancePowerStates.put(instance.getId(), VirtualMachine.PowerState.PowerReportMissing);
|
||||
} else {
|
||||
logger.debug("vm id: {} - time since last state update({} ms) has not passed graceful period yet",
|
||||
instance.getId(), milliSecondsSinceLastStateUpdate);
|
||||
logger.debug("vm id: {} - time since last state update({} ms) has not passed graceful period ({} ms) yet",
|
||||
instance.getId(), milliSecondsSinceLastStateUpdate, milliSecondsGracefulPeriod);
|
||||
}
|
||||
}
|
||||
updateAndPublishVmPowerStates(hostId, instancePowerStates, startTime);
|
||||
|
|
|
|||
|
|
@ -3586,8 +3586,9 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
final HashMap<Long, Long> stillFree = new HashMap<>();
|
||||
|
||||
final List<Long> networkIds = _networksDao.findNetworksToGarbageCollect();
|
||||
final int netGcWait = NumbersUtil.parseInt(_configDao.getValue(NetworkGcWait.key()), 60);
|
||||
logger.info("NetworkGarbageCollector uses '{}' seconds for GC interval.", netGcWait);
|
||||
final int netGcWait = NetworkGcWait.value();
|
||||
final int netGcInterval = NetworkGcInterval.value();
|
||||
logger.info("NetworkGarbageCollector uses '{}' seconds for GC wait and '{}' seconds for GC interval.", netGcWait, netGcInterval);
|
||||
|
||||
for (final Long networkId : networkIds) {
|
||||
if (!_networkModel.isNetworkReadyForGc(networkId)) {
|
||||
|
|
@ -4908,10 +4909,10 @@ public class NetworkOrchestrator extends ManagerBase implements NetworkOrchestra
|
|||
return NetworkOrchestrationService.class.getSimpleName();
|
||||
}
|
||||
|
||||
public static final ConfigKey<Integer> NetworkGcWait = new ConfigKey<>(Integer.class, "network.gc.wait", "Advanced", "600",
|
||||
"Time (in seconds) to wait before shutting down a network that's not in used", false, Scope.Global, null);
|
||||
public static final ConfigKey<Integer> NetworkGcInterval = new ConfigKey<>(Integer.class, "network.gc.interval", "Advanced", "600",
|
||||
"Seconds to wait before checking for networks to shutdown", true, Scope.Global, null);
|
||||
public static final ConfigKey<Integer> NetworkGcWait = new ConfigKey<Integer>(Integer.class, "network.gc.wait", "Advanced", "600",
|
||||
"Time (in seconds) to wait before shutting down a network that's not in used", true, Scope.Global, null);
|
||||
public static final ConfigKey<Integer> NetworkGcInterval = new ConfigKey<Integer>(Integer.class, "network.gc.interval", "Advanced", "600",
|
||||
"Seconds to wait before checking for networks to shutdown", false, Scope.Global, null);
|
||||
|
||||
@Override
|
||||
public ConfigKey<?>[] getConfigKeys() {
|
||||
|
|
|
|||
|
|
@ -36,6 +36,9 @@ import java.util.stream.Collectors;
|
|||
import javax.inject.Inject;
|
||||
import javax.naming.ConfigurationException;
|
||||
|
||||
import com.cloud.dc.dao.DataCenterDao;
|
||||
import com.cloud.storage.dao.VMTemplateDao;
|
||||
import com.cloud.template.TemplateManager;
|
||||
import org.apache.cloudstack.api.response.MigrationResponse;
|
||||
import org.apache.cloudstack.engine.orchestration.service.StorageOrchestrationService;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.DataObject;
|
||||
|
|
@ -45,6 +48,7 @@ import org.apache.cloudstack.engine.subsystem.api.storage.SecondaryStorageServic
|
|||
import org.apache.cloudstack.engine.subsystem.api.storage.SecondaryStorageService.DataObjectResult;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotDataFactory;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.SnapshotInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateDataFactory;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateInfo;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService;
|
||||
import org.apache.cloudstack.engine.subsystem.api.storage.TemplateService.TemplateApiResult;
|
||||
|
|
@ -103,6 +107,15 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra
|
|||
VolumeDataStoreDao volumeDataStoreDao;
|
||||
@Inject
|
||||
DataMigrationUtility migrationHelper;
|
||||
@Inject
|
||||
TemplateManager templateManager;
|
||||
@Inject
|
||||
VMTemplateDao templateDao;
|
||||
@Inject
|
||||
TemplateDataFactory templateDataFactory;
|
||||
@Inject
|
||||
DataCenterDao dcDao;
|
||||
|
||||
|
||||
ConfigKey<Double> ImageStoreImbalanceThreshold = new ConfigKey<>("Advanced", Double.class,
|
||||
"image.store.imbalance.threshold",
|
||||
|
|
@ -304,8 +317,9 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra
|
|||
}
|
||||
|
||||
@Override
|
||||
public Future<TemplateApiResult> orchestrateTemplateCopyToImageStore(TemplateInfo source, DataStore destStore) {
|
||||
return submit(destStore.getScope().getScopeId(), new CopyTemplateTask(source, destStore));
|
||||
public Future<TemplateApiResult> orchestrateTemplateCopyFromSecondaryStores(long srcTemplateId, DataStore destStore) {
|
||||
Long dstZoneId = destStore.getScope().getScopeId();
|
||||
return submit(dstZoneId, new CopyTemplateFromSecondaryStorageTask(srcTemplateId, destStore));
|
||||
}
|
||||
|
||||
protected Pair<String, Boolean> migrateCompleted(Long destDatastoreId, DataStore srcDatastore, List<DataObject> files, MigrationPolicy migrationPolicy, int skipped) {
|
||||
|
|
@ -624,13 +638,13 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra
|
|||
}
|
||||
}
|
||||
|
||||
private class CopyTemplateTask implements Callable<TemplateApiResult> {
|
||||
private TemplateInfo sourceTmpl;
|
||||
private DataStore destStore;
|
||||
private String logid;
|
||||
private class CopyTemplateFromSecondaryStorageTask implements Callable<TemplateApiResult> {
|
||||
private final long srcTemplateId;
|
||||
private final DataStore destStore;
|
||||
private final String logid;
|
||||
|
||||
public CopyTemplateTask(TemplateInfo sourceTmpl, DataStore destStore) {
|
||||
this.sourceTmpl = sourceTmpl;
|
||||
CopyTemplateFromSecondaryStorageTask(long srcTemplateId, DataStore destStore) {
|
||||
this.srcTemplateId = srcTemplateId;
|
||||
this.destStore = destStore;
|
||||
this.logid = ThreadContext.get(LOGCONTEXTID);
|
||||
}
|
||||
|
|
@ -639,17 +653,16 @@ public class StorageOrchestrator extends ManagerBase implements StorageOrchestra
|
|||
public TemplateApiResult call() {
|
||||
ThreadContext.put(LOGCONTEXTID, logid);
|
||||
TemplateApiResult result;
|
||||
AsyncCallFuture<TemplateApiResult> future = templateService.copyTemplateToImageStore(sourceTmpl, destStore);
|
||||
long destZoneId = destStore.getScope().getScopeId();
|
||||
TemplateInfo sourceTmpl = templateDataFactory.getTemplate(srcTemplateId, DataStoreRole.Image);
|
||||
try {
|
||||
result = future.get();
|
||||
} catch (ExecutionException | InterruptedException e) {
|
||||
logger.warn("Exception while copying template [{}] from image store [{}] to image store [{}]: {}",
|
||||
sourceTmpl.getUniqueName(), sourceTmpl.getDataStore().getName(), destStore.getName(), e.toString());
|
||||
templateService.handleTemplateCopyFromSecondaryStores(srcTemplateId, destStore);
|
||||
result = new TemplateApiResult(sourceTmpl);
|
||||
result.setResult(e.getMessage());
|
||||
} finally {
|
||||
tryCleaningUpExecutor(destZoneId);
|
||||
ThreadContext.clearAll();
|
||||
}
|
||||
tryCleaningUpExecutor(destStore.getScope().getScopeId());
|
||||
ThreadContext.clearAll();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -598,7 +598,7 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long>implements Ne
|
|||
public List<NetworkVO> listByPhysicalNetworkTrafficType(final long physicalNetworkId, final TrafficType trafficType) {
|
||||
final SearchCriteria<NetworkVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("trafficType", trafficType);
|
||||
sc.setParameters("physicalNetwork", physicalNetworkId);
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
return listBy(sc);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,9 @@ public class PhysicalNetworkTrafficTypeDaoImpl extends GenericDaoBase<PhysicalNe
|
|||
}
|
||||
|
||||
sc.setParameters("physicalNetworkId", physicalNetworkId);
|
||||
sc.setParameters("trafficType", trafficType);
|
||||
if (trafficType != null) {
|
||||
sc.setParameters("trafficType", trafficType);
|
||||
}
|
||||
List<String> tag = customSearch(sc, null);
|
||||
|
||||
return tag.size() == 0 ? null : tag.get(0);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
|
|||
|
||||
List<VolumeVO> findIncludingRemovedByInstanceAndType(long id, Volume.Type vType);
|
||||
|
||||
List<VolumeVO> findByInstanceIdAndPoolId(long instanceId, long poolId);
|
||||
List<VolumeVO> findNonDestroyedVolumesByInstanceIdAndPoolId(long instanceId, long poolId);
|
||||
|
||||
List<VolumeVO> findByInstanceIdDestroyed(long vmId);
|
||||
|
||||
|
|
@ -70,11 +70,11 @@ public interface VolumeDao extends GenericDao<VolumeVO, Long>, StateDao<Volume.S
|
|||
|
||||
List<VolumeVO> findCreatedByInstance(long id);
|
||||
|
||||
List<VolumeVO> findByPoolId(long poolId);
|
||||
List<VolumeVO> findNonDestroyedVolumesByPoolId(long poolId);
|
||||
|
||||
VolumeVO findByPoolIdName(long poolId, String name);
|
||||
|
||||
List<VolumeVO> findByPoolId(long poolId, Volume.Type volumeType);
|
||||
List<VolumeVO> findNonDestroyedVolumesByPoolId(long poolId, Volume.Type volumeType);
|
||||
|
||||
List<VolumeVO> findByPoolIdAndState(long poolid, Volume.State state);
|
||||
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByPoolId(long poolId) {
|
||||
public List<VolumeVO> findNonDestroyedVolumesByPoolId(long poolId) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("poolId", poolId);
|
||||
sc.setParameters("notDestroyed", Volume.State.Destroy, Volume.State.Expunged);
|
||||
|
|
@ -145,7 +145,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByInstanceIdAndPoolId(long instanceId, long poolId) {
|
||||
public List<VolumeVO> findNonDestroyedVolumesByInstanceIdAndPoolId(long instanceId, long poolId) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("instanceId", instanceId);
|
||||
sc.setParameters("poolId", poolId);
|
||||
|
|
@ -162,7 +162,7 @@ public class VolumeDaoImpl extends GenericDaoBase<VolumeVO, Long> implements Vol
|
|||
}
|
||||
|
||||
@Override
|
||||
public List<VolumeVO> findByPoolId(long poolId, Volume.Type volumeType) {
|
||||
public List<VolumeVO> findNonDestroyedVolumesByPoolId(long poolId, Volume.Type volumeType) {
|
||||
SearchCriteria<VolumeVO> sc = AllFieldsSearch.create();
|
||||
sc.setParameters("poolId", poolId);
|
||||
sc.setParameters("notDestroyed", Volume.State.Destroy, Volume.State.Expunged);
|
||||
|
|
|
|||
|
|
@ -606,7 +606,7 @@ public class SystemVmTemplateRegistration {
|
|||
template.setBits(64);
|
||||
template.setAccountId(Account.ACCOUNT_ID_SYSTEM);
|
||||
template.setUrl(details.getUrl());
|
||||
template.setChecksum(details.getChecksum());
|
||||
template.setChecksum(DigestHelper.prependAlgorithm(details.getChecksum()));
|
||||
template.setEnablePassword(false);
|
||||
template.setDisplayText(details.getName());
|
||||
template.setFormat(details.getFormat());
|
||||
|
|
@ -1079,7 +1079,7 @@ public class SystemVmTemplateRegistration {
|
|||
protected void updateTemplateUrlChecksumAndGuestOsId(VMTemplateVO templateVO,
|
||||
MetadataTemplateDetails templateDetails) {
|
||||
templateVO.setUrl(templateDetails.getUrl());
|
||||
templateVO.setChecksum(templateDetails.getChecksum());
|
||||
templateVO.setChecksum(DigestHelper.prependAlgorithm(templateDetails.getChecksum()));
|
||||
GuestOSVO guestOS = guestOSDao.findOneByDisplayName(templateDetails.getGuestOs());
|
||||
if (guestOS != null) {
|
||||
templateVO.setGuestOSId(guestOS.getId());
|
||||
|
|
|
|||
|
|
@ -0,0 +1,64 @@
|
|||
// 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.upgrade.dao;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.sql.Connection;
|
||||
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
|
||||
public class Upgrade42020to42030 extends DbUpgradeAbstractImpl implements DbUpgrade, DbUpgradeSystemVmTemplate {
|
||||
|
||||
@Override
|
||||
public String[] getUpgradableVersionRange() {
|
||||
return new String[]{"4.20.2.0", "4.20.3.0"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUpgradedVersion() {
|
||||
return "4.20.3.0";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsRollingUpgrade() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream[] getPrepareScripts() {
|
||||
final String scriptFile = "META-INF/db/schema-42020to42030.sql";
|
||||
final InputStream script = Thread.currentThread().getContextClassLoader().getResourceAsStream(scriptFile);
|
||||
if (script == null) {
|
||||
throw new CloudRuntimeException("Unable to find " + scriptFile);
|
||||
}
|
||||
|
||||
return new InputStream[] {script};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performDataMigration(Connection conn) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream[] getCleanupScripts() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateSystemVmTemplates(Connection conn) {
|
||||
}
|
||||
}
|
||||
|
|
@ -62,7 +62,7 @@ public interface UsageDao extends GenericDao<UsageVO, Long> {
|
|||
|
||||
void saveUsageRecords(List<UsageVO> usageRecords);
|
||||
|
||||
void removeOldUsageRecords(int days);
|
||||
void expungeAllOlderThan(int days, long limitPerQuery);
|
||||
|
||||
UsageVO persistUsage(final UsageVO usage);
|
||||
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue