Merge remote-tracking branch 'origin/4.14'

This commit is contained in:
Rohit Yadav 2020-12-01 14:04:53 +05:30
commit df07e27921
5 changed files with 69 additions and 8 deletions

View File

@ -95,10 +95,23 @@ public class HostForMigrationResponse extends BaseResponse {
@Param(description = "the CPU speed of the host")
private Long cpuSpeed;
@Deprecated
@SerializedName("cpuallocated")
@Param(description = "the amount of the host's CPU currently allocated")
private String cpuAllocated;
@SerializedName("cpuallocatedvalue")
@Param(description = "the amount of the host's CPU currently allocated in MHz")
private Long cpuAllocatedValue;
@SerializedName("cpuallocatedpercentage")
@Param(description = "the amount of the host's CPU currently allocated in percentage")
private String cpuAllocatedPercentage;
@SerializedName("cpuallocatedwithoverprovisioning")
@Param(description = "the amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor")
private String cpuAllocatedWithOverprovisioning;
@SerializedName("cpuused")
@Param(description = "the amount of the host's CPU currently used")
private String cpuUsed;
@ -303,6 +316,18 @@ public class HostForMigrationResponse extends BaseResponse {
this.cpuAllocated = cpuAllocated;
}
public void setCpuAllocatedValue(Long cpuAllocatedValue) {
this.cpuAllocatedValue = cpuAllocatedValue;
}
public void setCpuAllocatedPercentage(String cpuAllocatedPercentage) {
this.cpuAllocatedPercentage = cpuAllocatedPercentage;
}
public void setCpuAllocatedWithOverprovisioning(String cpuAllocatedWithOverprovisioning) {
this.cpuAllocatedWithOverprovisioning = cpuAllocatedWithOverprovisioning;
}
public void setCpuUsed(String cpuUsed) {
this.cpuUsed = cpuUsed;
}

View File

@ -103,16 +103,29 @@ public class HostResponse extends BaseResponse {
@Param(description = "the CPU speed of the host")
private Long cpuSpeed;
@Deprecated
@SerializedName("cpuallocated")
@Param(description = "the amount of the host's CPU currently allocated")
private String cpuAllocated;
@SerializedName("cpuallocatedvalue")
@Param(description = "the amount of the host's CPU currently allocated in MHz")
private Long cpuAllocatedValue;
@SerializedName("cpuallocatedpercentage")
@Param(description = "the amount of the host's CPU currently allocated in percentage")
private String cpuAllocatedPercentage;
@SerializedName("cpuallocatedwithoverprovisioning")
@Param(description = "the amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor")
private String cpuAllocatedWithOverprovisioning;
@SerializedName("cpuused")
@Param(description = "the amount of the host's CPU currently used")
private String cpuUsed;
@SerializedName("cpuwithoverprovisioning")
@Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor ")
@Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor")
private String cpuWithOverprovisioning;
@SerializedName(ApiConstants.CPU_LOAD_AVERAGE)
@ -342,6 +355,18 @@ public class HostResponse extends BaseResponse {
this.cpuAllocated = cpuAllocated;
}
public void setCpuAllocatedValue(Long cpuAllocatedValue) {
this.cpuAllocatedValue = cpuAllocatedValue;
}
public void setCpuAllocatedPercentage(String cpuAllocatedPercentage) {
this.cpuAllocatedPercentage = cpuAllocatedPercentage;
}
public void setCpuAllocatedWithOverprovisioning(String cpuAllocatedWithOverprovisioning) {
this.cpuAllocatedWithOverprovisioning = cpuAllocatedWithOverprovisioning;
}
public void setCpuUsed(String cpuUsed) {
this.cpuUsed = cpuUsed;
}

View File

@ -87,7 +87,6 @@ public class VirtualRoutingResource {
private int _retry;
private int _port;
private Duration _eachTimeout;
private Map<String, Object> _params;
private String _cfgVersion = "1.0";
@ -397,7 +396,7 @@ public class VirtualRoutingResource {
}
public boolean configureHostParams(final Map<String, String> params) {
if (_params.get("router.aggregation.command.each.timeout") != null) {
if (params.get("router.aggregation.command.each.timeout") != null) {
String value = (String)params.get("router.aggregation.command.each.timeout");
_eachTimeout = Duration.standardSeconds(NumbersUtil.parseLong(value, 600));
if (s_logger.isDebugEnabled()){
@ -410,7 +409,6 @@ public class VirtualRoutingResource {
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
_name = name;
_params = params;
String value = (String)params.get("ssh.sleep");
_sleep = NumbersUtil.parseInt(value, 10) * 1000;

View File

@ -193,8 +193,12 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
hostResponse.setCpuAllocatedValue(cpu);
String cpuAlloc = decimalFormat.format(((float)cpu / (float)(host.getCpus() * host.getSpeed())) * 100f) + "%";
hostResponse.setCpuAllocated(cpuAlloc);
hostResponse.setCpuAllocatedPercentage(cpuAlloc);
float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
hostResponse.setCpuAllocated(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
hostResponse.setCpuAllocatedWithOverprovisioning(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
hostResponse.setCpuWithOverprovisioning(decimalFormat.format(cpuWithOverprovisioning));
}
@ -345,8 +349,12 @@ public class HostJoinDaoImpl extends GenericDaoBase<HostJoinVO, Long> implements
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
hostResponse.setCpuAllocatedValue(cpu);
String cpuAlloc = decimalFormat.format(((float)cpu / (float)(host.getCpus() * host.getSpeed())) * 100f) + "%";
hostResponse.setCpuAllocated(cpuAlloc);
hostResponse.setCpuAllocatedPercentage(cpuAlloc);
float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
hostResponse.setCpuAllocated(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
hostResponse.setCpuAllocatedWithOverprovisioning(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
hostResponse.setCpuWithOverprovisioning(decimalFormat.format(cpuWithOverprovisioning));
}

View File

@ -64,8 +64,10 @@ class TestMulipleNicSupport(cloudstackTestCase):
cls.zone = Zone(zone.__dict__)
cls._cleanup = []
cls.skip = False
if str(cls.zone.securitygroupsenabled) != "True":
sys.exit(1)
cls.skip = True
return
cls.logger = logging.getLogger("TestMulipleNicSupport")
cls.stream_handler = logging.StreamHandler()
@ -78,7 +80,8 @@ class TestMulipleNicSupport(cloudstackTestCase):
cls.template = get_template(cls.apiclient, cls.zone.id, hypervisor="KVM")
if cls.template == FAILED:
sys.exit(1)
cls.skip = True
return
# Create new domain, account, network and VM
cls.user_domain = Domain.create(
@ -262,6 +265,8 @@ class TestMulipleNicSupport(cloudstackTestCase):
return
def setUp(self):
if self.skip:
self.skipTest("Test can be run only on advanced zone and KVM hypervisor")
self.apiclient = self.testClient.getApiClient()
self.cleanup = []
return