Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion api/src/main/java/org/apache/cloudstack/api/ApiConstants.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ public class ApiConstants {
public static final String CONVERT_INSTANCE_HOST_ID = "convertinstancehostid";
public static final String CONVERT_INSTANCE_STORAGE_POOL_ID = "convertinstancepoolid";
public static final String ENABLED_REVOCATION_CHECK = "enabledrevocationcheck";
public static final String CLIENT_ADDRESS = "clientaddress";
public static final String COMBINED_CAPACITY_ORDERING = "COMBINED";
public static final String CONTEXT_ID = "contextid";
public static final String CONTROLLER = "controller";
public static final String CONTROLLER_UNIT = "controllerunit";
public static final String CONSOLE_ENDPOINT_CREATOR_ADDRESS = "consoleendpointcreatoraddress";
Expand All @@ -124,6 +124,7 @@ public class ApiConstants {
public static final String DEST_CIDR_LIST = "destcidrlist";
public static final String CLEANUP = "cleanup";
public static final String MAKEREDUNDANT = "makeredundant";
public static final String CLIENT_ADDRESS = "clientaddress";
public static final String CLUSTER_ID = "clusterid";
public static final String CLUSTER_IDS = "clusterids";
public static final String CLUSTER_NAME = "clustername";
Expand All @@ -137,12 +138,14 @@ public class ApiConstants {
public static final String CNI_CONFIG_NAME = "cniconfigname";
public static final String CSI_ENABLED = "csienabled";
public static final String COMPONENT = "component";
public static final String CONNECTED = "connected";
public static final String CPU = "CPU";
public static final String CPU_CORE_PER_SOCKET = "cpucorepersocket";
public static final String CPU_NUMBER = "cpunumber";
public static final String CPU_SPEED = "cpuspeed";
public static final String CPU_LOAD_AVERAGE = "cpuloadaverage";
public static final String CREATED = "created";
public static final String CREATOR_ADDRESS = "creatoraddress";
public static final String CROSS_ZONE_INSTANCE_CREATION = "crosszoneinstancecreation";
public static final String CTX_ACCOUNT_ID = "ctxaccountid";
public static final String CTX_DETAILS = "ctxDetails";
Expand All @@ -161,6 +164,7 @@ public class ApiConstants {
public static final String ENCRYPT_ROOT = "encryptroot";
public static final String ENCRYPTION_SUPPORTED = "encryptionsupported";
public static final String ETCD_IPS = "etcdips";
public static final String FILTERS = "filters";
public static final String MIN_IOPS = "miniops";
public static final String MAX_IOPS = "maxiops";
public static final String HYPERVISOR_SNAPSHOT_RESERVE = "hypervisorsnapshotreserve";
Expand Down Expand Up @@ -368,6 +372,8 @@ public class ApiConstants {
public static final String LIMIT_CPU_USE = "limitcpuuse";
public static final String LIST_HOSTS = "listhosts";
public static final String LOCATION_TYPE = "locationtype";
public static final String LOG_IDS = "logids";
public static final String LOGS_WEB_SERVER_ENABLED = "logswebserverenabled";
public static final String LOCK = "lock";
public static final String LUN = "lun";
public static final String LBID = "lbruleid";
Expand Down Expand Up @@ -1312,6 +1318,8 @@ public class ApiConstants {
public static final String WEBHOOK_ID = "webhookid";
public static final String WEBHOOK_NAME = "webhookname";

public static final String WEBSOCKET = "websocket";

public static final String NFS_MOUNT_OPTIONS = "nfsmountopts";
public static final String MOUNT_OPTIONS = "mountopts";

Expand Down
21 changes: 21 additions & 0 deletions api/src/main/java/org/apache/cloudstack/api/BaseResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@
// under the License.
package org.apache.cloudstack.api;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

import com.google.gson.annotations.SerializedName;

import com.cloud.serializer.Param;
Expand All @@ -32,6 +36,10 @@ public abstract class BaseResponse implements ResponseObject {
@Param(description = "the current status of the latest async job acting on this object")
private Integer jobStatus;

@SerializedName(ApiConstants.LOG_IDS)
@Param(description = "the IDs of the logs for the request")
private List<String> logsIds;

public BaseResponse() {
}

Expand Down Expand Up @@ -83,4 +91,17 @@ public Integer getJobStatus() {
public void setJobStatus(Integer jobStatus) {
this.jobStatus = jobStatus;
}

@Override
public List<String> getLogIds() {
return logsIds;
}

@Override
public void addLogIds(String... logId) {
if (this.logsIds == null) {
logsIds = new ArrayList<>();
}
this.logsIds.addAll(Arrays.asList(logId));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// under the License.
package org.apache.cloudstack.api;

import java.util.List;

public interface ResponseObject {
/**
* Get the name of the API response
Expand Down Expand Up @@ -76,6 +78,9 @@ public interface ResponseObject {
*/
void setJobStatus(Integer jobStatus);

List<String> getLogIds();
void addLogIds(String... contextId);

public enum ResponseView {
Full,
Restricted
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,23 @@
import java.util.ArrayList;
import java.util.List;

import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.commons.lang3.StringUtils;

import org.apache.cloudstack.api.APICommand;
import org.apache.cloudstack.api.ApiConstants;
import org.apache.cloudstack.api.ApiErrorCode;
import org.apache.cloudstack.api.BaseListCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ListResponse;
import org.apache.cloudstack.api.response.ManagementServerResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;
import org.apache.commons.lang3.StringUtils;

import com.cloud.exception.InvalidParameterValueException;
import com.cloud.utils.Pair;
Expand Down Expand Up @@ -94,6 +94,13 @@ public class ListCfgsByCmd extends BaseListCmd {
description = "the ID of the Image Store to update the parameter value for corresponding image store")
private Long imageStoreId;

@Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID,
type = CommandType.UUID,
entityType = ManagementServerResponse.class,
description = "the ID of the Management Server to update the parameter value for corresponding management server",
since = "4.21.0")
private Long managementServerId;

@Parameter(name = ApiConstants.GROUP, type = CommandType.STRING, description = "lists configuration by group name (primarily used for UI)", since = "4.18.0")
private String groupName;

Expand Down Expand Up @@ -139,6 +146,10 @@ public Long getImageStoreId() {
return imageStoreId;
}

public Long getManagementServerId() {
return managementServerId;
}

public String getGroupName() {
return groupName;
}
Expand Down Expand Up @@ -200,6 +211,9 @@ private void setScope(ConfigurationResponse cfgResponse) {
if (getImageStoreId() != null){
cfgResponse.setScope("imagestore");
}
if (getManagementServerId() != null){
cfgResponse.setScope("managementserver");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@
import org.apache.cloudstack.api.BaseCmd;
import org.apache.cloudstack.api.Parameter;
import org.apache.cloudstack.api.ServerApiException;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.framework.config.ConfigKey;

import org.apache.cloudstack.api.response.AccountResponse;
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.DomainResponse;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ManagementServerResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;
import org.apache.cloudstack.framework.config.ConfigKey;

import com.cloud.user.Account;
import com.cloud.utils.Pair;
Expand Down Expand Up @@ -84,6 +84,13 @@ public class ResetCfgCmd extends BaseCmd {
description = "the ID of the Image Store to reset the parameter value for corresponding image store")
private Long imageStoreId;

@Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID,
type = CommandType.UUID,
entityType = ManagementServerResponse.class,
description = "the ID of the Management Server to update the parameter value for corresponding management server",
since = "4.21.0")
private Long managementServerId;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -116,6 +123,10 @@ public Long getImageStoreId() {
return imageStoreId;
}

public Long getManagementServerId() {
return managementServerId;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -149,6 +160,9 @@ public void execute() {
if (getImageStoreId() != null) {
response.setScope(ConfigKey.Scope.ImageStore.name());
}
if (getManagementServerId() != null) {
response.setScope(ConfigKey.Scope.ManagementServer.name());
}
response.setValue(cfg.second());
this.setResponseObject(response);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import org.apache.cloudstack.api.response.ClusterResponse;
import org.apache.cloudstack.api.response.ConfigurationResponse;
import org.apache.cloudstack.api.response.ImageStoreResponse;
import org.apache.cloudstack.api.response.ManagementServerResponse;
import org.apache.cloudstack.api.response.StoragePoolResponse;
import org.apache.cloudstack.api.response.ZoneResponse;
import org.apache.cloudstack.config.Configuration;
Expand Down Expand Up @@ -88,6 +89,14 @@ public class UpdateCfgCmd extends BaseCmd {
validations = ApiArgValidator.PositiveNumber)
private Long imageStoreId;

@Parameter(name = ApiConstants.MANAGEMENT_SERVER_ID,
type = CommandType.UUID,
entityType = ManagementServerResponse.class,
description = "the ID of the Management Server to update the parameter value for corresponding management server",
validations = ApiArgValidator.PositiveNumber,
since = "4.21.0")
private Long managementServerId;

/////////////////////////////////////////////////////
/////////////////// Accessors ///////////////////////
/////////////////////////////////////////////////////
Expand All @@ -112,7 +121,7 @@ public Long getClusterId() {
return clusterId;
}

public Long getStoragepoolId() {
public Long getStoragePoolId() {
return storagePoolId;
}

Expand All @@ -128,6 +137,10 @@ public Long getImageStoreId() {
return imageStoreId;
}

public Long getManagementServerId() {
return managementServerId;
}

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
Expand Down Expand Up @@ -184,7 +197,7 @@ public ConfigurationResponse setResponseScopes(ConfigurationResponse response) {
if (getClusterId() != null) {
response.setScope("cluster");
}
if (getStoragepoolId() != null) {
if (getStoragePoolId() != null) {
response.setScope("storagepool");
}
if (getAccountId() != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ public void execute() {
response.setExtensionsPath((String)capabilities.get(ApiConstants.EXTENSIONS_PATH));
response.setDynamicScalingEnabled((Boolean) capabilities.get(ApiConstants.DYNAMIC_SCALING_ENABLED));
response.setAdditionalConfigEnabled((Boolean) capabilities.get(ApiConstants.ADDITONAL_CONFIG_ENABLED));
response.setLogsWebServerEnabled((Boolean)capabilities.get(ApiConstants.LOGS_WEB_SERVER_ENABLED));
response.setObjectName("capability");
response.setResponseName(getCommandName());
this.setResponseObject(response);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ public class CapabilitiesResponse extends BaseResponse {
@Param(description = "true if additional configurations or extraconfig can be passed to Instances", since = "4.20.2")
private Boolean additionalConfigEnabled;

@SerializedName(ApiConstants.LOGS_WEB_SERVER_ENABLED)
@Param(description = "true if Logs Web Server plugin is enabled, false otherwise", since = "4.23.0")
private boolean logsWebServerEnabled;

public void setSecurityGroupsEnabled(boolean securityGroupsEnabled) {
this.securityGroupsEnabled = securityGroupsEnabled;
}
Expand Down Expand Up @@ -279,5 +283,10 @@ public void setDynamicScalingEnabled(Boolean dynamicScalingEnabled) {

public void setAdditionalConfigEnabled(Boolean additionalConfigEnabled) {
this.additionalConfigEnabled = additionalConfigEnabled;

}

public void setLogsWebServerEnabled(boolean logsWebServerEnabled) {
this.logsWebServerEnabled = logsWebServerEnabled;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.

package org.apache.cloudstack.cluster;

import com.cloud.agent.api.Command;

public interface ClusterCommandProcessor {
boolean supportsCommand(Class<?> clazz);
String processCommand(Command cmd);
}
7 changes: 7 additions & 0 deletions client/conf/server.properties.in
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,10 @@ extensions.deployment.mode=@EXTENSIONSDEPLOYMENTMODE@
# Thread pool configuration
#threads.min=10
#threads.max=500

# WebSocket server enable/disable flag used by the management server
websocket.enable=true

# WebSocket server port used by the management server
# If not set, defaults to 8822. It can be set to same value as http.port or https.port if needed.
websocket.port=8822
18 changes: 18 additions & 0 deletions client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.jetty.websocket</groupId>
<artifactId>websocket-server</artifactId>
</dependency>
<dependency>
<groupId>javax.websocket</groupId>
<artifactId>javax.websocket-api</artifactId>
</dependency>
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
Expand Down Expand Up @@ -116,6 +124,11 @@
<artifactId>cloud-framework-spring-lifecycle</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-framework-websocket-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-storage-volume-adaptive</artifactId>
Expand Down Expand Up @@ -246,6 +259,11 @@
<artifactId>cloud-plugin-user-two-factor-authenticator-staticpin</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-logs-web-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cloudstack</groupId>
<artifactId>cloud-plugin-metrics</artifactId>
Expand Down
Loading
Loading