Skip to content

Commit aca8732

Browse files
DaanHooglandDaan Hoogland
andauthored
[router] make a distinction between fatal errors, warnings and unknown as healthcheck result (#10710)
* [routers] distiction between fatal failure and warning or unknown on healthchecks * UI status for router health checks * status from scripts varied * automation signalled errors * revert removal of update sql * upgradeversion * move config item and further cleanup * handling services better * backwards compatible response --------- Co-authored-by: Daan Hoogland <[email protected]>
1 parent 3ef2556 commit aca8732

File tree

25 files changed

+543
-715
lines changed

25 files changed

+543
-715
lines changed

api/src/main/java/com/cloud/configuration/ConfigurationService.java

Lines changed: 1 addition & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -108,36 +108,22 @@ public interface ConfigurationService {
108108
/**
109109
* Updates a service offering
110110
*
111-
* @param serviceOfferingId
112-
* @param userId
113-
* @param name
114-
* @param displayText
115-
* @param offerHA
116-
* @param useVirtualNetwork
117-
* @param tags
118111
* @return updated service offering
119112
*/
120113
ServiceOffering updateServiceOffering(UpdateServiceOfferingCmd cmd);
121114

122115
/**
123116
* Deletes a service offering
124-
*
125-
* @param userId
126-
* @param serviceOfferingId
127117
*/
128118
boolean deleteServiceOffering(DeleteServiceOfferingCmd cmd);
129119

130120
/**
131121
* Retrieve ID of domains for a service offering
132-
*
133-
* @param serviceOfferingId
134122
*/
135123
List<Long> getServiceOfferingDomains(Long serviceOfferingId);
136124

137125
/**
138126
* Retrieve ID of domains for a service offering
139-
*
140-
* @param serviceOfferingId
141127
*/
142128
List<Long> getServiceOfferingZones(Long serviceOfferingId);
143129

@@ -147,7 +133,6 @@ public interface ConfigurationService {
147133
* @param cmd
148134
* - the command specifying diskOfferingId, name, description, tags
149135
* @return updated disk offering
150-
* @throws
151136
*/
152137
DiskOffering updateDiskOffering(UpdateDiskOfferingCmd cmd);
153138

@@ -157,34 +142,22 @@ public interface ConfigurationService {
157142
* @param cmd
158143
* - the command specifying disk offering id
159144
* @return true or false
160-
* @throws
161145
*/
162146
boolean deleteDiskOffering(DeleteDiskOfferingCmd cmd);
163147

164148
/**
165149
* Creates a new disk offering
166-
*
167-
* @param domainId
168-
* @param name
169-
* @param description
170-
* @param numGibibytes
171-
* @param mirrored
172-
* @param size
173150
* @return ID
174151
*/
175152
DiskOffering createDiskOffering(CreateDiskOfferingCmd cmd);
176153

177154
/**
178155
* Retrieve ID of domains for a disk offering
179-
*
180-
* @param diskOfferingId
181156
*/
182157
List<Long> getDiskOfferingDomains(Long diskOfferingId);
183158

184159
/**
185160
* Retrieve ID of domains for a disk offering
186-
*
187-
* @param diskOfferingId
188161
*/
189162
List<Long> getDiskOfferingZones(Long diskOfferingId);
190163

@@ -207,8 +180,6 @@ public interface ConfigurationService {
207180
* TODO
208181
* @param storageAccessGroups
209182
* @return the new pod if successful, null otherwise
210-
* @throws
211-
* @throws
212183
*/
213184
Pod createPod(long zoneId, String name, String startIp, String endIp, String gateway, String netmask, String allocationState, List<String> storageAccessGroups);
214185

@@ -228,8 +199,7 @@ public interface ConfigurationService {
228199
/**
229200
* Updates a mutually exclusive IP range in the pod.
230201
* @param cmd - The command specifying pod ID, current Start IP, current End IP, new Start IP, new End IP.
231-
* @throws com.cloud.exception.ConcurrentOperationException
232-
* @return Success
202+
* @throws com.cloud.exception.ConcurrentOperationException when this pod is already being accessed
233203
*/
234204
void updatePodIpRange(UpdatePodManagementNetworkIpRangeCmd cmd) throws ConcurrentOperationException;
235205

@@ -250,9 +220,6 @@ public interface ConfigurationService {
250220

251221
/**
252222
* Edits a pod in the database. Will not allow you to edit pods that are being used anywhere in the system.
253-
*
254-
* @param UpdatePodCmd
255-
* api command
256223
*/
257224
Pod editPod(UpdatePodCmd cmd);
258225

@@ -262,17 +229,12 @@ public interface ConfigurationService {
262229
* @param cmd
263230
* - the command containing podId
264231
* @return true or false
265-
* @throws ,
266232
*/
267233
boolean deletePod(DeletePodCmd cmd);
268234

269235
/**
270236
* Creates a new zone
271-
*
272-
* @param cmd
273237
* @return the zone if successful, null otherwise
274-
* @throws
275-
* @throws
276238
*/
277239
DataCenter createZone(CreateZoneCmd cmd);
278240

@@ -295,22 +257,7 @@ public interface ConfigurationService {
295257
* Adds a VLAN to the database, along with an IP address range. Can add three types of VLANs: (1) zone-wide VLANs on
296258
* the
297259
* virtual public network (2) pod-wide direct attached VLANs (3) account-specific direct attached VLANs
298-
*
299-
* @param userId
300-
* @param vlanType
301-
* - either "DomR" (VLAN for a virtual public network) or "DirectAttached" (VLAN for IPs that will be
302-
* directly
303-
* attached to UserVMs)
304-
* @param zoneId
305-
* @param accountId
306-
* @param podId
307-
* @param add
308-
* @param vlanId
309-
* @param gateway
310-
* @param startIP
311-
* @param endIP
312260
* @throws ResourceAllocationException TODO
313-
* @throws
314261
* @return The new Vlan object
315262
*/
316263
Vlan createVlanAndPublicIpRange(CreateVlanIpRangeCmd cmd) throws InsufficientCapacityException, ConcurrentOperationException, ResourceUnavailableException,
@@ -325,9 +272,6 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera
325272
/**
326273
* Marks the account with the default zone-id.
327274
*
328-
* @param accountName
329-
* @param domainId
330-
* @param defaultZoneId
331275
* @return The new account object
332276
*/
333277
Account markDefaultZone(String accountName, long domainId, long defaultZoneId);
@@ -349,14 +293,12 @@ Vlan updateVlanAndPublicIpRange(UpdateVlanIpRangeCmd cmd) throws ConcurrentOpera
349293
/**
350294
* Retrieve ID of domains for a network offering
351295
*
352-
* @param networkOfferingId
353296
*/
354297
List<Long> getNetworkOfferingDomains(Long networkOfferingId);
355298

356299
/**
357300
* Retrieve ID of domains for a network offering
358301
*
359-
* @param networkOfferingId
360302
*/
361303
List<Long> getNetworkOfferingZones(Long networkOfferingId);
362304

api/src/main/java/com/cloud/network/RouterHealthCheckResult.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public interface RouterHealthCheckResult {
2626

2727
String getCheckType();
2828

29-
boolean getCheckResult();
29+
VirtualNetworkApplianceService.RouterHealthStatus getCheckResult();
3030

3131
Date getLastUpdateTime();
3232

api/src/main/java/com/cloud/network/VirtualNetworkApplianceService.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,4 +87,8 @@ void startRouterForHA(VirtualMachine vm, Map<VirtualMachineProfile.Param, Object
8787
Pair<Boolean, String> performRouterHealthChecks(long routerId);
8888

8989
<T extends VirtualRouter> void collectNetworkStatistics(T router, Nic nic);
90+
91+
enum RouterHealthStatus{
92+
SUCCESS, FAILED, WARNING, UNKNOWN;
93+
}
9094
}

api/src/main/java/com/cloud/network/lb/LoadBalancingRulesService.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,23 @@
4141
public interface LoadBalancingRulesService {
4242
/**
4343
* Create a load balancer rule from the given ipAddress/port to the given private port
44+
* @param xId an existing UUID for this rule (for instance a device generated one)
45+
* @param name
46+
* @param description
47+
* @param srcPortStart
48+
* @param srcPortEnd
49+
* @param defPortStart
50+
* @param defPortEnd
51+
* @param ipAddrId
52+
* @param protocol
53+
* @param algorithm
54+
* @param networkId
55+
* @param lbOwnerId
4456
* @param openFirewall
45-
* TODO
46-
* @param forDisplay TODO
47-
* @param cmd
48-
* the command specifying the ip address, public port, protocol, private port, and algorithm
49-
*
57+
* @param lbProtocol
58+
* @param forDisplay
5059
* @return the newly created LoadBalancerVO if successful, null otherwise
60+
* @throws NetworkRuleConflictException
5161
* @throws InsufficientAddressCapacityException
5262
*/
5363
LoadBalancer createPublicLoadBalancerRule(String xId, String name, String description, int srcPortStart, int srcPortEnd, int defPortStart, int defPortEnd,

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

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import java.util.Date;
2121

22+
import com.cloud.network.VirtualNetworkApplianceService.RouterHealthStatus;
2223
import org.apache.cloudstack.api.ApiConstants;
2324
import org.apache.cloudstack.api.BaseResponse;
2425

@@ -35,9 +36,13 @@ public class RouterHealthCheckResultResponse extends BaseResponse {
3536
private String checkType;
3637

3738
@SerializedName(ApiConstants.SUCCESS)
38-
@Param(description = "result of the health check")
39+
@Param(description = "result of the health check if available")
3940
private boolean result;
4041

42+
@SerializedName(ApiConstants.STATUS)
43+
@Param(description = "the result of the health check in enum form: {SUCCESS, FAILURE, WARNING, UNKNOWN}")
44+
private RouterHealthStatus state;
45+
4146
@SerializedName(ApiConstants.LAST_UPDATED)
4247
@Param(description = "the date this VPC was created")
4348
private Date lastUpdated;
@@ -54,10 +59,14 @@ public String getCheckType() {
5459
return checkType;
5560
}
5661

57-
public boolean getResult() {
62+
public Boolean getResult() {
5863
return result;
5964
}
6065

66+
public RouterHealthStatus getState() {
67+
return state;
68+
}
69+
6170
public Date getLastUpdated() {
6271
return lastUpdated;
6372
}
@@ -74,10 +83,14 @@ public void setCheckType(String checkType) {
7483
this.checkType = checkType;
7584
}
7685

77-
public void setResult(boolean result) {
86+
public void setResult(Boolean result) {
7887
this.result = result;
7988
}
8089

90+
public void setState(RouterHealthStatus state) {
91+
this.state = state;
92+
}
93+
8194
public void setLastUpdated(Date lastUpdated) {
8295
this.lastUpdated = lastUpdated;
8396
}

0 commit comments

Comments
 (0)