address review comments

This commit is contained in:
Manoj Kumar 2026-04-28 23:30:07 +05:30
parent dc18aa7961
commit 80f7983910
No known key found for this signature in database
GPG Key ID: E952B7234D2C6F88
8 changed files with 32 additions and 16 deletions

View File

@ -38,8 +38,7 @@ public interface Resource {
backup_storage("backup_storage", 13),
bucket("bucket", 14),
object_storage("object_storage", 15),
gpu("gpu", 16),
dns_zone("dns_zone", 17);
gpu("gpu", 16);
private String name;
private int ordinal;

View File

@ -68,17 +68,22 @@ public class AddDnsServerCmd extends BaseCmd {
@Parameter(name = ApiConstants.PORT, type = CommandType.INTEGER, description = "Port number of the external DNS server")
private Integer port;
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Whether the DNS server is publicly accessible by other accounts")
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN,
description = "Whether this DNS server can be used by accounts other than the owner to create and manage DNS zones")
private Boolean isPublic;
@Parameter(name = ApiConstants.PUBLIC_DOMAIN_SUFFIX, type = CommandType.STRING, description = "The domain suffix used for public access (e.g. public.example.com)")
@Parameter(name = ApiConstants.PUBLIC_DOMAIN_SUFFIX, type = CommandType.STRING,
description = "Domain suffix that restricts DNS zones created by non-owner accounts to subdomains of this " +
"suffix (for example, sub.example.com under example.com)")
private String publicDomainSuffix;
@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.LIST, collectionType = CommandType.STRING,
required = true, description = "Comma separated list of name servers")
required = true,
description = "Comma separated list of name servers; used to create NS records for the DNS Zone (for example, ns1.example.com, ns2.example.com)")
private List<String> nameServers;
@Parameter(name = "externalserverid", type = CommandType.STRING, description = "External server id or hostname for the DNS server, e.g., 'localhost' for PowerDNS")
@Parameter(name = "externalserverid", type = CommandType.STRING,
description = "External server id or hostname for the DNS server, e.g., 'localhost' for PowerDNS")
private String externalServerId;
/////////////////////////////////////////////////////

View File

