Same issue in many files.
Issue-ID: APPC-446
Change-Id: Iea2d6a64d5d794d3300267438cd3a2971d378d3a
Signed-off-by:te burdziak <olaf.burdziakowski@nokia.com>
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;
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();
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);
}
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;
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();
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);
}
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)) {
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);
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)) {
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);
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();
} 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);
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,
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()));
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);
}
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);
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()));
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);
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;
/*
} 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);
}
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;
/*
} 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);
}
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()));
} 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);
}
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()) {
} 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);
}