Package org.platformlayer.service.cloud.direct.ops.kvm.monitor.KvmConfig

Examples of org.platformlayer.service.cloud.direct.ops.kvm.monitor.KvmConfig.KvmDrive


      @Override
      public List<KvmDrive> get() {
        List<KvmDrive> drives = Lists.newArrayList();

        {
          KvmDrive drive = new KvmDrive();
          drive.path = getImagePath().getAbsolutePath();
          drive.id = "0";
          drive.boot = true;
          drive.format = "raw";
          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")) {
            drive.format = "qcow2";
          }

          drives.add(drive);
        }
        {
          KvmDrive drive = new KvmDrive();

          drive.path = getConfigIsoPath().getAbsolutePath();
          drive.id = "config";
          drive.boot = false;
          drive.format = "raw";
View Full Code Here

TOP

Related Classes of org.platformlayer.service.cloud.direct.ops.kvm.monitor.KvmConfig.KvmDrive

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.