Merge remote-tracking branch 'origin/4.17'

This commit is contained in:
Rohit Yadav 2022-06-30 12:17:29 +05:30
commit 3fc825e246
18 changed files with 1720 additions and 34565 deletions

View File

@ -27,7 +27,11 @@ import org.apache.cloudstack.framework.config.ConfigKey;
public interface ResourceLimitService {
static final ConfigKey<Long> ResourceCountCheckInterval = new ConfigKey<Long>("Advanced", Long.class, "resourcecount.check.interval", "300",
static final ConfigKey<Long> MaxAccountSecondaryStorage = new ConfigKey<>("Account Defaults", Long.class, "max.account.secondary.storage", "400",
"The default maximum secondary storage space (in GiB) that can be used for an account", false);
static final ConfigKey<Long> MaxProjectSecondaryStorage = new ConfigKey<>("Project Defaults", Long.class, "max.project.secondary.storage", "400",
"The default maximum secondary storage space (in GiB) that can be used for a project", false);
static final ConfigKey<Long> ResourceCountCheckInterval = new ConfigKey<>("Advanced", Long.class, "resourcecount.check.interval", "300",
"Time (in seconds) to wait before running resource recalculation and fixing task. Default is 300 seconds, Setting this to 0 disables execution of the task", false);
/**

View File

@ -49,7 +49,7 @@ public class TemplateOrVolumePostUploadCommand {
String description;
private String defaultMaxAccountSecondaryStorage;
private long defaultMaxSecondaryStorageInGB;
private long processTimeout;
@ -185,12 +185,12 @@ public class TemplateOrVolumePostUploadCommand {
this.description = description;
}
public void setDefaultMaxAccountSecondaryStorage(String defaultMaxAccountSecondaryStorage) {
this.defaultMaxAccountSecondaryStorage = defaultMaxAccountSecondaryStorage;
public void setDefaultMaxSecondaryStorageInGB(long defaultMaxSecondaryStorageInGB) {
this.defaultMaxSecondaryStorageInGB = defaultMaxSecondaryStorageInGB;
}
public String getDefaultMaxAccountSecondaryStorage() {
return defaultMaxAccountSecondaryStorage;
public long getDefaultMaxSecondaryStorageInGB() {
return defaultMaxSecondaryStorageInGB;
}
public void setAccountId(long accountId) {

View File

@ -588,6 +588,7 @@ public class KubernetesClusterManagerImpl extends ManagerBase implements Kuberne
response.setAutoscalingEnabled(kubernetesCluster.getAutoscalingEnabled());
response.setMinSize(kubernetesCluster.getMinSize());
response.setMaxSize(kubernetesCluster.getMaxSize());
response.setCreated(kubernetesCluster.getCreated());
return response;
}

View File

@ -20,6 +20,8 @@ package com.cloud.kubernetes.version;
import org.apache.cloudstack.api.Identity;
import org.apache.cloudstack.api.InternalIdentity;
import java.util.Date;
/**
* KubernetesSupportedVersion describes the properties of supported kubernetes version
*
@ -36,6 +38,7 @@ public interface KubernetesSupportedVersion extends InternalIdentity, Identity {
long getIsoId();
Long getZoneId();
State getState();
Date getCreated();
/**
* @return minimum # of cpu.

View File

@ -158,6 +158,7 @@ public class KubernetesSupportedVersionVO implements KubernetesSupportedVersion
this.minimumRamSize = minimumRamSize;
}
@Override
public Date getCreated() {
return created;
}

View File

@ -105,6 +105,7 @@ public class KubernetesVersionManagerImpl extends ManagerBase implements Kuberne
response.setIsoName(template.getName());
response.setIsoState(template.getState().toString());
}
response.setCreated(kubernetesSupportedVersion.getCreated());
return response;
}

View File

@ -16,6 +16,7 @@
// under the License.
package org.apache.cloudstack.api.response;
import java.util.Date;
import java.util.List;
import org.apache.cloudstack.api.ApiConstants;
@ -158,6 +159,10 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
@Param(description = "Maximum size of the cluster")
private Long maxSize;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date when this Kubernetes cluster was created")
private Date created;
public KubernetesClusterResponse() {
}
@ -377,4 +382,8 @@ public class KubernetesClusterResponse extends BaseResponseWithAnnotations imple
public void setMaxSize(Long maxSize) {
this.maxSize = maxSize;
}
public void setCreated(Date created) {
this.created = created;
}
}

View File

@ -25,6 +25,8 @@ import com.cloud.kubernetes.version.KubernetesSupportedVersion;
import com.cloud.serializer.Param;
import com.google.gson.annotations.SerializedName;
import java.util.Date;
@SuppressWarnings("unused")
@EntityReference(value = {KubernetesSupportedVersion.class})
public class KubernetesSupportedVersionResponse extends BaseResponse {
@ -80,6 +82,10 @@ public class KubernetesSupportedVersionResponse extends BaseResponse {
@Param(description = "the minimum RAM size in MB needed for the Kubernetes supported version")
private Integer minimumRamSize;
@SerializedName(ApiConstants.CREATED)
@Param(description = "the date when this Kubernetes supported version was created")
private Date created;
public String getId() {
return id;
}
@ -183,4 +189,8 @@ public class KubernetesSupportedVersionResponse extends BaseResponse {
public void setSupportsAutoscaling(Boolean supportsAutoscaling) {
this.supportsAutoscaling = supportsAutoscaling;
}
public void setCreated(Date created) {
this.created = created;
}
}

View File

@ -1361,14 +1361,6 @@ public enum Config {
"200",
"The default maximum primary storage space (in GiB) that can be used for an account",
null),
DefaultMaxAccountSecondaryStorage(
"Account Defaults",
ManagementServer.class,
Long.class,
"max.account.secondary.storage",
"400",
"The default maximum secondary storage space (in GiB) that can be used for an account",
null),
//disabling lb as cluster sync does not work with distributed cluster
SubDomainNetworkAccess(
@ -1497,14 +1489,6 @@ public enum Config {
"200",
"The default maximum primary storage space (in GiB) that can be used for an project",
null),
DefaultMaxProjectSecondaryStorage(
"Project Defaults",
ManagementServer.class,
Long.class,
"max.project.secondary.storage",
"400",
"The default maximum secondary storage space (in GiB) that can be used for an project",
null),
ProjectInviteRequired(
"Project Defaults",

View File

@ -47,6 +47,7 @@ import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationSe
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
import org.apache.cloudstack.lb.ApplicationLoadBalancerRuleVO;
import org.apache.cloudstack.lb.dao.ApplicationLoadBalancerRuleDao;
import org.apache.commons.lang3.StringUtils;
import org.apache.log4j.Logger;
import com.cloud.agent.api.to.LoadBalancerTO;
@ -2105,6 +2106,7 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
LoadBalancerVO lbBackup = _lbDao.findById(lbRuleId);
String customId = cmd.getCustomId();
Boolean forDisplay = cmd.getDisplay();
String lbProtocol = cmd.getLbProtocol();
if (lb == null) {
throw new InvalidParameterValueException("Unable to find lb rule by id=" + lbRuleId);
@ -2133,6 +2135,10 @@ public class LoadBalancingRulesManagerImpl<Type> extends ManagerBase implements
lb.setDisplay(forDisplay);
}
if (StringUtils.isNotBlank(lbProtocol)) {
lb.setLbProtocol(lbProtocol);
}
// Validate rule in LB provider
LoadBalancingRule rule = getLoadBalancerRuleToApply(lb);
if (!validateLbRule(rule)) {

View File

@ -226,7 +226,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
projectResourceLimitMap.put(Resource.ResourceType.cpu, Long.parseLong(_configDao.getValue(Config.DefaultMaxProjectCpus.key())));
projectResourceLimitMap.put(Resource.ResourceType.memory, Long.parseLong(_configDao.getValue(Config.DefaultMaxProjectMemory.key())));
projectResourceLimitMap.put(Resource.ResourceType.primary_storage, Long.parseLong(_configDao.getValue(Config.DefaultMaxProjectPrimaryStorage.key())));
projectResourceLimitMap.put(Resource.ResourceType.secondary_storage, Long.parseLong(_configDao.getValue(Config.DefaultMaxProjectSecondaryStorage.key())));
projectResourceLimitMap.put(Resource.ResourceType.secondary_storage, MaxProjectSecondaryStorage.value());
accountResourceLimitMap.put(Resource.ResourceType.public_ip, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountPublicIPs.key())));
accountResourceLimitMap.put(Resource.ResourceType.snapshot, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountSnapshots.key())));
@ -238,7 +238,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
accountResourceLimitMap.put(Resource.ResourceType.cpu, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountCpus.key())));
accountResourceLimitMap.put(Resource.ResourceType.memory, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountMemory.key())));
accountResourceLimitMap.put(Resource.ResourceType.primary_storage, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountPrimaryStorage.key())));
accountResourceLimitMap.put(Resource.ResourceType.secondary_storage, Long.parseLong(_configDao.getValue(Config.DefaultMaxAccountSecondaryStorage.key())));
accountResourceLimitMap.put(Resource.ResourceType.secondary_storage, MaxAccountSecondaryStorage.value());
domainResourceLimitMap.put(Resource.ResourceType.public_ip, Long.parseLong(_configDao.getValue(Config.DefaultMaxDomainPublicIPs.key())));
domainResourceLimitMap.put(Resource.ResourceType.snapshot, Long.parseLong(_configDao.getValue(Config.DefaultMaxDomainSnapshots.key())));
@ -1100,7 +1100,7 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
@Override
public ConfigKey<?>[] getConfigKeys() {
return new ConfigKey<?>[] {ResourceCountCheckInterval};
return new ConfigKey<?>[] {ResourceCountCheckInterval, MaxAccountSecondaryStorage, MaxProjectSecondaryStorage};
}
protected class ResourceCountCheckTask extends ManagedContextRunnable {

View File

@ -456,8 +456,13 @@ public class VolumeApiServiceImpl extends ManagerBase implements VolumeApiServic
//using the existing max upload size configuration
command.setProcessTimeout(NumbersUtil.parseLong(_configDao.getValue("vmware.package.ova.timeout"), 3600));
command.setMaxUploadSize(_configDao.getValue(Config.MaxUploadVolumeSize.key()));
command.setDefaultMaxAccountSecondaryStorage(_configDao.getValue(Config.DefaultMaxAccountSecondaryStorage.key()));
command.setAccountId(vol.getAccountId());
Account account = _accountDao.findById(vol.getAccountId());
if (account.getType().equals(Account.Type.PROJECT)) {
command.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxProjectSecondaryStorage.value());
} else {
command.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxAccountSecondaryStorage.value());
}
Gson gson = new GsonBuilder().create();
String metadata = EncryptionUtil.encodeData(gson.toJson(command), key);
response.setMetadata(metadata);

View File

@ -93,6 +93,7 @@ import com.cloud.storage.dao.VMTemplateZoneDao;
import com.cloud.storage.download.DownloadMonitor;
import com.cloud.template.VirtualMachineTemplate.State;
import com.cloud.user.Account;
import com.cloud.user.ResourceLimitService;
import com.cloud.utils.Pair;
import com.cloud.utils.UriUtils;
import com.cloud.utils.db.DB;
@ -398,8 +399,13 @@ public class HypervisorTemplateAdapter extends TemplateAdapterBase {
templateOnStore.getDataStore().getRole().toString());
//using the existing max template size configuration
payload.setMaxUploadSize(_configDao.getValue(Config.MaxTemplateAndIsoSize.key()));
payload.setDefaultMaxAccountSecondaryStorage(_configDao.getValue(Config.DefaultMaxAccountSecondaryStorage.key()));
payload.setAccountId(template.getAccountId());
Account account = _accountDao.findById(template.getAccountId());
if (account.getType().equals(Account.Type.PROJECT)) {
payload.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxProjectSecondaryStorage.value());
} else {
payload.setDefaultMaxSecondaryStorageInGB(ResourceLimitService.MaxAccountSecondaryStorage.value());
}
payload.setRemoteEndPoint(ep.getPublicAddr());
payload.setRequiresHvm(template.requiresHvm());
payload.setDescription(template.getDisplayText());

View File

@ -3275,12 +3275,12 @@ public class NfsSecondaryStorageResource extends ServerResourceBase implements S
"accountTemplateDirSize: " + accountTemplateDirSize + " accountSnapshotDirSize: " + accountSnapshotDirSize + " accountVolumeDirSize: " + accountVolumeDirSize);
int accountDirSizeInGB = getSizeInGB(accountTemplateDirSize + accountSnapshotDirSize + accountVolumeDirSize);
int defaultMaxAccountSecondaryStorageInGB = Integer.parseInt(cmd.getDefaultMaxAccountSecondaryStorage());
long defaultMaxSecondaryStorageInGB = cmd.getDefaultMaxSecondaryStorageInGB();
if (defaultMaxAccountSecondaryStorageInGB != Resource.RESOURCE_UNLIMITED && (accountDirSizeInGB + contentLengthInGB) > defaultMaxAccountSecondaryStorageInGB) {
s_logger.error("accountDirSizeInGb: " + accountDirSizeInGB + " defaultMaxAccountSecondaryStorageInGB: " + defaultMaxAccountSecondaryStorageInGB + " contentLengthInGB:"
if (defaultMaxSecondaryStorageInGB != Resource.RESOURCE_UNLIMITED && (accountDirSizeInGB + contentLengthInGB) > defaultMaxSecondaryStorageInGB) {
s_logger.error("accountDirSizeInGb: " + accountDirSizeInGB + " defaultMaxSecondaryStorageInGB: " + defaultMaxSecondaryStorageInGB + " contentLengthInGB:"
+ contentLengthInGB); // extra attention
String errorMessage = "Maximum number of resources of type secondary_storage for account has exceeded";
String errorMessage = "Maximum number of resources of type secondary_storage for account/project has exceeded";
updateStateMapWithError(cmd.getEntityUUID(), errorMessage);
throw new InvalidParameterValueException(errorMessage);
}

36187
ui/package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -52,11 +52,9 @@
"npm-check-updates": "^6.0.1",
"nprogress": "^0.2.0",
"vue": "^3.2.31",
"vue-clipboard2": "^0.3.1",
"vue-cropper": "^1.0.2",
"vue-i18n": "^9.1.6",
"vue-loader": "^16.2.0",
"vue-ls": "^3.2.2",
"vue-router": "^4.0.14",
"vue-web-storage": "^6.1.0",
"vue3-clipboard": "^1.0.0",

View File

@ -435,7 +435,7 @@ export default {
fields.push('zonename')
return fields
},
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename'],
details: ['name', 'description', 'zonename', 'kubernetesversionname', 'autoscalingenabled', 'minsize', 'maxsize', 'size', 'controlnodes', 'cpunumber', 'memory', 'keypair', 'associatednetworkname', 'account', 'domain', 'zonename', 'created'],
tabs: [{
name: 'k8s',
component: shallowRef(defineAsyncComponent(() => import('@/views/compute/KubernetesServiceTab.vue')))

View File

@ -323,7 +323,7 @@ export default {
docHelp: 'plugins/cloudstack-kubernetes-service.html#kubernetes-supported-versions',
permission: ['listKubernetesSupportedVersions'],
columns: ['name', 'state', 'semanticversion', 'isostate', 'mincpunumber', 'minmemory', 'zonename'],
details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'mincpunumber', 'minmemory', 'supportsha', 'state'],
details: ['name', 'semanticversion', 'supportsautoscaling', 'zoneid', 'zonename', 'isoid', 'isoname', 'isostate', 'mincpunumber', 'minmemory', 'supportsha', 'state', 'created'],
actions: [
{
api: 'addKubernetesSupportedVersion',