Repository navigation
Expand file tree
/
Copy pathHostResponse.java
More file actions
executable file
·369 lines (270 loc) · 11.9 KB
/
Copy pathHostResponse.java
File metadata and controls
executable file
·369 lines (270 loc) · 11.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may not use this file except in compliance
// with the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,
// software distributed under the License is distributed on an
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
// KIND, either express or implied. See the License for the
// specific language governing permissions and limitations
// under the License.
package com.cloud.api.response;
import java.util.Date;
import com.cloud.api.ApiConstants;
import com.cloud.utils.IdentityProxy;
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;
public class HostResponse extends BaseResponse {
@SerializedName(ApiConstants.ID) @Param(description="the ID of the host")
private IdentityProxy id = new IdentityProxy("host");
@SerializedName(ApiConstants.NAME) @Param(description="the name of the host")
private String name;
@SerializedName(ApiConstants.STATE) @Param(description="the state of the host")
private Status state;
@SerializedName("disconnected") @Param(description="true if the host is disconnected. False otherwise.")
private Date disconnectedOn;
@SerializedName(ApiConstants.TYPE) @Param(description="the host type")
private Host.Type hostType;
@SerializedName("oscategoryid") @Param(description="the OS category ID of the host")
private IdentityProxy osCategoryId = new IdentityProxy("guest_os_category");
@SerializedName("oscategoryname") @Param(description="the OS category name of the host")
private String osCategoryName;
@SerializedName(ApiConstants.IP_ADDRESS) @Param(description="the IP address of the host")
private String ipAddress;
@SerializedName(ApiConstants.ZONE_ID) @Param(description="the Zone ID of the host")
private IdentityProxy zoneId = new IdentityProxy("data_center");
@SerializedName(ApiConstants.ZONE_NAME) @Param(description="the Zone name of the host")
private String zoneName;
@SerializedName(ApiConstants.POD_ID) @Param(description="the Pod ID of the host")
private IdentityProxy podId = new IdentityProxy("host_pod_ref");
@SerializedName("podname") @Param(description="the Pod name of the host")
private String podName;
@SerializedName("version") @Param(description="the host version")
private String version;
@SerializedName(ApiConstants.HYPERVISOR) @Param(description="the host hypervisor")
private HypervisorType hypervisor;
@SerializedName("cpunumber") @Param(description="the CPU number of the host")
private Integer cpuNumber;
@SerializedName("cpuspeed") @Param(description="the CPU speed of the host")
private Long cpuSpeed;
@SerializedName("cpuallocated") @Param(description="the amount of the host's CPU currently allocated")
private String cpuAllocated;
@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 ")
private String cpuWithOverprovisioning;
@SerializedName("averageload") @Param(description="the cpu average load on the host")
private Long averageLoad;
@SerializedName("networkkbsread") @Param(description="the incoming network traffic on the host")
private Long networkKbsRead;
@SerializedName("networkkbswrite") @Param(description="the outgoing network traffic on the host")
private Long networkKbsWrite;
@SerializedName("memorytotal") @Param(description="the memory total of the host")
private Long memoryTotal;
@SerializedName("memoryallocated") @Param(description="the amount of the host's memory currently allocated")
private Long memoryAllocated;
@SerializedName("memoryused") @Param(description="the amount of the host's memory currently used")
private Long memoryUsed;
@SerializedName("disksizetotal") @Param(description="the total disk size of the host")
private Long diskSizeTotal;
@SerializedName("disksizeallocated") @Param(description="the host's currently allocated disk size")
private Long diskSizeAllocated;
@SerializedName("capabilities") @Param(description="capabilities of the host")
private String capabilities;
@SerializedName("lastpinged") @Param(description="the date and time the host was last pinged")
private Date lastPinged;
@SerializedName("managementserverid") @Param(description="the management server ID of the host")
private Long managementServerId;
@SerializedName("clusterid") @Param(description="the cluster ID of the host")
private IdentityProxy clusterId = new IdentityProxy("cluster");
@SerializedName("clustername") @Param(description="the cluster name of the host")
private String clusterName;
@SerializedName("clustertype") @Param(description="the cluster type of the cluster that host belongs to")
private String clusterType;
@SerializedName("islocalstorageactive") @Param(description="true if local storage is active, false otherwise")
private Boolean localStorageActive;
@SerializedName(ApiConstants.CREATED) @Param(description="the date and time the host was created")
private Date created;
@SerializedName("removed") @Param(description="the date and time the host was removed")
private Date removed;
@SerializedName("events") @Param(description="events available for the host")
private String events;
@SerializedName("hosttags") @Param(description="comma-separated list of tags for the host")
private String hostTags;
@SerializedName("hasenoughcapacity") @Param(description="true if this host has enough CPU and RAM capacity to migrate a VM to it, false otherwise")
private Boolean hasEnoughCapacity;
@SerializedName("suitableformigration") @Param(description="true if this host is suitable(has enough capacity and satisfies all conditions like hosttags, max guests vm limit etc) to migrate a VM to it , false otherwise")
private Boolean suitableForMigration;
@SerializedName("resourcestate") @Param(description="the resource state of the host")
private String resourceState;
@SerializedName(ApiConstants.HYPERVISOR_VERSION) @Param(description="the hypervisor version")
private String hypervisorVersion;
@SerializedName(ApiConstants.HA_HOST) @Param(description="true if the host is Ha host (dedicated to vms started by HA process; false otherwise")
private Boolean haHost;
@Override
public Long getObjectId() {
return getId();
}
public Long getId() {
return id.getValue();
}
public void setId(Long id) {
this.id.setValue(id);
}
public void setName(String name) {
this.name = name;
}
public void setState(Status state) {
this.state = state;
}
public void setDisconnectedOn(Date disconnectedOn) {
this.disconnectedOn = disconnectedOn;
}
public void setHostType(Host.Type hostType) {
this.hostType = hostType;
}
public void setOsCategoryId(Long osCategoryId) {
this.osCategoryId.setValue(osCategoryId);
}
public void setOsCategoryName(String osCategoryName) {
this.osCategoryName = osCategoryName;
}
public void setIpAddress(String ipAddress) {
this.ipAddress = ipAddress;
}
public void setZoneId(Long zoneId) {
this.zoneId.setValue(zoneId);
}
public void setZoneName(String zoneName) {
this.zoneName = zoneName;
}
public void setPodId(Long podId) {
this.podId.setValue(podId);
}
public void setPodName(String podName) {
this.podName = podName;
}
public void setVersion(String version) {
this.version = version;
}
public void setHypervisor(HypervisorType hypervisor) {
this.hypervisor = hypervisor;
}
public void setCpuNumber(Integer cpuNumber) {
this.cpuNumber = cpuNumber;
}
public void setCpuSpeed(Long cpuSpeed) {
this.cpuSpeed = cpuSpeed;
}
public String getCpuAllocated() {
return cpuAllocated;
}
public void setCpuAllocated(String cpuAllocated) {
this.cpuAllocated = cpuAllocated;
}
public void setCpuUsed(String cpuUsed) {
this.cpuUsed = cpuUsed;
}
public void setAverageLoad(Long averageLoad) {
this.averageLoad = averageLoad;
}
public void setNetworkKbsRead(Long networkKbsRead) {
this.networkKbsRead = networkKbsRead;
}
public void setNetworkKbsWrite(Long networkKbsWrite) {
this.networkKbsWrite = networkKbsWrite;
}
public void setMemoryTotal(Long memoryTotal) {
this.memoryTotal = memoryTotal;
}
public void setMemoryAllocated(Long memoryAllocated) {
this.memoryAllocated = memoryAllocated;
}
public void setMemoryUsed(Long memoryUsed) {
this.memoryUsed = memoryUsed;
}
public void setDiskSizeTotal(Long diskSizeTotal) {
this.diskSizeTotal = diskSizeTotal;
}
public void setDiskSizeAllocated(Long diskSizeAllocated) {
this.diskSizeAllocated = diskSizeAllocated;
}
public void setCapabilities(String capabilities) {
this.capabilities = capabilities;
}
public void setLastPinged(Date lastPinged) {
this.lastPinged = lastPinged;
}
public void setManagementServerId(Long managementServerId) {
this.managementServerId = managementServerId;
}
public void setClusterId(Long clusterId) {
this.clusterId.setValue(clusterId);
}
public void setClusterName(String clusterName) {
this.clusterName = clusterName;
}
public void setClusterType(String clusterType) {
this.clusterType = clusterType;
}
public void setLocalStorageActive(Boolean localStorageActive) {
this.localStorageActive = localStorageActive;
}
public void setCreated(Date created) {
this.created = created;
}
public void setRemoved(Date removed) {
this.removed = removed;
}
public void setEvents(String events) {
this.events = events;
}
public void setHostTags(String hostTags) {
this.hostTags = hostTags;
}
public void setHasEnoughCapacity(Boolean hasEnoughCapacity) {
this.hasEnoughCapacity = hasEnoughCapacity;
}
public void setSuitableForMigration(Boolean suitableForMigration) {
this.suitableForMigration = suitableForMigration;
}
public String getResourceState() {
return resourceState;
}
public void setResourceState(String resourceState) {
this.resourceState = resourceState;
}
public String getCpuWithOverprovisioning() {
return cpuWithOverprovisioning;
}
public void setCpuWithOverprovisioning(String cpuWithOverprovisioning) {
this.cpuWithOverprovisioning = cpuWithOverprovisioning;
}
public void setHypervisorVersion(String hypervisorVersion) {
this.hypervisorVersion = hypervisorVersion;
}
public void setOsCategoryId(IdentityProxy osCategoryId) {
this.osCategoryId = osCategoryId;
}
public void setZoneId(IdentityProxy zoneId) {
this.zoneId = zoneId;
}
public void setPodId(IdentityProxy podId) {
this.podId = podId;
}
public void setClusterId(IdentityProxy clusterId) {
this.clusterId = clusterId;
}
public void setHaHost(Boolean haHost) {
this.haHost = haHost;
}
}