Examples of DriveInfo


Examples of org.jclouds.cloudsigma2.domain.DriveInfo

      }
   }

   @Test(dependsOnMethods = {"testCreateDrive"})
   public void testEditDrive() throws Exception {
      DriveInfo editedDrive = new DriveInfo.Builder()
            .name("Edited Drive")
            .size(createdDrive.getSize())
            .media(MediaType.DISK)
            .build();
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

                  .build(),
            responseBuilder()
                  .payload(payloadFromResourceWithContentType("/drive-info.json", MediaType.APPLICATION_JSON))
                  .build());

      DriveInfo result = api.getDriveInfo(uuid);
      assertNotNull(result);
      assertEquals(result.getName(), "test_drive_1");
      assertEquals(result.getJobs().get(0).getResourceUri(),
            "/api/2.0/jobs/ec01d3bc-1ec0-440d-a1c3-0a6421d0d511/");
      assertEquals(result.getJobs().get(0).getUuid(), "ec01d3bc-1ec0-440d-a1c3-0a6421d0d511");
     
      assertEquals(result.getJobs().get(2).getResourceUri(),
            "/api/2.0/jobs/8bacb5b3-6392-4f74-8094-ba3376a3f5f7/");
      assertEquals(result.getJobs().get(2).getUuid(), "8bacb5b3-6392-4f74-8094-ba3376a3f5f7");
   }
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

                  .build(),
            responseBuilder()
                  .payload(payloadFromResourceWithContentType("/drives-single.json", MediaType.APPLICATION_JSON))
                  .build());

      DriveInfo result = api.createDrive(new DriveInfo.Builder()
            .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
            .name("test_drive_0")
            .size(new BigInteger("1024000000"))
            .allowMultimount(false)
            .build());
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

                  .build(),
            responseBuilder()
                  .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
                  .build());

      DriveInfo result = api.editDrive(uuid, new DriveInfo.Builder()
            .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
            .name("test_drive_0")
            .size(new BigInteger("1024000000"))
            .allowMultimount(false)
            .build());
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

                  .build(),
            responseBuilder()
                  .payload(payloadFromResourceWithContentType("/drives-detail.json", MediaType.APPLICATION_JSON))
                  .build());

      DriveInfo result = api.cloneDrive(uuid, new DriveInfo.Builder()
            .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
            .name("test_drive_0")
            .size(new BigInteger("1024000000"))
            .allowMultimount(false)
            .build());
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

                  .build(),
            responseBuilder()
                  .payload(payloadFromResourceWithContentType("/libdrives-single.json", MediaType.APPLICATION_JSON))
                  .build());

      DriveInfo result = api.cloneLibraryDrive(uuid, new LibraryDrive.Builder()
            .media(org.jclouds.cloudsigma2.domain.MediaType.DISK)
            .name("test_drive_0")
            .size(new BigInteger("1024000000"))
            .allowMultimount(false)
            .build());
View Full Code Here

Examples of org.jclouds.cloudsigma2.domain.DriveInfo

   }

   @Override
   public <R extends HttpRequest> R bindToRequest(R request, Object payload) {
      checkArgument(payload instanceof DriveInfo, "this binder is only valid for DriveInfo!");
      DriveInfo create = DriveInfo.class.cast(payload);
      JsonObject driveJson = createDriveRequestToJson.apply(create);

      request.setPayload(driveJson.toString());
      request.getPayload().getContentMetadata().setContentType(MediaType.APPLICATION_JSON);
      return request;
View Full Code Here

Examples of org.jclouds.elasticstack.domain.DriveInfo

      @Override
      public Volume apply(Device input) {
         VolumeBuilder builder = new VolumeBuilder();
         builder.id(input.getId());
         try {
            DriveInfo drive = cache.getUnchecked(input.getDriveUuid());
            builder.size(drive.getSize() / (float) (1024 * 1024));
         } catch (NullPointerException e) {
            logger.debug("drive %s not found", input.getDriveUuid());
         } catch (UncheckedExecutionException e) {
            logger.warn(e, "error finding drive %s: %s", input.getDriveUuid(), e.getMessage());
         }
View Full Code Here

Examples of org.jclouds.elasticstack.domain.DriveInfo

         String imageId = null;
         String bootDeviceId = Iterables.get(from.getBootDeviceIds(), 0);
         Device bootDevice = from.getDevices().get(bootDeviceId);
         if (bootDevice != null) {
            try {
               DriveInfo drive = cache.getUnchecked(bootDevice.getDriveUuid());
               imageId = drive.getName();
            } catch (NullPointerException e) {
               logger.debug("drive %s not found", bootDevice.getDriveUuid());
            } catch (UncheckedExecutionException e) {
               logger.warn(e, "error finding drive %s: %s", bootDevice.getDriveUuid(), e.getMessage());
            }
View Full Code Here

Examples of org.jclouds.elasticstack.domain.DriveInfo

   @Override
   public NodeAndInitialCredentials<ServerInfo> createNodeWithGroupEncodedIntoName(String tag, String name, Template template) {
      long bootSize = (long) (template.getHardware().getVolumes().get(0).getSize() * 1024 * 1024 * 1024l);

      logger.debug(">> creating boot drive bytes(%d)", bootSize);
      DriveInfo drive = client
            .createDrive(new Drive.Builder().name(template.getImage().getId()).size(bootSize).build());
      logger.debug("<< drive(%s)", drive.getUuid());

      logger.debug(">> imaging boot drive source(%s)", template.getImage().getId());
      client.imageDrive(template.getImage().getId(), drive.getUuid(), ImageConversionType.GUNZIP);
      boolean success = driveNotClaimed.apply(drive);
      logger.debug("<< imaged (%s)", success);
      if (!success) {
         client.destroyDrive(drive.getUuid());
         throw new IllegalStateException("could not image drive in time!");
      }

      Server toCreate = small(name, drive.getUuid(), defaultVncPassword).mem(template.getHardware().getRam())
               .cpu((int) (template.getHardware().getProcessors().get(0).getSpeed()))
               .tags(template.getOptions().getTags()).userMetadata(template.getOptions().getUserMetadata()).build();

      ServerInfo from = client.createServer(toCreate);
      client.startServer(from.getUuid());
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.