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

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


      }

      /* 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


      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

      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

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

      assert volumeTester.apply(volume);

      Attachment attachment = client.getElasticBlockStoreServices().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

        }
        if(log.isDebugEnabled()){
            log.debug("Volume " + volumeId + " became  AVAILABLE");
        }

    Attachment attachment = blockStoreApi.attachVolumeInRegion(region, volumeId, instanceId, device);

    if (attachment == null) {
      log.fatal("Volume [id]: "+volumeId+" attachment for instance [id]: "+instanceId
          +" was unsuccessful. [region] : " + region
          + ", [zone] : " + zone + " of Iaas : " + iaasInfo);
      return null;
    }
   
    log.info("Volume [id]: "+volumeId+" attachment for instance [id]: "+instanceId
        +" was successful [status]: "+attachment.getStatus().value()+". [region] : " + region
        + ", [zone] : " + zone + " of Iaas : " + iaasInfo);
    return attachment.getStatus().value();
  }
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

         device = currentText.toString().trim();
      } else if (qName.equals("attachTime")) {
         attachTime = dateCodec.toDate(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.