Skip to content

Commit 580533f

Browse files
Merge branch 'main' into 4.21-gha-jdk17-build
2 parents d7dae8d + e8ab0ae commit 580533f

File tree

522 files changed

+17654
-3256
lines changed

Some content is hidden

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

522 files changed

+17654
-3256
lines changed

.github/workflows/ui.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
npm run test:unit
5757
5858
- uses: codecov/codecov-action@v4
59+
if: github.repository == 'apache/cloudstack'
5960
with:
6061
working-directory: ui
6162
files: ./coverage/lcov.info

INSTALL.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@ Install tools and dependencies used for development:
1818
# yum -y install git java-17-openjdk java-17-openjdk-devel \
1919
mysql mysql-server mkisofs git gcc python MySQL-python openssh-clients wget
2020

21-
Set up Maven (3.9.9):
21+
Set up Maven (3.9.10):
2222

23-
# wget https://dlcdn.apache.org/maven/maven-3/3.9.9/binaries/apache-maven-3.9.9-bin.tar.gz
24-
# tar -zxvf apache-maven-3.9.9-bin.tar.gz -C /usr/local
23+
# wget https://dlcdn.apache.org/maven/maven-3/3.9.10/binaries/apache-maven-3.9.10-bin.tar.gz
24+
# sudo tar -zxvf apache-maven-3.9.10-bin.tar.gz -C /usr/local
2525
# cd /usr/local
26-
# ln -s apache-maven-3.9.9 maven
26+
# sudo ln -s apache-maven-3.9.10 maven
2727
# echo export M2_HOME=/usr/local/maven >> ~/.bashrc # or .zshrc or .profile
2828
# echo export PATH=/usr/local/maven/bin:${PATH} >> ~/.bashrc # or .zshrc or .profile
2929
# source ~/.bashrc
3030

31-
Setup up NodeJS (LTS):
31+
Setup up Node.js 16:
3232

33-
# curl -sL https://rpm.nodesource.com/setup_12.x | sudo bash -
33+
# curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
3434
# sudo yum install nodejs
3535
# sudo npm install -g @vue/cli npm-check-updates
3636

@@ -104,13 +104,13 @@ To install dependencies.
104104

105105
To build the project.
106106

107-
$ npm build
107+
$ npm run build
108108

109109
For Development Mode.
110110

111111
$ npm start
112112

113-
Make sure to set CS_URL=http://localhost:8080/client on .env.local file on ui.
113+
Make sure to set `CS_URL=http://localhost:8080` on the `.env.local` file on UI.
114114

115115
You should be able to run the management server on http://localhost:5050
116116

agent/src/main/java/com/cloud/agent/Agent.java

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -453,22 +453,30 @@ private void scheduleCertificateRenewalTask() {
453453
certExecutor.schedule(new PostCertificateRenewalTask(this), 5, TimeUnit.SECONDS);
454454
}
455455

