use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method getExtensions.
/**
* Returns the set of extensions loaded, if any
*
* @return The list of extensions installed, if any
* @throws ZoneException
* If anything fails
*/
public List<String> getExtensions() throws ZoneException {
connect();
Context context = getContext();
ArrayList<String> extensions = new ArrayList<>();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
for (Extension extension : nova.getClient().extensions().list(true).execute()) {
extensions.add(extension.getName());
}
} catch (OpenStackBaseException e) {
if (e instanceof OpenStackResponseException) {
OpenStackResponseException osre = (OpenStackResponseException) e;
if (osre.getStatus() != 404) {
ExceptionMapper.mapException(e);
}
} else {
ExceptionMapper.mapException(e);
}
}
return extensions;
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method getAccessControlList.
/**
* @see com.att.cdp.zones.ComputeService#getAccessControlList(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public ACL getAccessControlList(String id) throws ZoneException {
checkArg(id, "id");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
SecurityGroup group = nova.getClient().securityGroups().showSecurityGroup(id).execute();
return new OpenStackACL(context, group);
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
return null;
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method unpauseServer.
/**
* @see com.att.cdp.zones.ComputeService#unpauseServer(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public void unpauseServer(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().unpause(id).execute();
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method deleteACLRule.
/**
* @see com.att.cdp.zones.ComputeService#deleteACLRule(java.lang.String)
*/
@SuppressWarnings("nls")
@Override
public void deleteACLRule(Rule rule) throws ZoneException {
checkArg(rule, "rule");
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
try {
nova.getClient().securityGroups().deleteSecurityGroupRule(rule.getId()).execute();
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
}
use of com.woorea.openstack.base.client.OpenStackBaseException in project AJSC by att.
the class OpenStackComputeService method moveServer.
/**
* @see com.att.cdp.zones.ComputeService#moveServer(java.lang.String,
* java.lang.String)
*/
@Override
public void moveServer(String serverId, String targetHostId) 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 {
if (targetHostId != null && targetHostId.length() > 0) {
nova.getClient().servers().evacuate(serverId, targetHostId).execute();
} else {
nova.getClient().servers().evacuate(serverId).execute();
}
} catch (OpenStackBaseException ex) {
ExceptionMapper.mapException(ex);
}
}
Aggregations