Search in sources :

Example 6 with VolumeService

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

the class OpenStackServer method loadVolumeAttachments.

/**
 * This method is called to load the volume attachments, if they have not already been loaded. If they have 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 volume cannot be listed, or a volume does not exist
 */
private void loadVolumeAttachments(Context context) throws ZoneException {
    if (volumeAttachmentsProcessed.compareAndSet(false, true)) {
        VolumeService volumeService = context.getVolumeService();
        ComputeService computeService = context.getComputeService();
        Map<String, String> attachments = computeService.getAttachments(getId());
        for (Entry<String, String> entry : attachments.entrySet()) {
            Volume volume = volumeService.getVolume(entry.getValue());
            getVolumes().put(entry.getKey(), volume);
        }
    }
}
Also used : Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) ComputeService(com.att.cdp.zones.ComputeService)

Example 7 with VolumeService

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

the class TestVolumeService method listVolumes.

/**
 * @throws ZoneException
 */
@Test
@Ignore
public void listVolumes() throws ZoneException {
    Context context = connect();
    VolumeService service = context.getVolumeService();
    List<Volume> volumes = service.getVolumes();
    assertNotNull(volumes);
    for (Volume volume : volumes) {
        assertNotNull(service.getVolume(volume.getId()));
        assertNotNull(service.getVolumes(volume.getName()));
        if (volume.getStatus().equals(Volume.Status.ERROR)) {
            System.out.printf("%-12s: %s\n", volume.getName(), volume.getId());
        }
    }
}
Also used : Context(com.att.cdp.zones.Context) Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 8 with VolumeService

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

the class TestVolumeService method listVolume.

@Test
@Ignore
public void listVolume() throws ZoneException {
    Context context = connect();
    VolumeService service = context.getVolumeService();
    String id = "15afc83f-557c-42d6-8a23-f357bf767f61";
    Volume volumes = service.getVolume(id);
    assertNotNull(volumes);
    System.out.println("::DONE::");
}
Also used : Context(com.att.cdp.zones.Context) Volume(com.att.cdp.zones.model.Volume) VolumeService(com.att.cdp.zones.VolumeService) Ignore(org.junit.Ignore) Test(org.junit.Test)

Aggregations

VolumeService (com.att.cdp.zones.VolumeService)8 Ignore (org.junit.Ignore)6 Test (org.junit.Test)6 Context (com.att.cdp.zones.Context)5 Volume (com.att.cdp.zones.model.Volume)5 ComputeService (com.att.cdp.zones.ComputeService)2 GlanceConnector (com.att.cdp.openstack.connectors.GlanceConnector)1 NovaConnector (com.att.cdp.openstack.connectors.NovaConnector)1 QuantumConnector (com.att.cdp.openstack.connectors.QuantumConnector)1 OpenStackComputeService (com.att.cdp.openstack.v2.OpenStackComputeService)1 IdentityService (com.att.cdp.zones.IdentityService)1 ImageService (com.att.cdp.zones.ImageService)1 NetworkService (com.att.cdp.zones.NetworkService)1 SnapshotService (com.att.cdp.zones.SnapshotService)1 StackService (com.att.cdp.zones.StackService)1 Tenant (com.att.cdp.zones.model.Tenant)1