Skip to content

Commit a000824

Browse files
authored
Merge branch 'main' into upgrade-markdownlint
2 parents 89038fe + 6d5cefd commit a000824

File tree

498 files changed

+14339
-3619
lines changed

Some content is hidden

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

498 files changed

+14339
-3619
lines changed

.asf.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,12 @@ github:
5353
- acs-robot
5454
- gpordeus
5555
- hsato03
56-
- bernardodemarco
5756
- FelipeM525
5857
- lucas-a-martins
5958
- nicoschmdt
6059
- abh1sar
61-
- sudo87
6260
- rosi-shapeblue
61+
- sudo87
6362

6463
protected_branches: ~
6564

.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

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
}

agent/src/main/java/com/cloud/agent/properties/AgentProperties.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,14 @@ public class AgentProperties{
155155
*/
156156
public static final Property<Integer> CMDS_TIMEOUT = new Property<>("cmds.timeout", 7200);
157157

158+
/**
159+
* The timeout (in seconds) for the snapshot merge operation, mainly used for classic volume snapshots and disk-only VM snapshots on file-based storage.<br>
160+
* This configuration is only considered if libvirt.events.enabled is also true. <br>
161+
* Data type: Integer.<br>
162+
* Default value: <code>259200</code>
163+
*/
164+
public static final Property<Integer> QCOW2_DELTA_MERGE_TIMEOUT = new Property<>("qcow2.delta.merge.timeout", 60 * 60 * 72);
165+
158166
/**
159167
* This parameter sets the VM migration speed (in mbps). The default value is -1,<br>
160168
* which means that the agent will try to guess the speed of the guest network and consume all possible bandwidth.<br>
@@ -833,7 +841,7 @@ public static class Property <T>{
833841
private T defaultValue;
834842
private Class<T> typeClass;
835843

836-
Property(String name, T value) {
844+
public Property(String name, T value) {
837845
init(name, value);
838846
}
839847

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,11 +801,19 @@ public class EventTypes {
801801
// Resource Limit
802802
public static final String EVENT_RESOURCE_LIMIT_UPDATE = "RESOURCE.LIMIT.UPDATE";
803803

804+
// Management Server
805+
public static final String EVENT_MANAGEMENT_SERVER_REMOVE = "MANAGEMENT.SERVER.REMOVE";
806+
804807
public static final String VM_LEASE_EXPIRED = "VM.LEASE.EXPIRED";
805808
public static final String VM_LEASE_DISABLED = "VM.LEASE.DISABLED";
806809
public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED";
807810
public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING";
808811

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+
809817
static {
810818

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

1312+
// Management Server
1313+
entityEventDetails.put(EVENT_MANAGEMENT_SERVER_REMOVE, "ManagementServer");
1314+
13041315
// VM Lease
13051316
entityEventDetails.put(VM_LEASE_EXPIRED, VirtualMachine.class);
13061317
entityEventDetails.put(VM_LEASE_EXPIRING, VirtualMachine.class);
13071318
entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class);
13081319
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");
13091325
}
13101326

13111327
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.

api/src/main/java/com/cloud/resource/ResourceState.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ public static Event toEvent(String e) {
7676
}
7777
}
7878

79+
public static List<ResourceState> s_maintenanceStates = List.of(ResourceState.Maintenance,
80+
ResourceState.ErrorInMaintenance, ResourceState.PrepareForMaintenance,
81+
ResourceState.ErrorInPrepareForMaintenance);
82+
7983
public ResourceState getNextState(Event a) {
8084
return s_fsm.getNextState(this, a);
8185
}
@@ -98,8 +102,7 @@ public static String[] toString(ResourceState... states) {
98102
}
99103

100104
public static boolean isMaintenanceState(ResourceState state) {
101-
return Arrays.asList(ResourceState.Maintenance, ResourceState.ErrorInMaintenance,
102-
ResourceState.PrepareForMaintenance, ResourceState.ErrorInPrepareForMaintenance).contains(state);
105+
return s_maintenanceStates.contains(state);
103106
}
104107

105108
public static boolean canAttemptMaintenance(ResourceState state) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
3939
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
4040
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
41+
import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd;
4142
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
4243
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
4344
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
@@ -506,4 +507,6 @@ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableE
506507

507508
Pair<Boolean, String> patchSystemVM(PatchSystemVMCmd cmd);
508509

510+
boolean removeManagementServer(RemoveManagementServerCmd cmd);
511+
509512
}

api/src/main/java/com/cloud/storage/VolumeApiService.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
137137

138138
void updateDisplay(Volume volume, Boolean displayVolume);
139139

140-
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName) throws ResourceAllocationException;
140+
Snapshot allocSnapshotForVm(Long vmId, Long volumeId, String snapshotName, Long vmSnapshotId) throws ResourceAllocationException;
141141

142142
/**
143143
* Checks if the storage pool supports the disk offering tags.
@@ -171,6 +171,13 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
171171
* </table>
172172
*/
173173
boolean doesStoragePoolSupportDiskOffering(StoragePool destPool, DiskOffering diskOffering);
174+
175+
/**
176+
* Checks if the storage pool supports the required disk offering tags
177+
* destPool the storage pool to check the disk offering tags
178+
* diskOfferingTags the tags that should be supported
179+
* return whether the tags are supported in the storage pool
180+
*/
174181
boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags);
175182

176183
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);

0 commit comments

Comments
 (0)