use of com.att.cdp.zones.model.Hypervisor in project AJSC by att.
the class OpenStackComputeService method getHypervisors.
/**
* @see com.att.cdp.zones.ComputeService#getHypervisors()
*/
@Override
public List<Hypervisor> getHypervisors() throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
ArrayList<Hypervisor> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Hypervisors hypervisors = nova.getClient().hypervisors().list(true).execute();
for (com.woorea.openstack.nova.model.Hypervisor h : hypervisors.getList()) {
list.add(new OpenStackHypervisor(context, h));
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.model.Hypervisor in project AJSC by att.
the class TestComputeService method testListHypervisors.
/**
* This test case is designed to simply list the existing hypervisors.
*
* @throws ZoneException
* If something goes horribly wrong
*/
@SuppressWarnings("nls")
@Ignore
@Test
public void testListHypervisors() throws ZoneException {
Context context = connect();
ComputeService computeService = context.getComputeService();
List<Hypervisor> hypervisors = computeService.getHypervisors();
for (Hypervisor hypervisor : hypervisors) {
System.out.println(hypervisor.toString());
}
}
use of com.att.cdp.zones.model.Hypervisor in project AJSC by att.
the class OpenStackComputeService method getHypervisors.
/**
* @see com.att.cdp.zones.ComputeService#getHypervisors(java.lang.String)
*/
@Override
public List<Hypervisor> getHypervisors(String id) throws ZoneException {
connect();
Context context = getContext();
trackRequest();
RequestState.put(RequestState.SERVICE, "Compute");
RequestState.put(RequestState.SERVICE_URL, nova.getEndpoint());
RequestState.put(RequestState.HYPERVISOR, id);
ArrayList<Hypervisor> list = new ArrayList<>();
try {
com.woorea.openstack.nova.model.Hypervisors hypervisors = nova.getClient().hypervisors().list(true).execute();
for (com.woorea.openstack.nova.model.Hypervisor h : hypervisors.getList()) {
if (id != null) {
if (h.getId().matches(id)) {
list.add(new OpenStackHypervisor(context, h));
}
} else {
list.add(new OpenStackHypervisor(context, h));
}
}
} catch (OpenStackBaseException e) {
ExceptionMapper.mapException(e);
}
return list;
}
use of com.att.cdp.zones.model.Hypervisor in project AJSC by att.
the class TestComputeService method testGetHypervisor.
/**
* This test case is designed to simply list the details for a hypervisor.
*
* @throws ZoneException
* If something goes horribly wrong
*/
@SuppressWarnings("nls")
@Ignore
@Test
public void testGetHypervisor() throws ZoneException {
Context context = connect();
ComputeService computeService = context.getComputeService();
Hypervisor hypervisor = computeService.getHypervisor("1");
System.out.println(hypervisor.toString());
}
use of com.att.cdp.zones.model.Hypervisor in project AJSC by att.
the class OpenStackServer method loadHypervisorAttachment.
/**
* This method is called to load the hypervisor attachment, if it has not already been loaded. If it has been
* loaded, then the call is ignored.
*
* @param context
* The context that represents the connection we are servicing
* @throws ZoneException
* If the attachments cannot be obtained, or if a hypervisor cannot be listed, or a hypervisor does not
* exist
*/
private void loadHypervisorAttachment(Context context) throws ZoneException {
if (hypervisorAttachmentProcessed.compareAndSet(false, true)) {
ComputeService computeService = context.getComputeService();
List<Hypervisor> hypervisors = computeService.getHypervisors();
if (this.novaModel.getHypervisorHostname() != null && !this.novaModel.getHypervisorHostname().isEmpty()) {
String hypervisorName = this.novaModel.getHypervisorHostname();
for (Hypervisor h : hypervisors) {
if (h.getHostName().equals(hypervisorName)) {
this.setHypervisor(h);
return;
}
}
}
}
}
Aggregations