Skip to content

Commit df07e27

Browse files
committed
Merge remote-tracking branch 'origin/4.14'
2 parents e4a504b + afebfd5 commit df07e27

File tree

5 files changed

+69
-8
lines changed

5 files changed

+69
-8
lines changed

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

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,23 @@ public class HostForMigrationResponse extends BaseResponse {
9595
@Param(description = "the CPU speed of the host")
9696
private Long cpuSpeed;
9797

98+
@Deprecated
9899
@SerializedName("cpuallocated")
99100
@Param(description = "the amount of the host's CPU currently allocated")
100101
private String cpuAllocated;
101102

103+
@SerializedName("cpuallocatedvalue")
104+
@Param(description = "the amount of the host's CPU currently allocated in MHz")
105+
private Long cpuAllocatedValue;
106+
107+
@SerializedName("cpuallocatedpercentage")
108+
@Param(description = "the amount of the host's CPU currently allocated in percentage")
109+
private String cpuAllocatedPercentage;
110+
111+
@SerializedName("cpuallocatedwithoverprovisioning")
112+
@Param(description = "the amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor")
113+
private String cpuAllocatedWithOverprovisioning;
114+
102115
@SerializedName("cpuused")
103116
@Param(description = "the amount of the host's CPU currently used")
104117
private String cpuUsed;
@@ -303,6 +316,18 @@ public void setCpuAllocated(String cpuAllocated) {
303316
this.cpuAllocated = cpuAllocated;
304317
}
305318

319+
public void setCpuAllocatedValue(Long cpuAllocatedValue) {
320+
this.cpuAllocatedValue = cpuAllocatedValue;
321+
}
322+
323+
public void setCpuAllocatedPercentage(String cpuAllocatedPercentage) {
324+
this.cpuAllocatedPercentage = cpuAllocatedPercentage;
325+
}
326+
327+
public void setCpuAllocatedWithOverprovisioning(String cpuAllocatedWithOverprovisioning) {
328+
this.cpuAllocatedWithOverprovisioning = cpuAllocatedWithOverprovisioning;
329+
}
330+
306331
public void setCpuUsed(String cpuUsed) {
307332
this.cpuUsed = cpuUsed;
308333
}

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,16 +103,29 @@ public class HostResponse extends BaseResponse {
103103
@Param(description = "the CPU speed of the host")
104104
private Long cpuSpeed;
105105

106+
@Deprecated
106107
@SerializedName("cpuallocated")
107108
@Param(description = "the amount of the host's CPU currently allocated")
108109
private String cpuAllocated;
109110

111+
@SerializedName("cpuallocatedvalue")
112+
@Param(description = "the amount of the host's CPU currently allocated in MHz")
113+
private Long cpuAllocatedValue;
114+
115+
@SerializedName("cpuallocatedpercentage")
116+
@Param(description = "the amount of the host's CPU currently allocated in percentage")
117+
private String cpuAllocatedPercentage;
118+
119+
@SerializedName("cpuallocatedwithoverprovisioning")
120+
@Param(description = "the amount of the host's CPU currently allocated after applying the cpu.overprovisioning.factor")
121+
private String cpuAllocatedWithOverprovisioning;
122+
110123
@SerializedName("cpuused")
111124
@Param(description = "the amount of the host's CPU currently used")
112125
private String cpuUsed;
113126

114127
@SerializedName("cpuwithoverprovisioning")
115-
@Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor ")
128+
@Param(description = "the amount of the host's CPU after applying the cpu.overprovisioning.factor")
116129
private String cpuWithOverprovisioning;
117130

118131
@SerializedName(ApiConstants.CPU_LOAD_AVERAGE)
@@ -342,6 +355,18 @@ public void setCpuAllocated(String cpuAllocated) {
342355
this.cpuAllocated = cpuAllocated;
343356
}
344357

358+
public void setCpuAllocatedValue(Long cpuAllocatedValue) {
359+
this.cpuAllocatedValue = cpuAllocatedValue;
360+
}
361+
362+
public void setCpuAllocatedPercentage(String cpuAllocatedPercentage) {
363+
this.cpuAllocatedPercentage = cpuAllocatedPercentage;
364+
}
365+
366+
public void setCpuAllocatedWithOverprovisioning(String cpuAllocatedWithOverprovisioning) {
367+
this.cpuAllocatedWithOverprovisioning = cpuAllocatedWithOverprovisioning;
368+
}
369+
345370
public void setCpuUsed(String cpuUsed) {
346371
this.cpuUsed = cpuUsed;
347372
}

core/src/main/java/com/cloud/agent/resource/virtualnetwork/VirtualRoutingResource.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ public class VirtualRoutingResource {
8787
private int _retry;
8888
private int _port;
8989
private Duration _eachTimeout;
90-
private Map<String, Object> _params;
9190

9291
private String _cfgVersion = "1.0";
9392

@@ -397,7 +396,7 @@ private Answer execute(GetDomRVersionCmd cmd) {
397396
}
398397

399398
public boolean configureHostParams(final Map<String, String> params) {
400-
if (_params.get("router.aggregation.command.each.timeout") != null) {
399+
if (params.get("router.aggregation.command.each.timeout") != null) {
401400
String value = (String)params.get("router.aggregation.command.each.timeout");
402401
_eachTimeout = Duration.standardSeconds(NumbersUtil.parseLong(value, 600));
403402
if (s_logger.isDebugEnabled()){
@@ -410,7 +409,6 @@ public boolean configureHostParams(final Map<String, String> params) {
410409

411410
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
412411
_name = name;
413-
_params = params;
414412

415413
String value = (String)params.get("ssh.sleep");
416414
_sleep = NumbersUtil.parseInt(value, 10) * 1000;

server/src/main/java/com/cloud/api/query/dao/HostJoinDaoImpl.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,12 @@ public HostResponse newHostResponse(HostJoinVO host, EnumSet<HostDetails> detail
193193

194194
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
195195

196+
hostResponse.setCpuAllocatedValue(cpu);
197+
String cpuAlloc = decimalFormat.format(((float)cpu / (float)(host.getCpus() * host.getSpeed())) * 100f) + "%";
198+
hostResponse.setCpuAllocated(cpuAlloc);
199+
hostResponse.setCpuAllocatedPercentage(cpuAlloc);
196200
float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
197-
hostResponse.setCpuAllocated(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
201+
hostResponse.setCpuAllocatedWithOverprovisioning(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
198202
hostResponse.setCpuWithOverprovisioning(decimalFormat.format(cpuWithOverprovisioning));
199203
}
200204

@@ -345,8 +349,12 @@ public HostForMigrationResponse newHostForMigrationResponse(HostJoinVO host, Enu
345349

346350
hostResponse.setHypervisorVersion(host.getHypervisorVersion());
347351

352+
hostResponse.setCpuAllocatedValue(cpu);
353+
String cpuAlloc = decimalFormat.format(((float)cpu / (float)(host.getCpus() * host.getSpeed())) * 100f) + "%";
354+
hostResponse.setCpuAllocated(cpuAlloc);
355+
hostResponse.setCpuAllocatedPercentage(cpuAlloc);
348356
float cpuWithOverprovisioning = host.getCpus() * host.getSpeed() * ApiDBUtils.getCpuOverprovisioningFactor(host.getClusterId());
349-
hostResponse.setCpuAllocated(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
357+
hostResponse.setCpuAllocatedWithOverprovisioning(calculateResourceAllocatedPercentage(cpu, cpuWithOverprovisioning));
350358
hostResponse.setCpuWithOverprovisioning(decimalFormat.format(cpuWithOverprovisioning));
351359
}
352360

test/integration/component/test_multiple_nic_support.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,10 @@ def setUpClass(cls):
6464
cls.zone = Zone(zone.__dict__)
6565
cls._cleanup = []
6666

67+
cls.skip = False
6768
if str(cls.zone.securitygroupsenabled) != "True":
68-
sys.exit(1)
69+
cls.skip = True
70+
return
6971

7072
cls.logger = logging.getLogger("TestMulipleNicSupport")
7173
cls.stream_handler = logging.StreamHandler()
@@ -78,7 +80,8 @@ def setUpClass(cls):
7880

7981
cls.template = get_template(cls.apiclient, cls.zone.id, hypervisor="KVM")
8082
if cls.template == FAILED:
81-
sys.exit(1)
83+
cls.skip = True
84+
return
8285

8386
# Create new domain, account, network and VM
8487
cls.user_domain = Domain.create(
@@ -262,6 +265,8 @@ def tearDownClass(self):
262265
return
263266

264267
def setUp(self):
268+
if self.skip:
269+
self.skipTest("Test can be run only on advanced zone and KVM hypervisor")
265270
self.apiclient = self.testClient.getApiClient()
266271
self.cleanup = []
267272
return

0 commit comments

Comments
 (0)