aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-01-30 12:47:50 +0100
committerPatrick Brady <pb071s@att.com>2018-01-31 20:49:54 +0000
commit6838f60cbfeccdb42c37f3fd40f839692ee10d76 (patch)
tree8c3a879a189d96a390b87927125d630edb26ecc2
parent4a12f557c13ee03831bf4aa5c3a02eb482998eba (diff)
Fix in CreateSnapshot
Change-Id: I05fa53bd4573aa4179fd488c617b338d9188f7ad Issue-ID: APPC-552 Signed-off-by: burdziak <olaf.burdziakowski@nokia.com>
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java7
1 files changed, 5 insertions, 2 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
index 5165b0ce0..451335255 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/CreateSnapshot.java
@@ -166,11 +166,14 @@ public class CreateSnapshot extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//this variable is also used in catch
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();
Server server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vm_url, context.getTenantName(), server.getStatus().toString());
+
+ logger.debug(Msg.SERVER_FOUND, vm_url, tenantName, server.getStatus().toString());
if (hasImageAccess(rc, context)) {
snapshot = createSnapshot(rc, server);
@@ -192,7 +195,7 @@ public class CreateSnapshot extends ProviderServerOperation {
} catch (Exception e1) {
msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
Operation.SNAPSHOT_SERVICE.toString(), vm_url,
- context == null ? "Unknown" : context.getTenantName());
+ tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}