Package com.vmware.aurora.composition

Examples of com.vmware.aurora.composition.CreateVmSP


            new ReplaceVmPrePowerOn(node.getMoId(), node.getVmName(),
                  clusterSpec.getNodeGroup(groupName).getStorage().getShares(),
                  createSchema.networkSchema, createSchema.diskSchema, ha, ft);

      // power on the new vm, but not wait for ip address here. we have startVmStep to wait for ip
      return new CreateVmSP(node.getVmName() + RECOVERY_VM_NAME_POSTFIX,
            createSchema, VcVmUtil.getTargetRp(clusterSpec.getName(),
                  groupName, node), getTargetDatastore(fullDiskSet),
            prePowerOn, null, guestVariable, false, getTargetFolder(node),
            getTargetHost(node));
   }
View Full Code Here


         fullDiskSet.add(disk.toDiskSpec());
      }
      fullDiskSet.removeAll(replacementDisks);
      fullDiskSet.addAll(replacementDisks);

      CreateVmSP cloneVmSp =
            getReplacementVmSp(spec, groupName, node, fullDiskSet);

      CompensateCreateVmSP deleteVmSp = new CompensateCreateVmSP(cloneVmSp);

      Pair<Callable<Void>, Callable<Void>>[] storeProcedures = new Pair[1];
      storeProcedures[0] =
            new Pair<Callable<Void>, Callable<Void>>(cloneVmSp, deleteVmSp);

      // execute store procedures to create VMs
      logger.info("ClusterHealService, start to create replacement vm for node "
            + nodeName);
      Pair<ExecutionResult, ExecutionResult>[] result;
      try {
         result =
               Scheduler
                     .executeStoredProcedures(
                           com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,
                           storeProcedures, 1, null);

         if (result == null) {
            logger.error("vm creation failed for node " + nodeName);
            return null;
         }

         Pair<ExecutionResult, ExecutionResult> pair = result[0];
         CreateVmSP sp = (CreateVmSP) storeProcedures[0].first;
         if (pair.first.finished && pair.first.throwable == null
               && pair.second.finished == false) {
            VcVirtualMachine vm = sp.getVM();
            AuAssert.check(vm != null);
            return vm;
         } else if (pair.first.throwable != null) {
            logger.error(
                  "Failed to create replacement virtual machine for node " + node.getVmName(),
View Full Code Here

            r = new ExecutionResult(true, null);
            if (operation == VmOperation.CREATE_FOLDER) {
               CreateVMFolderSP sp = (CreateVMFolderSP)storedProcedures[i];
               setReturnFolder(sp);
            } else if (operation == VmOperation.CREATE_VM) {
               CreateVmSP sp = (CreateVmSP)storedProcedures[i];
               setReturnVM(sp);
            }
            r = new ExecutionResult(true, null);
         } else {
            r = new ExecutionResult(true, new Throwable("test failure"));
View Full Code Here

      for (int i = 0; i < result.length; i++) {
         ExecutionResult f = null;
         ExecutionResult s = null;
         if (flag) {
            if (operation == VmOperation.CREATE_VM) {
               CreateVmSP sp = (CreateVmSP)storedProcedures[i].first;
               setReturnVM(sp);
            }
            f = new ExecutionResult(true, null);
            s = new ExecutionResult(false, null);
         } else {
View Full Code Here

      Pair<Callable<Void>, Callable<Void>>[] storeProcedures =
            new Pair[consumers.size()];

      for (int i = 0; i < consumers.size(); i++) {
         VmCreateSpec consumer = consumers.get(i);
         CreateVmSP cloneVmSp =
               new CreateVmSP(consumer.getVmName(), consumer.getSchema(),
                     consumer.getTargetRp(), consumer.getTargetDs(),
                     consumer.getPrePowerOn(), consumer.getPostPowerOn(),
                     consumer.getBootupConfigs(), false,
                     consumer.getTargetFolder(), consumer.getTargetHost());
         CompensateCreateVmSP deleteVmSp = new CompensateCreateVmSP(cloneVmSp);
         storeProcedures[i] =
               new Pair<Callable<Void>, Callable<Void>>(cloneVmSp, deleteVmSp);
      }

      try {
         // execute store procedures to create VMs
         logger.info("ClusterCloneService, start to create vms.");
         Pair<ExecutionResult, ExecutionResult>[] result =
               Scheduler
                     .executeStoredProcedures(
                           com.vmware.aurora.composition.concurrent.Priority.BACKGROUND,
                           storeProcedures, storeProcedures.length, callback);
         if (result == null) {
            logger.error("No VM is created.");
            return null;
         }

         int total = 0;
         List<VmCreateResult<?>> cloned = new ArrayList<VmCreateResult<?>>();
         for (int i = 0; i < storeProcedures.length; i++) {
            Pair<ExecutionResult, ExecutionResult> pair = result[i];
            VmCreateResult<VmCreateSpec> createResult = new VmCreateResult<VmCreateSpec>();
            VmCreateSpec node = consumers.get(i);
            createResult.setSpec(node);
            CreateVmSP sp = (CreateVmSP) storeProcedures[i].first;
            if (sp.getVM() != null) {
               node.setVmId(sp.getVM().getId());
            }
            if (pair.first.finished && pair.first.throwable == null
                  && pair.second.finished == false) {
               ++total;
               createResult.setSuccess(true);
View Full Code Here

TOP

Related Classes of com.vmware.aurora.composition.CreateVmSP

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.