Package org.jclouds.elasticstack.domain

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


         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

   @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

   @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);

      boolean success = driveNotClaimed.apply(drive);
      if (!success) {
         client.destroyDrive(drive.getUuid());
         throw new IllegalStateException(String.format("could not create drive %s in time!", drive));
      }

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

      template.getOptions().userMetadata(ComputeServiceConstants.NODE_GROUP_KEY, tag);

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

View Full Code Here

   @Test
   public void testCreateDrive() throws Exception {
      drive = client.createDrive(new CreateDriveRequest.Builder().name(prefix).size(driveSize).build());
      checkCreatedDrive();

      DriveInfo newInfo = client.getDriveInfo(drive.getUuid());
      checkDriveMatchesGet(newInfo);

   }
View Full Code Here

   }

   @Test(dependsOnMethods = "testCreateDrive")
   public void testSetDriveData() throws Exception {

      DriveInfo drive2 = client.setDriveData(drive.getUuid(), new DriveData.Builder().claimType(ClaimType.SHARED).name(
               "rediculous").readers(ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff")).tags(
               ImmutableSet.of("networking", "security", "gateway")).userMetadata(ImmutableMap.of("foo", "bar"))
               .build());

      assertNotNull(drive2.getUuid(), drive.getUuid());
      assertEquals(drive2.getName(), "rediculous");
      assertEquals(drive2.getClaimType(), ClaimType.SHARED);
      assertEquals(drive2.getReaders(), ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff"));
      assertEquals(drive2.getTags(), ImmutableSet.of("networking", "security", "gateway"));
      assertEquals(drive2.getUserMetadata(), ImmutableMap.of("foo", "bar"));
      drive = drive2;
   }
View Full Code Here

   @Test
   public void testCreateDrive() throws Exception {
      drive = client.createDrive(new CreateDriveRequest.Builder().name(prefix).size(driveSize).build());
      checkCreatedDrive();

      DriveInfo newInfo = client.getDriveInfo(drive.getUuid());
      checkDriveMatchesGet(newInfo);

   }
View Full Code Here

   }

   @Test(dependsOnMethods = "testCreateDrive")
   public void testSetDriveData() throws Exception {

      DriveInfo drive2 = client.setDriveData(drive.getUuid(), new DriveData.Builder().claimType(ClaimType.SHARED).name(
               "rediculous").readers(ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff")).tags(
               ImmutableSet.of("networking", "security", "gateway")).userMetadata(ImmutableMap.of("foo", "bar"))
               .build());

      assertNotNull(drive2.getUuid(), drive.getUuid());
      assertEquals(drive2.getName(), "rediculous");
      assertEquals(drive2.getClaimType(), ClaimType.SHARED);
      assertEquals(drive2.getReaders(), ImmutableSet.of("ffffffff-ffff-ffff-ffff-ffffffffffff"));
      assertEquals(drive2.getTags(), ImmutableSet.of("networking", "security", "gateway"));
      assertEquals(drive2.getUserMetadata(), ImmutableMap.of("foo", "bar"));
      drive = drive2;
   }
View Full Code Here

      @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

         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

TOP

Related Classes of org.jclouds.elasticstack.domain.DriveInfo

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.