Skip to content

Commit 7c82efb

Browse files
authored
Merge branch 'main' into add-custommetamanufactureproduct
2 parents 2508376 + be552fd commit 7c82efb

File tree

174 files changed

+9167
-9474
lines changed

Some content is hidden

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

174 files changed

+9167
-9474
lines changed

.asf.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ github:
5858
- gpordeus
5959
- hsato03
6060
- bernardodemarco
61+
- abh1sar
6162

6263
protected_branches: ~
6364

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ jobs:
8686
smoke/test_migration
8787
smoke/test_multipleips_per_nic
8888
smoke/test_nested_virtualization
89-
smoke/test_set_sourcenat",
89+
smoke/test_set_sourcenat
90+
smoke/test_webhook_lifecycle",
9091
"smoke/test_network
9192
smoke/test_network_acl
9293
smoke/test_network_ipv6

api/src/main/java/com/cloud/kubernetes/cluster/KubernetesClusterHelper.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
// under the License.
1717
package com.cloud.kubernetes.cluster;
1818

19-
import com.cloud.utils.component.Adapter;
2019
import org.apache.cloudstack.acl.ControlledEntity;
2120

21+
import com.cloud.uservm.UserVm;
22+
import com.cloud.utils.component.Adapter;
23+
2224
public interface KubernetesClusterHelper extends Adapter {
2325

2426
ControlledEntity findByUuid(String uuid);
2527
ControlledEntity findByVmId(long vmId);
28+
void checkVmCanBeDestroyed(UserVm userVm);
2629
}

