Search in sources :

Example 1 with OpenStackResponse

use of com.woorea.openstack.base.client.OpenStackResponse in project AJSC by att.

the class OpenStackComputeService method processResize.

/**
 * @see com.att.cdp.zones.ComputeService#processResize(com.att.cdp.zones.model.Server)
 */
@SuppressWarnings("nls")
@Override
public void processResize(Server server) throws ZoneException {
    checkArg(server, "server");
    checkArg(server.getId(), "server id");
    connect();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        OpenStackResponse request = nova.getClient().servers().confirmResize(server.getId()).request();
        if (request != null && request.getStatus() != Status.NO_CONTENT.getStatusCode()) {
            throw new ZoneException(request.getEntity(String.class));
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : OpenStackResponse(com.woorea.openstack.base.client.OpenStackResponse) ZoneException(com.att.cdp.exceptions.ZoneException) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 2 with OpenStackResponse

use of com.woorea.openstack.base.client.OpenStackResponse in project AJSC by att.

the class OpenStackComputeService method abortResize.

/**
 * @see com.att.cdp.zones.ComputeService#abortResize(com.att.cdp.zones.model.Server)
 */
@SuppressWarnings("nls")
@Override
public void abortResize(Server server) throws ZoneException {
    checkArg(server, "server");
    checkArg(server.getId(), "server id");
    connect();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        OpenStackResponse request = nova.getClient().servers().revertResize(server.getId()).request();
        if (request != null && request.getStatus() != Status.ACCEPTED.getStatusCode()) {
            throw new ZoneException(request.getEntity(String.class));
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : OpenStackResponse(com.woorea.openstack.base.client.OpenStackResponse) ZoneException(com.att.cdp.exceptions.ZoneException) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 3 with OpenStackResponse

use of com.woorea.openstack.base.client.OpenStackResponse in project AJSC by att.

the class OpenStackComputeService method migrateServer.

/**
 * @see com.att.cdp.zones.ComputeService#migrateServer(java.lang.String)
 */
@Override
public void migrateServer(String serverId) throws ZoneException {
    checkArg(serverId, "serverId");
    connect();
    trackRequest();
    RequestState.put(RequestState.SERVER, serverId);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        OpenStackResponse response = nova.getClient().servers().migrate(serverId).request();
        if (response == null || response.getStatus() != Status.ACCEPTED.getStatusCode()) {
            throw new ZoneException(response.getEntity(String.class));
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : OpenStackResponse(com.woorea.openstack.base.client.OpenStackResponse) ZoneException(com.att.cdp.exceptions.ZoneException) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 4 with OpenStackResponse

use of com.woorea.openstack.base.client.OpenStackResponse in project AJSC by att.

the class OpenStackComputeService method abortResize.

/**
 * @see com.att.cdp.zones.ComputeService#abortResize(com.att.cdp.zones.model.Server)
 */
@SuppressWarnings("nls")
@Override
public void abortResize(Server server) throws ZoneException {
    checkArg(server, "server");
    checkArg(server.getId(), "server id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        OpenStackResponse request = nova.getClient().servers().revertResize(server.getId()).request();
        if (request != null && request.getStatus() != Status.ACCEPTED.getStatusCode()) {
            throw new ZoneException(request.getEntity(String.class));
        }
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackResponse(com.woorea.openstack.base.client.OpenStackResponse) ZoneException(com.att.cdp.exceptions.ZoneException) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Aggregations

ZoneException (com.att.cdp.exceptions.ZoneException)4 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)4 OpenStackResponse (com.woorea.openstack.base.client.OpenStackResponse)4 OpenStackContext (com.att.cdp.openstack.OpenStackContext)1 Context (com.att.cdp.zones.Context)1