456-
private void scheduleHostLBCheckerTask(final long checkInterval) {
456+
private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long checkInterval) {
457457
String name = "HostLBCheckerTask";
458458
if (hostLbCheckExecutor != null && !hostLbCheckExecutor.isShutdown()) {
459+
logger.info("Shutting down the preferred host checker task {}", name);
459460
hostLbCheckExecutor.shutdown();
460461
try {
461462
if (!hostLbCheckExecutor.awaitTermination(1, TimeUnit.SECONDS)) {
462463
hostLbCheckExecutor.shutdownNow();
463464
}
464465
} catch (InterruptedException e) {
465-
logger.debug("Forcing {} shutdown as it did not shutdown in the desired time due to: {}",
466+
logger.debug("Forcing the preferred host checker task {} shutdown as it did not shutdown in the desired time due to: {}",
466467
name, e.getMessage());
467468
hostLbCheckExecutor.shutdownNow();
468469
}
469470
}
470471
if (checkInterval > 0L) {
471-
logger.info("Scheduling preferred host task with host.lb.interval={}ms", checkInterval);
472+
if ("shuffle".equalsIgnoreCase(lbAlgorithm)) {
473+
logger.info("Scheduling the preferred host checker task to trigger once (to apply lb algorithm '{}') after host.lb.interval={} ms", lbAlgorithm, checkInterval);
474+
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
475+
hostLbCheckExecutor.schedule(new PreferredHostCheckerTask(), checkInterval, TimeUnit.MILLISECONDS);
476+
return;
477+
}
478+
479+
logger.info("Scheduling a recurring preferred host checker task with lb algorithm '{}' and host.lb.interval={} ms", lbAlgorithm, checkInterval);
472480
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
473481
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
474482
TimeUnit.MILLISECONDS);
@@ -928,7 +936,7 @@ private Answer setupAgentCertificate(final SetupCertificateCommand cmd) {
928936
return new SetupCertificateAnswer(true);
929937
}
930938

931-
private void processManagementServerList(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval) {
939+
private void processManagementServerList(final List<String> msList, final List<String> avoidMsList, final String lbAlgorithm, final Long lbCheckInterval, final boolean triggerHostLB) {
932940
if (CollectionUtils.isNotEmpty(msList) && StringUtils.isNotEmpty(lbAlgorithm)) {
933941
try {
934942
final String newMSHosts = String.format("%s%s%s", com.cloud.utils.StringUtils.toCSVList(msList), IAgentShell.hostLbAlgorithmSeparator, lbAlgorithm);
@@ -941,22 +949,24 @@ private void processManagementServerList(final List<String> msList, final List<S
941949
}
942950
}
943951
shell.setAvoidHosts(avoidMsList);
944-
if ("shuffle".equals(lbAlgorithm)) {
945-
scheduleHostLBCheckerTask(0);
946-
} else {
947-
scheduleHostLBCheckerTask(shell.getLbCheckerInterval(lbCheckInterval));
952+
if (triggerHostLB) {
953+
logger.info("Triggering the preferred host checker task now");
954+
ScheduledExecutorService hostLbExecutor = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("HostLB-Executor"));
955+
hostLbExecutor.schedule(new PreferredHostCheckerTask(), 0, TimeUnit.MILLISECONDS);
956+
hostLbExecutor.shutdown();
948957
}
958+
scheduleHostLBCheckerTask(lbAlgorithm, shell.getLbCheckerInterval(lbCheckInterval));
949959
}
950960

951961
private Answer setupManagementServerList(final SetupMSListCommand cmd) {
952-
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
962+
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), cmd.getTriggerHostLb());
953963
return new SetupMSListAnswer(true);
954964
}
955965

956966
private Answer migrateAgentToOtherMS(final MigrateAgentConnectionCommand cmd) {
957967
try {
958968
if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
959-
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval());
969+
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);
960970
}
961971
Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job")).schedule(() -> {
962972
migrateAgentConnection(cmd.getAvoidMsList());
@@ -1046,7 +1056,7 @@ public void processReadyCommand(final Command cmd) {
10461056
}
10471057

10481058
verifyAgentArch(ready.getArch());
1049-
processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval());
1059+
processManagementServerList(ready.getMsHostList(), ready.getAvoidMsHostList(), ready.getLbAlgorithm(), ready.getLbCheckInterval(), false);
10501060

10511061
logger.info("Ready command is processed for agent [id: {}, uuid: {}, name: {}]", getId(), getUuid(), getName());
10521062
}

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

