Skip to content

Commit 842a53d

Browse files
committed
Merge remote-tracking branch 'apache/main' into ExternalDeploymentIntegration
2 parents 12e4e0e + f52e058 commit 842a53d

117 files changed

Lines changed: 7696 additions & 788 deletions

File tree

Some content is hidden

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

.github/workflows/ui.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ jobs:
5656
npm run test:unit
5757
5858
- uses: codecov/codecov-action@v4
59+
if: github.repository == 'apache/cloudstack'
5960
with:
6061
working-directory: ui
6162
files: ./coverage/lcov.info

api/src/main/java/com/cloud/event/EventTypes.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -812,6 +812,11 @@ public class EventTypes {
812812
public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED";
813813
public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING";
814814

815+
// GUI Theme
816+
public static final String EVENT_GUI_THEME_CREATE = "GUI.THEME.CREATE";
817+
public static final String EVENT_GUI_THEME_REMOVE = "GUI.THEME.REMOVE";
818+
public static final String EVENT_GUI_THEME_UPDATE = "GUI.THEME.UPDATE";
819+
815820
// Extension
816821
public static final String EVENT_EXTENSION_CREATE = "EXTENSION.CREATE";
817822
public static final String EVENT_EXTENSION_UPDATE = "EXTENSION.UPDATE";
@@ -1329,6 +1334,11 @@ public class EventTypes {
13291334
entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class);
13301335
entityEventDetails.put(VM_LEASE_CANCELLED, VirtualMachine.class);
13311336

1337+
// GUI theme
1338+
entityEventDetails.put(EVENT_GUI_THEME_CREATE, "GuiTheme");
1339+
entityEventDetails.put(EVENT_GUI_THEME_REMOVE, "GuiTheme");
1340+
entityEventDetails.put(EVENT_GUI_THEME_UPDATE, "GuiTheme");
1341+
13321342
// Extension
13331343
entityEventDetails.put(EVENT_EXTENSION_CREATE, Extension.class);
13341344
entityEventDetails.put(EVENT_EXTENSION_UPDATE, Extension.class);

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,13 @@ Volume updateVolume(long volumeId, String path, String state, Long storageId,
171171
* </table>
172172
*/
173173
boolean doesStoragePoolSupportDiskOffering(StoragePool destPool, DiskOffering diskOffering);
174+
175+
/**
176+
* Checks if the storage pool supports the required disk offering tags
177+
* destPool the storage pool to check the disk offering tags
178+
* diskOfferingTags the tags that should be supported
179+
* return whether the tags are supported in the storage pool
180+
*/
174181
boolean doesStoragePoolSupportDiskOfferingTags(StoragePool destPool, String diskOfferingTags);
175182

176183
Volume destroyVolume(long volumeId, Account caller, boolean expunge, boolean forceExpunge);

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
// under the License.
1717
package com.cloud.vm;
1818

19+
import com.cloud.storage.Snapshot;
20+
import com.cloud.storage.Volume;
1921
import java.util.LinkedHashMap;
2022
import java.util.List;
2123
import java.util.Map;
@@ -222,7 +224,7 @@ UserVm createBasicSecurityGroupVirtualMachine(DataCenter zone, ServiceOffering s
222224
String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIp, Boolean displayVm, String keyboard,
223225
List<Long> affinityGroupIdList, Map<String, String> customParameter, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
224226
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
225-
Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId) throws InsufficientCapacityException,
227+
Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot) throws InsufficientCapacityException,
226228
ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
227229

228230
/**
@@ -298,7 +300,7 @@ UserVm createAdvancedSecurityGroupVirtualMachine(DataCenter zone, ServiceOfferin
298300
List<Long> securityGroupIdList, Account owner, String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor,
299301
HTTPMethod httpmethod, String userData, Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard,
300302
List<Long> affinityGroupIdList, Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap,
301-
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
303+
Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap, Map<String, String> userVmOVFProperties, boolean dynamicScalingEnabled, Long overrideDiskOfferingId, String vmType, Volume volume, Snapshot snapshot) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
302304

303305
/**
304306
* Creates a User VM in Advanced Zone (Security Group feature is disabled)
@@ -370,7 +372,7 @@ UserVm createAdvancedVirtualMachine(DataCenter zone, ServiceOffering serviceOffe
370372
String hostName, String displayName, Long diskOfferingId, Long diskSize, String group, HypervisorType hypervisor, HTTPMethod httpmethod, String userData,
371373
Long userDataId, String userDataDetails, List<String> sshKeyPairs, Map<Long, IpAddresses> requestedIps, IpAddresses defaultIps, Boolean displayVm, String keyboard, List<Long> affinityGroupIdList,
372374
Map<String, String> customParameters, String customId, Map<String, Map<Integer, String>> dhcpOptionMap, Map<Long, DiskOffering> dataDiskTemplateToDiskOfferingMap,
373-
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId)
375+
Map<String, String> templateOvfPropertiesMap, boolean dynamicScalingEnabled, String vmType, Long overrideDiskOfferingId, Volume volume, Snapshot snapshot)
374376

375377
throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException, StorageUnavailableException, ResourceAllocationException;
376378

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

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,11 @@ public class ApiConstants {
9191
public static final String CONVERT_INSTANCE_HOST_ID = "convertinstancehostid";
9292
public static final String CONVERT_INSTANCE_STORAGE_POOL_ID = "convertinstancepoolid";
9393
public static final String ENABLED_REVOCATION_CHECK = "enabledrevocationcheck";
94+
public static final String COMBINED_CAPACITY_ORDERING = "COMBINED";
9495
public static final String CONTROLLER = "controller";
9596
public static final String CONTROLLER_UNIT = "controllerunit";
9697
public static final String COPY_IMAGE_TAGS = "copyimagetags";
98+
public static final String CPU_OVERCOMMIT_RATIO = "cpuOvercommitRatio";
9799
public static final String CSR = "csr";
98100
public static final String PRIVATE_KEY = "privatekey";
99101
public static final String DATASTORE_HOST = "datastorehost";
@@ -125,6 +127,7 @@ public class ApiConstants {
125127
public static final String CNI_CONFIG_DETAILS = "cniconfigdetails";
126128
public static final String CNI_CONFIG_NAME = "cniconfigname";
127129
public static final String COMPONENT = "component";
130+
public static final String CPU = "CPU";
128131
public static final String CPU_CORE_PER_SOCKET = "cpucorepersocket";
129132
public static final String CPU_NUMBER = "cpunumber";
130133
public static final String CPU_SPEED = "cpuspeed";
@@ -354,6 +357,7 @@ public class ApiConstants {
354357
public static final String MAX_BACKUPS = "maxbackups";
355358
public static final String MAX_CPU_NUMBER = "maxcpunumber";
356359
public static final String MAX_MEMORY = "maxmemory";
360+
public static final String MEMORY_OVERCOMMIT_RATIO = "memoryOvercommitRatio";
357361
public static final String MESSAGE = "message";
358362
public static final String MIN_CPU_NUMBER = "mincpunumber";
359363
public static final String MIN_MEMORY = "minmemory";
@@ -454,6 +458,7 @@ public class ApiConstants {
454458
public static final String PUBLIC_END_PORT = "publicendport";
455459
public static final String PUBLIC_ZONE = "publiczone";
456460
public static final String PURGE_RESOURCES = "purgeresources";
461+
public static final String RAM = "RAM";
457462
public static final String REBALANCE = "rebalance";
458463
public static final String RECEIVED_BYTES = "receivedbytes";
459464
public static final String RECONNECT = "reconnect";
@@ -1276,6 +1281,22 @@ public class ApiConstants {
12761281

12771282
public static final String VMWARE_DC = "vmwaredc";
12781283

1284+
public static final String CSS = "css";
1285+
1286+
public static final String JSON_CONFIGURATION = "jsonconfiguration";
1287+
1288+
public static final String COMMON_NAMES = "commonnames";
1289+
1290+
public static final String COMMON_NAME = "commonname";
1291+
1292+
public static final String DOMAIN_IDS = "domainids";
1293+
1294+
public static final String SHOW_PUBLIC = "showpublic";
1295+
1296+
public static final String LIST_ONLY_DEFAULT_THEME = "listonlydefaulttheme";
1297+
1298+
public static final String RECURSIVE_DOMAINS = "recursivedomains";
1299+
12791300
/**
12801301
* This enum specifies IO Drivers, each option controls specific policies on I/O.
12811302
* 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/ResponseGenerator.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@
6464
import org.apache.cloudstack.api.response.GuestOsMappingResponse;
6565
import org.apache.cloudstack.api.response.GuestVlanRangeResponse;
6666
import org.apache.cloudstack.api.response.GuestVlanResponse;
67+
import org.apache.cloudstack.api.response.GuiThemeResponse;
6768
import org.apache.cloudstack.api.response.HostForMigrationResponse;
6869
import org.apache.cloudstack.api.response.HostResponse;
6970
import org.apache.cloudstack.api.response.HypervisorCapabilitiesResponse;
@@ -150,6 +151,7 @@
150151
import org.apache.cloudstack.direct.download.DirectDownloadCertificate;
151152
import org.apache.cloudstack.direct.download.DirectDownloadCertificateHostMap;
152153
import org.apache.cloudstack.direct.download.DirectDownloadManager;
154+
import org.apache.cloudstack.gui.theme.GuiThemeJoin;
153155
import org.apache.cloudstack.management.ManagementServerHost;
154156
import org.apache.cloudstack.network.lb.ApplicationLoadBalancerRule;
155157
import org.apache.cloudstack.region.PortableIp;
@@ -579,4 +581,6 @@ List<TemplateResponse> createTemplateResponses(ResponseView view, VirtualMachine
579581
SharedFSResponse createSharedFSResponse(ResponseView view, SharedFS sharedFS);
580582

581583
void updateTemplateIsoResponsesForIcons(List<TemplateResponse> responses, ResourceTag.ResourceObjectType type);
584+
585+
GuiThemeResponse createGuiThemeResponse(GuiThemeJoin guiThemeJoin);
582586
}
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
17+
package org.apache.cloudstack.api.command.user.gui.theme;
18+
19+
import org.apache.cloudstack.acl.RoleType;
20+
import org.apache.cloudstack.api.APICommand;
21+
import org.apache.cloudstack.api.ApiConstants;
22+
import org.apache.cloudstack.api.ApiErrorCode;
23+
import org.apache.cloudstack.api.BaseCmd;
24+
import org.apache.cloudstack.api.Parameter;
25+
import org.apache.cloudstack.api.ServerApiException;
26+
import org.apache.cloudstack.api.response.GuiThemeResponse;
27+
import org.apache.cloudstack.context.CallContext;
28+
import org.apache.cloudstack.gui.theme.GuiTheme;
29+
import org.apache.cloudstack.gui.theme.GuiThemeJoin;
30+
import org.apache.cloudstack.gui.theme.GuiThemeService;
31+
32+
import javax.inject.Inject;
33+
34+
@APICommand(name = "createGuiTheme", description = "Creates a customized GUI theme for a set of Common Names (fixed or wildcard), a set of domain UUIDs, and/or a set of " +
35+
"account UUIDs.", responseObject = GuiThemeResponse.class, entityType = {GuiTheme.class}, requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
36+
since = "4.21.0.0", authorized = {RoleType.Admin})
37+
public class CreateGuiThemeCmd extends BaseCmd {
38+
39+
@Inject
40+
GuiThemeService guiThemeService;
41+
42+
@Parameter(name = ApiConstants.NAME, required = true, type = CommandType.STRING, length = 2048, description = "A name to identify the theme.")
43+
private String name;
44+
45+
@Parameter(name = ApiConstants.DESCRIPTION, type = CommandType.STRING, length = 4096, description = "A description for the theme.")
46+
private String description;
47+
48+
@Parameter(name = ApiConstants.CSS, type = CommandType.STRING, length = 65535, description = "The CSS to be retrieved and imported into the GUI " +
49+
"when matching the theme access configurations.")
50+
private String css;
51+
52+
@Parameter(name = ApiConstants.JSON_CONFIGURATION, type = CommandType.STRING, length = 65535, description = "The JSON with the configurations to be " +
53+
"retrieved and imported into the GUI when matching the theme access configurations.")
54+
private String jsonConfiguration;
55+
56+
@Parameter(name = ApiConstants.COMMON_NAMES, type = CommandType.STRING, length = 65535, description = "A set of Common Names (CN) (fixed or " +
57+
"wildcard) separated by comma that can retrieve the theme; e.g.: *acme.com,acme2.com")
58+
private String commonNames;
59+
60+
@Parameter(name = ApiConstants.DOMAIN_IDS, type = CommandType.STRING, length = 65535, description = "A set of domain UUIDs (also known as ID for " +
61+
"the end-user) separated by comma that can retrieve the theme.")
62+
private String domainIds;
63+
64+
@Parameter(name = ApiConstants.ACCOUNT_IDS, type = CommandType.STRING, length = 65535, description = "A set of account UUIDs (also known as ID for" +
65+
" the end-user) separated by comma that can retrieve the theme.")
66+
private String accountIds;
67+
68+
@Parameter(name = ApiConstants.IS_PUBLIC, type = CommandType.BOOLEAN, description = "Defines whether a theme can be retrieved by anyone when only " +
69+
"the `commonNames` is informed. If the `domainIds` or `accountIds` is informed, it is considered as `false`.")
70+
private Boolean isPublic = true;
71+
72+
@Parameter(name = ApiConstants.RECURSIVE_DOMAINS, type = CommandType.BOOLEAN, description = "Defines whether the subdomains of the informed domains are considered. Default " +
73+
"value is false.")
74+
private Boolean recursiveDomains = false;
75+
76+
public String getName() {
77+
return name;
78+
}
79+
80+
public String getDescription() {
81+
return description;
82+
}
83+
84+
public String getCss() {
85+
return css;
86+
}
87+
88+
public String getJsonConfiguration() {
89+
return jsonConfiguration;
90+
}
91+
92+
public String getCommonNames() {
93+
return commonNames;
94+
}
95+
96+
public String getDomainIds() {
97+
return domainIds;
98+
}
99+
100+
public String getAccountIds() {
101+
return accountIds;
102+
}
103+
104+
public Boolean getPublic() {
105+
return isPublic;
106+
}
107+
108+
public Boolean getRecursiveDomains() {
109+
return recursiveDomains;
110+
}
111+
112+
@Override
113+
public void execute() {
114+
GuiThemeJoin guiThemeJoin = guiThemeService.createGuiTheme(this);
115+
116+
if (guiThemeJoin == null) {
117+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to create the GUI theme.");
118+
}
119+
120+
GuiThemeResponse response = _responseGenerator.createGuiThemeResponse(guiThemeJoin);
121+
response.setResponseName(getCommandName());
122+
this.setResponseObject(response);
123+
}
124+
125+
@Override
126+
public long getEntityOwnerId() {
127+
return CallContext.current().getCallingAccountId();
128+
}
129+
}

0 commit comments

Comments
 (0)