Skip to content

Commit cb822fe

Browse files
author
Daan Hoogland
committed
Merge branch '4.22'
2 parents d6c192c + 75db42b commit cb822fe

File tree

45 files changed

+462
-238
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+462
-238
lines changed

api/src/main/java/com/cloud/network/NetworkService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,10 @@ Network createGuestNetwork(long networkOfferingId, String name, String displayTe
108108
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType) throws
109109
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
110110

111+
Network createGuestNetwork(long networkOfferingId, String name, String displayText, Account owner,
112+
PhysicalNetwork physicalNetwork, long zoneId, ControlledEntity.ACLType aclType, Pair<Integer, Integer> vrIfaceMTUs) throws
113+
InsufficientCapacityException, ConcurrentOperationException, ResourceAllocationException;
114+
111115
Pair<List<? extends Network>, Integer> searchForNetworks(ListNetworksCmd cmd);
112116

113117
boolean deleteNetwork(long networkId, boolean forced);

api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,9 @@ public class ListHostsCmd extends BaseListCmd {
118118
since = "4.21.0")
119119
private String storageAccessGroup;
120120

121+
@Parameter(name = ApiConstants.VERSION, type = CommandType.STRING, description = "the host version", since = "4.20.3")
122+
private String version;
123+
121124
/////////////////////////////////////////////////////
122125
/////////////////// Accessors ///////////////////////
123126
/////////////////////////////////////////////////////
@@ -222,6 +225,10 @@ public ListHostsCmd(String storageAccessGroup) {
222225
this.storageAccessGroup = storageAccessGroup;
223226
}
224227

228+
public String getVersion() {
229+
return version;
230+
}
231+
225232
/////////////////////////////////////////////////////
226233
/////////////// API Implementation///////////////////
227234
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/management/ListMgmtsCmd.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@ public class ListMgmtsCmd extends BaseListCmd {
4545
since = "4.20.1.0")
4646
private Boolean peers;
4747

48+
@Parameter(name = ApiConstants.VERSION, type = CommandType.STRING,
49+
description = "the version of the management server", since = "4.20.3")
50+
private String version;
51+
4852
/////////////////////////////////////////////////////
4953
/////////////////// Accessors ///////////////////////
5054
/////////////////////////////////////////////////////
@@ -61,6 +65,10 @@ public Boolean getPeers() {
6165
return BooleanUtils.toBooleanDefaultIfNull(peers, false);
6266
}
6367

