mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.14' into 4.15
This commit is contained in:
commit
2cdde8774b
@ -18,8 +18,6 @@ package org.apache.cloudstack.api.response;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants;
|
||||
import org.apache.cloudstack.api.BaseResponse;
|
||||
import org.apache.cloudstack.api.EntityReference;
|
||||
@ -28,6 +26,7 @@ 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 HostForMigrationResponse extends BaseResponse {
|
||||
@ -452,6 +451,10 @@ public class HostForMigrationResponse extends BaseResponse {
|
||||
this.hypervisorVersion = hypervisorVersion;
|
||||
}
|
||||
|
||||
public Boolean getHaHost() {
|
||||
return haHost;
|
||||
}
|
||||
|
||||
public void setHaHost(Boolean haHost) {
|
||||
this.haHost = haHost;
|
||||
}
|
||||
|
||||
@ -26,16 +26,18 @@ import java.util.Set;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import org.apache.cloudstack.api.ApiConstants.HostDetails;
|
||||
import org.apache.cloudstack.api.response.GpuResponse;
|
||||
import org.apache.cloudstack.api.response.HostForMigrationResponse;
|
||||
import org.apache.cloudstack.api.response.HostResponse;
|
||||
import org.apache.cloudstack.api.response.VgpuResponse;
|
||||
import org.apache.cloudstack.framework.config.dao.ConfigurationDao;
|
||||
import org.apache.cloudstack.ha.HAResource;
|
||||
import org.apache.cloudstack.ha.dao.HAConfigDao;
|
||||
import org.apache.cloudstack.outofbandmanagement.dao.OutOfBandManagementDao;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.cloud.api.ApiDBUtils;
|
||||
import com.cloud.api.query.vo.HostJoinVO;
|
||||
@ -52,9 +54,6 @@ import com.cloud.utils.db.GenericDaoBase;
|
||||
import com.cloud.utils.db.SearchBuilder;
|
||||
import com.cloud.utils.db.SearchCriteria;
|
||||
|
||||
import org.apache.cloudstack.ha.HAResource;
|
||||
import org.apache.cloudstack.ha.dao.HAConfigDao;
|
||||
|
||||
@Component
|
||||
public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements HostJoinDao {
|
||||
public static final Logger s_logger = Logger.getLogger(HostJoinDaoImpl.class);
|
||||
@ -178,17 +177,13 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
hostResponse.setMemoryAllocatedPercentage(memoryAllocatedPercentage);
|
||||
|
||||
String hostTags = host.getTag();
|
||||
hostResponse.setHostTags(host.getTag());
|
||||
hostResponse.setHostTags(hostTags);
|
||||
|
||||
hostResponse.setHaHost(false);
|
||||
String haTag = ApiDBUtils.getHaTag();
|
||||
if (haTag != null && !haTag.isEmpty() && hostTags != null && !hostTags.isEmpty()) {
|
||||
if (haTag.equalsIgnoreCase(hostTags)) {
|
||||
hostResponse.setHaHost(true);
|
||||
} else {
|
||||
hostResponse.setHaHost(false);
|
||||
}
|
||||
} else {
|
||||
hostResponse.setHaHost(false);
|
||||
if (StringUtils.isNotEmpty(haTag) && StringUtils.isNotEmpty(hostTags) &&
|
||||
haTag.equalsIgnoreCase(hostTags)) {
|
||||
hostResponse.setHaHost(true);
|
||||
}
|
||||
|
||||
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
|
||||
@ -274,12 +269,19 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
@Override
|
||||
public HostResponse setHostResponse(HostResponse response, HostJoinVO host) {
|
||||
String tag = host.getTag();
|
||||
if (tag != null) {
|
||||
if (response.getHostTags() != null && response.getHostTags().length() > 0) {
|
||||
if (StringUtils.isNotEmpty(tag)) {
|
||||
if (StringUtils.isNotEmpty(response.getHostTags())) {
|
||||
response.setHostTags(response.getHostTags() + "," + tag);
|
||||
} else {
|
||||
response.setHostTags(tag);
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(response.getHaHost())) {
|
||||
String haTag = ApiDBUtils.getHaTag();
|
||||
if (StringUtils.isNotEmpty(haTag) && haTag.equalsIgnoreCase(tag)) {
|
||||
response.setHaHost(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
@ -334,17 +336,13 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
hostResponse.setMemoryAllocatedBytes(mem);
|
||||
|
||||
String hostTags = host.getTag();
|
||||
hostResponse.setHostTags(host.getTag());
|
||||
hostResponse.setHostTags(hostTags);
|
||||
|
||||
hostResponse.setHaHost(false);
|
||||
String haTag = ApiDBUtils.getHaTag();
|
||||
if (haTag != null && !haTag.isEmpty() && hostTags != null && !hostTags.isEmpty()) {
|
||||
if (haTag.equalsIgnoreCase(hostTags)) {
|
||||
hostResponse.setHaHost(true);
|
||||
} else {
|
||||
hostResponse.setHaHost(false);
|
||||
}
|
||||
} else {
|
||||
hostResponse.setHaHost(false);
|
||||
if (StringUtils.isNotEmpty(haTag) && StringUtils.isNotEmpty(hostTags) &&
|
||||
haTag.equalsIgnoreCase(hostTags)) {
|
||||
hostResponse.setHaHost(true);
|
||||
}
|
||||
|
||||
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
|
||||
@ -419,6 +417,13 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
|
||||
} else {
|
||||
response.setHostTags(tag);
|
||||
}
|
||||
|
||||
if (Boolean.FALSE.equals(response.getHaHost())) {
|
||||
String haTag = ApiDBUtils.getHaTag();
|
||||
if (StringUtils.isNotEmpty(haTag) && haTag.equalsIgnoreCase(tag)) {
|
||||
response.setHaHost(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user