Skip to content

Commit 4ee8ba0

Browse files
authored
Merge branch 'ablestack-diplo' into mold-europa
2 parents df2e79f + 818773e commit 4ee8ba0

File tree

97 files changed

+3164
-2501
lines changed

Some content is hidden

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

97 files changed

+3164
-2501
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ public class EventTypes {
454454
public static final String EVENT_HOST_OUTOFBAND_MANAGEMENT_ACTION = "HOST.OOBM.ACTION";
455455
public static final String EVENT_HOST_OUTOFBAND_MANAGEMENT_CHANGE_PASSWORD = "HOST.OOBM.CHANGEPASSWORD";
456456
public static final String EVENT_HOST_OUTOFBAND_MANAGEMENT_POWERSTATE_TRANSITION = "HOST.OOBM.POWERSTATE.TRANSITION";
457+
public static final String EVENT_HOST_OUTOFBAND_MANAGEMENT_GET_REDFISH_DATA = "HOST.OOBM.FETCH.REDFISH.DATA";
457458

458459
// HA
459460
public static final String EVENT_HA_RESOURCE_ENABLE = "HA.RESOURCE.ENABLE";

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1371,6 +1371,9 @@ public class ApiConstants {
13711371
public static final String ISSUED_DATE = "issueddate";
13721372
public static final String XML_CONFIG = "xmlconfig";
13731373
public static final String CURRENT_VM_ID = "currentvmid";
1374+
1375+
public static final String RESULT_REDFISH_DATA = "redfishdata";
1376+
13741377
/**
13751378
* This enum specifies IO Drivers, each option controls specific policies on I/O.
13761379
* Qemu guests support "threads" and "native" options Since 0.8.8 ; "io_uring" is supported Since 6.3.0 (QEMU 5.0).
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
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.outofbandmanagement;
18+
19+
import com.cloud.exception.ConcurrentOperationException;
20+
import com.cloud.exception.InsufficientCapacityException;
21+
import com.cloud.exception.NetworkRuleConflictException;
22+
import com.cloud.exception.ResourceAllocationException;
23+
import com.cloud.exception.ResourceUnavailableException;
24+
import com.cloud.host.Host;
25+
import org.apache.cloudstack.acl.RoleType;
26+
import org.apache.cloudstack.api.APICommand;
27+
import org.apache.cloudstack.api.ApiArgValidator;
28+
import org.apache.cloudstack.api.ApiCommandResourceType;
29+
import org.apache.cloudstack.api.ApiConstants;
30+
import org.apache.cloudstack.api.ApiErrorCode;
31+
import org.apache.cloudstack.api.BaseCmd;
32+
import org.apache.cloudstack.api.Parameter;
33+
import org.apache.cloudstack.api.ServerApiException;
34+
import org.apache.cloudstack.api.response.HostResponse;
35+
import org.apache.cloudstack.api.response.OutOfBandManagementResponse;
36+
import org.apache.cloudstack.context.CallContext;
37+
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagementService;
38+
39+
import javax.inject.Inject;
40+
41+
@APICommand(name = "listHostRedfishData", description = "Changes out-of-band management interface password on the host and updates the interface configuration in CloudStack if the operation succeeds, else reverts the old password",
42+
responseObject = OutOfBandManagementResponse.class, requestHasSensitiveInfo = true, responseHasSensitiveInfo = false,
43+
since = "4.9.0", authorized = {RoleType.Admin})
44+
public class ListHostRedfishDataCmd extends BaseCmd {
45+
46+
@Inject
47+
private OutOfBandManagementService outOfBandManagementService;
48+
49+
/////////////////////////////////////////////////////
50+
//////////////// API parameters /////////////////////
51+
/////////////////////////////////////////////////////
52+
53+
@Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, entityType = HostResponse.class, required = true,
54+
validations = {ApiArgValidator.PositiveNumber}, description = "the ID of the host")
55+
private Long hostId;
56+
57+
@Parameter(name = ApiConstants.CATEGORY, type = CommandType.STRING, description = "the new host management interface password of maximum length 16, if none is provided a random password would be used")
58+
private String catagory;
59+
60+
/////////////////////////////////////////////////////
61+
/////////////// API Implementation///////////////////
62+
/////////////////////////////////////////////////////
63+
64+
@Override
65+
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
66+
final Host host = _resourceService.getHost(getHostId());
67+
if (host == null) {
68+
throw new ServerApiException(ApiErrorCode.PARAM_ERROR, "Unable to find host by ID: " + getHostId());
69+
}
70+
71+
// CallContext.current().setEventDetails("Host Id: " + host.getId() + " Password: " + getPassword().charAt(0) + "****");
72+
// CallContext.current().putContextParameter(Host.class, host.getUuid());
73+
74+
final OutOfBandManagementResponse response = outOfBandManagementService.getHostRedfishData(host, catagory);
75+
response.setResponseName(getCommandName());
76+
setResponseObject(response);
77+
}
78+
79+
@Override
80+
public long getEntityOwnerId() {
81+
return CallContext.current().getCallingAccountId();
82+
}
83+
84+
public Long getHostId() {
85+
return hostId;
86+
}
87+
88+
public String getCatagory() {
89+
return catagory;
90+
}
91+
92+
@Override
93+
public Long getApiResourceId() {
94+
return getHostId();
95+
}
96+
97+
@Override
98+
public ApiCommandResourceType getApiResourceType() {
99+
return ApiCommandResourceType.Host;
100+
}
101+
}

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,10 @@ public class LoginCmdResponse extends AuthenticationCmdResponse {
9494
@Param(description = "Management Server ID that the user logged to", since = "4.21.0.0")
9595
private String managementServerId;
9696

97+
@SerializedName(value = ApiConstants.EXTERNAL_ENTITY)
98+
@Param(description = "externalEntity")
99+
private String externalEntity;
100+
97101
public String getUsername() {
98102
return username;
99103
}
@@ -234,5 +238,12 @@ public String getManagementServerId() {
234238

235239
public void setManagementServerId(String managementServerId) {
236240
this.managementServerId = managementServerId;
241+
242+
public String getExternalEntity() {
243+
return externalEntity;
244+
}
245+
246+
public void setExternalEntity(String externalEntity) {
247+
this.externalEntity = externalEntity;
237248
}
238249
}

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,10 @@ public class OutOfBandManagementResponse extends BaseResponse {
7171
@Param(description = "the operation result")
7272
private Boolean success;
7373

74+
@SerializedName(ApiConstants.RESULT_REDFISH_DATA)
75+
@Param(description = "the operation result redfish data")
76+
private String resultRedfishData;
77+
7478
public OutOfBandManagementResponse() {
7579
super("outofbandmanagement");
7680
}
@@ -186,4 +190,8 @@ public Boolean getSuccess() {
186190
public void setSuccess(Boolean success) {
187191
this.success = success;
188192
}
193+
194+
public void setResultRedfishData(String resultRedfishData) {
195+
this.resultRedfishData = resultRedfishData;
196+
}
189197
}

api/src/main/java/org/apache/cloudstack/config/ApiServiceConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public String getConfigComponentName() {
5252

5353
@Override
5454
public ConfigKey<?>[] getConfigKeys() {
55-
return new ConfigKey<?>[] {ManagementServerAddresses, ApiServletPath, DefaultUIPageSize, ApiSourceCidrChecksEnabled, ApiAllowedSourceIp, ApiAllowedSourceCidr, MonitoringWallPortalProtocol, MonitoringWallPortalDomain, MonitoringWallPortalPort, MonitoringWallPortalVmUri, EventDeleteEnabled};
55+
return new ConfigKey<?>[] {ManagementServerAddresses, ApiServletPath, DefaultUIPageSize, ApiSourceCidrChecksEnabled, ApiAllowedSourceIp, ApiAllowedSourceCidr, MonitoringWallPortalProtocol, MonitoringWallPortalDomain, MonitoringWallPortalPort, MonitoringWallPortalVmUri, MonitoringWallPortalHostUri, MonitoringWallPortalClusterUri, EventDeleteEnabled};
5656
}
5757

5858
}

api/src/main/java/org/apache/cloudstack/outofbandmanagement/OutOfBandManagementService.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ public interface OutOfBandManagementService {
3030
ConfigKey<Long> ActionTimeout = new ConfigKey<Long>("Advanced", Long.class, "outofbandmanagement.action.timeout", "60",
3131
"The out of band management action timeout in seconds, configurable by cluster", true, ConfigKey.Scope.Cluster);
3232

33-
ConfigKey<Integer> SyncThreadPoolSize = new ConfigKey<Integer>("Advanced", Integer.class, "outofbandmanagement.sync.poolsize", "50",
33+
ConfigKey<Integer> SyncThreadPoolSize = new ConfigKey<Integer>("Advanced", Integer.class, "outofbandmanagement.sync.poolsize", "3",
3434
"The out of band management background sync thread pool size", true, ConfigKey.Scope.Global);
3535

36-
ConfigKey<Integer> OutOfBandManagementBackgroundTaskExecutionInterval = new ConfigKey<>("Advanced", Integer.class, "outofbandmanagement.background.task.execution.interval", "4",
36+
ConfigKey<Integer> OutOfBandManagementBackgroundTaskExecutionInterval = new ConfigKey<>("Advanced", Integer.class, "outofbandmanagement.background.task.execution.interval", "15",
3737
"The interval in seconds for the out of band management (OOBM) background task.", true);
3838

3939
long getId();
@@ -52,4 +52,5 @@ public interface OutOfBandManagementService {
5252
OutOfBandManagementResponse configure(Host host, ImmutableMap<OutOfBandManagement.Option, String> options);
5353
OutOfBandManagementResponse executePowerOperation(Host host, OutOfBandManagement.PowerOperation operation, Long timeout);
5454
OutOfBandManagementResponse changePassword(Host host, String password);
55+
OutOfBandManagementResponse getHostRedfishData(Host host, String category);
5556
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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.outofbandmanagement.driver;
18+
19+
import com.google.common.collect.ImmutableMap;
20+
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement;
21+
22+
public final class OutOfBandManagementDriverRedfishDataCommand extends OutOfBandManagementDriverCommand {
23+
private final String category;
24+
25+
public OutOfBandManagementDriverRedfishDataCommand(final ImmutableMap<OutOfBandManagement.Option, String> options, final Long timeout, final String category) {
26+
super(options, timeout);
27+
this.category = category;
28+
}
29+
30+
public final String getCategory() {
31+
return category;
32+
}
33+
}

api/src/main/java/org/apache/cloudstack/outofbandmanagement/driver/OutOfBandManagementDriverResponse.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ public class OutOfBandManagementDriverResponse {
2424
private boolean success = false;
2525
private boolean hasAuthFailure = false;
2626
private OutOfBandManagement.PowerState powerState;
27+
private String redfishData;
2728

2829
public OutOfBandManagementDriverResponse(String result, String error, boolean success) {
2930
this.result = result;
@@ -82,4 +83,13 @@ public boolean hasAuthFailure() {
8283
public void setAuthFailure(boolean hasAuthFailure) {
8384
this.hasAuthFailure = hasAuthFailure;
8485
}
86+
87+
public String getRedfishData() {
88+
return redfishData;
89+
}
90+
91+
public void setRedfishData(String redfishData) {
92+
this.redfishData = redfishData;
93+
}
94+
8595
}

engine/api/src/main/java/org/apache/cloudstack/engine/orchestration/service/NetworkOrchestrationService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public interface NetworkOrchestrationService {
8888
ConfigKey<String> GuestDomainSuffix = new ConfigKey<String>(String.class, GuestDomainSuffixCK, "Network", "cloud.internal",
8989
"Default domain name for vms inside virtualized networks fronted by router", true, ConfigKey.Scope.Zone, null);
9090

91-
ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "1000",
91+
ConfigKey<Integer> NetworkThrottlingRate = new ConfigKey<Integer>("Network", Integer.class, NetworkThrottlingRateCK, "10000",
9292
"Default data transfer rate in megabits per second allowed in network.", true, ConfigKey.Scope.Zone);
9393

9494
ConfigKey<Boolean> PromiscuousMode = new ConfigKey<Boolean>("Advanced", Boolean.class, "network.promiscuous.mode", "false",

0 commit comments

Comments
 (0)