api/src/main/java/com/cloud/uservm/UserVm.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ public interface UserVm extends VirtualMachine, ControlledEntity {
4848
void setAccountId(long accountId);
4949

5050
public boolean isDisplayVm();
51+
52+
String getUserVmType();
5153
}

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,8 @@ public class ApiConstants {
175175
public static final String END_IPV6 = "endipv6";
176176
public static final String END_PORT = "endport";
177177
public static final String ENTRY_TIME = "entrytime";
178+
public static final String EVENT_ID = "eventid";
179+
public static final String EVENT_TYPE = "eventtype";
178180
public static final String EXPIRES = "expires";
179181
public static final String EXTRA_CONFIG = "extraconfig";
180182
public static final String EXTRA_DHCP_OPTION = "extradhcpoption";
@@ -209,6 +211,7 @@ public class ApiConstants {
209211
public static final String HA_PROVIDER = "haprovider";
210212
public static final String HA_STATE = "hastate";
211213
public static final String HEALTH = "health";
214+
public static final String HEADERS = "headers";
212215
public static final String HIDE_IP_ADDRESS_USAGE = "hideipaddressusage";
213216
public static final String HOST_ID = "hostid";
214217
public static final String HOST_IDS = "hostids";
@@ -281,6 +284,7 @@ public class ApiConstants {
281284
public static final String JOB_STATUS = "jobstatus";
282285
public static final String KEEPALIVE_ENABLED = "keepaliveenabled";
283286
public static final String KERNEL_VERSION = "kernelversion";
287+
public static final String KEY = "key";
284288
public static final String LABEL = "label";
285289
public static final String LASTNAME = "lastname";
286290
public static final String LAST_BOOT = "lastboottime";
@@ -355,6 +359,7 @@ public class ApiConstants {
355359
public static final String SSHKEY_ENABLED = "sshkeyenabled";
356360
public static final String PATH = "path";
357361
public static final String PAYLOAD = "payload";
362+
public static final String PAYLOAD_URL = "payloadurl";
358363
public static final String POD_ID = "podid";
359364
public static final String POD_NAME = "podname";
360365
public static final String POD_IDS = "podids";
@@ -400,11 +405,9 @@ public class ApiConstants {
400405
public static final String QUERY_FILTER = "queryfilter";
401406
public static final String SCHEDULE = "schedule";
402407
public static final String SCOPE = "scope";
403-
public static final String SECRET_KEY = "usersecretkey";
404-
public static final String SECONDARY_IP = "secondaryip";
405-
public static final String SINCE = "since";
406-
public static final String KEY = "key";
407408
public static final String SEARCH_BASE = "searchbase";
409+
public static final String SECONDARY_IP = "secondaryip";
410+
public static final String SECRET_KEY = "secretkey";
408411
public static final String SECURITY_GROUP_IDS = "securitygroupids";
409412
public static final String SECURITY_GROUP_NAMES = "securitygroupnames";
410413
public static final String SECURITY_GROUP_NAME = "securitygroupname";
@@ -422,15 +425,15 @@ public class ApiConstants {
422425
public static final String SHOW_UNIQUE = "showunique";
423426
public static final String SIGNATURE = "signature";
424427
public static final String SIGNATURE_VERSION = "signatureversion";
428+
public static final String SINCE = "since";
425429
public static final String SIZE = "size";
426430
public static final String SNAPSHOT = "snapshot";
427431
public static final String SNAPSHOT_ID = "snapshotid";
428432
public static final String SNAPSHOT_POLICY_ID = "snapshotpolicyid";
429433
public static final String SNAPSHOT_TYPE = "snapshottype";
430434
public static final String SNAPSHOT_QUIESCEVM = "quiescevm";
431435
public static final String SOURCE_ZONE_ID = "sourcezoneid";
432-
public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine";
433-
public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot";
436+
public static final String SSL_VERIFICATION = "sslverification";
434437
public static final String START_DATE = "startdate";
435438
public static final String START_ID = "startid";
436439
public static final String START_IP = "startip";
@@ -449,6 +452,9 @@ public class ApiConstants {
449452
public static final String SYSTEM_VM_TYPE = "systemvmtype";
450453
public static final String TAGS = "tags";
451454
public static final String STORAGE_TAGS = "storagetags";
455+
public static final String SUCCESS = "success";
456+
public static final String SUITABLE_FOR_VM = "suitableforvirtualmachine";
457+
public static final String SUPPORTS_STORAGE_SNAPSHOT = "supportsstoragesnapshot";
452458
public static final String TARGET_IQN = "targetiqn";
453459
public static final String TEMPLATE_FILTER = "templatefilter";
454460
public static final String TEMPLATE_ID = "templateid";
@@ -482,6 +488,7 @@ public class ApiConstants {
482488
public static final String USERNAME = "username";
483489
public static final String USER_CONFIGURABLE = "userconfigurable";
484490
public static final String USER_SECURITY_GROUP_LIST = "usersecuritygrouplist";
491+
public static final String USER_SECRET_KEY = "usersecretkey";
485492
public static final String USE_VIRTUAL_NETWORK = "usevirtualnetwork";
486493
public static final String UPDATE_IN_SEQUENCE = "updateinsequence";
487494
public static final String VALUE = "value";
@@ -561,6 +568,7 @@ public class ApiConstants {
561568
public static final String ALLOCATION_STATE = "allocationstate";
562569
public static final String MANAGED_STATE = "managedstate";
563570
public static final String MANAGEMENT_SERVER_ID = "managementserverid";
571+
public static final String MANAGEMENT_SERVER_NAME = "managementservername";
564572
public static final String STORAGE = "storage";
565573
public static final String STORAGE_ID = "storageid";
566574
public static final String PING_STORAGE_SERVER_IP = "pingstorageserverip";
@@ -1121,6 +1129,9 @@ public class ApiConstants {
11211129

11221130
public static final String PARAMETER_DESCRIPTION_IS_TAG_A_RULE = "Whether the informed tag is a JS interpretable rule or not.";
11231131

1132+
public static final String WEBHOOK_ID = "webhookid";
1133+
public static final String WEBHOOK_NAME = "webhookname";
1134+
11241135
/**
11251136
* This enum specifies IO Drivers, each option controls specific policies on I/O.
11261137
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).

api/src/main/java/org/apache/cloudstack/api/command/admin/user/UpdateUserCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ public class UpdateUserCmd extends BaseCmd {
6666
@Parameter(name = ApiConstants.CURRENT_PASSWORD, type = CommandType.STRING, description = "Current password that was being used by the user. You must inform the current password when updating the password.", acceptedOnAdminPort = false)
6767
private String currentPassword;
6868

69-
@Parameter(name = ApiConstants.SECRET_KEY, type = CommandType.STRING, description = "The secret key for the user. Must be specified with userApiKey")
69+
@Parameter(name = ApiConstants.USER_SECRET_KEY, type = CommandType.STRING, description = "The secret key for the user. Must be specified with userApiKey")
7070
private String secretKey;
7171

7272
@Parameter(name = ApiConstants.TIMEZONE,

api/src/main/java/org/apache/cloudstack/api/command/user/vm/ListVMsCmd.java

Lines changed: 28 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,10 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.command.user.vm;
1818

19-
import java.util.ArrayList;
2019
import java.util.EnumSet;
20+
import java.util.HashSet;
2121
import java.util.List;
22+
import java.util.Set;
2223

2324
import org.apache.cloudstack.acl.RoleType;
2425
import org.apache.cloudstack.affinity.AffinityGroupResponse;
@@ -45,6 +46,7 @@
4546
import org.apache.cloudstack.api.response.VpcResponse;
4647
import org.apache.cloudstack.api.response.ZoneResponse;
4748
import org.apache.commons.lang3.BooleanUtils;
49+
import org.apache.commons.collections.CollectionUtils;
4850

4951
import com.cloud.exception.InvalidParameterValueException;
5052
import com.cloud.server.ResourceIcon;
@@ -56,7 +58,6 @@
5658
requestHasSensitiveInfo = false, responseHasSensitiveInfo = true)
5759
public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements UserCmd {
5860

59-
private static final String s_name = "listvirtualmachinesresponse";
6061

6162
/////////////////////////////////////////////////////
6263
//////////////// API parameters /////////////////////
@@ -96,7 +97,8 @@ public class ListVMsCmd extends BaseListRetrieveOnlyResourceCountCmd implements
9697
collectionType = CommandType.STRING,
9798
description = "comma separated list of vm details requested, "
9899
+ "value can be a list of [all, group, nics, stats, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp]."
99-
+ " If no parameter is passed in, the details will be defaulted to all")
100+
+ " If no parameter is passed in, the details will be defaulted to all. When return.vm.stats.on.vm.list is true, the default" +
101+
"details change to [group, nics, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp], thus the stats will not be returned. ")
100102
private List<String> viewDetails;
101103

102104
@Parameter(name = ApiConstants.TEMPLATE_ID, type = CommandType.UUID, entityType = TemplateResponse.class, description = "list vms by template")
@@ -237,22 +239,32 @@ public Long getAutoScaleVmGroupId() {
237239
return autoScaleVmGroupId;
238240
}
239241

242+
protected boolean isViewDetailsEmpty() {
243+
return CollectionUtils.isEmpty(viewDetails);
244+
}
245+
240246
public EnumSet<VMDetails> getDetails() throws InvalidParameterValueException {
241-
EnumSet<VMDetails> dv;
242-
if (viewDetails == null || viewDetails.size() <= 0) {
243-
dv = EnumSet.of(VMDetails.all);
244-
} else {
245-
try {
246-
ArrayList<VMDetails> dc = new ArrayList<VMDetails>();
247-
for (String detail : viewDetails) {
248-
dc.add(VMDetails.valueOf(detail));
249-
}
250-
dv = EnumSet.copyOf(dc);
251-
} catch (IllegalArgumentException e) {
252-
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(VMDetails.class));
247+
if (isViewDetailsEmpty()) {
248+
if (_queryService.ReturnVmStatsOnVmList.value()) {
249+
return EnumSet.of(VMDetails.all);
250+
}
251+
252+
Set<VMDetails> allDetails = new HashSet<>(Set.of(VMDetails.values()));
253+
allDetails.remove(VMDetails.stats);
254+
allDetails.remove(VMDetails.all);
255+
return EnumSet.copyOf(allDetails);
256+
}
257+
258+
try {
259+
Set<VMDetails> dc = new HashSet<>();
260+
for (String detail : viewDetails) {
261+
dc.add(VMDetails.valueOf(detail));
253262
}
263+
264+
return EnumSet.copyOf(dc);
265+
} catch (IllegalArgumentException e) {
266+
throw new InvalidParameterValueException("The details parameter contains a non permitted value. The allowed values are " + EnumSet.allOf(VMDetails.class));
254267
}
255-
return dv;
256268
}
257269

258270
@Override
@@ -275,10 +287,6 @@ public Boolean getVnf() {
275287
/////////////////////////////////////////////////////
276288
/////////////// API Implementation///////////////////
277289
/////////////////////////////////////////////////////
278-
@Override
279-
public String getCommandName() {
280-
return s_name;
281-
}
282290

283291
@Override
284292
public ApiCommandResourceType getApiResourceType() {

api/src/main/java/org/apache/cloudstack/api/response/BucketResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public class BucketResponse extends BaseResponseWithTagInformation implements Co
9898
@Param(description = "Bucket Access Key")
9999
private String accessKey;
100100

101-
@SerializedName(ApiConstants.SECRET_KEY)
101+
@SerializedName(ApiConstants.USER_SECRET_KEY)
102102
@Param(description = "Bucket Secret Key")
103103
private String secretKey;
104104

api/src/main/java/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
import com.cloud.uservm.UserVm;
3838
import com.cloud.vm.VirtualMachine;
3939
import com.google.gson.annotations.SerializedName;
40+
import org.apache.commons.collections.CollectionUtils;
4041

4142
@SuppressWarnings("unused")
4243
@EntityReference(value = {VirtualMachine.class, UserVm.class, VirtualRouter.class})
@@ -273,6 +274,10 @@ public class UserVmResponse extends BaseResponseWithTagInformation implements Co
273274
@Param(description = "the hypervisor on which the template runs")
274275
private String hypervisor;
275276

277+
@SerializedName(ApiConstants.IP_ADDRESS)
278+
@Param(description = "the VM's primary IP address")
279+
private String ipAddress;
280+
276281
@SerializedName(ApiConstants.PUBLIC_IP_ID)
277282
@Param(description = "public IP address id associated with vm via Static nat rule")
278283
private String publicIpId;
@@ -627,6 +632,10 @@ public String getHypervisor() {
627632
return hypervisor;
628633
}
629634

635+
public String getIpAddress() {
636+
return ipAddress;
637+
}
638+
630639
public String getPublicIpId() {
631640
return publicIpId;
632641
}
@@ -863,6 +872,13 @@ public void setForVirtualNetwork(Boolean forVirtualNetwork) {
863872

864873
public void setNics(Set<NicResponse> nics) {
865874
this.nics = nics;
875+
setIpAddress(nics);
876+
}
877+
878+
public void setIpAddress(final Set<NicResponse> nics) {
879+
if (CollectionUtils.isNotEmpty(nics)) {
880+
this.ipAddress = nics.iterator().next().getIpaddress();
881+
}
866882
}
867883

868884
public void addNic(NicResponse nic) {

api/src/main/java/org/apache/cloudstack/query/QueryService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,10 @@ public interface QueryService {
125125
static final ConfigKey<Boolean> SharePublicTemplatesWithOtherDomains = new ConfigKey<>("Advanced", Boolean.class, "share.public.templates.with.other.domains", "true",
126126
"If false, templates of this domain will not show up in the list templates of other domains.", true, ConfigKey.Scope.Domain);
127127

128+
ConfigKey<Boolean> ReturnVmStatsOnVmList = new ConfigKey<>("Advanced", Boolean.class, "return.vm.stats.on.vm.list", "true",
129+
"If false, changes the listVirtualMachines default details to [group, nics, secgrp, tmpl, servoff, diskoff, backoff, iso, volume, min, affgrp], so that the VMs' stats" +
130+
" are not returned by default when listing VMs; only when the 'stats' or 'all' detail is informed.", true, ConfigKey.Scope.Global);
131+
128132
ListResponse<UserResponse> searchForUsers(ListUsersCmd cmd) throws PermissionDeniedException;
129133

130134
ListResponse<UserResponse> searchForUsers(Long domainId, boolean recursive) throws PermissionDeniedException;

0 commit comments

Comments
 (0)