Search in sources :

Example 1 with InterfaceAttachmentForCreate

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

the class OpenStackComputeService method attachPort.

/**
 * @see com.att.cdp.zones.ComputeService#attachPort(com.att.cdp.zones.model.Server, com.att.cdp.zones.model.Port)
 */
@Override
public void attachPort(Server server, Port port) throws ZoneException {
    checkArg(server, "server");
    checkArg(port, "port");
    connect();
    trackRequest();
    RequestState.put(RequestState.PORT, port.getId());
    RequestState.put(RequestState.SERVER, server.getId());
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    InterfaceAttachmentForCreate iafc = new InterfaceAttachmentForCreate();
    iafc.setPortId(port.getId());
    try {
        nova.getClient().servers().createInterfaceAttachment(server.getId(), iafc).execute();
    } catch (OpenStackConnectException | OpenStackResponseException e) {
        ExceptionMapper.mapException(e);
    }
}
Also used : OpenStackResponseException(com.woorea.openstack.base.client.OpenStackResponseException) InterfaceAttachmentForCreate(com.woorea.openstack.nova.model.InterfaceAttachmentForCreate) OpenStackConnectException(com.woorea.openstack.base.client.OpenStackConnectException)

Example 2 with InterfaceAttachmentForCreate

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

the class OpenStackComputeService method attachPort.

/**
 * @see com.att.cdp.zones.ComputeService#attachPort(com.att.cdp.zones.model.Server,
 *      com.att.cdp.zones.model.Port)
 */
@Override
public void attachPort(Server server, Port port) throws ZoneException {
    checkArg(server, "server");
    checkArg(port, "port");
    connect();
    trackRequest();
    RequestState.put(RequestState.PORT, port.getId());
    RequestState.put(RequestState.SERVER, server.getId());
    RequestState.put(RequestState.SERVICE, "Compute");
    RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
    InterfaceAttachmentForCreate iafc = new InterfaceAttachmentForCreate();
    iafc.setPortId(port.getId());
    try {
        nova.getClient().servers().createInterfaceAttachment(server.getId(), iafc).execute();
    } catch (OpenStackConnectException | OpenStackResponseException e) {
        ExceptionMapper.mapException(e);
    }
}
Also used : OpenStackResponseException(com.woorea.openstack.base.client.OpenStackResponseException) InterfaceAttachmentForCreate(com.woorea.openstack.nova.model.InterfaceAttachmentForCreate) OpenStackConnectException(com.woorea.openstack.base.client.OpenStackConnectException)

Aggregations

OpenStackConnectException (com.woorea.openstack.base.client.OpenStackConnectException)2 OpenStackResponseException (com.woorea.openstack.base.client.OpenStackResponseException)2 InterfaceAttachmentForCreate (com.woorea.openstack.nova.model.InterfaceAttachmentForCreate)2