Skip to content

Commit ba9c130

Browse files
authored
Merge branch 'main' into fix-typo-java
2 parents d1b6fb9 + 3d6ec29 commit ba9c130

File tree

1,309 files changed

+77335
-11604
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,309 files changed

+77335
-11604
lines changed

.github/workflows/build.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@ jobs:
3232
steps:
3333
- uses: actions/checkout@v4
3434

35-
- name: Set up JDK 11
35+
- name: Set up JDK 17
3636
uses: actions/setup-java@v4
3737
with:
38-
java-version: '11'
39-
distribution: 'adopt'
40-
architecture: x64
41-
cache: maven
38+
distribution: 'temurin'
39+
java-version: '17'
40+
cache: 'maven'
4241

4342
- name: Set up Python
4443
uses: actions/setup-python@v5

.github/workflows/ci.yml

Lines changed: 9 additions & 6 deletions
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
@@ -216,13 +220,12 @@ jobs:
216220
with:
217221
fetch-depth: 0
218222

219-
- name: Set up JDK
223+
- name: Set up JDK 17
220224
uses: actions/setup-java@v4
221225
with:
222-
java-version: '11'
223-
distribution: 'adopt'
224-
architecture: x64
225-
cache: maven
226+
distribution: 'temurin'
227+
java-version: '17'
228+
cache: 'maven'
226229

227230
- name: Set up Python
228231
uses: actions/setup-python@v5

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
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:
@@ -32,7 +32,7 @@ repos:
3232
name: run gitleaks
3333
description: detect hardcoded secrets
3434
- repo: https://github.com/pre-commit/pre-commit-hooks
35-
rev: v4.6.0
35+
rev: v5.0.0
3636
hooks:
3737
#- id: check-added-large-files
3838
- id: check-case-conflict
@@ -75,7 +75,7 @@ repos:
7575
name: run codespell
7676
description: Check spelling with codespell
7777
args: [--ignore-words=.github/linters/codespell.txt]
78-
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$
7979
- repo: https://github.com/pycqa/flake8
8080
rev: 7.0.0
8181
hooks:

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/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.21.0.0-SNAPSHOT</version>
27+
<version>4.22.0.0-SNAPSHOT</version>
2828
</parent>
2929
<dependencies>
3030
<dependency>

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: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,15 @@ public class AgentProperties{
221221
*/
222222
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");
223223

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+
224233
/**
225234
* 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>
226235
* Libvirt XML transformer hook does XML-to-XML transformation.<br>
@@ -241,6 +250,15 @@ public class AgentProperties{
241250
*/
242251
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");
243252

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+
244262
/**
245263
* 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>
246264
* The hook is called right after Libvirt successfully launched the VM.<br>
@@ -260,6 +278,15 @@ public class AgentProperties{
260278
*/
261279
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");
262280

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+
263290
/**
264291
* 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>
265292
* The hook is called right after libvirt successfully stopped the VM.<br>
@@ -398,8 +425,9 @@ public class AgentProperties{
398425
public static final Property<String> GUEST_CPU_ARCH = new Property<>("guest.cpu.arch", null, String.class);
399426

400427
/**
401-
* This param will require CPU features on the CPU section.<br>
402-
* 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>
403431
* Possible values: vmx vme <br>
404432
* Data type: String.<br>
405433
* Default value: <code>null</code>
@@ -836,6 +864,14 @@ public Property<Integer> getWorkers() {
836864
* */
837865
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
838866

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+
839875
public static class Property <T>{
840876
private String name;
841877
private T defaultValue;

agent/src/main/java/com/cloud/agent/resource/DummyResource.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.HashMap;
2121
import java.util.List;
2222
import java.util.Map;
23-
import java.util.UUID;
2423

2524
import com.cloud.agent.IAgentControl;
2625
import com.cloud.agent.api.Answer;
@@ -40,6 +39,7 @@
4039
import com.cloud.storage.Storage;
4140
import com.cloud.storage.Storage.StoragePoolType;
4241
import com.cloud.utils.StringUtils;
42+
import com.cloud.utils.UuidUtils;
4343

4444
public class DummyResource implements ServerResource {
4545
String _name;
@@ -133,7 +133,7 @@ protected StoragePoolInfo initializeLocalStorage() {
133133
String hostIp = getConfiguredProperty("private.ip.address", "127.0.0.1");
134134
String localStoragePath = getConfiguredProperty("local.storage.path", "/mnt");
135135
String lh = hostIp + localStoragePath;
136-
String uuid = UUID.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString();
136+
String uuid = UuidUtils.nameUUIDFromBytes(lh.getBytes(StringUtils.getPreferredCharset())).toString();
137137

138138
String capacity = getConfiguredProperty("local.storage.capacity", "1000000000");
139139
String available = getConfiguredProperty("local.storage.avail", "10000000");

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.21.0.0-SNAPSHOT</version>
27+
<version>4.22.0.0-SNAPSHOT</version>
2828
</parent>
2929
<dependencies>
3030
<dependency>

0 commit comments

Comments
 (0)