Skip to content

Commit 5c0979f

Browse files
committed
Merge release branch 4.9 to master
* 4.9: CLOUDSTACK-9783: Improve metrics view performance
2 parents 85d073b + 6548839 commit 5c0979f

42 files changed

Lines changed: 2922 additions & 920 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ env:
4848
smoke/test_list_ids_parameter
4949
smoke/test_loadbalance
5050
smoke/test_login
51+
smoke/test_metrics_api
5152
smoke/test_multipleips_per_nic
5253
smoke/test_network
5354
smoke/test_network_acl

api/src/org/apache/cloudstack/api/command/admin/cluster/ListClustersCmd.java

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,18 +125,22 @@ public String getCommandName() {
125125
return s_name;
126126
}
127127

128-
@Override
129-
public void execute() {
128+
protected List<ClusterResponse> getClusterResponses() {
130129
Pair<List<? extends Cluster>, Integer> result = _mgr.searchForClusters(this);
131-
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
132130
List<ClusterResponse> clusterResponses = new ArrayList<ClusterResponse>();
133131
for (Cluster cluster : result.first()) {
134132
ClusterResponse clusterResponse = _responseGenerator.createClusterResponse(cluster, showCapacities);
135133
clusterResponse.setObjectName("cluster");
136134
clusterResponses.add(clusterResponse);
137135
}
136+
return clusterResponses;
137+
}
138138

139-
response.setResponses(clusterResponses, result.second());
139+
@Override
140+
public void execute() {
141+
List<ClusterResponse> clusterResponses = getClusterResponses();
142+
ListResponse<ClusterResponse> response = new ListResponse<ClusterResponse>();
143+
response.setResponses(clusterResponses, clusterResponses.size());
140144
response.setResponseName(getCommandName());
141145
this.setResponseObject(response);
142146
}

api/src/org/apache/cloudstack/api/command/admin/host/ListHostsCmd.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,10 @@ public String getState() {
132132
return state;
133133
}
134134

135+
public void setType(String type) {
136+
this.type = type;
137+
}
138+
135139
public String getType() {
136140
return type;
137141
}
@@ -198,19 +202,16 @@ public ApiCommandJobType getInstanceType() {
198202
return ApiCommandJobType.Host;
199203
}
200204

201-
@Override
202-
public void execute() {
203-
ListResponse<HostResponse> response = null;
205+
protected ListResponse<HostResponse> getHostResponses() {
206+
ListResponse<HostResponse> response = new ListResponse<>();
204207
if (getVirtualMachineId() == null) {
205208
response = _queryService.searchForServers(this);
206209
} else {
207210
Pair<List<? extends Host>, Integer> result;
208211
Ternary<Pair<List<? extends Host>, Integer>, List<? extends Host>, Map<Host, Boolean>> hostsForMigration =
209-
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
212+
_mgr.listHostsForMigrationOfVM(getVirtualMachineId(), this.getStartIndex(), this.getPageSizeVal());
210213
result = hostsForMigration.first();
211214
List<? extends Host> hostsWithCapacity = hostsForMigration.second();
212-
213-
response = new ListResponse<HostResponse>();
214215
List<HostResponse> hostResponses = new ArrayList<HostResponse>();
215216
for (Host host : result.first()) {
216217
HostResponse hostResponse = _responseGenerator.createHostResponse(host, getDetails());
@@ -222,9 +223,14 @@ public void execute() {
222223
hostResponse.setObjectName("host");
223224
hostResponses.add(hostResponse);
224225
}
225-
226226
response.setResponses(hostResponses, result.second());
227227
}
228+
return response;
229+
}
230+
231+
@Override
232+
public void execute() {
233+
ListResponse<HostResponse> response = getHostResponses();
228234
response.setResponseName(getCommandName());
229235
this.setResponseObject(response);
230236
}

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

Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -458,4 +458,163 @@ public void setDetails(Map details) {
458458

459459
}
460460

461+
public String getName() {
462+
return name;
463+
}
464+
465+
public Status getState() {
466+
return state;
467+
}
468+
469+
public Date getDisconnectedOn() {
470+
return disconnectedOn;
471+
}
472+
473+
public Host.Type getHostType() {
474+
return hostType;
475+
}
476+
477+
public String getOsCategoryId() {
478+
return osCategoryId;
479+
}
480+
481+
public String getOsCategoryName() {
482+
return osCategoryName;
483+
}
484+
485+
public String getIpAddress() {
486+
return ipAddress;
487+
}
488+
489+
public String getZoneId() {
490+
return zoneId;
491+
}
492+
493+
public String getZoneName() {
494+
return zoneName;
495+
}
496+
497+
public String getPodId() {
498+
return podId;
499+
}
500+
501+
public String getPodName() {
502+
return podName;
503+
}
504+
505+
public String getVersion() {
506+
return version;
507+
}
508+
509+
public HypervisorType getHypervisor() {
510+
return hypervisor;
511+
}
512+
513+
public Integer getCpuSockets() {
514+
return cpuSockets;
515+
}
516+
517+
public Integer getCpuNumber() {
518+
return cpuNumber;
519+
}
520+
521+
public Long getCpuSpeed() {
522+
return cpuSpeed;
523+
}
524+
525+
public String getCpuUsed() {
526+
return cpuUsed;
527+
}
528+
529+
public Long getAverageLoad() {
530+
return averageLoad;
531+
}
532+
533+
public Long getNetworkKbsRead() {
534+
return networkKbsRead;
535+
}
536+
537+
public Long getNetworkKbsWrite() {
538+
return networkKbsWrite;
539+
}
540+
541+
public Long getMemoryTotal() {
542+
return memoryTotal;
543+
}
544+
545+
public Long getMemoryAllocated() {
546+
return memoryAllocated;
547+
}
548+
549+
public Long getMemoryUsed() {
550+
return memoryUsed;
551+
}
552+
553+
public List<GpuResponse> getGpuGroup() {
554+
return gpuGroup;
555+
}
556+
557+
public Long getDiskSizeTotal() {
558+
return diskSizeTotal;
559+
}
560+
561+
public Long getDiskSizeAllocated() {
562+
return diskSizeAllocated;
563+
}
564+
565+
public String getCapabilities() {
566+
return capabilities;
567+
}
568+
569+
public Date getLastPinged() {
570+
return lastPinged;
571+
}
572+
573+
public Long getManagementServerId() {
574+
return managementServerId;
575+
}
576+
577+
public String getClusterId() {
578+
return clusterId;
579+
}
580+
581+
public String getClusterName() {
582+
return clusterName;
583+
}
584+
585+
public String getClusterType() {
586+
return clusterType;
587+
}
588+
589+
public Boolean getLocalStorageActive() {
590+
return localStorageActive;
591+
}
592+
593+
public Date getCreated() {
594+
return created;
595+
}
596+
597+
public Date getRemoved() {
598+
return removed;
599+
}
600+
601+
public String getEvents() {
602+
return events;
603+
}
604+
605+
public Boolean getHasEnoughCapacity() {
606+
return hasEnoughCapacity;
607+
}
608+
609+
public Boolean getSuitableForMigration() {
610+
return suitableForMigration;
611+
}
612+
613+
public String getHypervisorVersion() {
614+
return hypervisorVersion;
615+
}
616+
617+
public Boolean getHaHost() {
618+
return haHost;
619+
}
461620
}

api/src/org/apache/cloudstack/api/response/NicResponse.java

Lines changed: 79 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@
1616
// under the License.
1717
package org.apache.cloudstack.api.response;
1818

19-
import java.util.List;
20-
19+
import com.cloud.serializer.Param;
20+
import com.cloud.vm.Nic;
21+
import com.google.gson.annotations.SerializedName;
2122
import org.apache.cloudstack.api.ApiConstants;
2223
import org.apache.cloudstack.api.BaseResponse;
2324
import org.apache.cloudstack.api.EntityReference;
2425

25-
import com.cloud.serializer.Param;
26-
import com.cloud.vm.Nic;
27-
import com.google.gson.annotations.SerializedName;
26+
import java.util.List;
2827

2928
@SuppressWarnings("unused")
3029
@EntityReference(value = Nic.class)
@@ -221,4 +220,79 @@ public void setNsxLogicalSwitchPort(String nsxLogicalSwitchPort) {
221220
this.nsxLogicalSwitchPort = nsxLogicalSwitchPort;
222221
}
223222

223+
public String getNetworkId() {
224+
return networkId;
225+
}
226+
227+
public String getNetworkName() {
228+
return networkName;
229+
}
230+
231+
public String getNetmask() {
232+
return netmask;
233+
}
234+
235+
public String getGateway() {
236+
return gateway;
237+
}
238+
239+
public String getIsolationUri() {
240+
return isolationUri;
241+
}
242+
243+
public String getBroadcastUri() {
244+
return broadcastUri;
245+
}
246+
247+
public String getTrafficType() {
248+
return trafficType;
249+
}
250+
251+
public String getType() {
252+
return type;
253+
}
254+
255+
public Boolean getDefault() {
256+
return isDefault;
257+
}
258+
259+
public String getMacAddress() {
260+
return macAddress;
261+
}
262+
263+
public String getIpaddress() {
264+
return ipaddress;
265+
}
266+
267+
public String getIp6Gateway() {
268+
return ip6Gateway;
269+
}
270+
271+
public String getIp6Cidr() {
272+
return ip6Cidr;
273+
}
274+
275+
public String getIp6Address() {
276+
return ip6Address;
277+
}
278+
279+
public List<NicSecondaryIpResponse> getSecondaryIps() {
280+
return secondaryIps;
281+
}
282+
283+
public String getDeviceId() {
284+
return deviceId;
285+
}
286+
287+
public String getVmId() {
288+
return vmId;
289+
}
290+
291+
public String getNsxLogicalSwitch() {
292+
return nsxLogicalSwitch;
293+
}
294+
295+
public String getNsxLogicalSwitchPort() {
296+
return nsxLogicalSwitchPort;
297+
}
224298
}

api/src/org/apache/cloudstack/api/response/StoragePoolResponse.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,4 +309,12 @@ public void setSuitableForMigration(Boolean suitableForMigration) {
309309
public void setOverProvisionFactor(String overProvisionFactor) {
310310
this.overProvisionFactor = overProvisionFactor;
311311
}
312+
313+
public String getOverProvisionFactor() {
314+
return overProvisionFactor;
315+
}
316+
317+
public Boolean getSuitableForMigration() {
318+
return suitableForMigration;
319+
}
312320
}

api/src/org/apache/cloudstack/api/response/UserVmResponse.java

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,4 +813,28 @@ public void setDetails(Map details) {
813813
public void setOsTypeId(Long osTypeId) {
814814
this.osTypeId = osTypeId;
815815
}
816+
817+
public Set<Long> getTagIds() {
818+
return tagIds;
819+
}
820+
821+
public void setTagIds(Set<Long> tagIds) {
822+
this.tagIds = tagIds;
823+
}
824+
825+
public Map getDetails() {
826+
return details;
827+
}
828+
829+
public Boolean getDynamicallyScalable() {
830+
return isDynamicallyScalable;
831+
}
832+
833+
public void setDynamicallyScalable(Boolean dynamicallyScalable) {
834+
isDynamicallyScalable = dynamicallyScalable;
835+
}
836+
837+
public Long getOsTypeId() {
838+
return osTypeId;
839+
}
816840
}

0 commit comments

Comments
 (0)