Package org.platformlayer.ops

Examples of org.platformlayer.ops.OpsTarget.executeCommand()


    FileUpload.upload(target, fstabFile, fstab);

    target.mkdir(cgroupsFile);

    Command mountCommand = Command.build("mount cgroup");
    target.executeCommand(mountCommand);

    // mkdir /cgroup
    // echo -e "cgroup\t/cgroup\tcgroup\tdefaults\t0\t0" >> /etc/fstab
    // mount cgroup
  }
View Full Code Here


          drive.media = "disk";

          OpsTarget target = OpsContext.get().getInstance(OpsTarget.class);
          ProcessExecution fileCommand;
          try {
            fileCommand = target.executeCommand(Command.build("file --brief {0}", getImagePath()));
          } catch (OpsException e) {
            throw new IllegalStateException("Error querying file type", e);
          }
          String fileStdout = fileCommand.getStdOut();
          if (fileStdout.contains("QCOW Image")) {
View Full Code Here

      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));
View Full Code Here

      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));
View Full Code Here

      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));
View Full Code Here

      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
View Full Code Here

      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"));
View Full Code Here

      // 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));
View Full Code Here

      // // 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);
        }
View Full Code Here

      }

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