mirror of
https://github.com/apache/cloudstack.git
synced 2025-11-02 20:02:29 +01:00
Merge remote-tracking branch 'origin/4.13'
This commit is contained in:
commit
518ed5379c
@ -22,7 +22,6 @@ import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseCmd;
|
||||
import org.apache.cloudstack.api.BaseListCmd;
|
||||
import org.apache.cloudstack.api.Parameter;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.ListResponse;
|
||||
import org.apache.cloudstack.api.response.ManagementServerResponse;
|
||||
import org.apache.log4j.Logger;
|
||||
@ -38,7 +37,7 @@ public class ListMgmtsCmd extends BaseListCmd {
|
||||
//////////////// API parameters /////////////////////
|
||||
/////////////////////////////////////////////////////
|
||||
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = HostResponse.class, description = "the id of the management server")
|
||||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, description = "the id of the management server")
|
||||
private Long id;
|
||||
|
||||
@Parameter(name = ApiConstants.NAME, type = CommandType.STRING, description = "the name of the management server")
|
||||
|
||||
@ -21,14 +21,13 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
|
||||
import com.cloud.org.Cluster;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value = Cluster.class)
|
||||
public class ClusterResponse extends BaseResponse {
|
||||
@ -216,4 +215,8 @@ public class ClusterResponse extends BaseResponse {
|
||||
resourceDetails.remove("password");
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, String> getResourceDetails() {
|
||||
return resourceDetails;
|
||||
}
|
||||
}
|
||||
|
||||
@ -16,21 +16,22 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.api.response;
|
||||
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
import org.apache.cloudstack.ha.HAConfig;
|
||||
import org.apache.cloudstack.outofbandmanagement.OutOfBandManagement;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.cloud.host.Host;
|
||||
import com.cloud.host.Status;
|
||||
import com.cloud.hypervisor.Hypervisor.HypervisorType;
|
||||
import com.cloud.serializer.Param;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
@EntityReference(value = Host.class)
|
||||
public class HostResponse extends BaseResponse {
|
||||
@ -243,11 +244,6 @@ public class HostResponse extends BaseResponse {
|
||||
@Param(description = "the admin that annotated this host", since = "4.11")
|
||||
private String username;
|
||||
|
||||
// Default visibility to support accessing the details from unit tests
|
||||
Map getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.getId();
|
||||
@ -361,7 +357,7 @@ public class HostResponse extends BaseResponse {
|
||||
this.memoryUsed = memoryUsed;
|
||||
}
|
||||
|
||||
public void setGpuGroups(List<GpuResponse> gpuGroup) {
|
||||
public void setGpuGroup(List<GpuResponse> gpuGroup) {
|
||||
this.gpuGroup = gpuGroup;
|
||||
}
|
||||
|
||||
@ -437,6 +433,10 @@ public class HostResponse extends BaseResponse {
|
||||
this.hostHAResponse = new HostHAResponse(config);
|
||||
}
|
||||
|
||||
public void setHostHAResponse(HostHAResponse hostHAResponse) {
|
||||
this.hostHAResponse = hostHAResponse;
|
||||
}
|
||||
|
||||
public OutOfBandManagementResponse getOutOfBandManagementResponse() {
|
||||
return outOfBandManagementResponse;
|
||||
}
|
||||
@ -445,6 +445,10 @@ public class HostResponse extends BaseResponse {
|
||||
this.outOfBandManagementResponse = new OutOfBandManagementResponse(outOfBandManagementConfig);
|
||||
}
|
||||
|
||||
public void setOutOfBandManagementResponse(OutOfBandManagementResponse outOfBandManagementResponse) {
|
||||
this.outOfBandManagementResponse = outOfBandManagementResponse;
|
||||
}
|
||||
|
||||
public String getResourceState() {
|
||||
return resourceState;
|
||||
}
|
||||
@ -496,7 +500,10 @@ public class HostResponse extends BaseResponse {
|
||||
detailsCopy.remove("password");
|
||||
|
||||
this.details = detailsCopy;
|
||||
}
|
||||
|
||||
public Map getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setMemoryTotal(Long memoryTotal) {
|
||||
|
||||
@ -262,19 +262,19 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
|
||||
|
||||
@SerializedName(ApiConstants.CLUSTER_ID)
|
||||
@Param(description = "cluster id of the volume")
|
||||
private String clusterid;
|
||||
private String clusterId;
|
||||
|
||||
@SerializedName(ApiConstants.CLUSTER_NAME)
|
||||
@Param(description = "cluster name where the volume is allocated")
|
||||
private String clustername;
|
||||
private String clusterName;
|
||||
|
||||
@SerializedName(ApiConstants.POD_ID)
|
||||
@Param(description = "pod id of the volume")
|
||||
private String podid;
|
||||
private String podId;
|
||||
|
||||
@SerializedName(ApiConstants.POD_NAME)
|
||||
@Param(description = "pod name of the volume")
|
||||
private String podname;
|
||||
private String podName;
|
||||
|
||||
public String getPath() {
|
||||
return path;
|
||||
@ -751,35 +751,34 @@ public class VolumeResponse extends BaseResponseWithTagInformation implements Co
|
||||
}
|
||||
|
||||
public String getClusterId() {
|
||||
return clusterid;
|
||||
return clusterId;
|
||||
}
|
||||
|
||||
public void setClusterId(String clusterid) {
|
||||
this.clusterid = clusterid;
|
||||
public void setClusterId(String clusterId) {
|
||||
this.clusterId = clusterId;
|
||||
}
|
||||
|
||||
public String getClusterName() {
|
||||
return clustername;
|
||||
return clusterName;
|
||||
}
|
||||
|
||||
public void setClusterName(String clustername) {
|
||||
this.clustername = clustername;
|
||||
public void setClusterName(String clusterName) {
|
||||
this.clusterName = clusterName;
|
||||
}
|
||||
|
||||
public String getPodId() {
|
||||
return podid;
|
||||
return podId;
|
||||
}
|
||||
|
||||
public void setPodId(String podid) {
|
||||
this.podid = podid;
|
||||
public void setPodId(String podId) {
|
||||
this.podId = podId;
|
||||
}
|
||||
|
||||
public String getPodName() {
|
||||
return podname;
|
||||
return podName;
|
||||
}
|
||||
|
||||
public void setPodName(String podname) {
|
||||
this.podname = podname;
|
||||
public void setPodName(String podName) {
|
||||
this.podName = podName;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class ZoneResponse extends BaseResponse {
|
||||
this.domainId = domainId;
|
||||
}
|
||||
|
||||
public void setType(String networkType) {
|
||||
public void setNetworkType(String networkType) {
|
||||
this.networkType = networkType;
|
||||
}
|
||||
|
||||
|
||||
@ -16,15 +16,14 @@
|
||||
// under the License.
|
||||
package org.apache.cloudstack.management;
|
||||
|
||||
public interface ManagementServerHost {
|
||||
import org.apache.cloudstack.api.Identity;
|
||||
import org.apache.cloudstack.api.InternalIdentity;
|
||||
|
||||
public interface ManagementServerHost extends InternalIdentity, Identity {
|
||||
enum State {
|
||||
Up, Down
|
||||
}
|
||||
|
||||
long getId();
|
||||
|
||||
String getUuid();
|
||||
|
||||
long getMsid();
|
||||
|
||||
State getState();
|
||||
|
||||
@ -3868,20 +3868,43 @@ public class QueryManagerImpl extends MutualExclusiveIdsManagerBase implements Q
|
||||
@Override
|
||||
public ListResponse<ManagementServerResponse> listManagementServers(ListMgmtsCmd cmd) {
|
||||
ListResponse<ManagementServerResponse> response = new ListResponse<>();
|
||||
List<ManagementServerResponse> result = new ArrayList<>();
|
||||
for (ManagementServerHostVO mgmt : managementServerHostDao.listAll()) {
|
||||
ManagementServerResponse mgmtResponse = new ManagementServerResponse();
|
||||
mgmtResponse.setId(mgmt.getUuid());
|
||||
mgmtResponse.setName(mgmt.getName());
|
||||
mgmtResponse.setState(mgmt.getState());
|
||||
mgmtResponse.setVersion(mgmt.getVersion());
|
||||
mgmtResponse.setObjectName("managementserver");
|
||||
result.add(mgmtResponse);
|
||||
Pair<List<ManagementServerHostVO>, Integer> result = listManagementServersInternal(cmd);
|
||||
List<ManagementServerResponse> hostResponses = new ArrayList<>();
|
||||
|
||||
for (ManagementServerHostVO host : result.first()) {
|
||||
ManagementServerResponse hostResponse = createManagementServerResponse(host);
|
||||
hostResponses.add(hostResponse);
|
||||
}
|
||||
response.setResponses(result);
|
||||
|
||||
response.setResponses(hostResponses);
|
||||
return response;
|
||||
}
|
||||
|
||||
protected Pair<List<ManagementServerHostVO>, Integer> listManagementServersInternal(ListMgmtsCmd cmd) {
|
||||
Long id = cmd.getId();
|
||||
String name = cmd.getHostName();
|
||||
|
||||
SearchBuilder<ManagementServerHostVO> sb = managementServerHostDao.createSearchBuilder();
|
||||
SearchCriteria<ManagementServerHostVO> sc = sb.create();
|
||||
if (id != null) {
|
||||
sc.addAnd("id", SearchCriteria.Op.EQ, id);
|
||||
}
|
||||
if (name != null) {
|
||||
sc.addAnd("name", SearchCriteria.Op.EQ, name);
|
||||
}
|
||||
return managementServerHostDao.searchAndCount(sc, null);
|
||||
}
|
||||
|
||||
protected ManagementServerResponse createManagementServerResponse(ManagementServerHostVO mgmt) {
|
||||
ManagementServerResponse mgmtResponse = new ManagementServerResponse();
|
||||
mgmtResponse.setId(mgmt.getUuid());
|
||||
mgmtResponse.setName(mgmt.getName());
|
||||
mgmtResponse.setState(mgmt.getState());
|
||||
mgmtResponse.setVersion(mgmt.getVersion());
|
||||
mgmtResponse.setObjectName("managementserver");
|
||||
return mgmtResponse;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ListResponse<TemplateOVFPropertyResponse> listTemplateOVFProperties(ListTemplateOVFProperties cmd) {
|
||||
ListResponse<TemplateOVFPropertyResponse> response = new ListResponse<>();
|
||||
|
||||
@ -90,7 +90,7 @@ public class DataCenterJoinDaoImpl extends GenericDaoBase<DataCenterJoinVO, Long
|
||||
zoneResponse.setDomainId(dataCenter.getDomainUuid());
|
||||
zoneResponse.setDomainName(dataCenter.getDomainName());
|
||||
|
||||
zoneResponse.setType(dataCenter.getNetworkType().toString());
|
||||
zoneResponse.setNetworkType(dataCenter.getNetworkType().toString());
|
||||
zoneResponse.setAllocationState(dataCenter.getAllocationState().toString());
|
||||
zoneResponse.setZoneToken(dataCenter.getZoneToken());
|
||||
zoneResponse.setDhcpProvider(dataCenter.getDhcpProvider());
|
||||
|
||||
@ -138,7 +138,7 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
}
|
||||
gpus.add(gpuResponse);
|
||||
}
|
||||
hostResponse.setGpuGroups(gpus);
|
||||
hostResponse.setGpuGroup(gpus);
|
||||
}
|
||||
if (details.contains(HostDetails.all) || details.contains(HostDetails.capacity) || details.contains(HostDetails.stats) || details.contains(HostDetails.events)) {
|
||||
|
||||
|
||||
@ -29,8 +29,8 @@ from netaddr import *
|
||||
|
||||
PUBLIC_INTERFACES = {"router": "eth2", "vpcrouter": "eth1"}
|
||||
|
||||
STATE_COMMANDS = {"router": "ip addr | grep eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'",
|
||||
"vpcrouter": "ip addr | grep eth1 | grep state | awk '{print $9;}' | xargs bash -c 'if [ $0 == \"UP\" ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'"}
|
||||
STATE_COMMANDS = {"router": "ip addr show dev eth0 | grep inet | wc -l | xargs bash -c 'if [ $0 == 2 ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'",
|
||||
"vpcrouter": "ip addr show dev eth1 | grep state | awk '{print $9;}' | xargs bash -c 'if [ $0 == \"UP\" ]; then echo \"MASTER\"; else echo \"BACKUP\"; fi'"}
|
||||
|
||||
|
||||
def reconfigure_interfaces(router_config, interfaces):
|
||||
@ -215,7 +215,7 @@ def save_iptables(command, iptables_file):
|
||||
|
||||
def execute2(command, wait=True):
|
||||
""" Execute command """
|
||||
logging.debug("Executing: %s" % command)
|
||||
logging.info("Executing: %s" % command)
|
||||
p = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
|
||||
if wait:
|
||||
p.wait()
|
||||
|
||||
@ -102,7 +102,7 @@ class CsRedundant(object):
|
||||
command = "ip link show %s | grep 'state UP'" % dev
|
||||
devUp = CsHelper.execute(command)
|
||||
if devUp:
|
||||
logging.info("Device %s is present, let's start keepalive now." % dev)
|
||||
logging.info("Device %s is present, let's start keepalived now." % dev)
|
||||
isDeviceReady = True
|
||||
|
||||
if not isDeviceReady:
|
||||
@ -231,7 +231,7 @@ class CsRedundant(object):
|
||||
return
|
||||
|
||||
self.set_lock()
|
||||
logging.info("Router switched to fault mode")
|
||||
logging.info("Setting router to fault")
|
||||
|
||||
interfaces = [interface for interface in self.address.get_interfaces() if interface.is_public()]
|
||||
for interface in interfaces:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user