Package com.vmware.vim.binding.vmodl

Examples of com.vmware.vim.binding.vmodl.ManagedObjectReference


            new VcLongCall<Map<String, PerformanceSample[]>>() {
         public Map<String, PerformanceSample[]> callVc() {
            List<ManagedObjectReference> targetMOB = new ArrayList<ManagedObjectReference>(targetIds.size());
            String firstType = null;
            for (String refId : targetIds) {
               ManagedObjectReference moRef = MoUtil.stringToMoref(refId);
               if (firstType == null) {
                  firstType = moRef.getType();
               } else if (!moRef.getType().equals(firstType)) {
                  throw VcException.INVALID_ARGUMENT();
               }
               targetMOB.add(moRef);
            }
View Full Code Here


            QuerySpec[] specs = new QuerySpecImpl[childrenMap.size()];
            int index = 0;
            for (String refId : childrenMap.keySet()) {
               List<String> childrenList = childrenMap.get(refId);
               if (childrenList != null && childrenList.size() > 0) {
                  ManagedObjectReference moRef = MoUtil.stringToMoref(refId);
                  specs[index] = new QuerySpecImpl();
                  specs[index].setEntity(moRef);
                  specs[index].setIntervalId(sampleInterval);
                  specs[index].setFormat("normal");
                  MetricId[] metrics = new MetricIdImpl[childrenList.size()];
View Full Code Here

         return;
      }
      VcEventUtil.dumpUpdateSet(updates, currentVersion);

      for (FilterUpdate pfu : filterUpdates) {
         ManagedObjectReference filterMoRef = pfu.getFilter();
         if (filterMoRef.equals(eventFilterMoRef)) {
            /* EventCollector.latestPage update. */
            invokeEventHandler = true;
         } else {
            /* Task.info.state updates: extract individual moRefs & changes. */
            AuAssert.check(filterMoRef.equals(taskFilterMoRef));
            if (pfu.getObjectSet() != null) {
               for (ObjectUpdate oUpdate : pfu.getObjectSet()) {
                  AuAssert.check(oUpdate.getObj().getType().equalsIgnoreCase("Task"));
                  totalTaskCount++;
                  if ((oUpdate.getKind() == Kind.modify ||
View Full Code Here

               if (groupFolder == null || groupFolder.getName() == null
                     || !groupFolder.getName().equals(groupFolderName)) {
                  logger.debug("VM group folder name mismatch, not Serengeti managed VM.");
                  return false;
               }
               ManagedObjectReference mo = groupFolder.getParent();
               if (mo == null) {
                  logger.debug("VM cluster folder is empty, not Serengeti managed VM.");
                  return false;
               }
               Folder clusterFolder = MoUtil.getManagedObject(mo);
View Full Code Here

         final ResourceAllocationInfo memAllocation,
         final boolean force) throws Exception
   {
      final ResourceConfigSpec spec = new ResourceConfigSpecImpl(
               null, null, null, cpuAllocation, memAllocation);
      ManagedObjectReference ref =
         VcContext.getTaskMgr().execPseudoTask("ResourcePool.createResourcePool",
            VcEventType.ResourcePoolCreated, getMoRef(),
            new IVcPseudoTaskBody() {
         @Override
         public final ManagedObjectReference body() throws Exception {
            final ResourcePool rp = getManagedObject();
            ManagedObjectReference child = null;
            //at least execute once
            while (true) {
               try {
                  child = rp.createResourcePool(name, spec);
                  break;
View Full Code Here

   /* (non-Javadoc)
    * @see com.vmware.aurora.vc.VcResourcePool#destroy()
    */
   @Override
   public void destroy() throws Exception {
      final ManagedObjectReference oldParent = parent;
      try {
         VcTask task = destroy(new IVcTaskCallback() {
            @Override
            public void completeCB(VcTask task) {
               VcCache.purge(getMoRef());
View Full Code Here

   public static VcVirtualMachine createVm(final Folder parentFolder,
         final ConfigSpec spec, final VcResourcePool rp, final HostSystem host,
         final IVcTaskCallback callback) throws Exception {
      VcTask task = VcContext.getTaskMgr().execute(new IVcTaskBody() {
         public VcTask body() throws Exception {
            ManagedObjectReference hostRef =
                  host != null ? host._getRef() : null;
            ManagedObjectReference taskRef =
                  parentFolder.createVm(spec, rp.getMoRef(), hostRef);
            return new VcTask(TaskType.CreateVm, taskRef, callback);
         }
      });
      task.waitForCompletion();
View Full Code Here

      return (VcVirtualMachine) task.getResult();
   }

   public static void processNotFoundException(ManagedObjectNotFound e,
         String moId, Logger logger) throws Exception {
      ManagedObjectReference moRef = e.getObj();
      if (MoUtil.morefToString(moRef).equals(moId)) {
         logger.error("VC object " + MoUtil.morefToString(moRef)
               + " is already deleted from VC. Purge from vc cache");
         // in case the event is lost
         VcCache.purge(moRef);
         ManagedObjectReference rpMoRef = VcCache.removeVmRpPair(moRef);
         if (rpMoRef != null) {
            VcCache.refresh(rpMoRef);
         }
      } else {
         throw e;
View Full Code Here

      try {
         if (existing != null) {
            existing.reconfigure(spec);
            logger.info("Alarm " + alarmName + " exists");
         } else {
            ManagedObjectReference alarmMoref = alarmManager.create(rootFolder._getRef(), spec);
            logger.info("Create " + alarmMoref.getValue() + " " + alarmName);
         }
      } catch (InvalidName e) {
         logger.error("Invalid alarm name", e);
      } catch (DuplicateName e) {
         logger.error("Duplicate alarm name", e);
View Full Code Here

            || e instanceof HostCommunication);
   }

   public static int getHostTimeDiffInSec(VcHost vcHost) throws Exception {
      HostSystem hostSystem = (HostSystem) vcHost.getManagedObject();
      ManagedObjectReference ref = hostSystem.getConfigManager().getDateTimeSystem();
      DateTimeSystem dateTimeSystem = MoUtil.getManagedObject(ref);

      return (int)(dateTimeSystem.queryDateTime().getTimeInMillis() - System.currentTimeMillis())/1000;
   }
View Full Code Here

TOP

Related Classes of com.vmware.vim.binding.vmodl.ManagedObjectReference

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.