Examples of OperatingSystem


Examples of org.jclouds.compute.domain.OperatingSystem

      String description = checkNotNull(Iterables.getFirst(from.getRepoTags(), "image must have at least one repo tag"));

      OsFamily osFamily = osFamily().apply(description);
      String osVersion = parseVersion(description);

      OperatingSystem os = OperatingSystem.builder()
              .description(description)
              .family(osFamily)
              .version(osVersion)
              .is64Bit(is64bit(from))
              .build();
View Full Code Here

Examples of org.jclouds.compute.domain.OperatingSystem

         builder.registrant("registrant");
         builder.description("description");
         builder.id("ABCDEFGH");
         DiskImage image = builder.build();

         OperatingSystem os = new DiskImageToOperatingSystem().apply(image);

         assertNotNull(os, description);
         assertNotNull(os.getFamily(), description);
         assertNotEquals(OsFamily.UNRECOGNIZED, os.getFamily(),
               "OsFamily not recognised: " + description);
         assertNotNull(os.getVersion(), "Version not recognised: "
               + description);
         assertEquals(os.getName(), description);
         assertEquals(os.getDescription(), description);
         assertNotNull(os.getArch(), description);
      }
   }
View Full Code Here

Examples of org.jclouds.compute.domain.OperatingSystem

   @Test
   public void testOsFamilyUnrecognized() {
      DiskImage image = DiskImage.builder()
            .osName("not a known operating system").build();

      OperatingSystem os = new DiskImageToOperatingSystem().apply(image);

      assertNotNull(os);
      assertEquals(os.getFamily(), OsFamily.UNRECOGNIZED);
   }
View Full Code Here

Examples of org.jclouds.digitalocean.domain.OperatingSystem

      builder.ids(String.valueOf(input.getId()));
      builder.name(input.getName());
      builder.description(input.getName());
      builder.status(Status.AVAILABLE);

      OperatingSystem os = input.getOs();

      builder.operatingSystem(builder()
            .name(input.getName())
            .family(os.getDistribution().getOsFamily())
            .description(input.getName())
            .arch(os.getArch())
            .version(os.getVersion())
            .is64Bit(os.is64bit())
            .build());

      ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder();
      metadata.put("publicImage", String.valueOf(input.isPublicImage()));
      builder.userMetadata(metadata.build());
View Full Code Here

Examples of org.jclouds.digitalocean.domain.OperatingSystem

      builder.providerId(String.valueOf(input.getId()));
      builder.name(input.getName());
      builder.description(input.getName());
      builder.status(Status.AVAILABLE);

      OperatingSystem os = input.getOs();

      builder.operatingSystem(builder()
            .name(input.getName())
            .family(os.getDistribution().getOsFamily())
            .description(input.getName())
            .arch(os.getArch())
            .version(os.getVersion())
            .is64Bit(os.is64bit())
            .build());

      ImmutableMap.Builder<String, String> metadata = ImmutableMap.builder();
      metadata.put("publicImage", String.valueOf(input.isPublicImage()));
      builder.userMetadata(metadata.build());
View Full Code Here

Examples of org.jclouds.softlayer.domain.OperatingSystem

      // list private images and transform them to OperatingSystem
      Set<VirtualGuestBlockDeviceTemplateGroup> privateImages = api.getAccountApi().getBlockDeviceTemplateGroups();
      Map<String, SoftwareDescription> privateImagesSoftwareDescriptions = extractSoftwareDescriptions(privateImages);
      for (Map.Entry<String, SoftwareDescription> entry : privateImagesSoftwareDescriptions.entrySet()) {
         OperatingSystem os = getOperatingSystem(entry);
         if (os != null) {
            result.add(os);
         }
      }
      // list public images and transform them to OperatingSystem
      if (includePublicImages) {
         Set<VirtualGuestBlockDeviceTemplateGroup> publicImages = api.getVirtualGuestBlockDeviceTemplateGroupApi().getPublicImages();
         Map<String, SoftwareDescription> publicImagesSoftwareDescriptions = extractSoftwareDescriptions(publicImages);
         for (Map.Entry<String, SoftwareDescription> entry : publicImagesSoftwareDescriptions.entrySet()) {
            OperatingSystem os = getOperatingSystem(entry);
            if (os != null) {
               result.add(os);
            }
         }
      }
View Full Code Here

Examples of org.nasutekds.server.types.OperatingSystem

    }


    EmbeddedUtils.initializeForClientUse();

    OperatingSystem operatingSystem = DirectoryServer.getOperatingSystem();
    if (! OperatingSystem.isUNIXBased(operatingSystem))
    {
      err.println(ERR_CREATERC_ONLY_RUNS_ON_UNIX.get().toString());
      return 1;
    }
