Skip to content

Commit 19297e0

Browse files
committed
Merge branch 'main' of https://github.com/apache/cloudstack into add-support-csi-projects
2 parents 1d46d49 + f2d6356 commit 19297e0

File tree

1,408 files changed

+89993
-14437
lines changed

Some content is hidden

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

1,408 files changed

+89993
-14437
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/linters/.markdown-lint.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,6 @@ MD046: false
8686

8787
# MD052/reference-links-images Reference links and images should use a label that is defined
8888
MD052: false
89+
90+
# MD059/descriptive-link-text Link text should be descriptive
91+
MD059: false

.github/workflows/ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,10 @@ jobs:
8989
smoke/test_nested_virtualization
9090
smoke/test_set_sourcenat
9191
smoke/test_webhook_lifecycle
92-
smoke/test_purge_expunged_vms",
92+
smoke/test_purge_expunged_vms
93+
smoke/test_extension_lifecycle
94+
smoke/test_extension_custom_action_lifecycle
95+
smoke/test_extension_custom",
9396
"smoke/test_network
9497
smoke/test_network_acl
9598
smoke/test_network_ipv6
@@ -137,6 +140,7 @@ jobs:
137140
smoke/test_vm_deployment_planner
138141
smoke/test_vm_strict_host_tags
139142
smoke/test_vm_schedule
143+
smoke/test_deploy_vgpu_enabled_vm
140144
smoke/test_vm_life_cycle
141145
smoke/test_vm_lifecycle_unmanage_import
142146
smoke/test_vm_snapshot_kvm

.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

