DaanHoogland commented on code in PR #12499:
URL: https://github.com/apache/cloudstack/pull/12499#discussion_r2715720251
##########
api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java:
##########
@@ -124,6 +125,9 @@ public static void validateVnfNics(List<VNF.VnfNic>
nicsList) {
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 Template cannot
be registered with VNF nics as Template settings are read from OVA.");
+ }
Review Comment:
Do we want this always to be true? I could imagine a VNF getting a default
gateway… Probably my lack of knowledge. I hope this is in the documentation.
##########
server/src/main/java/com/cloud/vm/UserVmManagerImpl.java:
##########
@@ -6127,7 +6127,11 @@ public UserVm createVirtualMachine(DeployVMCmd cmd)
throws InsufficientCapacityE
throw new InvalidParameterValueException("Unable to use template "
+ templateId);
}
if (TemplateType.VNF.equals(template.getTemplateType())) {
- vnfTemplateManager.validateVnfApplianceNics(template,
cmd.getNetworkIds());
+ if (template.isDeployAsIs()) {
+ vnfTemplateManager.validateVnfApplianceNetworksMap(template,
cmd.getVmNetworkMap());
+ } else {
+ vnfTemplateManager.validateVnfApplianceNics(template,
cmd.getNetworkIds());
+ }
} else if (cmd instanceof DeployVnfApplianceCmd) {
throw new InvalidParameterValueException("Can't deploy VNF
appliance from a non-VNF template");
}
Review Comment:
can we extract this as a new validation method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]