Skip to content

Commit f7095c3

Browse files
committed
Merge remote-tracking branch 'origin' into differential-snapshots
2 parents 1940c17 + 2df1ac5 commit f7095c3

File tree

210 files changed

+5109
-2199
lines changed

Some content is hidden

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

210 files changed

+5109
-2199
lines changed

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ github:
5959
- nicoschmdt
6060
- abh1sar
6161
- sudo87
62+
- rosi-shapeblue
6263

6364
protected_branches: ~
6465

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ jobs:
236236
237237
- name: Install Python dependencies
238238
run: |
239-
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid
239+
python3 -m pip install --user --upgrade urllib3 lxml paramiko nose texttable ipmisim pyopenssl pycrypto mock flask netaddr pylint pycodestyle six astroid pynose
240240
241241
- name: Install jacoco dependencies
242242
run: |

api/src/main/java/com/cloud/cpu/CPU.java

Lines changed: 30 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -16,52 +16,55 @@
1616
// under the License.
1717
package com.cloud.cpu;
1818

19-
import com.cloud.utils.exception.CloudRuntimeException;
2019
import org.apache.commons.lang3.StringUtils;
2120

22-
import java.util.LinkedHashMap;
23-
import java.util.Map;
24-
2521
public class CPU {
22+
public enum CPUArch {
23+
x86("i686", 32),
24+
amd64("x86_64", 64),
25+
arm64("aarch64", 64);
2626

27-
public static final String archX86Identifier = "i686";
28-
public static final String archX86_64Identifier = "x86_64";
29-
public static final String archARM64Identifier = "aarch64";
30-
31-
public static class CPUArch {
32-
private static final Map<String, CPUArch> cpuArchMap = new LinkedHashMap<>();
33-
34-
public static final CPUArch archX86 = new CPUArch(archX86Identifier, 32);
35-
public static final CPUArch amd64 = new CPUArch(archX86_64Identifier, 64);
36-
public static final CPUArch arm64 = new CPUArch(archARM64Identifier, 64);
27+
private final String type;
28+
private final int bits;
3729

38-
private String type;
39-
private int bits;
40-
41-
public CPUArch(String type, int bits) {
30+
CPUArch(String type, int bits) {
4231
this.type = type;
4332
this.bits = bits;
44-
cpuArchMap.put(type, this);
33+
}
34+
35+
public static CPUArch getDefault() {
36+
return amd64;
4537
}
4638

4739
public String getType() {
48-
return this.type;
40+
return type;
4941
}
5042

5143
public int getBits() {
52-
return this.bits;
44+
return bits;
5345
}
5446

5547
public static CPUArch fromType(String type) {
5648
if (StringUtils.isBlank(type)) {
57-
return amd64;
49+
return getDefault();
50+
}
51+
for (CPUArch arch : values()) {
52+
if (arch.type.equals(type)) {
53+
return arch;
54+
}
55+
}
56+
throw new IllegalArgumentException("Unsupported arch type: " + type);
57+
}
58+
59+
public static String getTypesAsCSV() {
60+
StringBuilder sb = new StringBuilder();
61+
for (CPUArch arch : values()) {
62+
sb.append(arch.getType()).append(",");
5863
}
59-
switch (type) {
60-
case archX86Identifier: return archX86;
61-
case archX86_64Identifier: return amd64;
62-
case archARM64Identifier: return arm64;
63-
default: throw new CloudRuntimeException(String.format("Unsupported arch type: %s", type));
64+
if (sb.length() > 0) {
65+
sb.setLength(sb.length() - 1);
6466
}
67+
return sb.toString();
6568
}
6669
}
6770
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
package com.cloud.storage;
1818

1919
import java.util.Date;
20+
import java.util.List;
2021

2122
import org.apache.cloudstack.api.InternalIdentity;
2223

@@ -25,6 +26,8 @@ public static enum Status {
2526
UNKNOWN, DOWNLOAD_ERROR, NOT_DOWNLOADED, DOWNLOAD_IN_PROGRESS, DOWNLOADED, ABANDONED, UPLOADED, NOT_UPLOADED, UPLOAD_ERROR, UPLOAD_IN_PROGRESS, CREATING, CREATED, BYPASSED
2627
}
2728

29+
List<Status> PENDING_DOWNLOAD_STATES = List.of(Status.NOT_DOWNLOADED, Status.DOWNLOAD_IN_PROGRESS);
30+
2831
String getInstallPath();
2932

3033
long getTemplateId();

api/src/main/java/com/cloud/vm/VmDetailConstants.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,4 +101,13 @@ public interface VmDetailConstants {
101101
String VMWARE_HOST_NAME = String.format("%s-host", VMWARE_TO_KVM_PREFIX);
102102
String VMWARE_DISK = String.format("%s-disk", VMWARE_TO_KVM_PREFIX);
103103
String VMWARE_MAC_ADDRESSES = String.format("%s-mac-addresses", VMWARE_TO_KVM_PREFIX);
104+
105+
// TPM
106+
String VIRTUAL_TPM_ENABLED = "virtual.tpm.enabled";
107+
String VIRTUAL_TPM_MODEL = "virtual.tpm.model";
108+
String VIRTUAL_TPM_VERSION = "virtual.tpm.version";
109+
110+
// CPU mode and model, ADMIN only
111+
String GUEST_CPU_MODE = "guest.cpu.mode";
112+
String GUEST_CPU_MODEL = "guest.cpu.model";
104113
}

api/src/main/java/org/apache/cloudstack/api/ApiConstants.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -485,12 +485,11 @@ public class ApiConstants {
485485
public static final String STATE = "state";
486486
public static final String STATS = "stats";
487487
public static final String STATUS = "status";
488+
public static final String STORAGE_TYPE = "storagetype";
489+
public static final String STORAGE_POLICY = "storagepolicy";
490+
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
488491
public static final String STORAGE_CAPABILITIES = "storagecapabilities";
489492
public static final String STORAGE_CUSTOM_STATS = "storagecustomstats";
490-
public static final String STORAGE_MOTION_ENABLED = "storagemotionenabled";
491-
public static final String STORAGE_POLICY = "storagepolicy";
492-
public static final String STORAGE_POOL = "storagepool";
493-
public static final String STORAGE_TYPE = "storagetype";
494493
public static final String SUBNET = "subnet";
495494
public static final String OWNER = "owner";
496495
public static final String SWAP_OWNER = "swapowner";

api/src/main/java/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22-
2322
import org.apache.cloudstack.api.APICommand;
2423
import org.apache.cloudstack.api.ApiConstants;
2524
import org.apache.cloudstack.api.BaseListCmd;
@@ -28,7 +27,9 @@
2827
import org.apache.cloudstack.api.response.ListResponse;
2928
import org.apache.cloudstack.api.response.PodResponse;
3029
import org.apache.cloudstack.api.response.ZoneResponse;
30+
import org.apache.commons.lang3.StringUtils;
3131

32+
import com.cloud.cpu.CPU;
3233
import com.cloud.org.Cluster;
3334
import com.cloud.utils.Pair;
3435

@@ -68,6 +69,11 @@ public class ListClustersCmd extends BaseListCmd {
6869
@Parameter(name = ApiConstants.SHOW_CAPACITIES, type = CommandType.BOOLEAN, description = "flag to display the capacity of the clusters")
6970
private Boolean showCapacities;
7071

72+
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
73+
description = "CPU arch of the clusters",
74+
since = "4.20.1")
75+
private String arch;
76+
7177
/////////////////////////////////////////////////////
7278
/////////////////// Accessors ///////////////////////
7379
/////////////////////////////////////////////////////
@@ -112,6 +118,10 @@ public Boolean getShowCapacities() {
112118
return showCapacities;
113119
}
114120

121+
public CPU.CPUArch getArch() {
122+
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
123+
}
124+
115125
/////////////////////////////////////////////////////
116126
/////////////// API Implementation///////////////////
117127
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import java.util.List;
2222
import java.util.Map;
2323

24-
2524
import org.apache.cloudstack.api.APICommand;
2625
import org.apache.cloudstack.api.ApiCommandResourceType;
2726
import org.apache.cloudstack.api.ApiConstants;
@@ -35,7 +34,9 @@
3534
import org.apache.cloudstack.api.response.PodResponse;
3635
import org.apache.cloudstack.api.response.UserVmResponse;
3736
import org.apache.cloudstack.api.response.ZoneResponse;
37+
import org.apache.commons.lang3.StringUtils;
3838

39+
import com.cloud.cpu.CPU;
3940
import com.cloud.exception.InvalidParameterValueException;
4041
import com.cloud.host.Host;
4142
import com.cloud.hypervisor.Hypervisor.HypervisorType;
@@ -109,6 +110,9 @@ public class ListHostsCmd extends BaseListCmd {
109110
@Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "the id of the management server", since="4.21.0")
110111
private Long managementServerId;
111112

113+
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING, description = "CPU Arch of the host", since = "4.20.1")
114+
private String arch;
115+
112116
/////////////////////////////////////////////////////
113117
/////////////////// Accessors ///////////////////////
114118
/////////////////////////////////////////////////////
@@ -197,6 +201,10 @@ public Long getManagementServerId() {
197201
return managementServerId;
198202
}
199203

204+
public CPU.CPUArch getArch() {
205+
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
206+
}
207+
200208
/////////////////////////////////////////////////////
201209
/////////////// API Implementation///////////////////
202210
/////////////////////////////////////////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/router/ListRoutersCmd.java

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.admin.router;
1818

19-
import org.apache.commons.lang.BooleanUtils;
20-
2119
import org.apache.cloudstack.api.APICommand;
2220
import org.apache.cloudstack.api.ApiCommandResourceType;
2321
import org.apache.cloudstack.api.ApiConstants;
@@ -32,7 +30,10 @@
3230
import org.apache.cloudstack.api.response.UserVmResponse;
3331
import org.apache.cloudstack.api.response.VpcResponse;
3432
import org.apache.cloudstack.api.response.ZoneResponse;
33+
import org.apache.commons.lang.BooleanUtils;
34+
import org.apache.commons.lang3.StringUtils;
3535

36+
import com.cloud.cpu.CPU;
3637
import com.cloud.network.router.VirtualRouter.Role;
3738
import com.cloud.vm.VirtualMachine;
3839

@@ -86,6 +87,11 @@ public class ListRoutersCmd extends BaseListProjectAndAccountResourcesCmd {
8687
description = "if true is passed for this parameter, also fetch last executed health check results for the router. Default is false")
8788
private Boolean fetchHealthCheckResults;
8889

90+
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
91+
description = "CPU arch of the router",
92+
since = "4.20.1")
93+
private String arch;
94+
8995
/////////////////////////////////////////////////////
9096
/////////////////// Accessors ///////////////////////
9197
/////////////////////////////////////////////////////
@@ -146,6 +152,10 @@ public boolean shouldFetchHealthCheckResults() {
146152
return BooleanUtils.isTrue(fetchHealthCheckResults);
147153
}
148154

155+
public CPU.CPUArch getArch() {
156+
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
157+
}
158+
149159

150160
/////////////////////////////////////////////////////
151161
/////////////// API Implementation///////////////////

api/src/main/java/org/apache/cloudstack/api/command/admin/systemvm/ListSystemVMsCmd.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
import java.util.ArrayList;
2020
import java.util.List;
2121

22-
2322
import org.apache.cloudstack.api.APICommand;
2423
import org.apache.cloudstack.api.ApiCommandResourceType;
2524
import org.apache.cloudstack.api.ApiConstants;
@@ -31,7 +30,9 @@
3130
import org.apache.cloudstack.api.response.StoragePoolResponse;
3231
import org.apache.cloudstack.api.response.SystemVmResponse;
3332
import org.apache.cloudstack.api.response.ZoneResponse;
33+
import org.apache.commons.lang3.StringUtils;
3434

35+
import com.cloud.cpu.CPU;
3536
import com.cloud.utils.Pair;
3637
import com.cloud.vm.VirtualMachine;
3738

@@ -74,6 +75,11 @@ public class ListSystemVMsCmd extends BaseListCmd {
7475
since = "3.0.1")
7576
private Long storageId;
7677

78+
@Parameter(name = ApiConstants.ARCH, type = CommandType.STRING,
79+
description = "CPU arch of the system VM",
80+
since = "4.20.1")
81+
private String arch;
82+
7783
/////////////////////////////////////////////////////
7884
/////////////////// Accessors ///////////////////////
7985
/////////////////////////////////////////////////////
@@ -110,6 +116,10 @@ public Long getStorageId() {
110116
return storageId;
111117
}
112118

119+
public CPU.CPUArch getArch() {
120+
return StringUtils.isBlank(arch) ? null : CPU.CPUArch.fromType(arch);
121+
}
122+
113123
/////////////////////////////////////////////////////
114124
/////////////// API Implementation///////////////////
115125
/////////////////////////////////////////////////////

0 commit comments

Comments
 (0)