@ -17,6 +17,8 @@
package org.apache.cloudstack.api.command.user.dns;
import java.util.List;
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.acl.SecurityChecker;
import org.apache.cloudstack.api.ACL;
@ -58,20 +60,25 @@ public class UpdateDnsServerCmd extends BaseCmd {
@Parameter(name = ApiConstants.URL, type = CommandType.STRING, description = "API URL of the provider")
private String url;
@Parameter(name = ApiConstants.DNS_API_KEY, type = CommandType.STRING, required = false, description = "API Key or Credentials for the external provider")
@Parameter(name = ApiConstants.DNS_API_KEY, type = CommandType.STRING, description = "API Key or Credentials for the external provider")
private String dnsApiKey;
@Parameter(name = ApiConstants.PORT, type = CommandType.INTEGER, description = "Port number of the external DNS server")
private Integer port;
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Whether the DNS server is publicly accessible by other accounts")
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN,
description = "Whether this DNS server can be used by accounts other than the owner to create and manage DNS zones")
private Boolean isPublic;
@Parameter(name = ApiConstants.PUBLIC_DOMAIN_SUFFIX, type = CommandType.STRING, description = "The domain suffix used for public access (e.g. public.example.com)")
@Parameter(name = ApiConstants.PUBLIC_DOMAIN_SUFFIX, type = CommandType.STRING,
description = "Domain suffix that restricts DNS zones created by non-owner accounts to subdomains of this " +
"suffix (for example, sub.example.com under example.com)")
private String publicDomainSuffix;
@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.STRING, description = "Comma separated list of name servers")
private String nameServers;
@Parameter(name = ApiConstants.NAME_SERVERS, type = CommandType.LIST, collectionType = CommandType.STRING,
required = true,
description = "Comma separated list of name servers; used to create NS records for the DNS Zone (for example, ns1.example.com, ns2.example.com)")
private List<String> nameServers;
@Parameter(name = ApiConstants.STATE, type = CommandType.STRING, description = "Update state for the DNS server (Enabled, Disabled)")
private String state;
@ -95,7 +102,7 @@ public class UpdateDnsServerCmd extends BaseCmd {
public String getPublicDomainSuffix() {
return publicDomainSuffix;
}
public String getNameServers() { return nameServers; }
public String getNameServers() { return String.join(",", nameServers); }
@Override
public long getEntityOwnerId() {

View File

@ -151,7 +151,7 @@ public class NicResponse extends BaseResponse {
private Boolean isEnabled;
@SerializedName(ApiConstants.NIC_DNS_NAME)
@Param(description = "Public IP address associated with this NIC via Static NAT rule")
@Param(description = "DNS name associated with this NIC's IP address")
private String nicDnsName;
public void setVmId(String vmId) {

View File

@ -23,6 +23,8 @@ import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.Arrays;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DnsServerResponse;
import org.apache.cloudstack.dns.DnsServer;
@ -43,7 +45,7 @@ public class UpdateDnsServerCmdTest extends BaseDnsCmdTest {
setField(cmd, "port", 9090);
setField(cmd, "isPublic", true);
setField(cmd, "publicDomainSuffix", "updated.example.com");
setField(cmd, "nameServers", "ns1.updated.com,ns2.updated.com");
setField(cmd, "nameServers", Arrays.asList("ns1.updated.com", "ns2.updated.com"));
setField(cmd, "state", "Enabled");
return cmd;
}

View File

@ -20,6 +20,7 @@ package com.cloud.vm.dao;
import java.util.List;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Component;
import org.apache.cloudstack.resourcedetail.ResourceDetailsDaoBase;
@ -48,6 +49,9 @@ public class NicDetailsDaoImpl extends ResourceDetailsDaoBase<NicDetailVO> imple
@Override
public void removeDetailsForValuesIn(String resourceName, List<String> values) {
if (CollectionUtils.isEmpty(values)) {
return;
}
SearchCriteria<NicDetailVO> sc = NameValuesSearch.create();
sc.setParameters(ApiConstants.NAME, resourceName);
sc.setParameters(ApiConstants.VALUE, values.toArray());

View File

@ -328,7 +328,6 @@ public class ResourceLimitManagerImpl extends ManagerBase implements ResourceLim
accountResourceLimitMap.put(Resource.ResourceType.backup_storage.name(), Long.parseLong(_configDao.getValue(BackupManager.DefaultMaxAccountBackupStorage.key())));
accountResourceLimitMap.put(Resource.ResourceType.bucket.name(), Long.parseLong(_configDao.getValue(BucketApiService.DefaultMaxAccountBuckets.key())));
accountResourceLimitMap.put(Resource.ResourceType.object_storage.name(), Long.parseLong(_configDao.getValue(BucketApiService.DefaultMaxAccountObjectStorage.key())));
accountResourceLimitMap.put(ResourceType.dns_zone.name(), DefaultMaxDnsAccounts.value());
domainResourceLimitMap.put(Resource.ResourceType.public_ip.name(), Long.parseLong(_configDao.getValue(Config.DefaultMaxDomainPublicIPs.key())));
domainResourceLimitMap.put(Resource.ResourceType.snapshot.name(), Long.parseLong(_configDao.getValue(Config.DefaultMaxDomainSnapshots.key())));

View File

@ -1527,7 +1527,7 @@ export default {
},
{
name: 'dnsserver',
title: 'label.dns.server',
title: 'label.dns.servers',
icon: 'cloud-server-outlined',
permission: ['listDnsServers'],
columns: ['name', 'url', 'provider', 'ispublic', 'port', 'nameservers', 'publicdomainsuffix'],