Lines changed: 85 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ public class VirtualMachineTO {
3131
private String name;
3232
private BootloaderType bootloader;
3333
private VirtualMachine.State state;
34-
Type type;
35-
int cpus;
34+
private Type type;
35+
private int cpus;
3636

3737
/**
3838
'speed' is still here since 4.0.X/4.1.X management servers do not support
@@ -43,49 +43,50 @@ public class VirtualMachineTO {
4343
So this is here for backwards compatibility with 4.0.X/4.1.X management servers
4444
and newer agents.
4545
*/
46-
Integer speed;
47-
Integer minSpeed;
48-
Integer maxSpeed;
49-
50-
long minRam;
51-
long maxRam;
52-
String hostName;
53-
String arch;
54-
String os;
55-
String platformEmulator;
56-
String bootArgs;
57-
String[] bootupScripts;
58-
boolean enableHA;
59-
boolean limitCpuUse;
60-
boolean enableDynamicallyScaleVm;
46+
private Integer speed;
47+
private Integer minSpeed;
48+
private Integer maxSpeed;
49+
50+
private long minRam;
51+
private long maxRam;
52+
private String hostName;
53+
private String arch;
54+
private String os;
55+
private String platformEmulator;
56+
private String bootArgs;
57+
private String[] bootupScripts;
58+
private boolean enableHA;
59+
private boolean limitCpuUse;
60+
private boolean enableDynamicallyScaleVm;
6161
@LogLevel(LogLevel.Log4jLevel.Off)
62-
String vncPassword;
63-
String vncAddr;
64-
Map<String, String> details;
65-
String uuid;
66-
String bootType;
67-
String bootMode;
68-
boolean enterHardwareSetup;
69-
70-
DiskTO[] disks;
71-
NicTO[] nics;
72-
GPUDeviceTO gpuDevice;
73-
Integer vcpuMaxLimit;
74-
List<String[]> vmData = null;
75-
76-
String configDriveLabel = null;
77-
String configDriveIsoRootFolder = null;
78-
String configDriveIsoFile = null;
79-
NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
80-
81-
Double cpuQuotaPercentage = null;
82-
83-
Map<String, String> guestOsDetails = new HashMap<String, String>();
84-
Map<String, String> extraConfig = new HashMap<>();
85-
Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
86-
DeployAsIsInfoTO deployAsIsInfo;
87-
String metadataManufacturer;
88-
String metadataProductName;
62+
private String vncPassword;
63+
private String vncAddr;
64+
private Map<String, String> details;
65+
private Map<String, String> params;
66+
private String uuid;
67+
private String bootType;
68+
private String bootMode;
69+
private boolean enterHardwareSetup;
70+
71+
private DiskTO[] disks;
72+
private NicTO[] nics;
73+
private GPUDeviceTO gpuDevice;
74+
private Integer vcpuMaxLimit;
75+
private List<String[]> vmData = null;
76+
77+
private String configDriveLabel = null;
78+
private String configDriveIsoRootFolder = null;
79+
private String configDriveIsoFile = null;
80+
private NetworkElement.Location configDriveLocation = NetworkElement.Location.SECONDARY;
81+
82+
private Double cpuQuotaPercentage = null;
83+
84+
private Map<String, String> guestOsDetails = new HashMap<String, String>();
85+
private Map<String, String> extraConfig = new HashMap<>();
86+
private Map<Long, String> networkIdToNetworkNameMap = new HashMap<>();
87+
private DeployAsIsInfoTO deployAsIsInfo;
88+
private String metadataManufacturer;
89+
private String metadataProductName;
8990

9091
public VirtualMachineTO(long id, String instanceName, VirtualMachine.Type type, int cpus, Integer speed, long minRam, long maxRam, BootloaderType bootloader,
9192
String os, boolean enableHA, boolean limitCpuUse, String vncPassword) {
@@ -260,6 +261,10 @@ public void setBootupScripts(String[] bootupScripts) {
260261
this.bootupScripts = bootupScripts;
261262
}
262263

264+
public void setEnableHA(boolean enableHA) {
265+
this.enableHA = enableHA;
266+
}
267+
263268
public DiskTO[] getDisks() {
264269
return disks;
265270
}
@@ -435,6 +440,42 @@ public void setDeployAsIsInfo(DeployAsIsInfoTO deployAsIsInfo) {
435440
this.deployAsIsInfo = deployAsIsInfo;
436441
}
437442

443+
public void setSpeed(Integer speed) {
444+
this.speed = speed;
445+
}
446+
447+
public void setMinSpeed(Integer minSpeed) {
448+
this.minSpeed = minSpeed;
449+
}
450+
451+
public void setMaxSpeed(Integer maxSpeed) {
452+
this.maxSpeed = maxSpeed;
453+
}
454+
455+
public void setMinRam(long minRam) {
456+
this.minRam = minRam;
457+
}
458+
459+
public void setMaxRam(long maxRam) {
460+
this.maxRam = maxRam;
461+
}
462+
463+
public void setLimitCpuUse(boolean limitCpuUse) {
464+
this.limitCpuUse = limitCpuUse;
465+
}
466+
467+
public Map<String, String> getParams() {
468+
return params;
469+
}
470+
471+
public void setParams(Map<String, String> params) {
472+
this.params = params;
473+
}
474+
475+
public void setExtraConfig(Map<String, String> extraConfig) {
476+
this.extraConfig = extraConfig;
477+
}
478+
438479
public String getMetadataManufacturer() {
439480
return metadataManufacturer;
440481
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,8 @@ public class EventTypes {
289289

290290
//registering userdata events
291291
public static final String EVENT_REGISTER_USER_DATA = "REGISTER.USER.DATA";
292+
public static final String EVENT_REGISTER_CNI_CONFIG = "REGISTER.CNI.CONFIG";
293+
public static final String EVENT_DELETE_CNI_CONFIG = "DELETE.CNI.CONFIG";
292294

293295
//register for user API and secret keys
294296
public static final String EVENT_REGISTER_FOR_SECRET_API_KEY = "REGISTER.USER.KEY";
@@ -799,11 +801,19 @@ public class EventTypes {
799801
// Resource Limit
800802
public static final String EVENT_RESOURCE_LIMIT_UPDATE = "RESOURCE.LIMIT.UPDATE";
801803

804+
// Management Server
805+
public static final String EVENT_MANAGEMENT_SERVER_REMOVE = "MANAGEMENT.SERVER.REMOVE";
806+
802807
public static final String VM_LEASE_EXPIRED = "VM.LEASE.EXPIRED";
803808
public static final String VM_LEASE_DISABLED = "VM.LEASE.DISABLED";
804809
public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED";
805810
public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING";
806811

812+
// GUI Theme
813+
public static final String EVENT_GUI_THEME_CREATE = "GUI.THEME.CREATE";
814+
public static final String EVENT_GUI_THEME_REMOVE = "GUI.THEME.REMOVE";
815+
public static final String EVENT_GUI_THEME_UPDATE = "GUI.THEME.UPDATE";
816+
807817
static {
808818

809819
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@@ -1299,11 +1309,19 @@ public class EventTypes {
12991309
entityEventDetails.put(EVENT_SHAREDFS_EXPUNGE, SharedFS.class);
13001310
entityEventDetails.put(EVENT_SHAREDFS_RECOVER, SharedFS.class);
13011311

1312+
// Management Server
1313+
entityEventDetails.put(EVENT_MANAGEMENT_SERVER_REMOVE, "ManagementServer");
1314+
13021315
// VM Lease
13031316
entityEventDetails.put(VM_LEASE_EXPIRED, VirtualMachine.class);
13041317
entityEventDetails.put(VM_LEASE_EXPIRING, VirtualMachine.class);
13051318
entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class);
13061319
entityEventDetails.put(VM_LEASE_CANCELLED, VirtualMachine.class);
1320+
1321+
// GUI theme
1322+
entityEventDetails.put(EVENT_GUI_THEME_CREATE, "GuiTheme");
1323+
entityEventDetails.put(EVENT_GUI_THEME_REMOVE, "GuiTheme");
1324+
entityEventDetails.put(EVENT_GUI_THEME_UPDATE, "GuiTheme");
13071325
}
13081326

13091327
public static boolean isNetworkEvent(String eventType) {

api/src/main/java/com/cloud/exception/OperationTimedoutException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public class OperationTimedoutException extends CloudException {
4040
boolean _isActive;
4141

4242
public OperationTimedoutException(Command[] cmds, long agentId, long seqId, int time, boolean isActive) {
43-
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time);
43+
super("Commands " + seqId + " to Host " + agentId + " timed out after " + time + " secs");
4444
_agentId = agentId;
4545
_seqId = seqId;
4646
_time = time;

api/src/main/java/com/cloud/host/Host.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,12 @@ public static String[] toStrings(Host.Type... types) {
5353
return strs;
5454
}
5555
}
56-
public static final String HOST_UEFI_ENABLE = "host.uefi.enable";
57-
public static final String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
58-
public static final String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
56+
57+
String HOST_UEFI_ENABLE = "host.uefi.enable";
58+
String HOST_VOLUME_ENCRYPTION = "host.volume.encryption";
59+
String HOST_INSTANCE_CONVERSION = "host.instance.conversion";
60+
String HOST_OVFTOOL_VERSION = "host.ovftool.version";
61+
String HOST_VIRTV2V_VERSION = "host.virtv2v.version";
5962

6063
/**
6164
* @return name of the machine.

0 commit comments

Comments
 (0)