View Full Code Here

Examples of org.netbeans.modules.exceptions.entity.Operatingsystem

        em.persist(m);
        r1 = new Report(1);
        r2 = new Report(2);
        em.persist(r1);
        em.persist(r2);
        linux = new Operatingsystem(1);
        linux.setName("Linux");
        em.persist(linux);
        solaris = new Operatingsystem(2);
        solaris.setName("SunOS");
        em.persist(solaris);
    }
View Full Code Here

Examples of org.platformlayer.service.imagefactory.OperatingSystem

    String version = operatingSystemRecipe.version;
    if (Strings.isNullOrEmpty(version)) {
      version = distribution.getDefaultOsVersion();
    }

    return new OperatingSystem(distribution, version);
  }
View Full Code Here

Examples of org.platformlayer.service.imagefactory.OperatingSystem

    opsContext.setFailure(true);

    MachineProvider targetCloud = cloudHelpers.getCloud(image.cloud);
    DiskImageRecipe recipe = platformLayer.getItem(image.recipeId, DiskImageRecipe.class);

    OperatingSystem operatingSystem = getRequestedOperatingSystem(recipe);

    String kernelPackage = packageHelpers.getDefaultKernelPackage(operatingSystem);
    String filesystem = "ext3";

    ImageFormat imageFormat = EnumUtils.valueOfCaseInsensitive(ImageFormat.class, image.format);

    boolean buildTar = imageFormat == ImageFormat.Tar;

    // TODO: This logic is not intrinsically correct
    // boolean supportCloudConfigDisk = imageFormat != ImageFormat.DiskQcow2;
    boolean supportCloudConfigDisk = true;
    boolean useConfigDriveSymlinks = false;
    String configDriveLabel = "config";

    List<String> packages = Lists.newArrayList();
    packages.add("openssh-server");

    // Needed for preseeding
    packages.add("debconf-utils");

    if (operatingSystem.getDistribution() == Distribution.Debian) {
      packages.add("locales");
    }

    // We always want some basics available in our images
    packages.add("curl");

    String hostname = "openstack";

    MachineCreationRequest request = new MachineCreationRequest();

    SshKey sshKey = service.getSshKey();

    // There are problems using LXC with debootstrap
    request.hostPolicy = new HostPolicy();
    request.hostPolicy.allowRunInContainer = false;

    request.recipeId = null; // Null means 'use bootstrap image'
    request.sshPublicKey = sshKey.getKeyPair().getPublic();
    request.sshPublicKeyName = service.getSshKeyName();
    request.securityGroups = Lists.newArrayList();

    String securityGroup = service.getSecurityGroupName();
    request.securityGroups.add(securityGroup);

    // We don't need a lot of memory to build a disk image (I think!)
    request.minimumMemoryMB = 256;

    Machine machine = cloud.createInstance(request, image.getKey());

    opsContext.takeOwnership(machine);

    machine = waitForAddress(machine);
    OpsTarget target = machine.getTarget(sshKey);
    waitForTarget(target);

    File tempDir = target.createTempDir();

    apt.update(target, true);

    // We need to install curl first so we can detect the performance of our proxies
    apt.install(target, "curl"); // Needed for proxy testing at least

    CommandEnvironment httpProxyEnv = httpProxies.getHttpProxyEnvironment(target, Usage.SoftwarePackages, null);

    // For now, we assume that this image doesn't have debootstrap pre-installed
    apt.install(target, "debootstrap");

    // For transferring the file to a direct image server

    // debootstrap with LXC seems to have serious problems...
    boolean supportLxc = false;

    if (supportLxc) {
      apt.install(target, "fakechroot", "fakeroot");
    }

    Command command;

    File rootfsDir;
    File imageFile;
    File loopbackPartition = null;

    if (!buildTar) {
      apt.install(target, "mbr");
      apt.install(target, "parted");
      apt.install(target, "kpartx");
      apt.install(target, "extlinux");

      // Same with qemu-kvm
      // (needed for qemu-img convert ... a lot of extra stuff for just the
      // utils!)
      String qemuImgPackage = "qemu-utils"; // packageHelpers.getPackageFor("qemu-img", operatingSystem);
      apt.install(target, qemuImgPackage);

      // Use local ephemeral storage...
      imageFile = new File(tempDir, "image.raw");
      command = Command.build("dd if=/dev/null bs=1M seek=8180 of={0}", imageFile);
      target.executeCommand(command);

      // Create partitions
      target.executeCommand(Command.build("parted -s {0} mklabel msdos", imageFile));
      target.executeCommand(Command.build("parted -s {0} mkpart primary 0% 100%", imageFile));
      target.executeCommand(Command.build("parted -s {0} set 1 boot on", imageFile));

      // Install Master Boot Record
      target.executeCommand(Command.build("install-mbr {0}", imageFile));

      // Mount the partitions
      // Hopefully it’s loop0p1...
      target.executeCommand(Command.build("modprobe dm-mod"));

      // boolean isMounted = false;
      //
      // {
      // ProcessExecution mountExecution = target.executeCommand(Command.build("mount", imageFile));
      // String stdout = mountExecution.getStdOut();
      // System.out.println(stdout);
      //
      // for (String line : Splitter.on('\n').split(stdout)) {
      // line = line.trim();
      // if (line.isEmpty()) {
      // continue;
      // }
      //
      // List<String> tokens = Lists.newArrayList(Splitter.on(' ').split(line));
      // if (tokens.size() < 3) {
      // throw new IllegalStateException("Cannot parse mount line: " + line);
      // }
      //
      // String mountDir = tokens.get(2);
      // if (mountDir.equals(mntDir.getAbsolutePath())) {
      // isMounted = true;
      // loopbackPartition = new File(tokens.get(0));
      // break;
      // }
      // }
      //
      // // /dev/sda1 on / type ext4 (rw,errors=remount-ro)
      // // tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
      // // proc on /proc type proc (rw,noexec,nosuid,nodev)
      // // sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
      // // udev on /dev type tmpfs (rw,mode=0755)
      // // tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
      // // devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
      // // /dev/mapper/loop0p1 on /tmp/8389210e66cd0df6/mnt type ext3 (rw)
      // // proc on /tmp/8389210e66cd0df6/mnt/proc type proc (rw)
      // }
      //
      // if (!isMounted)
      {
        ProcessExecution kpartxExecution = target.executeCommand(Command.build("kpartx -av {0}", imageFile));
        String stdout = kpartxExecution.getStdOut();
        List<String> tokens = Lists.newArrayList(Splitter.on(' ').split(stdout));
        if (tokens.size() != 9) {
          throw new IllegalStateException("Cannot parse kpartx stdout: " + stdout);
        }
        // add map loop6p1 (253:6): 0 16750592 linear /dev/loop6 2048
        String partitionDevice = tokens.get(2);
        if (!partitionDevice.startsWith("loop")) {
          throw new IllegalStateException("kpartx output does not look like a partition: " + stdout);
        }
        loopbackPartition = new File("/dev/mapper/" + partitionDevice);
      }

      // Format filesystem
      command = Command.build("yes | mkfs." + filesystem + " {0}", loopbackPartition);
      command.setTimeout(TimeSpan.FIVE_MINUTES);
      target.executeCommand(command);

      // Get this onto disk now, so we don't delay later commands
      target.executeCommand(Command.build("sync").setTimeout(TimeSpan.FIVE_MINUTES));

      // Don’t force a check based on dates
      target.executeCommand(Command.build("tune2fs -i 0 {0}", loopbackPartition)
          .setTimeout(TimeSpan.FIVE_MINUTES));

      // Get this onto disk now, so we don't delay later commands
      target.executeCommand(Command.build("sync").setTimeout(TimeSpan.FIVE_MINUTES));

      // Mount on mnt/
      File mntDir = new File(tempDir, "mnt");
      target.executeCommand("mkdir {0}", mntDir);

      target.executeCommand(Command.build("mount {0} {1}", loopbackPartition, mntDir).setTimeout(
          TimeSpan.FIVE_MINUTES));

      rootfsDir = mntDir;
    } else {
      rootfsDir = new File(tempDir, "rootfs");
      imageFile = new File(tempDir, "image.tar.bz2");
    }

    if (buildTar) {
      apt.install(target, "bzip2");
    }

    // Do debootstrap

    if (supportLxc) {
      command = Command.build("fakechroot fakeroot debootstrap");
    } else {
      command = Command.build("debootstrap");
    }

    command.addLiteral("--verbose");
    command.addLiteral("--resolve-deps");
    if (supportLxc) {
      // Lxc has problems with mounting etc; fakechroot avoids this
      command.addLiteral("--variant=fakechroot");
      // command.addLiteral("--variant=minbase");
    }
    command.addQuoted("--include=", Joiner.on(",").join(packages));
    command.addLiteral(operatingSystem.getVersion());
    command.addFile(rootfsDir);
    // command.addQuoted(aptSource);

    command.setEnvironment(httpProxyEnv);
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.