.pre-commit-config.yaml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,24 @@
1515
# specific language governing permissions and limitations
1616
# under the License.
1717
---
18-
default_stages: [commit, push]
18+
default_stages: [pre-commit, pre-push]
1919
default_language_version:
2020
# force all unspecified Python hooks to run python3
2121
python: python3
22-
minimum_pre_commit_version: "2.17.0"
22+
minimum_pre_commit_version: "3.2.0"
2323
repos:
2424
- repo: meta
2525
hooks:
2626
- id: identity
2727
- id: check-hooks-apply
28+
- repo: https://github.com/gitleaks/gitleaks
29+
rev: v8.27.2
30+
hooks:
31+
- id: gitleaks
32+
name: run gitleaks
33+
description: detect hardcoded secrets
2834
- repo: https://github.com/pre-commit/pre-commit-hooks
29-
rev: v4.6.0
35+
rev: v5.0.0
3036
hooks:
3137
#- id: check-added-large-files
3238
- id: check-case-conflict
@@ -69,7 +75,7 @@ repos:
6975
name: run codespell
7076
description: Check spelling with codespell
7177
args: [--ignore-words=.github/linters/codespell.txt]
72-
exclude: ^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
78+
exclude: ^systemvm/agent/noVNC/|^ui/package\.json$|^ui/package-lock\.json$|^ui/public/js/less\.min\.js$|^ui/public/locales/.*[^n].*\.json$
7379
- repo: https://github.com/pycqa/flake8
7480
rev: 7.0.0
7581
hooks:
@@ -87,7 +93,7 @@ repos:
8793
^setup/bindir/cloud-setup-encryption\.in$|
8894
^venv/.*$
8995
- repo: https://github.com/igorshubovych/markdownlint-cli
90-
rev: v0.43.0
96+
rev: v0.45.0
9197
hooks:
9298
- id: markdownlint
9399
name: run markdownlint

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,11 @@ The following provides more details on the included cryptographic software:
160160
* CloudStack makes use of the Bouncy Castle general-purpose encryption library.
161161
* CloudStack can optionally interact with and control OpenSwan-based VPNs.
162162
* CloudStack has a dependency on and makes use of JSch - a java SSH2 implementation.
163+
164+
## Star History
165+
166+
[![Apache CloudStack Star History](https://api.star-history.com/svg?repos=apache/cloudstack&type=Date)](https://www.star-history.com/#apache/cloudstack&Date)
167+
168+
## Contributors
169+
170+
[![Apache CloudStack Contributors](https://contrib.rocks/image?repo=apache/cloudstack&anon=0&max=500)](https://github.com/apache/cloudstack/graphs/contributors)

agent/conf/agent.properties

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -213,8 +213,9 @@ hypervisor.type=kvm
213213
# If null (default), defaults to the VM's OS architecture
214214
#guest.cpu.arch=
215215

216-
# This param will require CPU features on the CPU section.
217-
# The features listed in this property must be separated by a blank space (e.g.: vmx vme)
216+
# Specifies required CPU features for end-user and system VMs.
217+
# These features must be present on the host CPU for VM deployment.
218+
# Multiple features should be separated by whitespace (e.g.: vmx vme).
218219
#guest.cpu.features=
219220

220221
# Disables memory ballooning on VM guests for overcommit.
@@ -447,3 +448,6 @@ iscsi.session.cleanup.enabled=false
447448

448449
# Timeout (in seconds) to wait for the incremental snapshot to complete.
449450
# incremental.snapshot.timeout=10800
451+
452+
# If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise.
453+
# create.full.clone=false

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

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
import com.cloud.utils.nio.NioClient;
9898
import com.cloud.utils.nio.NioConnection;
9999
import com.cloud.utils.nio.Task;
100-
import com.cloud.utils.script.OutputInterpreter;
101100
import com.cloud.utils.script.Script;
102101

103102
/**
@@ -476,7 +475,7 @@ private void scheduleHostLBCheckerTask(final String lbAlgorithm, final long chec
476475
return;
477476
}
478477

479-
logger.info("Scheduling a recurring preferred host checker task with lb algorithm '{}' and host.lb.interval={} ms", lbAlgorithm, checkInterval);
478+
logger.info("Scheduling a recurring preferred host checker task with host.lb.interval={} ms", checkInterval);
480479
hostLbCheckExecutor = Executors.newSingleThreadScheduledExecutor((new NamedThreadFactory(name)));
481480
hostLbCheckExecutor.scheduleAtFixedRate(new PreferredHostCheckerTask(), checkInterval, checkInterval,
482481
TimeUnit.MILLISECONDS);
@@ -614,9 +613,9 @@ protected void setupStartupCommand(final StartupCommand startup) {
614613
}
615614

616615
protected String getAgentArch() {
617-
final Script command = new Script("/usr/bin/arch", 500, logger);
618-
final OutputInterpreter.OneLineParser parser = new OutputInterpreter.OneLineParser();
619-
return command.execute(parser);
616+
String arch = Script.runSimpleBashScript(Script.getExecutableAbsolutePath("arch"), 1000);
617+
logger.debug("Arch for agent: {} found: {}", _name, arch);
618+
return arch;
620619
}
621620

622621
@Override
@@ -968,9 +967,11 @@ private Answer migrateAgentToOtherMS(final MigrateAgentConnectionCommand cmd) {
968967
if (CollectionUtils.isNotEmpty(cmd.getMsList())) {
969968
processManagementServerList(cmd.getMsList(), cmd.getAvoidMsList(), cmd.getLbAlgorithm(), cmd.getLbCheckInterval(), false);
970969
}
971-
Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job")).schedule(() -> {
970+
ScheduledExecutorService migrateAgentConnectionService = Executors.newSingleThreadScheduledExecutor(new NamedThreadFactory("MigrateAgentConnection-Job"));
971+
migrateAgentConnectionService.schedule(() -> {
972972
migrateAgentConnection(cmd.getAvoidMsList());
973973
}, 3, TimeUnit.SECONDS);
974+
migrateAgentConnectionService.shutdown();
974975
} catch (Exception e) {
975976
String errMsg = "Migrate agent connection failed, due to " + e.getMessage();
976977
logger.debug(errMsg, e);

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

Lines changed: 47 additions & 3 deletions
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>
@@ -213,6 +221,15 @@ public class AgentProperties{
213221
*/
214222
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.script", "libvirt-vm-xml-transformer.groovy");
215223

224+
/**
225+
* This property is used with the agent.hooks.basedir property to define the Libvirt VM XML transformer shell script.<br>
226+
* The shell script is used to execute the Libvirt VM XML transformer script.<br>
227+
* For more information see the agent.properties file.<br>
228+
* Data type: String.<br>
229+
* Default value: <code>libvirt-vm-xml-transformer.sh</code>
230+
*/
231+
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_XML_TRANSFORMER_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_xml_transformer.shell_script", "libvirt-vm-xml-transformer.sh");
232+
216233
/**
217234
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_xml_transformer.script properties to define the Libvirt VM XML transformer method.<br>
218235
* Libvirt XML transformer hook does XML-to-XML transformation.<br>
@@ -233,6 +250,15 @@ public class AgentProperties{
233250
*/
234251
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_START_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.script", "libvirt-vm-state-change.groovy");
235252

253+
/**
254+
* This property is used with the agent.hooks.basedir property to define the Libvirt VM on start shell script.<br>
255+
* The shell script is used to execute the Libvirt VM on start script.<br>
256+
* For more information see the agent.properties file.<br>
257+
* Data type: String.<br>
258+
* Default value: <code>libvirt-vm-state-change.sh</code>
259+
*/
260+
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_START_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_start.shell_script", "libvirt-vm-state-change.sh");
261+
236262
/**
237263
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_start.script properties to define the Libvirt VM on start method.<br>
238264
* The hook is called right after Libvirt successfully launched the VM.<br>
@@ -252,6 +278,15 @@ public class AgentProperties{
252278
*/
253279
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.script", "libvirt-vm-state-change.groovy");
254280

281+
/**
282+
* This property is used with the agent.hooks.basedir property to define the Libvirt VM on stop shell script.<br>
283+
* The shell script is used to execute the Libvirt VM on stop script.<br>
284+
* For more information see the agent.properties file.<br>
285+
* Data type: String.<br>
286+
* Default value: <code>libvirt-vm-state-change.sh</code>
287+
*/
288+
public static final Property<String> AGENT_HOOKS_LIBVIRT_VM_ON_STOP_SHELL_SCRIPT = new Property<>("agent.hooks.libvirt_vm_on_stop.shell_script", "libvirt-vm-state-change.sh");
289+
255290
/**
256291
* This property is used with the agent.hooks.basedir and agent.hooks.libvirt_vm_on_stop.script properties to define the Libvirt VM on stop method.<br>
257292
* The hook is called right after libvirt successfully stopped the VM.<br>
@@ -390,8 +425,9 @@ public class AgentProperties{
390425
public static final Property<String> GUEST_CPU_ARCH = new Property<>("guest.cpu.arch", null, String.class);
391426

392427
/**
393-
* This param will require CPU features on the CPU section.<br>
394-
* The features listed in this property must be separated by a blank space (see example below).<br>
428+
* Specifies required CPU features for end-user and system VMs.<br>
429+
* These features must be present on the host CPU for VM deployment.<br>
430+
* Multiple features should be separated by whitespace (see example below).<br>
395431
* Possible values: vmx vme <br>
396432
* Data type: String.<br>
397433
* Default value: <code>null</code>
@@ -828,12 +864,20 @@ public Property<Integer> getWorkers() {
828864
* */
829865
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
830866

867+
/**
868+
* If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise. <br>
869+
* Data type: Boolean. <br>
870+
* Default value: <code>false</code>
871+
*/
872+
public static final Property<Boolean> CREATE_FULL_CLONE = new Property<>("create.full.clone", false);
873+
874+
831875
public static class Property <T>{
832876
private String name;
833877
private T defaultValue;
834878
private Class<T> typeClass;
835879

836-
Property(String name, T value) {
880+
public Property(String name, T value) {
837881
init(name, value);
838882
}
839883

api/src/main/java/com/cloud/agent/api/Command.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@
1919
import java.util.HashMap;
2020
import java.util.Map;
2121

22-
import com.cloud.agent.api.LogLevel.Log4jLevel;
23-
import org.apache.logging.log4j.Logger;
2422
import org.apache.logging.log4j.LogManager;
23+
import org.apache.logging.log4j.Logger;
24+
25+
import com.cloud.agent.api.LogLevel.Log4jLevel;
2526

2627
/**
2728
* implemented by classes that extends the Command class. Command specifies
@@ -60,6 +61,7 @@ public enum State {
6061
private int wait; //in second
6162
private boolean bypassHostMaintenance = false;
6263
private transient long requestSequence = 0L;
64+
protected Map<String, Map<String, String>> externalDetails;
6365

6466
protected Command() {
6567
this.wait = 0;
@@ -128,6 +130,14 @@ public void setRequestSequence(long requestSequence) {
128130
this.requestSequence = requestSequence;
129131
}
130132

133+
public void setExternalDetails(Map<String, Map<String, String>> externalDetails) {
134+
this.externalDetails = externalDetails;
135+
}
136+
137+
public Map<String, Map<String, String>> getExternalDetails() {
138+
return externalDetails;
139+
}
140+
131141
@Override
132142
public boolean equals(Object o) {
133143
if (this == o) return true;

0 commit comments

Comments
 (0)