Skip to content

Commit b040691

Browse files
authored
Merge branch 'main' into clusterOrderVMAlloc
2 parents 8f12011 + fb6adac commit b040691

357 files changed

Lines changed: 8672 additions & 2215 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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -801,11 +801,19 @@ public class EventTypes {
801801
// Resource Limit
802802
public static final String EVENT_RESOURCE_LIMIT_UPDATE = "RESOURCE.LIMIT.UPDATE";
803803

804+
// Management Server
805+
public static final String EVENT_MANAGEMENT_SERVER_REMOVE = "MANAGEMENT.SERVER.REMOVE";
806+
804807
public static final String VM_LEASE_EXPIRED = "VM.LEASE.EXPIRED";
805808
public static final String VM_LEASE_DISABLED = "VM.LEASE.DISABLED";
806809
public static final String VM_LEASE_CANCELLED = "VM.LEASE.CANCELLED";
807810
public static final String VM_LEASE_EXPIRING = "VM.LEASE.EXPIRING";
808811

812+
// GUI Theme
813+
public static final String EVENT_GUI_THEME_CREATE = "GUI.THEME.CREATE";
814+
public static final String EVENT_GUI_THEME_REMOVE = "GUI.THEME.REMOVE";
815+
public static final String EVENT_GUI_THEME_UPDATE = "GUI.THEME.UPDATE";
816+
809817
static {
810818

811819
// TODO: need a way to force author adding event types to declare the entity details as well, with out braking
@@ -1301,11 +1309,19 @@ public class EventTypes {
13011309
entityEventDetails.put(EVENT_SHAREDFS_EXPUNGE, SharedFS.class);
13021310
entityEventDetails.put(EVENT_SHAREDFS_RECOVER, SharedFS.class);
13031311

1312+
// Management Server
1313+
entityEventDetails.put(EVENT_MANAGEMENT_SERVER_REMOVE, "ManagementServer");
1314+
13041315
// VM Lease
13051316
entityEventDetails.put(VM_LEASE_EXPIRED, VirtualMachine.class);
13061317
entityEventDetails.put(VM_LEASE_EXPIRING, VirtualMachine.class);
13071318
entityEventDetails.put(VM_LEASE_DISABLED, VirtualMachine.class);
13081319
entityEventDetails.put(VM_LEASE_CANCELLED, VirtualMachine.class);
1320+
1321+
// GUI theme
1322+
entityEventDetails.put(EVENT_GUI_THEME_CREATE, "GuiTheme");
1323+
entityEventDetails.put(EVENT_GUI_THEME_REMOVE, "GuiTheme");
1324+
entityEventDetails.put(EVENT_GUI_THEME_UPDATE, "GuiTheme");
13091325
}
13101326

13111327
public static boolean isNetworkEvent(String eventType) {

api/src/main/java/com/cloud/server/ManagementService.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import org.apache.cloudstack.api.command.admin.guest.UpdateGuestOsMappingCmd;
3939
import org.apache.cloudstack.api.command.admin.host.ListHostsCmd;
4040
import org.apache.cloudstack.api.command.admin.host.UpdateHostPasswordCmd;
41+
import org.apache.cloudstack.api.command.admin.management.RemoveManagementServerCmd;
4142
import org.apache.cloudstack.api.command.admin.pod.ListPodsByCmd;
4243
import org.apache.cloudstack.api.command.admin.resource.ArchiveAlertsCmd;
4344
import org.apache.cloudstack.api.command.admin.resource.DeleteAlertsCmd;
@@ -506,4 +507,6 @@ VirtualMachine upgradeSystemVM(ScaleSystemVMCmd cmd) throws ResourceUnavailableE
506507

507508
Pair<Boolean, String> patchSystemVM(PatchSystemVMCmd cmd);
508509

510+
boolean removeManagementServer(RemoveManagementServerCmd cmd);
511+
509512
}

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: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1261,6 +1261,22 @@ public class ApiConstants {
12611261

12621262
public static final String VMWARE_DC = "vmwaredc";
12631263

1264+
public static final String CSS = "css";
1265+
1266+
public static final String JSON_CONFIGURATION = "jsonconfiguration";
1267+
1268+
public static final String COMMON_NAMES = "commonnames";
1269+
1270+
public static final String COMMON_NAME = "commonname";
1271+
1272+
public static final String DOMAIN_IDS = "domainids";
1273+
1274+
public static final String SHOW_PUBLIC = "showpublic";
1275+
1276+
public static final String LIST_ONLY_DEFAULT_THEME = "listonlydefaulttheme";
1277+
1278+
public static final String RECURSIVE_DOMAINS = "recursivedomains";
1279+
12641280
/**
12651281
* This enum specifies IO Drivers, each option controls specific policies on I/O.
12661282
* 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/ApiErrorCode.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
*/
2323
public enum ApiErrorCode {
2424

25+
BAD_REQUEST(400),
2526
UNAUTHORIZED(401),
2627
UNAUTHORIZED2FA(511),
2728
METHOD_NOT_ALLOWED(405),

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,6 @@ public ResponseObject loginUser(HttpSession session, String username, String pas
4848
boolean forgotPassword(UserAccount userAccount, Domain domain);
4949

5050
boolean resetPassword(UserAccount userAccount, String token, String password);
51+
52+
boolean isPostRequestsAndTimestampsEnforced();
5153
}

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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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.admin.management;
18+
19+
import com.cloud.event.EventTypes;
20+
import org.apache.cloudstack.acl.RoleType;
21+
import org.apache.cloudstack.api.APICommand;
22+
import org.apache.cloudstack.api.Parameter;
23+
import org.apache.cloudstack.api.ServerApiException;
24+
import org.apache.cloudstack.api.ApiConstants;
25+
import org.apache.cloudstack.api.ApiErrorCode;
26+
import org.apache.cloudstack.api.BaseCmd;
27+
import org.apache.cloudstack.api.response.ManagementServerResponse;
28+
import org.apache.cloudstack.api.response.SuccessResponse;
29+
import org.apache.cloudstack.context.CallContext;
30+
31+
@APICommand(name = "removeManagementServer", description = "Removes a Management Server.", responseObject = SuccessResponse.class,
32+
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = RoleType.Admin)
33+
public class RemoveManagementServerCmd extends BaseCmd {
34+
35+
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, required = true, description = "the ID of the Management Server")
36+
private Long id;
37+
38+
public Long getId() {
39+
return id;
40+
}
41+
42+
@Override
43+
public void execute() {
44+
boolean result = _mgr.removeManagementServer(this);
45+
if (result) {
46+
SuccessResponse response = new SuccessResponse(getCommandName());
47+
this.setResponseObject(response);
48+
} else {
49+
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove Management Server.");
50+
}
51+
}
52+
53+
@Override
54+
public long getEntityOwnerId() {
55+
return CallContext.current().getCallingAccountId();
56+
}
57+
58+
public String getEventType() {
59+
return EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE;
60+
}
61+
}

0 commit comments

Comments
 (0)