Search in sources :

Example 56 with Context

use of com.att.cdp.zones.Context in project AJSC by att.

the class OpenStackComputeService method associateACL.

/**
 * @see com.att.cdp.zones.ComputeService#associateACL(java.lang.String,
 *      java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void associateACL(String serverId, String aclName) throws ZoneException {
    checkArg(serverId, "serverId");
    checkArg(aclName, "aclName");
    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().associateSecurityGroup(serverId, aclName).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 57 with Context

use of com.att.cdp.zones.Context 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 58 with Context

use of com.att.cdp.zones.Context 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 59 with Context

use of com.att.cdp.zones.Context 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 60 with Context

use of com.att.cdp.zones.Context 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)

Aggregations

Context (com.att.cdp.zones.Context)248 OpenStackContext (com.att.cdp.openstack.OpenStackContext)167 OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)140 ArrayList (java.util.ArrayList)55 Ignore (org.junit.Ignore)50 Test (org.junit.Test)47 Quantum (com.woorea.openstack.quantum.Quantum)35 ZoneException (com.att.cdp.exceptions.ZoneException)30 NetworkService (com.att.cdp.zones.NetworkService)24 Server (com.att.cdp.zones.model.Server)22 ComputeService (com.att.cdp.zones.ComputeService)21 Network (com.att.cdp.zones.model.Network)19 OpenStackServer (com.att.cdp.openstack.model.OpenStackServer)18 OpenStackSnapshot (com.att.cdp.openstack.model.OpenStackSnapshot)18 Subnet (com.att.cdp.zones.model.Subnet)15 Port (com.att.cdp.zones.model.Port)14 Snapshot (com.att.cdp.zones.model.Snapshot)12 Volume (com.att.cdp.zones.model.Volume)11 OpenStackResponseException (com.woorea.openstack.base.client.OpenStackResponseException)11 ResourceNotFoundException (com.att.cdp.exceptions.ResourceNotFoundException)10