Examples of VolumeAttachment


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

      ).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

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

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

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

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

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

            boolean foundIt = false;
            for (VolumeAttachment att : attachments) {
               VolumeAttachment details = volumeAttachmentApi.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

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

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

   private void attachVolume(Volume volume, NodeMetadata node) throws TimeoutException {
      System.out.format("Create Volume Attachment%n");

      // Note the use of NodeMetadata.getProviderId()
      // This is necessary as NodeMetadata.getId() will return a Location/Id combination
      VolumeAttachment volumeAttachment = volumeAttachmentApi
            .attachVolumeToServerAsDevice(volume.getId(), node.getProviderId(), DEVICE);

      // Wait for the volume to become Attached (aka In Use) before moving on
      if (!VolumePredicates.awaitInUse(volumeApi).apply(volume)) {
         throw new TimeoutException("Timeout on volume: " + volume);
View Full Code Here

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

    */
   public static void main(String[] args) throws IOException {
      DetachVolume detachVolume = new DetachVolume(args[0], args[1]);

      try {
         VolumeAttachment volumeAttachment = detachVolume.getVolumeAttachment();
         detachVolume.unmountVolume(volumeAttachment);
         detachVolume.detachVolume(volumeAttachment);
      }
      catch (Exception e) {
         e.printStackTrace();
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.