Package com.vmware.aurora.vc

Examples of com.vmware.aurora.vc.VcResourcePool


         throw ClusteringServiceException.TEMPLATE_ID_NOT_FOUND();
      }
      VcVirtualMachine serverVm = VcCache.get(serverMobId);

      if (ConfigInfo.isDeployAsVApp()) {
         VcResourcePool vApp = serverVm.getParentVApp();
         initUUID(vApp.getName());
         for (VcVirtualMachine vm : vApp.getChildVMs()) {
            // assume only two vm under serengeti vApp, serengeti server and
            // template
            if (!vm.getName().equals(serverVm.getName())) {
               logger.info("got template vm: " + vm.getName());
               return vm;
View Full Code Here


               throw ClusteringServiceException
                     .CANNOT_FIND_VC_CLUSTER(vcClusterName);
            }
            List<String> resourcePoolNames = vcClusterRpNamesEntry.getValue();
            for (String resourcePoolName : resourcePoolNames) {
               VcResourcePool parentVcResourcePool =
                     VcResourceUtils.findRPInVCCluster(vcClusterName,
                           resourcePoolName);
               if (parentVcResourcePool == null) {
                  String errorMsg =
                        "Cannot find the vCenter Server resource pool "
                              + resourcePoolName + ".";
                  logger.error(errorMsg);
                  throw ClusteringServiceException
                        .CANNOT_FIND_VC_RESOURCE_POOL(resourcePoolName);
               }
               CreateResourcePoolSP clusterSP =
                     new CreateResourcePoolSP(parentVcResourcePool,
                           clusterRpName);
               clusterSPs[i] = clusterSP;
               i++;
            }
         }

         // execute store procedures to create cluster resource pool(s)
         logger.info("ClusteringService, start to create cluster resource pool(s).");
         executeResourcePoolStoreProcedures(clusterSPs, "cluster", clusterName);

         /*
          * define node group store procedures of resource pool(s)
          */
         int nodeGroupNameCount = countResult.get("nodeGroupNameCount");
         Callable<Void>[] nodeGroupSPs = new Callable[nodeGroupNameCount];
         i = 0;
         for (Entry<String, List<String>> vcClusterRpNamesEntry : vcClusterRpNamesMap
               .entrySet()) {
            String vcClusterName = vcClusterRpNamesEntry.getKey();
            VcCluster vcCluster = VcResourceUtils.findVcCluster(vcClusterName);
            if (vcCluster == null) {
               String errorMsg =
                     "Cannot find the vCenter Server cluster " + vcClusterName
                           + ".";
               logger.error(errorMsg);
               throw ClusteringServiceException
                     .CANNOT_FIND_VC_CLUSTER(vcClusterName);
            }
            if (!vcCluster.getConfig().getDRSEnabled()) {
               continue;
            }
            List<String> resourcePoolNames = vcClusterRpNamesEntry.getValue();
            for (String resourcePoolName : resourcePoolNames) {
               VcResourcePool parentVcResourcePool = null;
               String vcRPName =
                     CommonUtil.isBlank(resourcePoolName) ? clusterRpName
                           : resourcePoolName + "/" + clusterRpName;
               parentVcResourcePool =
                     VcResourceUtils.findRPInVCCluster(vcClusterName, vcRPName);
View Full Code Here

         } else {
            vcRPName =
                  vNode.getTargetRp() + "/" + clusterRpName + "/"
                        + vNode.getNodeGroup().getName();
         }
         VcResourcePool rp =
               VcResourceUtils.findRPInVCCluster(vNode.getTargetVcCluster(),
                     vcRPName);
         if (rp == null) {
            throw ClusteringServiceException.TARGET_VC_RP_NOT_FOUND(
                  vNode.getTargetVcCluster(), vNode.getTargetRp());
View Full Code Here

            clusterMap
                  .put(vcClusterName, new HashMap<String, VcResourcePool>());
         }
         Map<String, VcResourcePool> rpMap = clusterMap.get(vcClusterName);
         if (rpMap.get(vcRpName) == null) {
            VcResourcePool vcRp =
                  VcResourceUtils.findRPInVCCluster(vcClusterName, vcRpName);
            if (vcRp != null) {
               rpMap.put(vcRpName, vcRp);
            }
         }
View Full Code Here

   @Mock
   public static VcResourcePool findRPInVCCluster(final String clusterName,
         final String vcRPName) {
      if (flag) {
         VcResourcePool rp = Mockito.mock(VcResourcePool.class);
         Mockito.when(rp.getName()).thenReturn("root");
         return rp;
      } else {
         return null;
      }
   }
View Full Code Here

         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");
            return (T)vm;
         } else {
            VcVirtualMachine vm = Mockito.mock(VcVirtualMachine.class);
            Mockito.when(vm.getName()).thenReturn(id);
View Full Code Here

      cleanUpUtils.removeCluster(clusterEntityMgr, TEST_STATIC_IP_CLUSTER_NAME);
      cleanUpUtils.removeCluster(clusterEntityMgr, TEST_DHCP_CLUSTER_NAME);
   }

   private static void removeVMs() {
      final VcResourcePool vcRp =
            VcResourceUtils.findRPInVCCluster(vcCluster, vcRP);
      if (vcRp == null) {
         return;
      }
      VcContext.inVcSessionDo(new VcSession<Void>() {
         @Override
         protected boolean isTaskSession() {
            return true;
         }

         @Override
         protected Void body() throws Exception {
            deleteChildVms(vcRp);
            for (VcResourcePool clusterRp : vcRp.getChildren()) {
               deleteChildVms(clusterRp);
               for (VcResourcePool groupRp : clusterRp.getChildren()) {
                  deleteChildVms(groupRp);
                  groupRp.destroy();
               }
View Full Code Here

      Assert.assertNotNull(childFolder, "Folder " + folderName
            + " is not exist.");
   }

   private void checkVcResourePools(ClusterRead cluster, final String rpName) {
      VcResourcePool rp = VcResourceUtils.findRPInVCCluster(vcCluster, vcRP);
      List<VcResourcePool> children = rp.getChildren();
      boolean found = false;
      VcResourcePool clusterRp = null;
      for (VcResourcePool child : children) {
         if (child.getName().equals(rpName)) {
            found = true;
            clusterRp = child;
            break;
         }
      }
      Assert.assertTrue(found, "Resource pool " + rpName + " is not created.");
      found = false;
      String groupRpName = cluster.getNodeGroups().get(0).getName();
      for (VcResourcePool groupRp : clusterRp.getChildren()) {
         if (groupRp.getName().equals(groupRpName)) {
            found = true;
            break;
         }
      }
View Full Code Here

            + TEST_STATIC_IP_CLUSTER_NAME);
      assertFolderRemoved(TEST_STATIC_IP_CLUSTER_NAME);
   }

   private void assertChildRPRemoved(String rpName) {
      VcResourcePool rp = VcResourceUtils.findRPInVCCluster(vcCluster, vcRP);
      List<VcResourcePool> children = rp.getChildren();
      boolean found = false;
      for (VcResourcePool child : children) {
         if (child.getName().equals(rpName)) {
            found = true;
            break;
View Full Code Here

      Assert.assertTrue(hosts.size() > 0);
   }

   @Test
   public void testFindRPInVCCluster() {
      VcResourcePool rp = VcResourceUtils.findRPInVCCluster("cluster2", "rp1");
      Assert.assertNull(rp);
      rp = VcResourceUtils.findRPInVCCluster("cluster1", "rp2");
      Assert.assertNull(rp);
      rp = VcResourceUtils.findRPInVCCluster("cluster1", "rp1");
      Assert.assertNotNull(rp);
View Full Code Here

TOP

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

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.