Skip to content

Commit 403b87d

Browse files
authored
Merge branch 'main' into fix-spelling-grammar-case-whitespace
2 parents f104bd5 + 9295a16 commit 403b87d

File tree

429 files changed

+12341
-1226
lines changed

Some content is hidden

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

429 files changed

+12341
-1226
lines changed

agent/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>org.apache.cloudstack</groupId>
2626
<artifactId>cloudstack</artifactId>
27-
<version>4.20.0.0-SNAPSHOT</version>
27+
<version>4.21.0.0-SNAPSHOT</version>
2828
</parent>
2929
<dependencies>
3030
<dependency>

agent/src/main/java/com/cloud/agent/resource/consoleproxy/ConsoleProxyResource.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,9 +397,8 @@ protected void runInContext() {
397397
}
398398

399399
public String authenticateConsoleAccess(String host, String port, String vmId, String sid, String ticket,
400-
Boolean isReauthentication, String sessionToken) {
401-
402-
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket, sessionToken);
400+
Boolean isReauthentication, String sessionToken, String clientAddress) {
401+
ConsoleAccessAuthenticationCommand cmd = new ConsoleAccessAuthenticationCommand(host, port, vmId, sid, ticket, sessionToken, clientAddress);
403402
cmd.setReauthenticating(isReauthentication);
404403

405404
ConsoleProxyAuthenticationResult result = new ConsoleProxyAuthenticationResult();

api/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<parent>
2525
<groupId>org.apache.cloudstack</groupId>
2626
<artifactId>cloudstack</artifactId>
27-
<version>4.20.0.0-SNAPSHOT</version>
27+
<version>4.21.0.0-SNAPSHOT</version>
2828
</parent>
2929
<dependencies>
3030
<dependency>

api/src/main/java/com/cloud/agent/api/to/PortForwardingRuleTO.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
import com.cloud.network.rules.FirewallRule;
2020
import com.cloud.network.rules.PortForwardingRule;
2121
import com.cloud.utils.net.NetUtils;
22+
import org.apache.commons.lang3.StringUtils;
23+
24+
import java.util.List;
2225

2326
/**
2427
* PortForwardingRuleTO specifies one port forwarding rule.
@@ -29,6 +32,8 @@ public class PortForwardingRuleTO extends FirewallRuleTO {
2932
String dstIp;
3033
int[] dstPortRange;
3134

35+
List<String> sourceCidrList;
36+
3237
protected PortForwardingRuleTO() {
3338
super();
3439
}
@@ -37,6 +42,7 @@ public PortForwardingRuleTO(PortForwardingRule rule, String srcVlanTag, String s
3742
super(rule, srcVlanTag, srcIp);
3843
this.dstIp = rule.getDestinationIpAddress().addr();
3944
this.dstPortRange = new int[] {rule.getDestinationPortStart(), rule.getDestinationPortEnd()};
45+
this.sourceCidrList = rule.getSourceCidrList();
4046
}
4147

4248
public PortForwardingRuleTO(long id, String srcIp, int srcPortStart, int srcPortEnd, String dstIp, int dstPortStart, int dstPortEnd, String protocol,
@@ -58,4 +64,11 @@ public String getStringDstPortRange() {
5864
return NetUtils.portRangeToString(dstPortRange);
5965
}
6066

67+
public String getSourceCidrListAsString() {
68+
if (sourceCidrList != null) {
69+
return StringUtils.join(sourceCidrList, ",");
70+
}
71+
return null;
72+
}
73+
6174
}

api/src/main/java/com/cloud/bgp/BGPService.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
import com.cloud.network.vpc.Vpc;
2222
import com.cloud.utils.Pair;
2323
import org.apache.cloudstack.api.command.user.bgp.ListASNumbersCmd;
24+
import org.apache.cloudstack.network.BgpPeer;
2425

2526
import java.util.List;
2627

@@ -36,4 +37,8 @@ public interface BGPService {
3637
boolean applyBgpPeers(Network network, boolean continueOnError) throws ResourceUnavailableException;
3738

3839
boolean applyBgpPeers(Vpc vpc, boolean continueOnError) throws ResourceUnavailableException;
40+
41+
List<? extends BgpPeer> getBgpPeersForNetwork(Network network);
42+
43+
List<? extends BgpPeer> getBgpPeersForVpc(Vpc vpc);
3944
}

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,7 @@ public class EventTypes {
292292

293293
//register for user API and secret keys
294294
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
295+
public static final String API_KEY_ACCESS_UPDATE = "API.KEY.ACCESS.UPDATE";
295296

296297
// Template Events
297298
public static final String EVENT_TEMPLATE_CREATE = "TEMPLATE.CREATE";

api/src/main/java/com/cloud/hypervisor/Hypervisor.java

Lines changed: 41 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,57 @@
2020
import org.apache.commons.lang3.StringUtils;
2121

2222
import java.util.LinkedHashMap;
23+
import java.util.List;
2324
import java.util.Locale;
2425
import java.util.Map;
2526
import java.util.Objects;
27+
import java.util.Set;
28+
import java.util.EnumSet;
29+
import java.util.stream.Collectors;
30+
31+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.DirectDownloadTemplate;
32+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.RootDiskSizeOverride;
33+
import static com.cloud.hypervisor.Hypervisor.HypervisorType.Functionality.VmStorageMigration;
2634

2735
public class Hypervisor {
2836
public static class HypervisorType {
37+
public enum Functionality {
38+
DirectDownloadTemplate,
39+
RootDiskSizeOverride,
40+
VmStorageMigration
41+
}
42+
2943
private static final Map<String, HypervisorType> hypervisorTypeMap = new LinkedHashMap<>();
3044
public static final HypervisorType None = new HypervisorType("None"); //for storage hosts
31-
public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD);
32-
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2);
33-
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA);
45+
public static final HypervisorType XenServer = new HypervisorType("XenServer", ImageFormat.VHD, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
46+
public static final HypervisorType KVM = new HypervisorType("KVM", ImageFormat.QCOW2, EnumSet.of(DirectDownloadTemplate, RootDiskSizeOverride, VmStorageMigration));
47+
public static final HypervisorType VMware = new HypervisorType("VMware", ImageFormat.OVA, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
3448
public static final HypervisorType Hyperv = new HypervisorType("Hyperv");
3549
public static final HypervisorType VirtualBox = new HypervisorType("VirtualBox");
3650
public static final HypervisorType Parralels = new HypervisorType("Parralels");
3751
public static final HypervisorType BareMetal = new HypervisorType("BareMetal");
38-
public static final HypervisorType Simulator = new HypervisorType("Simulator");
52+
public static final HypervisorType Simulator = new HypervisorType("Simulator", null, EnumSet.of(RootDiskSizeOverride, VmStorageMigration));
3953
public static final HypervisorType Ovm = new HypervisorType("Ovm", ImageFormat.RAW);
4054
public static final HypervisorType Ovm3 = new HypervisorType("Ovm3", ImageFormat.RAW);
4155
public static final HypervisorType LXC = new HypervisorType("LXC");
42-
public static final HypervisorType Custom = new HypervisorType("Custom");
56+
public static final HypervisorType Custom = new HypervisorType("Custom", null, EnumSet.of(RootDiskSizeOverride));
4357
public static final HypervisorType Any = new HypervisorType("Any"); /*If you don't care about the hypervisor type*/
4458
private final String name;
4559
private final ImageFormat imageFormat;
60+
private final Set<Functionality> supportedFunctionalities;
4661

4762
public HypervisorType(String name) {
48-
this(name, null);
63+
this(name, null, EnumSet.noneOf(Functionality.class));
4964
}
5065

5166
public HypervisorType(String name, ImageFormat imageFormat) {
67+
this(name, imageFormat, EnumSet.noneOf(Functionality.class));
68+
}
69+
70+
public HypervisorType(String name, ImageFormat imageFormat, Set<Functionality> supportedFunctionalities) {
5271
this.name = name;
5372
this.imageFormat = imageFormat;
73+
this.supportedFunctionalities = supportedFunctionalities;
5474
if (name.equals("Parralels")){ // typo in the original code
5575
hypervisorTypeMap.put("parallels", this);
5676
} else {
@@ -81,6 +101,12 @@ public static HypervisorType valueOf(String name) {
81101
return hypervisorType;
82102
}
83103

104+
public static List<HypervisorType> getListOfHypervisorsSupportingFunctionality(Functionality functionality) {
105+
return hypervisorTypeMap.values().stream()
106+
.filter(hypervisor -> hypervisor.supportedFunctionalities.contains(functionality))
107+
.collect(Collectors.toList());
108+
}
109+
84110
/**
85111
* Returns the display name of a hypervisor type in case the custom hypervisor is used,
86112
* using the 'hypervisor.custom.display.name' setting. Otherwise, returns hypervisor name
@@ -102,6 +128,15 @@ public String name() {
102128
return name;
103129
}
104130

131+
/**
132+
* Make this method to be part of the properties of the hypervisor type itself.
133+
*
134+
* @return true if the hypervisor plugin support the specified functionality
135+
*/
136+
public boolean isFunctionalitySupported(Functionality functionality) {
137+
return supportedFunctionalities.contains(functionality);
138+
}
139+
105140
@Override
106141
public int hashCode() {
107142
return Objects.hash(name);

api/src/main/java/com/cloud/network/rules/RulesService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import com.cloud.user.Account;
2727
import com.cloud.utils.Pair;
2828
import com.cloud.utils.net.Ip;
29+
import org.apache.cloudstack.api.command.user.firewall.UpdatePortForwardingRuleCmd;
2930

3031
public interface RulesService {
3132
Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipId, Long id, Long vmId, Long start, Long size, String accountName, Long domainId,
@@ -81,6 +82,8 @@ Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(Long ipId, Long
8182

8283
boolean disableStaticNat(long ipId) throws ResourceUnavailableException, NetworkRuleConflictException, InsufficientAddressCapacityException;
8384

84-
PortForwardingRule updatePortForwardingRule(long id, Integer privatePort, Integer privateEndPort, Long virtualMachineId, Ip vmGuestIp, String customId, Boolean forDisplay);
85+
PortForwardingRule updatePortForwardingRule(UpdatePortForwardingRuleCmd cmd);
86+
87+
void validatePortForwardingSourceCidrList(List<String> sourceCidrList);
8588

8689
}

api/src/main/java/com/cloud/server/ManagementServerHostStats.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ public interface ManagementServerHostStats {
3232

3333
String getManagementServerHostUuid();
3434

35+
long getManagementServerRunId();
36+
3537
long getSessions();
3638

3739
double getCpuUtilization();

api/src/main/java/com/cloud/user/Account.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,8 @@ public static Type getFromValue(Integer type){
9393

9494
boolean isDefault();
9595

96+
public void setApiKeyAccess(Boolean apiKeyAccess);
97+
98+
public Boolean getApiKeyAccess();
99+
96100
}

0 commit comments

Comments
 (0)