68+
public String getVersion() {
69+
return version;
70+
}
71+
6472
/////////////////////////////////////////////////////
6573
/////////////// API Implementation///////////////////
6674
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/user/backup/ListBackupScheduleCmd.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ public class ListBackupScheduleCmd extends BaseListProjectAndAccountResourcesCmd
5959
@Parameter(name = ApiConstants.VIRTUAL_MACHINE_ID,
6060
type = CommandType.UUID,
6161
entityType = UserVmResponse.class,
62-
required = true,
6362
description = "ID of the Instance")
6463
private Long vmId;
6564

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
public class DeployVnfApplianceCmd extends DeployVMCmd implements UserCmd {
4444

4545
@Parameter(name = ApiConstants.VNF_CONFIGURE_MANAGEMENT, type = CommandType.BOOLEAN, required = false,
46-
description = "True by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. False otherwise. " +
46+
description = "False by default, security group or network rules (source nat and firewall rules) will be configured for VNF management interfaces. True otherwise. " +
4747
"Network rules are configured if management network is an isolated network or shared network with security groups.")
4848
private Boolean vnfConfigureManagement;
4949

api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateManager.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
import org.apache.cloudstack.api.command.user.vm.DeployVnfApplianceCmd;
3030
import org.apache.cloudstack.framework.config.ConfigKey;
3131
import java.util.List;
32+
import java.util.Map;
3233

3334
public interface VnfTemplateManager {
3435

@@ -42,11 +43,12 @@ public interface VnfTemplateManager {
4243

4344
void updateVnfTemplate(long templateId, UpdateVnfTemplateCmd cmd);
4445

45-
void validateVnfApplianceNics(VirtualMachineTemplate template, List<Long> networkIds);
46+
void validateVnfApplianceNics(VirtualMachineTemplate template, List<Long> networkIds, Map<Integer, Long> vmNetworkMap);
4647

4748
SecurityGroup createSecurityGroupForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner, DeployVnfApplianceCmd cmd);
4849

4950
void createIsolatedNetworkRulesForVnfAppliance(DataCenter zone, VirtualMachineTemplate template, Account owner,
5051
UserVm vm, DeployVnfApplianceCmd cmd)
5152
throws InsufficientAddressCapacityException, ResourceAllocationException, ResourceUnavailableException;
53+
5254
}

api/src/main/java/org/apache/cloudstack/storage/template/VnfTemplateUtils.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// under the License.
1717
package org.apache.cloudstack.storage.template;
1818

19+
import com.cloud.agent.api.to.deployasis.OVFNetworkTO;
1920
import com.cloud.exception.InvalidParameterValueException;
2021
import com.cloud.network.VNF;
2122
import com.cloud.storage.Storage;
@@ -124,6 +125,9 @@ public static void validateVnfNics(List<VNF.VnfNic> nicsList) {
124125
public static void validateApiCommandParams(BaseCmd cmd, VirtualMachineTemplate template) {
125126
if (cmd instanceof RegisterVnfTemplateCmd) {
126127
RegisterVnfTemplateCmd registerCmd = (RegisterVnfTemplateCmd) cmd;
128+
if (registerCmd.isDeployAsIs() && CollectionUtils.isNotEmpty(registerCmd.getVnfNics())) {
129+
throw new InvalidParameterValueException("VNF nics cannot be specified when register a deploy-as-is Template. Please wait until Template settings are read from OVA.");
130+
}
127131
validateApiCommandParams(registerCmd.getVnfDetails(), registerCmd.getVnfNics(), registerCmd.getTemplateType());
128132
} else if (cmd instanceof UpdateVnfTemplateCmd) {
129133
UpdateVnfTemplateCmd updateCmd = (UpdateVnfTemplateCmd) cmd;
@@ -149,4 +153,18 @@ public static void validateVnfCidrList(List<String> cidrList) {
149153
}
150154
}
151155
}
156+
157+
public static void validateDeployAsIsTemplateVnfNics(List<OVFNetworkTO> ovfNetworks, List<VNF.VnfNic> vnfNics) {
158+
if (CollectionUtils.isEmpty(vnfNics)) {
159+
return;
160+
}
161+
if (CollectionUtils.isEmpty(ovfNetworks)) {
162+
throw new InvalidParameterValueException("The list of networks read from OVA is empty. Please wait until the template is fully downloaded and processed.");
163+
}
164+
for (VNF.VnfNic vnfNic : vnfNics) {
165+
if (vnfNic.getDeviceId() < ovfNetworks.size() && !vnfNic.isRequired()) {
166+
throw new InvalidParameterValueException(String.format("The VNF nic [device ID: %s ] is required as it is defined in the OVA template.", vnfNic.getDeviceId()));
167+
}
168+
}
169+
}
152170
}

client/src/main/java/org/apache/cloudstack/ACSRequestLog.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,15 @@
1818
//
1919
package org.apache.cloudstack;
2020

21+
import com.cloud.api.ApiServlet;
2122
import com.cloud.utils.StringUtils;
2223
import org.eclipse.jetty.server.NCSARequestLog;
2324
import org.eclipse.jetty.server.Request;
2425
import org.eclipse.jetty.server.Response;
2526
import org.eclipse.jetty.util.DateCache;
2627
import org.eclipse.jetty.util.component.LifeCycle;
2728

29+
import java.net.InetAddress;
2830
import java.util.Locale;
2931
import java.util.TimeZone;
3032

@@ -51,9 +53,8 @@ public void log(Request request, Response response) {
5153
StringBuilder sb = buffers.get();
5254
sb.setLength(0);
5355

54-
sb.append(request.getHttpChannel().getEndPoint()
55-
.getRemoteAddress().getAddress()
56-
.getHostAddress())
56+
InetAddress remoteAddress = ApiServlet.getClientAddress(request);
57+
sb.append(remoteAddress.getHostAddress())
5758
.append(" - - [")
5859
.append(dateCache.format(request.getTimeStamp()))
5960
.append("] \"")

client/src/main/java/org/apache/cloudstack/ServerDaemon.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,12 @@
2424
import java.io.InputStream;
2525
import java.lang.management.ManagementFactory;
2626
import java.net.URL;
27-
import java.util.Arrays;
2827
import java.util.Properties;
2928

30-
import com.cloud.api.ApiServer;
3129
import org.apache.commons.daemon.Daemon;
3230
import org.apache.commons.daemon.DaemonContext;
3331
import org.apache.commons.lang3.StringUtils;
3432
import org.eclipse.jetty.jmx.MBeanContainer;
35-
import org.eclipse.jetty.server.ForwardedRequestCustomizer;
3633
import org.eclipse.jetty.server.HttpConfiguration;
3734
import org.eclipse.jetty.server.HttpConnectionFactory;
3835
import org.eclipse.jetty.server.RequestLog;
@@ -193,7 +190,6 @@ public void start() throws Exception {
193190
httpConfig.setResponseHeaderSize(8192);
194191
httpConfig.setSendServerVersion(false);
195192
httpConfig.setSendDateHeader(false);
196-
addForwardingCustomiser(httpConfig);
197193

198194
// HTTP Connector
199195
createHttpConnector(httpConfig);
@@ -216,21 +212,6 @@ public void start() throws Exception {
216212
server.join();
217213
}
218214

219-
/**
220-
* Adds a ForwardedRequestCustomizer to the HTTP configuration to handle forwarded headers.
221-
* The header used for forwarding is determined by the ApiServer.listOfForwardHeaders property.
222-
* Only non empty headers are considered and only the first of the comma-separated list is used.
223-
* @param httpConfig the HTTP configuration to which the customizer will be added
224-
*/
225-
private static void addForwardingCustomiser(HttpConfiguration httpConfig) {
226-
ForwardedRequestCustomizer customiser = new ForwardedRequestCustomizer();
227-
String header = Arrays.stream(ApiServer.listOfForwardHeaders.value().split(",")).findFirst().orElse(null);
228-
if (com.cloud.utils.StringUtils.isNotEmpty(header)) {
229-
customiser.setForwardedForHeader(header);
230-
}
231-
httpConfig.addCustomizer(customiser);
232-
}
233-
234215
@Override
235216
public void stop() throws Exception {
236217
server.stop();

debian/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Priority: extra
44
Maintainer: The Apache CloudStack Team <dev@cloudstack.apache.org>
55
Build-Depends: debhelper (>= 9), openjdk-17-jdk | java17-sdk | java17-jdk | zulu-17 | openjdk-11-jdk | java11-sdk | java11-jdk | zulu-11, genisoimage,
66
python-mysql.connector | python3-mysql.connector | mysql-connector-python-py3, maven (>= 3) | maven3,
7-
python (>= 2.7) | python2 (>= 2.7), python3 (>= 3), python-setuptools, python3-setuptools,
7+
python3 (>= 3), python3-setuptools,
88
nodejs (>= 12), lsb-release, dh-systemd | debhelper (>= 13)
99
Standards-Version: 3.8.1
1010
Homepage: http://www.cloudstack.org/

0 commit comments

Comments
 (0)