Skip to content

Commit e929f20

Browse files
author
Daan Hoogland
committed
Merge branch '4.22'
2 parents e32d08e + cd6a8f6 commit e929f20

File tree

23 files changed

+670
-173
lines changed

23 files changed

+670
-173
lines changed

api/src/main/java/org/apache/cloudstack/api/BaseUpdateTemplateOrIsoCmd.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ public Map getDetails() {
153153
return (Map) (paramsCollection.toArray())[0];
154154
}
155155

156-
public boolean isCleanupDetails(){
157-
return cleanupDetails == null ? false : cleanupDetails.booleanValue();
156+
public boolean isCleanupDetails() {
157+
return cleanupDetails != null && cleanupDetails;
158158
}
159159

160160
public CPU.CPUArch getCPUArch() {

api/src/main/java/org/apache/cloudstack/api/command/user/vm/BaseDeployVMCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public abstract class BaseDeployVMCmd extends BaseAsyncCreateCustomIdCmd impleme
188188
@Parameter(name = ApiConstants.MAC_ADDRESS, type = CommandType.STRING, description = "the mac address for default vm's network")
189189
private String macAddress;
190190

191-
@Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
191+
@Parameter(name = ApiConstants.KEYBOARD, type = CommandType.STRING, description = "an optional keyboard device type for the virtual machine. valid value can be one of de,de-ch,es,es-latam,fi,fr,fr-be,fr-ch,is,it,jp,nl-be,no,pt,uk,us")
192192
private String keyboard;
193193

194194
@Parameter(name = ApiConstants.PROJECT_ID, type = CommandType.UUID, entityType = ProjectResponse.class, description = "Deploy vm for the project")

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,6 +340,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
340340
@Param(description = "List of read-only Instance details as comma separated string.", since = "4.16.0")
341341
private String readOnlyDetails;
342342

343+
@SerializedName("alloweddetails")
344+
@Param(description = "List of allowed Vm details as comma separated string if VM instance settings are read from OVA.", since = "4.22.1")
345+
private String allowedDetails;
346+
343347
@SerializedName(ApiConstants.SSH_KEYPAIRS)
344348
@Param(description = "SSH key-pairs")
345349
private String keyPairNames;
@@ -1091,6 +1095,10 @@ public void setReadOnlyDetails(String readOnlyDetails) {
10911095
this.readOnlyDetails = readOnlyDetails;
10921096
}
10931097

1098+
public void setAllowedDetails(String allowedDetails) {
1099+
this.allowedDetails = allowedDetails;
1100+
}
1101+
10941102
public void setOsTypeId(String osTypeId) {
10951103
this.osTypeId = osTypeId;
10961104
}
@@ -1115,6 +1123,10 @@ public String getReadOnlyDetails() {
11151123
return readOnlyDetails;
11161124
}
11171125

1126+
public String getAllowedDetails() {
1127+
return allowedDetails;
1128+
}
1129+
11181130
public Boolean getDynamicallyScalable() {
11191131
return isDynamicallyScalable;
11201132
}

engine/schema/src/main/java/com/cloud/storage/dao/VMTemplateDaoImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ public void saveDetails(VMTemplateVO tmpl) {
457457
if (detailsStr == null) {
458458
return;
459459
}
460-
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
460+
List<VMTemplateDetailVO> details = new ArrayList<>();
461461
for (String key : detailsStr.keySet()) {
462462
VMTemplateDetailVO detail = new VMTemplateDetailVO(tmpl.getId(), key, detailsStr.get(key), true);
463463
details.add(detail);
@@ -479,7 +479,7 @@ public long addTemplateToZone(VMTemplateVO tmplt, long zoneId) {
479479
}
480480

481481
if (tmplt.getDetails() != null) {
482-
List<VMTemplateDetailVO> details = new ArrayList<VMTemplateDetailVO>();
482+
List<VMTemplateDetailVO> details = new ArrayList<>();
483483
for (String key : tmplt.getDetails().keySet()) {
484484
details.add(new VMTemplateDetailVO(tmplt.getId(), key, tmplt.getDetails().get(key), true));
485485
}

pom.xml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,20 +65,20 @@
6565
<!-- Plugins versions -->
6666
<cs.antrun-plugin.version>1.8</cs.antrun-plugin.version>
6767
<cs.builder-helper-plugin.version>3.0.0</cs.builder-helper-plugin.version>
68-
<cs.checkstyle-plugin.version>3.1.0</cs.checkstyle-plugin.version>
68+
<cs.checkstyle-plugin.version>3.6.0</cs.checkstyle-plugin.version>
6969
<cs.jacoco-plugin.version>0.8.11</cs.jacoco-plugin.version>
7070
<cs.compiler-plugin.version>3.8.1</cs.compiler-plugin.version>
71-
<cs.dependency-plugin.version>3.1.1</cs.dependency-plugin.version>
71+
<cs.dependency-plugin.version>3.9.0</cs.dependency-plugin.version>
7272
<cs.failsafe-plugin.version>2.22.2</cs.failsafe-plugin.version>
7373
<cs.spotbugs.version>3.1.12</cs.spotbugs.version>
7474
<cs.spotbugs-maven-plugin.version>3.1.12.2</cs.spotbugs-maven-plugin.version>
7575
<cs.jar-plugin.version>3.2.0</cs.jar-plugin.version>
76-
<cs.pmd-plugin.version>3.12.0</cs.pmd-plugin.version>
76+
<cs.pmd-plugin.version>3.28.0</cs.pmd-plugin.version>
7777
<cs.project-info-plugin.version>3.0.0</cs.project-info-plugin.version>
7878
<cs.owasp.dependency-checker-plugin.version>7.4.4</cs.owasp.dependency-checker-plugin.version>
7979
<cs.release-plugin.version>2.5.3</cs.release-plugin.version>
8080
<cs.resources-plugin.version>3.1.0</cs.resources-plugin.version>
81-
<cs.site-plugin.version>3.8.2</cs.site-plugin.version>
81+
<cs.site-plugin.version>3.21.0</cs.site-plugin.version>
8282
<cs.surefire-plugin.version>2.22.2</cs.surefire-plugin.version>
8383
<cs.clover-maven-plugin.version>4.4.1</cs.clover-maven-plugin.version>
8484
<cs.exec-maven-plugin.version>3.2.0</cs.exec-maven-plugin.version>

server/src/main/java/com/cloud/api/query/QueryManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5408,7 +5408,7 @@ private void fillVMOrTemplateDetailOptions(final Map<String, List<String>> optio
54085408

54095409
options.put(ApiConstants.BootType.UEFI.toString(), Arrays.asList(ApiConstants.BootMode.LEGACY.toString(),
54105410
ApiConstants.BootMode.SECURE.toString()));
5411-
options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us", "jp", "fr"));
5411+
options.put(VmDetailConstants.KEYBOARD, Arrays.asList("uk", "us", "jp", "fr", "es-latam"));
54125412
options.put(VmDetailConstants.CPU_CORE_PER_SOCKET, Collections.emptyList());
54135413
options.put(VmDetailConstants.ROOT_DISK_SIZE, Collections.emptyList());
54145414

server/src/main/java/com/cloud/api/query/dao/UserVmJoinDaoImpl.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,11 @@
6969
import com.cloud.storage.DiskOfferingVO;
7070
import com.cloud.storage.GuestOS;
7171
import com.cloud.storage.Storage.TemplateType;
72+
import com.cloud.storage.VMTemplateVO;
7273
import com.cloud.storage.VnfTemplateDetailVO;
7374
import com.cloud.storage.VnfTemplateNicVO;
7475
import com.cloud.storage.Volume;
76+
import com.cloud.storage.dao.VMTemplateDao;
7577
import com.cloud.storage.dao.VnfTemplateDetailsDao;
7678
import com.cloud.storage.dao.VnfTemplateNicDao;
7779
import com.cloud.user.Account;
@@ -124,6 +126,8 @@ public class UserVmJoinDaoImpl extends GenericDaoBaseWithTagInformation<UserVmJo
124126
private ServiceOfferingDao serviceOfferingDao;
125127
@Inject
126128
private VgpuProfileDao vgpuProfileDao;
129+
@Inject
130+
VMTemplateDao vmTemplateDao;
127131

128132
private final SearchBuilder<UserVmJoinVO> VmDetailSearch;
129133
private final SearchBuilder<UserVmJoinVO> activeVmByIsoSearch;
@@ -465,6 +469,10 @@ public UserVmResponse newUserVmResponse(ResponseView view, String objectName, Us
465469
if (caller.getType() != Account.Type.ADMIN) {
466470
userVmResponse.setReadOnlyDetails(QueryService.UserVMReadOnlyDetails.value());
467471
}
472+
VMTemplateVO template = vmTemplateDao.findByIdIncludingRemoved(userVm.getTemplateId());
473+
if (template != null && template.isDeployAsIs() && UserVmManager.VmwareAdditionalDetailsFromOvaEnabled.valueIn(userVm.getDataCenterId())) {
474+
userVmResponse.setAllowedDetails(UserVmManager.VmwareAllowedAdditionalDetailsFromOva.valueIn(userVm.getDataCenterId()));
475+
}
468476
}
469477

470478
userVmResponse.setObjectName(objectName);

server/src/main/java/com/cloud/template/TemplateManagerImpl.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2256,7 +2256,7 @@ private VMTemplateVO updateTemplateOrIso(BaseUpdateTemplateOrIsoCmd cmd) {
22562256
templateTag == null &&
22572257
forCks == null &&
22582258
arch == null &&
2259-
(! cleanupDetails && details == null) //update details in every case except this one
2259+
(!cleanupDetails && details == null) //update details in every case except this one
22602260
);
22612261
if (!updateNeeded) {
22622262
return template;
@@ -2360,8 +2360,7 @@ private VMTemplateVO updateTemplateOrIso(BaseUpdateTemplateOrIsoCmd cmd) {
23602360
if (cleanupDetails) {
23612361
template.setDetails(null);
23622362
_tmpltDetailsDao.removeDetails(id);
2363-
}
2364-
else if (details != null && !details.isEmpty()) {
2363+
} else if (details != null && !details.isEmpty()) {
23652364
template.setDetails(details);
23662365
_tmpltDao.saveDetails(template);
23672366
}

server/src/main/java/com/cloud/vm/UserVmManager.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,15 @@ public interface UserVmManager extends UserVmService {
9999
ConfigKey.Scope.Account);
100100

101101

102+
ConfigKey<Boolean> VmwareAdditionalDetailsFromOvaEnabled = new ConfigKey<Boolean>("Advanced", Boolean.class,
103+
"vmware.additional.details.from.ova.enabled", "false",
104+
"If true, allow users to add additional VM settings if VM instance settings are read from OVA.", true, ConfigKey.Scope.Zone);
105+
106+
ConfigKey<String> VmwareAllowedAdditionalDetailsFromOva = new ConfigKey<>(String.class,
107+
"vmware.allowed.additional.details.from.ova", "Advanced", "",
108+
"Comma separated list of allowed additional VM settings if VM instance settings are read from OVA.",
109+
true, ConfigKey.Scope.Zone, null, null, null, null, null, ConfigKey.Kind.CSV, null);
110+
102111
static final int MAX_USER_DATA_LENGTH_BYTES = 2048;
103112

104113
public static final String CKS_NODE = "cksnode";

0 commit comments

Comments
 (0)