Search in sources :

Example 36 with OpenStackBaseException

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

the class OpenStackComputeService method stopServer.

/**
 * Stops the indicated server
 *
 * @param id
 *            The id of the server to be stopped
 * @throws ZoneException
 *             If the server is in an invalid state or it does not exist.
 * @see com.att.cdp.zones.ComputeService#stopServer(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void stopServer(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, id);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        nova.getClient().servers().stop(id).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 37 with OpenStackBaseException

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

the class OpenStackComputeService method resumeServer.

/**
 * @see com.att.cdp.zones.ComputeService#resumeServer(java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void resumeServer(String id) throws ZoneException {
    checkArg(id, "id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, id);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        nova.getClient().servers().resume(id).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 38 with OpenStackBaseException

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

the class OpenStackComputeService method rebuildServer.

/**
 * Rebuilds the server with the exact same image that it was currently built
 * from.
 *
 * @see com.att.cdp.zones.ComputeService#rebuildServer(com.att.cdp.zones.model.Server)
 */
@SuppressWarnings("nls")
@Override
public void rebuildServer(Server server) throws ZoneException {
    checkArg(server, "server");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, server.getId());
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    Rebuild rebuild = new Rebuild();
    rebuild.setImageRef(server.getImage());
    try {
        nova.getClient().servers().rebuild(server.getId(), rebuild).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) Rebuild(com.woorea.openstack.nova.model.ServerAction.Rebuild)

Example 39 with OpenStackBaseException

use of com.woorea.openstack.base.client.OpenStackBaseException 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();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVER, serverId);
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        nova.getClient().servers().migrate(serverId).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Example 40 with OpenStackBaseException

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

the class OpenStackComputeService method prepareResize.

/**
 * @see com.att.cdp.zones.ComputeService#prepareResize(com.att.cdp.zones.model.Server,
 *      java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void prepareResize(Server server, Template newTemplate) throws ZoneException {
    checkArg(server, "server");
    checkArg(server.getId(), "server id");
    checkArg(newTemplate, "template");
    checkArg(newTemplate.getId(), "template id");
    connect();
    Context context = getContext();
    trackRequest();
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    try {
        nova.getClient().servers().resize(server.getId(), newTemplate.getId(), null).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : Context(com.att.cdp.zones.Context) OpenStackContext(com.att.cdp.openstack.OpenStackContext) OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException)

Aggregations

OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)151 OpenStackContext (com.att.cdp.openstack.OpenStackContext)140 Context (com.att.cdp.zones.Context)140 ArrayList (java.util.ArrayList)54 Quantum (com.woorea.openstack.quantum.Quantum)36 OpenStackSnapshot (com.att.cdp.openstack.model.OpenStackSnapshot)18 ZoneException (com.att.cdp.exceptions.ZoneException)15 OpenStackServer (com.att.cdp.openstack.model.OpenStackServer)14 Server (com.att.cdp.zones.model.Server)11 ConnectedServer (com.att.cdp.zones.spi.model.ConnectedServer)11 HashMap (java.util.HashMap)11 ResourceNotFoundException (com.att.cdp.exceptions.ResourceNotFoundException)10 Snapshot (com.att.cdp.zones.model.Snapshot)10 OpenStackACL (com.att.cdp.openstack.model.OpenStackACL)8 OpenStackImage (com.att.cdp.openstack.model.OpenStackImage)8 OpenStackPort (com.att.cdp.openstack.model.OpenStackPort)8 OpenStackVolume (com.att.cdp.openstack.model.OpenStackVolume)8 OpenStackNetwork (com.att.cdp.openstack.model.OpenStackNetwork)7 Network (com.att.cdp.zones.model.Network)7 Port (com.att.cdp.zones.model.Port)7