Skip to content

Commit a550287

Browse files
authored
Merge branch 'main' into ghi3777-codeInComments
2 parents a7ccaeb + d7b7bd5 commit a550287

File tree

825 files changed

+61359
-8716
lines changed

Some content is hidden

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

825 files changed

+61359
-8716
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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -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: 6 additions & 5 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
/**
@@ -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;

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

Lines changed: 162 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,32 @@
1515
// specific language governing permissions and limitations
1616
// under the License.
1717
package com.cloud.agent.api;
18+
19+
import org.apache.cloudstack.gpu.GpuDevice;
20+
1821
public class VgpuTypesInfo {
1922

23+
private boolean passthroughEnabled = true;
24+
private GpuDevice.DeviceType deviceType;
25+
private String parentBusAddress;
26+
private String busAddress;
27+
private String numaNode;
28+
private String pciRoot;
29+
private String deviceId;
30+
private String deviceName;
31+
private String vendorId;
32+
private String vendorName;
2033
private String modelName;
2134
private String groupName;
35+
private String vmName;
2236
private Long maxHeads;
2337
private Long videoRam;
2438
private Long maxResolutionX;
2539
private Long maxResolutionY;
2640
private Long maxVgpuPerGpu;
2741
private Long remainingCapacity;
2842
private Long maxCapacity;
43+
private boolean display = false;
2944

3045
public String getModelName() {
3146
return modelName;
@@ -39,22 +54,42 @@ public Long getVideoRam() {
3954
return videoRam;
4055
}
4156

57+
public void setVideoRam(Long videoRam) {
58+
this.videoRam = videoRam;
59+
}
60+
4261
public Long getMaxHeads() {
4362
return maxHeads;
4463
}
4564

65+
public void setMaxHeads(Long maxHeads) {
66+
this.maxHeads = maxHeads;
67+
}
68+
4669
public Long getMaxResolutionX() {
4770
return maxResolutionX;
4871
}
4972

73+
public void setMaxResolutionX(Long maxResolutionX) {
74+
this.maxResolutionX = maxResolutionX;
75+
}
76+
5077
public Long getMaxResolutionY() {
5178
return maxResolutionY;
5279
}
5380

81+
public void setMaxResolutionY(Long maxResolutionY) {
82+
this.maxResolutionY = maxResolutionY;
83+
}
84+
5485
public Long getMaxVpuPerGpu() {
5586
return maxVgpuPerGpu;
5687
}
5788

89+
public void setMaxVgpuPerGpu(Long maxVgpuPerGpu) {
90+
this.maxVgpuPerGpu = maxVgpuPerGpu;
91+
}
92+
5893
public Long getRemainingCapacity() {
5994
return remainingCapacity;
6095
}
@@ -71,8 +106,133 @@ public void setMaxVmCapacity(Long maxCapacity) {
71106
this.maxCapacity = maxCapacity;
72107
}
73108

74-
public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX, Long maxResolutionY, Long maxVgpuPerGpu,
75-
Long remainingCapacity, Long maxCapacity) {
109+
public boolean isPassthroughEnabled() {
110+
return passthroughEnabled;
111+
}
112+
113+
public void setPassthroughEnabled(boolean passthroughEnabled) {
114+
this.passthroughEnabled = passthroughEnabled;
115+
}
116+
117+
public GpuDevice.DeviceType getDeviceType() {
118+
return deviceType;
119+
}
120+
121+
public void setDeviceType(GpuDevice.DeviceType deviceType) {
122+
this.deviceType = deviceType;
123+
}
124+
125+
public String getParentBusAddress() {
126+
return parentBusAddress;
127+
}
128+
129+
public void setParentBusAddress(String parentBusAddress) {
130+
this.parentBusAddress = parentBusAddress;
131+
}
132+
133+
public String getBusAddress() {
134+
return busAddress;
135+
}
136+
137+
public void setBusAddress(String busAddress) {
138+
this.busAddress = busAddress;
139+
}
140+
141+
public String getNumaNode() {
142+
return numaNode;
143+
}
144+
145+
public void setNumaNode(String numaNode) {
146+
this.numaNode = numaNode;
147+
}
148+
149+
public String getPciRoot() {
150+
return pciRoot;
151+
}
152+
153+
public void setPciRoot(String pciRoot) {
154+
this.pciRoot = pciRoot;
155+
}
156+
157+
public String getDeviceId() {
158+
return deviceId;
159+
}
160+
161+
public void setDeviceId(String deviceId) {
162+
this.deviceId = deviceId;
163+
}
164+
165+
public String getDeviceName() {
166+
return deviceName;
167+
}
168+
169+
public void setDeviceName(String deviceName) {
170+
this.deviceName = deviceName;
171+
}
172+
173+
public String getVendorId() {
174+
return vendorId;
175+
}
176+
177+
public void setVendorId(String vendorId) {
178+
this.vendorId = vendorId;
179+
}
180+
181+
public String getVendorName() {
182+
return vendorName;
183+
}
184+
185+
public void setVendorName(String vendorName) {
186+
this.vendorName = vendorName;
187+
}
188+
189+
public String getVmName() {
190+
return vmName;
191+
}
192+
193+
public void setVmName(String vmName) {
194+
this.vmName = vmName;
195+
}
196+
197+
public boolean isDisplay() {
198+
return display;
199+
}
200+
201+
public void setDisplay(boolean display) {
202+
this.display = display;
203+
}
204+
205+
public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress,
206+
String vendorId, String vendorName, String deviceId, String deviceName, String numaNode, String pciRoot
207+
) {
208+
this.deviceType = deviceType;
209+
this.groupName = groupName;
210+
this.modelName = modelName;
211+
this.busAddress = busAddress;
212+
this.deviceId = deviceId;
213+
this.deviceName = deviceName;
214+
this.vendorId = vendorId;
215+
this.vendorName = vendorName;
216+
this.numaNode = numaNode;
217+
this.pciRoot = pciRoot;
218+
}
219+
220+
public VgpuTypesInfo(GpuDevice.DeviceType deviceType, String groupName, String modelName, String busAddress,
221+
String vendorId, String vendorName, String deviceId, String deviceName
222+
) {
223+
this.deviceType = deviceType;
224+
this.groupName = groupName;
225+
this.modelName = modelName;
226+
this.busAddress = busAddress;
227+
this.deviceId = deviceId;
228+
this.deviceName = deviceName;
229+
this.vendorId = vendorId;
230+
this.vendorName = vendorName;
231+
}
232+
233+
public VgpuTypesInfo(String groupName, String modelName, Long videoRam, Long maxHeads, Long maxResolutionX,
234+
Long maxResolutionY, Long maxVgpuPerGpu, Long remainingCapacity, Long maxCapacity
235+
) {
76236
this.groupName = groupName;
77237
this.modelName = modelName;
78238
this.videoRam = videoRam;

0 commit comments

Comments
 (0)