summaryrefslogtreecommitdiffstats
path: root/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src
diff options
context:
space:
mode:
authorburdziak <olaf.burdziakowski@nokia.com>2018-01-22 10:36:53 +0100
committerPatrick Brady <pb071s@att.com>2018-01-22 18:09:46 +0000
commitbf326542858edfd6fb707404c580a146e26e019f (patch)
tree64772758c1c6874af11760e2dcb12192250b7832 /appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src
parent9ed1e8d5ba5f08d608d23975479a9abb8ee25548 (diff)
Evaluate to variable value
Same issue in many files. Issue-ID: APPC-446 Change-Id: Iea2d6a64d5d794d3300267438cd3a2971d378d3a Signed-off-by:te burdziak <olaf.burdziakowski@nokia.com>
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src')
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java7
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RebuildServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java7
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java6
-rw-r--r--appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java6
11 files changed, 44 insertions, 24 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java
index 2acd49918..3d3b9b767 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/AttachVolumeServer.java
@@ -59,6 +59,7 @@ public class AttachVolumeServer extends ProviderServerOperation {
String device = params.get(ProviderAdapter.DEVICE);
VMURL vm = VMURL.parseURL(vm_url);
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
if (validateVM(rc, appName, vm_url, vm))
return null;
@@ -68,9 +69,10 @@ public class AttachVolumeServer extends ProviderServerOperation {
String msg;
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
VolumeService vs = context.getVolumeService();
vs.getVolumes(server);;
Volume vol = new Volume();
@@ -104,7 +106,7 @@ public class AttachVolumeServer extends ProviderServerOperation {
doFailure(rc, e.getStatus(), e.getMessage());
} catch (Exception ex) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
- ATTACHVOLUME_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+ ATTACHVOLUME_SERVICE.toString(), vm_url, tenantName);
logger.error(msg, ex);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java
index 8c408c4d5..3dd843b67 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/DettachVolumeServer.java
@@ -68,6 +68,7 @@ public class DettachVolumeServer extends ProviderServerOperation{
String device = params.get(ProviderAdapter.DEVICE);
VMURL vm = VMURL.parseURL(vm_url);
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
if (validateVM(rc, appName, vm_url, vm))
return null;
@@ -77,9 +78,10 @@ public class DettachVolumeServer extends ProviderServerOperation{
String msg;
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
Volume vol = new Volume();
vol.setId(vol_id);
Map volms = server.getVolumes();
@@ -110,7 +112,7 @@ public class DettachVolumeServer extends ProviderServerOperation{
doFailure(rc, e.getStatus(), e.getMessage());
} catch (Exception ex) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, ex, ex.getClass().getSimpleName(),
- ATTACHVOLUME_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+ ATTACHVOLUME_SERVICE.toString(), vm_url, tenantName);
logger.error(msg, ex);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java
index 73e468846..ab61a1892 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/EvacuateServer.java
@@ -174,12 +174,13 @@ public class EvacuateServer extends ProviderServerOperation {
String targetHostId = params.get(ProviderAdapter.PROPERTY_TARGETHOST_ID);
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
context = getContext(rc, vmUrl, identStr);
if (context != null) {
-
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
server = lookupServer(rc, context, vm.getServerId());
- logger.debug(Msg.SERVER_FOUND, vmUrl, context.getTenantName(), server.getStatus().toString());
+ logger.debug(Msg.SERVER_FOUND, vmUrl, tenantName, server.getStatus().toString());
// check target host status
if (isComputeNodeDown(context, targetHostId)) {
@@ -268,7 +269,7 @@ public class EvacuateServer extends ProviderServerOperation {
doFailure(rc, e.getStatus(), e.getMessage());
} catch (IOException | ZoneException e1) {
msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
- Operation.EVACUATE_SERVICE.toString(), vmUrl, context == null ? "Unknown" : context.getTenantName());
+ Operation.EVACUATE_SERVICE.toString(), vmUrl, tenantName);
logger.error(msg, e1);
metricsLogger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
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 c87dc7e85..ae418d38b 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
@@ -357,12 +357,14 @@ public class RebuildServer extends ProviderServerOperation {
ctx.setAttribute("REBUILD_STATUS", "ERROR");
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
// Manually checking image service until new PAL release
if (hasImageAccess(rc, context)) {
@@ -391,7 +393,7 @@ public class RebuildServer extends ProviderServerOperation {
doFailure(rc, HttpStatus.NOT_FOUND_404, msg);
} catch (Exception e1) {
msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
- STOP_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+ STOP_SERVICE.toString(), vm_url, tenantName);
ctx.setAttribute("REBUILD_STATUS", "ERROR");
logger.error(msg, e1);
metricsLogger.error(msg);
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java
index 18ddacf00..42a3b9087 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestartServer.java
@@ -208,12 +208,14 @@ public class RestartServer extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
rc.reset();
restartServer(rc, server, ctx);
context.close();
@@ -232,7 +234,7 @@ public class RestartServer extends ProviderServerOperation {
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
- context == null ? "Unknown" : context.getTenantName());
+ tenantName);
logger.error(msg, e1);
metricsLogger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java
index 7eeb23783..218684eb8 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/RestoreStack.java
@@ -100,7 +100,7 @@ public class RestoreStack extends ProviderStackOperation {
String vm_url = null;
Context context = null;
-
+ String tenantName = "Unknown";//to be used also in case of exception
try {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
@@ -114,8 +114,9 @@ public class RestoreStack extends ProviderStackOperation {
context = resolveContext(rc, params, appName, vm_url);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
stack = lookupStack(rc, context, stackId);
- logger.debug(Msg.STACK_FOUND, vm_url, context.getTenantName(), stack.getStatus().toString());
+ logger.debug(Msg.STACK_FOUND, vm_url, tenantName, stack.getStatus().toString());
logger.info(EELFResourceManager.format(Msg.TERMINATING_STACK, stack.getName()));
restoreStack(stack, snapshotId);
logger.info(EELFResourceManager.format(Msg.TERMINATE_STACK, stack.getName()));
@@ -134,7 +135,7 @@ public class RestoreStack extends ProviderStackOperation {
doFailure(rc, e.getStatus(), e.getMessage(), e);
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.STACK_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
- "restoreStack", vm_url, null == context ? "n/a" : context.getTenantName());
+ "restoreStack", vm_url, tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg, e1);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java
index bf7ebc755..93f062ff6 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/SnapshotStack.java
@@ -114,6 +114,7 @@ public class SnapshotStack extends ProviderStackOperation {
String vm_url = null;
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
validateParametersExist(params, ProviderAdapter.PROPERTY_INSTANCE_URL,
ProviderAdapter.PROPERTY_PROVIDER_NAME, ProviderAdapter.PROPERTY_STACK_ID);
@@ -124,8 +125,9 @@ public class SnapshotStack extends ProviderStackOperation {
context = resolveContext(rc, params, appName, vm_url);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
stack = lookupStack(rc, context, stackId);
- logger.debug(Msg.STACK_FOUND, vm_url, context.getTenantName(), stack.getStatus().toString());
+ logger.debug(Msg.STACK_FOUND, vm_url, tenantName, stack.getStatus().toString());
logger.info(EELFResourceManager.format(Msg.SNAPSHOTING_STACK, stack.getName()));
metricsLogger.info(EELFResourceManager.format(Msg.SNAPSHOTING_STACK, stack.getName()));
@@ -154,7 +156,7 @@ public class SnapshotStack extends ProviderStackOperation {
doFailure(rc, e.getStatus(), e.getMessage(), e);
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.STACK_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
- "snapshotStack", vm_url, null == context ? "n/a" : context.getTenantName());
+ "snapshotStack", vm_url, tenantName);
logger.error(msg, e1);
metricsLogger.error(msg);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg, e1);
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
index f5d618fef..ecd7becae 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StartServer.java
@@ -77,13 +77,15 @@ public class StartServer extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
ctx.setAttribute("START_STATUS", "ERROR");
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
String msg;
/*
@@ -163,7 +165,7 @@ public class StartServer extends ProviderServerOperation {
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
e1.getClass().getSimpleName(), START_SERVICE.toString(), vm_url,
- context == null ? "Unknown" : context.getTenantName());
+ tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
index 15adca90c..6c0ed90b0 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/StopServer.java
@@ -79,13 +79,15 @@ public class StopServer extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
ctx.setAttribute("STOP_STATUS", "ERROR");
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
rc.reset();
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());
String msg;
/*
@@ -180,7 +182,7 @@ public class StopServer extends ProviderServerOperation {
} catch (Exception e1) {
String msg =
EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1, e1.getClass().getSimpleName(),
- STOP_SERVICE.toString(), vm_url, context == null ? "Unknown" : context.getTenantName());
+ STOP_SERVICE.toString(), vm_url, tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
index 6bd7d27f7..2582ed903 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/TerminateServer.java
@@ -200,11 +200,13 @@ public class TerminateServer extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
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());
logger.info(EELFResourceManager.format(Msg.TERMINATING_SERVER, server.getName()));
terminateServer(rc, server);
logger.info(EELFResourceManager.format(Msg.TERMINATE_SERVER, server.getName()));
@@ -221,7 +223,7 @@ public class TerminateServer extends ProviderServerOperation {
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
- context == null ? "Unknown" : context.getTenantName());
+ tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
index 9185e35fc..406d7c242 100644
--- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
+++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/onap/appc/adapter/iaas/provider/operation/impl/VmStatuschecker.java
@@ -80,11 +80,13 @@ public class VmStatuschecker extends ProviderServerOperation {
String identStr = (ident == null) ? null : ident.toString();
Context context = null;
+ String tenantName = "Unknown";//to be used also in case of exception
try {
context = getContext(rc, vm_url, identStr);
if (context != null) {
+ tenantName = context.getTenantName();//this varaible also is used in case of exception
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());
String statusvm;
switch (server.getStatus()) {
@@ -138,7 +140,7 @@ public class VmStatuschecker extends ProviderServerOperation {
} catch (Exception e1) {
String msg = EELFResourceManager.format(Msg.SERVER_OPERATION_EXCEPTION, e1,
e1.getClass().getSimpleName(), RESTART_SERVICE.toString(), vm_url,
- context == null ? "Unknown" : context.getTenantName());
+ tenantName);
logger.error(msg, e1);
doFailure(rc, HttpStatus.INTERNAL_SERVER_ERROR_500, msg);
}