diff options
Diffstat (limited to 'appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org')
2 files changed, 28 insertions, 11 deletions
diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java index de0569d42..1888861c6 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/impl/ProviderAdapterImpl.java @@ -52,6 +52,9 @@ import java.util.Properties; /** * This class implements the {@link ProviderAdapter} interface. This interface defines the behaviors that our service * provides. + * + * @since Aug 12, 2015 + * @version $Id$ */ @SuppressWarnings("javadoc") public class ProviderAdapterImpl implements ProviderAdapter { @@ -278,8 +281,8 @@ public class ProviderAdapterImpl implements ProviderAdapter { * provider1.name=ILAB * provider1.identity=http://provider1:5000/v2.0 * provider1.tenant1.name=CDP-ONAP-APPC - * provider1.tenant1.userid=cdpdev - * provider1.tenant1.password=cdpdev@123 + * provider1.tenant1.userid=testUser + * provider1.tenant1.password=testPassword * provider1.tenant2.name=TEST-TENANT * provider1.tenant2.userid=testUser * provider1.tenant2.password=testPassword diff --git a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java index f037e58a3..b7ad626ce 100644 --- a/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java +++ b/appc-adapters/appc-iaas-adapter/appc-iaas-adapter-bundle/src/main/java/org/openecomp/appc/adapter/iaas/provider/operation/impl/base/ProviderServerOperation.java @@ -535,19 +535,33 @@ public abstract class ProviderServerOperation extends ProviderOperation{ throws ZoneException, RequestFailedException { logger.info("Performing the Hypervisor status checks.."); - String status = null, state = null, msg = null; - - status = server.getHypervisor().getStatus().toString(); - state = server.getHypervisor().getState().toString(); - if (!status.equals(Hypervisor.Status.ENABLED.toString()) || !state.equals(Hypervisor.State.UP.toString())) { - msg = EELFResourceManager.format(Msg.HYPERVISOR_DOWN_ERROR, server.getHypervisor().getHostName(), server.getName()); - logger.error(msg.toString()); + String msg = null; + if(server.getHypervisor() != null && server.getHypervisor().getStatus() != null && server.getHypervisor().getState() != null) + { + String status = null, state = null; + + status = server.getHypervisor().getStatus().toString(); + state = server.getHypervisor().getState().toString(); + + if (!status.equals(Hypervisor.Status.ENABLED.toString()) || !state.equals(Hypervisor.State.UP.toString())) + { + msg = EELFResourceManager.format(Msg.HYPERVISOR_DOWN_ERROR, server.getHypervisor().getHostName(), server.getName()); + logger.error(msg.toString()); - //doFailure(rc, HttpStatus.PRECONDITION_FAILED_412, msg); - throw new RequestFailedException("Hypervisor status DOWN or NOT ENABLED", msg.toString(), HttpStatus.PRECONDITION_FAILED_412, + //doFailure(rc, HttpStatus.PRECONDITION_FAILED_412, msg); + throw new RequestFailedException("Hypervisor status DOWN or NOT ENABLED", msg.toString(), HttpStatus.PRECONDITION_FAILED_412, server); + } + } + else + { + msg = EELFResourceManager.format(Msg.HYPERVISOR_STATUS_UKNOWN, server.getName()); + logger.error(msg.toString()); + + throw new RequestFailedException("Unable to determine Hypervisor status", msg.toString(), HttpStatus.PRECONDITION_FAILED_412, + server); } logger.info("Passed the Hypervisor status checks.."); |