Skip to content

Commit 6e6326a

Browse files
authored
Merge branch 'main' into excetion-typo-fix
2 parents 53e5375 + 9fd2b90 commit 6e6326a

File tree

1,056 files changed

+75810
-10597
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,056 files changed

+75810
-10597
lines changed

.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

.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: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,3 +447,6 @@ iscsi.session.cleanup.enabled=false
447447

448448
# Timeout (in seconds) to wait for the incremental snapshot to complete.
449449
# incremental.snapshot.timeout=10800
450+
451+
# If set to true, creates VMs as full clones of their templates on KVM hypervisor. Creates as linked clones otherwise.
452+
# 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: 35 additions & 0 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>
@@ -836,6 +863,14 @@ public Property<Integer> getWorkers() {
836863
* */
837864
public static final Property<Integer> REVERT_SNAPSHOT_TIMEOUT = new Property<>("revert.snapshot.timeout", 10800);
838865

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

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)