Search in sources :

Example 1 with Rebuild

use of com.woorea.openstack.nova.model.ServerAction.Rebuild 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 2 with Rebuild

use of com.woorea.openstack.nova.model.ServerAction.Rebuild 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();
    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 : OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) Rebuild(com.woorea.openstack.nova.model.ServerAction.Rebuild)

Example 3 with Rebuild

use of com.woorea.openstack.nova.model.ServerAction.Rebuild in project AJSC by att.

the class OpenStackComputeService method rebuildServer.

/**
 * Rebuilds the server from a supplied snapshot
 *
 * @see com.att.cdp.zones.ComputeService#rebuildServer(com.att.cdp.zones.model.Server, java.lang.String)
 */
@SuppressWarnings("nls")
@Override
public void rebuildServer(Server server, String snapshot) throws ZoneException {
    checkArg(server, "server");
    checkArg(snapshot, "snapshot");
    connect();
    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(snapshot);
    try {
        nova.getClient().servers().rebuild(server.getId(), rebuild).execute();
    } catch (OpenStackBaseException ex) {
        ExceptionMapper.mapException(ex);
    }
}
Also used : OpenStackBaseException(com.woorea.openstack.base.client.OpenStackBaseException) Rebuild(com.woorea.openstack.nova.model.ServerAction.Rebuild)

Example 4 with Rebuild

use of com.woorea.openstack.nova.model.ServerAction.Rebuild in project AJSC by att.

the class OpenStackComputeService method rebuildServer.

/**
 * Rebuilds the server from a supplied snapshot
 *
 * @param server
 *            The server to be re-built
 * @param snapshot
 *            The snapshot or image id to be used to rebuild the server
 * @throws ZoneException
 *             If the server cannot be rebuilt
 */
@SuppressWarnings("nls")
@Override
public void rebuildServer(Server server, String snapshot) throws ZoneException {
    checkArg(server, "server");
    checkArg(snapshot, "snapshot");
    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(snapshot);
    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)

Aggregations

OpenStackBaseException (com.woorea.openstack.base.client.OpenStackBaseException)4 Rebuild (com.woorea.openstack.nova.model.ServerAction.Rebuild)4 OpenStackContext (com.att.cdp.openstack.OpenStackContext)2 Context (com.att.cdp.zones.Context)2