You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LOG.trace("Unable to find next HA state for current HA state: " + currentHAState + " for event: " + event + " for host" + haConfig.getResourceId());
171
-
}
168
+
LOG.warn(String.format("Unable to find next HA state for current HA state=[%s] for event=[%s] for host=[%s].", currentHAState, event, haConfig.getResourceId()), e);
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, "Incompatible haprovider provided for the resource of hypervisor type:" + host.getHypervisorType());
284
+
285
+
if (host == null) {
286
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Resource [%s] not found.", resourceId));
287
+
}
288
+
289
+
if (host.getHypervisorType() == null) {
290
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, String.format("No hypervisor type provided on resource [%s].", resourceId));
291
+
}
292
+
293
+
if (haProvider.resourceSubType() == null) {
294
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, "No hypervisor type provided on haprovider.");
295
+
}
296
+
297
+
if (!host.getHypervisorType().toString().equals(haProvider.resourceSubType().toString())) {
298
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, String.format("Incompatible haprovider provided [%s] for the resource [%s] of hypervisor type: [%s].", haProvider.resourceSubType().toString(), host.getId(),host.getHypervisorType()));
@@ -351,7 +353,7 @@ public Boolean doInTransaction(TransactionStatus status) {
351
353
haConfig.setResourceId(resourceId);
352
354
haConfig.setResourceType(resourceType);
353
355
if (Strings.isNullOrEmpty(haConfig.getHaProvider())) {
354
-
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, "HAProvider is not provided for the resource, failing configuration.");
356
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, String.format("HAProvider is not provided for the resource [%s], failing configuration.", resourceId));
355
357
}
356
358
if (haConfigDao.persist(haConfig) != null) {
357
359
returntrue;
@@ -364,7 +366,7 @@ public Boolean doInTransaction(TransactionStatus status) {
364
366
haConfig.setHaProvider(haProvider);
365
367
}
366
368
if (Strings.isNullOrEmpty(haConfig.getHaProvider())) {
367
-
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, "HAProvider is not provided for the resource, failing configuration.");
369
+
thrownewServerApiException(ApiErrorCode.PARAM_ERROR, String.format("HAProvider is not provided for the resource [%s], failing configuration.", resourceId));
LOG.trace("HA state pre-transition:: new state=" + newState + ", old state=" + oldState + ", for resource id=" + haConfig.getResourceId() + ", status=" + status + ", ha config state=" + haConfig.getState());
538
-
}
538
+
539
+
LOG.debug(String.format("HA state pre-transition:: new state=[%s], old state=[%s], for resource id=[%s], status=[%s], ha config state=[%s]." , newState, oldState, haConfig.getResourceId(), status, haConfig.getState()));
540
+
539
541
if (status && haConfig.getState() != newState) {
540
-
LOG.warn("HA state pre-transition:: HA state is not equal to transition state, HA state=" + haConfig.getState() + ", new state=" + newState);
542
+
LOG.warn(String.format("HA state pre-transition:: HA state is not equal to transition state, HA state=[%s], new state=[%s].", haConfig.getState(), newState));
LOG.trace("HA state post-transition:: new state=" + transition.getToState() + ", old state=" + transition.getCurrentState() + ", for resource id=" + haConfig.getResourceId() + ", status=" + status + ", ha config state=" + haConfig.getState());
549
-
}
549
+
LOG.debug(String.format("HA state post-transition:: new state=[%s], old state=[%s], for resource id=[%s], status=[%s], ha config state=[%s].", transition.getToState(), transition.getCurrentState(), haConfig.getResourceId(), status, haConfig.getState()));
550
+
550
551
if (status && haConfig.getState() != transition.getToState()) {
551
-
LOG.warn("HA state post-transition:: HA state is not equal to transition state, HA state=" + haConfig.getState() + ", new state=" + transition.getToState());
552
+
LOG.warn(String.format("HA state post-transition:: HA state is not equal to transition state, HA state=[%s], new state=[%s].", haConfig.getState(), transition.getToState()));
0 commit comments