Package com.vmware.aurora.vc

Examples of com.vmware.aurora.vc.VcHost


         String groupName, String nodeName, List<DiskSpec> badDisks) {
      ClusterCreate spec = configMgr.getClusterConfig(clusterName);

      NodeEntity nodeEntity =
            clusterEntityMgr.findByName(clusterName, groupName, nodeName);
      VcHost targetHost = VcResourceUtils.findHost(nodeEntity.getHostName());

      List<VcDatastore> validDatastores =
            filterDatastores(targetHost, spec, groupName);

      // initialize env for placement algorithm
      int totalSizeInGB = 0;
      Map<AbstractDatastore, Integer> usage =
            new HashMap<AbstractDatastore, Integer>(validDatastores.size());
      List<AbstractDatastore> pools =
            new ArrayList<AbstractDatastore>(validDatastores.size());

      for (VcDatastore ds : validDatastores) {
         totalSizeInGB += ds.getFreeSpace() >> 30;
         AbstractDatastore ads =
               new AbstractDatastore(ds.getName(),
                     (int) (ds.getFreeSpace() >> 30));
         pools.add(ads);
         usage.put(ads, 0);
      }

      int requiredSizeInGB = 0;
      for (DiskSpec disk : badDisks) {
         requiredSizeInGB += disk.getSize();
      }

      if (totalSizeInGB < requiredSizeInGB) {
         throw ClusterHealServiceException.NOT_ENOUGH_STORAGE(nodeName,
               "" + requiredSizeInGB + " GB storage is required on host "
                     + targetHost.getName() + ", but only " + totalSizeInGB
                     + " GB available");
      }

      List<DiskEntity> goodDisks = clusterEntityMgr.getDisks(nodeName);
View Full Code Here


      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

   public static int getHostTimeDiffInSec(final String hostName) {
      return VcContext.inVcSessionDo(new VcSession<Integer>() {

         @Override
         protected Integer body() throws Exception {
            VcHost vcHost = null;
            List<VcCluster> vcClusters = VcInventory.getClusters();
            for (VcCluster vcCluster : vcClusters) {
               List<VcHost> hosts = vcCluster.getHosts();
               for (VcHost host : hosts) {
                  if (hostName.equals(host.getName())) {
View Full Code Here

            - swapDisk.getSizeInMB()) {
         return currentDs;
      }

      // else find a valid datastore with largest free space
      VcHost locateHost = VcResourceUtils.findHost(node.getHostName());

      // swap disk should use image store pattern
      String[] dsNamePatterns =
            NodeGroupCreate.getImagestoreNamePattern(clusterSpec, ngSpec);
      VcDatastore targetDs = null;
      for (VcDatastore ds : locateHost.getDatastores()) {
         if (!ds.isAccessible()) {
            continue;
         }
         for (String pattern : dsNamePatterns) {
            if (ds.getName().matches(pattern)) {
View Full Code Here

         StartVmSP.StartVmPrePowerOn prePowerOn = new StartVmSP.StartVmPrePowerOn(isMapDistro,
               (new Gson()).toJson(node.getVolumns()));
         StartVmPostPowerOn query =
               new StartVmPostPowerOn(node.fetchAllPortGroups(),
                     Constants.VM_POWER_ON_WAITING_SEC, clusterEntityMgr);
         VcHost host = null;
         if (node.getHostName() != null) {
            host = VcResourceUtils.findHost(node.getHostName());
         }
         StartVmSP startSp = new StartVmSP(vcVm, prePowerOn, query, host);
         storeProcedures.add(startSp);
View Full Code Here

            VcVmUtil.getVolumes(node.getMoId(), node.getDisks()));
      StartVmPostPowerOn query =
            new StartVmPostPowerOn(node.fetchAllPortGroups(),
                  Constants.VM_POWER_ON_WAITING_SEC, clusterEntityMgr);

      VcHost host = null;
      if (node.getHostName() != null) {
         host = VcResourceUtils.findHost(node.getHostName());
      }

      VcVirtualMachine vcVm = VcCache.getIgnoreMissing(node.getMoId());
View Full Code Here

      MockVcResourceUtils.flag = flag;
   }

   @Mock
   public static VcHost findHost(final String hostName) {
      VcHost host = Mockito.mock(VcHost.class);
      Mockito.when(host.getName()).thenReturn("host1.eng.vmware.com");
      return host;
   }
View Full Code Here

         cache.put(id, vm);
         return (T)vm;
      } else if (getFlag) {
         if (id != null && id.equals("create-vm-succ")) {
            VcVirtualMachine vm = Mockito.mock(VcVirtualMachine.class);
            VcHost host = Mockito.mock(VcHost.class);
            Mockito.when(vm.getHost()).thenReturn(host);
            Mockito.when(host.getName()).thenReturn("host1.eng.vmware.com");
            VcResourcePool rp = Mockito.mock(VcResourcePool.class);
            Mockito.when(vm.getResourcePool()).thenReturn(rp);
            VcCluster cluster = Mockito.mock(VcCluster.class);
            Mockito.when(rp.getVcCluster()).thenReturn(cluster);
            Mockito.when(cluster.getName()).thenReturn("cluster-ws");
View Full Code Here

            Mockito.when(ds.getFreeSpace()).thenReturn(
                  100 * 1024 * 1024 * 1024L);
            Mockito.when(ds.getName()).thenReturn(LOCAL_DS_NAME_PREFIX + i);
            datastores.add(ds);
         }
         VcHost host = Mockito.mock(VcHost.class);
         Mockito.when(host.getDatastores()).thenReturn(datastores);

         Mockito.when(host.getName()).thenReturn(HOST_NAME);

         return host;
      }
View Full Code Here

        
         datastores.add(ds1);
         datastores.add(ds2);
         datastores.add(ds3);
        
         VcHost host = Mockito.mock(VcHost.class);
         Mockito.when(host.getDatastores()).thenReturn(datastores);

         return host;
      }
View Full Code Here

TOP

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

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.