Package com.vmware.aurora.vc

Examples of com.vmware.aurora.vc.VcVirtualMachine


         @Override
         protected Void body() throws Exception {
            if (node.getMoId() == null) {
               return null;
            }
            VcVirtualMachine vcVm = VcCache.getIgnoreMissing(String.valueOf(node.getMoId()));
            if (vcVm == null) {
               return null;
            }
            Map<String, String> bootupConfigs = vcVm.getGuestConfigs();
            AuAssert.check(bootupConfigs != null);

            /* serengeti operation flag - a random generated uuid
            * a script inside the vm compares this uuid with its stored value, if they are
            * different, this VM decides it's started by Serengeti, otherwise, it's started
            * by third parties.
            */
            VcVmUtil.addBootupUUID(bootupConfigs);
            vcVm.setGuestConfigs(bootupConfigs);

            return null;
         }

         protected boolean isTaskSession() {
View Full Code Here


      this.description = description;
   }

   @Override
   public Void call() throws Exception {
      final VcVirtualMachine vm = VcCache.get(vmId);
      VcContext.inVcSessionDo(new VcSession<Void>() {
         @Override
         protected Void body() throws Exception {
            VcSnapshot snap = vm.createSnapshot(name, description);
            snapId = snap.getId();
            return null;
         }
         protected boolean isTaskSession() {
            return true;
View Full Code Here

            if (index >= oldInstanceNum) {
               if (node.getVmMobId() == null) {
                  deletedNodes.add(node);
                  continue;
               }
               VcVirtualMachine vm = VcCache.getIgnoreMissing(node.getVmMobId());
               Set<String> ips = VcVmUtil.getAllIpAddresses(vm, node.getNics().keySet(), false);
               if (vm == null
                     || (!vm.isPoweredOn())
                     || ips.contains(Constants.NULL_IPV4_ADDRESS)) {
                  deletedNodes.add(node);
                  continue;
               }
            }
View Full Code Here

            // Skip templates?
            //if (vm.getConfig().isTemplate()) {
            //   continue;
            //}

            VcVirtualMachine vm = VcCache.get(rawVm._getRef());
            System.out.println("VM " + vm.getName() + ":");

            System.out.println("  managed by: " + mbToString(vm.getManagedBy()));
         }
      }
   }
View Full Code Here

   public void enumAllManagedVMs() throws Exception {
      // iterate datacenters to iterate virtual machines
      for (Datacenter dc : getDatacenters()) {
         System.out.println("DC " + dc);
         for (VirtualMachine rawVm: getVirtualMachines(dc)) {
            VcVirtualMachine vm = VcCache.get(rawVm._getRef());
            ManagedByInfo mb = vm.getManagedBy();
            if (mb != null) {
               System.out.println("VM " + vm.getName() + " is managed by " + mbToString(mb));
            }
         }
      }
   }
View Full Code Here

         for (VirtualMachine rawVm: getVirtualMachines(dc)) {
            if (!rawVm.getName().equals(mungeeName)) {
               continue;
            }

            VcVirtualMachine vm = VcCache.get(rawVm._getRef());
            System.out.println("VM " + vm.getName() + ":");

            System.out.println("  before: managed by: " + mbToString(vm.getManagedBy()));

            vm.setManagedBy(VcContext.getService().getExtensionKey(), "dbvm");

            System.out.println("  after: managed by: " + mbToString(vm.getManagedBy()));
         }
      }
   }
View Full Code Here

   private Folder getTargetFolder(final NodeEntity node) {
      return VcContext.inVcSessionDo(new VcSession<Folder>() {
         @Override
         protected Folder body() throws Exception {
            VcVirtualMachine vm = VcCache.get(node.getMoId());
            return vm.getParentFolder();
         }
      });
   }
View Full Code Here

         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

   public void updateData(String clusterName, String groupName,
         String nodeName, String newVmId) {
      NodeEntity node = clusterEntityMgr.findNodeByName(nodeName);

      logger.info("start update vm id and host info for node " + nodeName);
      VcVirtualMachine vm = VcCache.getIgnoreMissing(newVmId);

      node.setMoId(vm.getId());
      node.setHostName(vm.getHost().getName());
      clusterEntityMgr.update(node);

      logger.info("sync up status for node " + nodeName);
      clusterEntityMgr.syncUpNode(clusterName, nodeName);
View Full Code Here

      NodeEntity nodeEntity = clusterEntityMgr.findNodeByName(nodeName);
      StartVmPostPowerOn query =
            new StartVmPostPowerOn(nodeEntity.fetchAllPortGroups(),
                  Constants.VM_POWER_ON_WAITING_SEC, clusterEntityMgr);

      VcVirtualMachine vcVm = VcCache.getIgnoreMissing(vmId);

      if (vcVm == null) {
         logger.error("VC vm does not exist for vmId: " + vmId);
      }

      VcHost host = vcVm.getHost();

      Callable<Void>[] storeProceduresArray = new Callable[1];
      storeProceduresArray[0] = new StartVmSP(vcVm, null, query, host);
      NoProgressUpdateCallback callback = new NoProgressUpdateCallback();
View Full Code Here

TOP

Related Classes of com.vmware.aurora.vc.VcVirtualMachine

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.