Examples of VolumeAttachment


Examples of com.amazonaws.services.ec2.model.VolumeAttachment

                continue;
            }

            Map<String, String> janitorMetadata = parseJanitorTag(tags);
            // finding the instance attached most recently.
            VolumeAttachment latest = null;
            for (VolumeAttachment attachment : attachments) {
                if (latest == null || latest.getAttachTime().before(attachment.getAttachTime())) {
                    latest = attachment;
                }
            }
            if (latest != null) {
                instanceId = latest.getInstanceId();
                owner = getOwnerEmail(instanceId, janitorMetadata, tags, awsClient);
            }

            if (latest == null || "detached".equals(latest.getState())) {
                if (janitorMetadata.get(JanitorMonkey.DETACH_TIME_TAG_KEY) == null) {
                    // There is no attached instance and the last detached time is not set.
                    // Use the current time as the last detached time.
                    LOGGER.info(String.format("Setting the last detached time to %s for volume %s",
                            now, volume.getVolumeId()));
View Full Code Here

Examples of com.woorea.openstack.nova.model.VolumeAttachment

    }

  }

  public AttachVolume attachVolume(String serverId, String volumeId, String device) {
    VolumeAttachment volumeAttachment = new VolumeAttachment();
    volumeAttachment.setVolumeId(volumeId);
    volumeAttachment.setDevice(device);
    return new AttachVolume(serverId, volumeAttachment);
  }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

      return null;
    }
   
    RestContext<NovaApi, NovaAsyncApi> nova = context.unwrap();
        VolumeAttachmentApi api = nova.getApi().getVolumeAttachmentExtensionForZone(region).get();
        VolumeAttachment attachment = api.attachVolumeToServerAsDevice(volumeId, instanceId, device);
       
        if (attachment == null) {
      log.fatal("Volume [id]: "+volumeId+" attachment for instance [id]: "+instanceId
          +" was unsuccessful. [region] : " + region
          + " of Iaas : " + iaasInfo);
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

      ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();

      Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
      assertEquals(attachments, ImmutableSet.of(testAttachment()));
      // double-check individual fields
      VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
      assertEquals(attachment.getDevice(), "/dev/vdc");
      assertEquals(attachment.getServerId(), "b4785058-cb80-491b-baa3-e4ee6546450e");
      assertEquals(attachment.getId(), "1");
      assertEquals(attachment.getVolumeId(), "1");
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
      ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();

      VolumeAttachment attachment = api.getAttachmentForVolumeOnServer("1", "instance-1");
      assertEquals(attachment, testAttachment());
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

            authenticatedGET().endpoint(endpoint).method("POST")
                  .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
      ).getVolumeAttachmentExtensionForZone("az-1.region-a.geo-1").get();

      VolumeAttachment result = api.attachVolumeToServerAsDevice("1", "instance-1", "/dev/vdc");
      assertEquals(result, testAttachment());
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      Set<? extends VolumeAttachment> attachments = api.listAttachmentsOnServer("instance-1").toSet();
      assertEquals(attachments, ImmutableSet.of(testAttachment()));
      // double-check individual fields
      VolumeAttachment attachment = Iterables.getOnlyElement(attachments);
      assertEquals(attachment.getDevice(), "/dev/vdc");
      assertEquals(attachment.getServerId(), "b4785058-cb80-491b-baa3-e4ee6546450e");
      assertEquals(attachment.getId(), "1");
      assertEquals(attachment.getVolumeId(), "1");
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

            responseWithKeystoneAccess, extensionsOfNovaRequest, extensionsOfNovaResponse,
            authenticatedGET().endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      VolumeAttachment attachment = api.getAttachmentForVolumeOnServer("1", "instance-1");
      assertEquals(attachment, testAttachment());
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

            authenticatedGET().endpoint(endpoint).method("POST")
                  .payload(payloadFromStringWithContentType("{\"volumeAttachment\":{\"volumeId\":\"1\",\"device\":\"/dev/vdc\"}}", MediaType.APPLICATION_JSON)).endpoint(endpoint).build(),
            HttpResponse.builder().statusCode(200).payload(payloadFromResource("/attachment_details.json")).build()
      ).getVolumeExtensionForZone("az-1.region-a.geo-1").get();

      VolumeAttachment result = api.attachVolumeToServerAsDevice("1", "instance-1", "/dev/vdc");
      assertEquals(result, testAttachment());
   }
View Full Code Here

Examples of org.jclouds.openstack.nova.v2_0.domain.VolumeAttachment

            Set<? extends VolumeAttachment> attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
            assertNotNull(attachments);
            final int before = attachments.size();

            VolumeAttachment testAttachment = volumeOption.get().attachVolumeToServerAsDevice(testVolume.getId(),
                     serverId, "/dev/vdf");
            assertNotNull(testAttachment.getId());
            assertEquals(testAttachment.getVolumeId(), testVolume.getId());

            assertTrue(retry(new Predicate<VolumeApi>() {
               public boolean apply(VolumeApi volumeApi) {
                  return volumeOption.get().listAttachmentsOnServer(serverId).size() > before;
               }
            }, 60 * 1000L).apply(volumeOption.get()));

            attachments = volumeOption.get().listAttachmentsOnServer(serverId).toSet();
            assertNotNull(attachments);
            assertEquals(attachments.size(), before + 1);

            assertEquals(volumeOption.get().get(testVolume.getId()).getStatus(), Volume.Status.IN_USE);

            boolean foundIt = false;
            for (VolumeAttachment att : attachments) {
               VolumeAttachment details = volumeOption.get()
                        .getAttachmentForVolumeOnServer(att.getVolumeId(), serverId);
               assertNotNull(details);
               assertNotNull(details.getId());
               assertNotNull(details.getServerId());
               assertNotNull(details.getVolumeId());
               if (Objects.equal(details.getVolumeId(), testVolume.getId())) {
                  foundIt = true;
                  assertEquals(details.getDevice(), "/dev/vdf");
                  assertEquals(details.getServerId(), serverId);
               }
            }

            assertTrue(foundIt, "Failed to find the attachment we created in listAttachments() response");

View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.