Package org.jclouds.openstack.quantum.v1_0.domain

Examples of org.jclouds.openstack.quantum.v1_0.domain.Attachment


   public Attachment getResult() {
      String region = AWSUtils.findRegionInArgsOrNull(getRequest());
      if (region == null)
         region = defaultRegion.get();
      return new Attachment(region, volumeId, instanceId, device, attachmentStatus, attachTime);
   }
View Full Code Here


            VOLUME_SIZE);
      System.out.printf("%d: %s awaiting volume to become available%n", System.currentTimeMillis(), volume.getId());

      assert volumeTester.apply(volume);

      Attachment attachment = client.getElasticBlockStoreApi().get().attachVolumeInRegion(instance.getRegion(),
            volume.getId(), instance.getId(), "/dev/sdh");

      System.out.printf("%d: %s awaiting attachment to complete%n", System.currentTimeMillis(), attachment.getId());

      assert attachTester.apply(attachment);
      System.out.printf("%d: %s attachment complete%n", System.currentTimeMillis(), attachment.getId());
   }
View Full Code Here

               Volume.Status.AVAILABLE, dateService.iso8601DateParse("2009-12-28T05:42:53.000Z"),
               Sets.<Attachment> newLinkedHashSet()));
      expected.add(new Volume(defaultRegion, "vol-4282672b", 800, "snap-536d1b3a",
               "us-east-1a", Volume.Status.IN_USE, dateService
                        .iso8601DateParse("2008-05-07T11:51:50.000Z"), Sets
                        .<Attachment> newHashSet(new Attachment(defaultRegion, "vol-4282672b", "i-6058a509",
                                 "/dev/sdh", Attachment.Status.ATTACHED, dateService
                                          .iso8601DateParse("2008-05-07T12:51:50.000Z")))));

      DescribeVolumesResponseHandler handler = injector
               .getInstance(DescribeVolumesResponseHandler.class);
View Full Code Here

      volumeDetached = new VolumeDetached(client);
   }

   @Test
   public void testVolumeWithEmptyListOfAttachments() {
      Attachment attachment = newAttachmentWithStatus(Status.ATTACHED);
      Set<Volume> volumes = newHashSet(newVolumeWithAttachments(/* empty */));

      expect(client.describeVolumesInRegion(attachment.getRegion(),
         attachment.getVolumeId())).andReturn(volumes);
      replay(client);

      assertTrue(volumeDetached.apply(attachment));
      verify(client);
   }
View Full Code Here

      };
   }

   @Test(dataProvider = "notDetachedStatuses")
   public void testWithDifferentStatus(Status attachmentStatus) {
      Attachment attachment = newAttachmentWithStatus(attachmentStatus);
      Set<Volume> volumes = newHashSet(newVolumeWithAttachments(attachment));

      expect(client.describeVolumesInRegion(attachment.getRegion(),
         attachment.getVolumeId())).andReturn(volumes);
      replay(client);

      assertFalse(volumeDetached.apply(attachment));
      verify(client);
   }
View Full Code Here

      verify(client);
   }

   @Test
   public void testWithStatusDetached() {
      Attachment attachment = newAttachmentWithStatus(Status.DETACHED);
      Set<Volume> volumes = newHashSet(newVolumeWithAttachments(attachment));

      expect(client.describeVolumesInRegion(attachment.getRegion(),
         attachment.getVolumeId())).andReturn(volumes);
      replay(client);

      assertTrue(volumeDetached.apply(attachment));
      verify(client);
   }
View Full Code Here

public class AttachmentHandlerTest extends BaseEC2HandlerTest {
   public void testApplyInputStream() {
      DateService dateService = injector.getInstance(DateService.class);
      InputStream is = getClass().getResourceAsStream("/attach.xml");

      Attachment expected = new Attachment(defaultRegion, "vol-4d826724", "i-6058a509", "/dev/sdh",
            Attachment.Status.ATTACHING, dateService.iso8601DateParse("2008-05-07T11:51:50.000Z"));

      AttachmentHandler handler = injector.getInstance(AttachmentHandler.class);
      addDefaultRegionToHandler(handler);
      Attachment result = factory.create(handler).parse(is);

      assertEquals(result, expected);
   }
View Full Code Here

      Volume volume = Iterables.getOnlyElement(client.describeVolumesInRegion(attachment
               .getRegion(), attachment.getVolumeId()));
      if (volume.getAttachments().size() == 0) {
         return false;
      }
      Attachment lastAttachment = Sets.newTreeSet(volume.getAttachments()).last();
      logger.trace("%s: looking for status %s: currently: %s", lastAttachment,
               Attachment.Status.ATTACHED, lastAttachment.getStatus());
      return lastAttachment.getStatus() == Attachment.Status.ATTACHED;
   }
View Full Code Here

      }

      /* But if attachment size is > 0, then the attachment could be in any state.
         * So we need to check if the status is DETACHED (return true) or not (return false).
         */
      Attachment lastAttachment = getLast(volume.getAttachments());
      logger.trace("%s: looking for status %s: currently: %s", lastAttachment,
              Attachment.Status.DETACHED, lastAttachment.getStatus());
      return lastAttachment.getStatus() == Attachment.Status.DETACHED;
   }
View Full Code Here

         iops = Integer.parseInt(currentText.toString().trim());
      } else if (qName.equals("encrypted")) {
         encrypted = Boolean.parseBoolean(currentText.toString().trim());
      } else if (qName.equals("item")) {
         if (inAttachmentSet) {
            attachments.add(new Attachment(region, volumeId, instanceId, device, attachmentStatus, attachTime));
            volumeId = null;
            instanceId = null;
            device = null;
            attachmentStatus = null;
            attachTime = null;
View Full Code Here

TOP

Related Classes of org.jclouds.openstack.quantum.v1_0.domain.Attachment

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.