summaryrefslogtreecommitdiffstats
path: root/appc-adapters
diff options
context:
space:
mode:
authorBalaji, Ramya (rb111y) <rb111y@att.com>2018-09-04 13:17:17 -0400
committerBalaji, Ramya (rb111y) <rb111y@att.com>2018-09-04 13:31:13 -0400
commit875d836aeff308645ce59daf0ca59b77e0f13940 (patch)
tree9cd7b153ea9fd35732ff6fafb4ee2e8e58b5e9b5 /appc-adapters
parent06ee81fdf3eb1cc4e82f2c1cbf337098ee786b0d (diff)
Fixed error message for rebuild
Corrected code to ensure that all errors in retrieving images do not result in a misleading error message attributed to bootable volumes. Instead, a generic error message processing has been added. Issue-ID: APPC-1189 Change-Id: Ic4dc917e86429a3ab7bce4432796083f0741c637 Signed-off-by: Balaji, Ramya (rb111y) <rb111y@att.com>
Diffstat (limited to 'appc-adapters')
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java18
1 files changed, 14 insertions, 4 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java
index fa8b22b16..c320f49b4 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java
@@ -9,15 +9,15 @@
* Licensed 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.
-*
+*
* ============LICENSE_END=========================================================
*/
@@ -77,7 +77,7 @@ public class RebuildServer extends ProviderServerOperation {
// processing the request"
private long rebuildSleepTime = 10L * 1000L;
- /**
+ /*
* Rebuild the indicated server with the indicated image. This method assumes
* the server has been determined to be in the correct state to do the rebuild.
*
@@ -176,6 +176,16 @@ public class RebuildServer extends ProviderServerOperation {
*/
setTimeForMetricsLogger();
String msg;
+ //Throw error if boot source is unknown
+ if (ServerBootSource.UNKNOWN.equals(builtFrom)) {
+ logger.debug("Boot Source Unknown" );
+ msg = String.format("Error occured when retrieving server boot source [%s]!!!", server.getId());
+ logger.error(msg);
+ generateEvent(rc, false,msg);
+ metricsLogger.error(msg);
+ throw new RequestFailedException("Rebuild Server", msg, HttpStatus.INTERNAL_SERVER_ERROR_500, server);
+ }
+
// Throw exception for non image/snap boot source
if (ServerBootSource.VOLUME.equals(builtFrom)) {
msg = String.format("Rebuilding is currently not supported for servers built from bootable volumes [%s]",