コード例 #1
0
 @Override
 public Volume apply(Device input) {
   VolumeBuilder builder = new VolumeBuilder();
   builder.id(input.getId());
   DriveInfo drive = cache.get(input.getDriveUuid());
   if (drive != null) {
     builder.size(drive.getSize() / 1024 / 1024f);
   }
   return new VolumeBuilder().durable(true).type(Volume.Type.NAS).build();
 }
コード例 #2
0
  @Override
  public NodeAndInitialCredentials<ServerInfo> createNodeWithGroupEncodedIntoName(
      String tag, String name, Template template) {
    long bootSize =
        (long) (template.getHardware().getVolumes().get(0).getSize() * 1024 * 1024 * 1024l);
    AffinityType affinityType = AffinityType.HDD;
    if (template.getOptions() instanceof CloudSigmaTemplateOptions) {
      CloudSigmaTemplateOptions options =
          CloudSigmaTemplateOptions.class.cast(template.getOptions());
      affinityType = options.getDiskDriveAffinity();
    }
    logger.debug(
        ">> imaging boot drive source(%s) bytes(%d) affinityType(%s)",
        template.getImage().getId(), bootSize, affinityType);
    DriveInfo drive =
        client.cloneDrive(
            template.getImage().getId(),
            template.getImage().getId(),
            new CloneDriveOptions().size(bootSize).affinity(affinityType));
    boolean success = driveNotClaimed.apply(drive);
    logger.debug("<< image(%s) complete(%s)", drive.getUuid(), success);
    if (!success) {
      client.destroyDrive(drive.getUuid());
      throw new IllegalStateException("could not image drive in time!");
    }

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

    logger.debug(">> creating server");
    ServerInfo from = client.createServer(toCreate);
    logger.debug("<< created server(%s)", from.getUuid());
    logger.debug(">> starting server(%s)", from.getUuid());
    client.startServer(from.getUuid());
    return new NodeAndInitialCredentials<ServerInfo>(
        from,
        from.getUuid(),
        LoginCredentials.builder().password(defaultVncPassword).authenticateSudo(true).build());
  }
コード例 #3
0
ファイル: DriveInfo.java プロジェクト: nterry/jclouds-1
 public static Builder fromDriveInfo(DriveInfo in) {
   return new Builder()
       .uuid(in.getUuid())
       .name(in.getName())
       .size(in.getSize())
       .claimType(in.getClaimType())
       .readers(in.getReaders())
       .use(in.getUse())
       .status(in.getStatus())
       .user(in.getUser())
       .claimed(in.getClaimed())
       .encryptionCipher(in.getEncryptionCipher())
       .imaging(in.getImaging())
       .metrics(in.getMetrics())
       .autoexpanding(in.getAutoexpanding())
       .bits(in.getBits())
       .description(in.getDescription())
       .encryptionKey(in.getEncryptionKey())
       .free(in.getFree())
       .installNotes(in.getInstallNotes())
       .type(in.getType())
       .url(in.getUrl());
 }
コード例 #4
0
 @Override
 public boolean apply(DriveInfo drive) {
   return drive.getType().equals(DriveType.DISK)
       && drive.getDriveType().contains("preinstalled");
 }