Package com.vmware.bdd.software.mgmt.thrift

Examples of com.vmware.bdd.software.mgmt.thrift.OperationStatusWithDetail$OperationStatusWithDetailTupleSchemeFactory


   @Override
   public void doWork() throws Exception {
      boolean exit = false;

      logger.info("start monitor operation progress for target " + targetName);
      OperationStatusWithDetail detailedStatus = null;
      SoftwareManagementClient monitorClient = new SoftwareManagementClient();
      monitorClient.init();

      while (!exit) {
         try {
            Thread.sleep(queryInterval);
         } catch (InterruptedException e) {
            logger.info("monitor thread is waked up by caller to stop monitoring");
            stop = true;
         }
         if (stop) {
            logger.info("received stop signal, will do one more query then exit, so as to retrieve the final progress after Ironfan exits.");
            exit = true;
         }

         logger.info("progress query started");
         detailedStatus = monitorClient.getOperationStatusWithDetail(targetName);
         if (null == detailedStatus) {
            logger.error("Failed to query progress. Something wrong with the Monitor Service?");
            break;
         }
         logger.info("progress finished? " + detailedStatus.getOperationStatus().isFinished());
         logger.debug(detailedStatus.toString());
         logger.info("progress query completed");
         if (detailedStatus.getOperationStatus().getProgress() < 100) {
            int progress = detailedStatus.getOperationStatus().getProgress();
            if (statusUpdater != null) {
               statusUpdater.setProgress(((double) progress) / 100);
            }
         }
         setLastErrorMsg(detailedStatus.getOperationStatus().getErrorMsg());
         clusterEntityMgr.handleOperationStatus(targetName.split("-")[0], detailedStatus, exit);

         // for large scale cluster (100+ nodes), don't need to query too frequent which will cause too much overhead on Chef Server
         if (queryInterval == QUERY_INTERVAL_DEFAULT) {
            int size = detailedStatus.getClusterData().getClusterSize();
            if (size > BIG_CLUSTER_NODES_COUNT) {
               queryInterval = Math.min(QUERY_INTERVAL_MAX, QUERY_INTERVAL_LONG * (size / BIG_CLUSTER_NODES_COUNT));
               logger.info("progress query interval set to " + queryInterval / 1000 + "s because this cluster has " + size + " nodes");
            }
         }
View Full Code Here


      client.runClusterOperation(clusterOperation);
   }

   @Test(groups = { "software-management" })
   public void getOperationStatusWithDetail() {
      OperationStatusWithDetail status =
            client.getOperationStatusWithDetail(clusterName);
      Assert.assertNotNull(status);
      ClusterData clusterData = status.getClusterData();
      String clusterName = clusterData.getClusterName();
      System.out.println("clusterName : " + clusterName);
      Map<String, GroupData> groups = clusterData.getGroups();
      for (String groupName : groups.keySet()) {
         System.out.println("group name key: " + groupName);
View Full Code Here

TOP

Related Classes of com.vmware.bdd.software.mgmt.thrift.OperationStatusWithDetail$OperationStatusWithDetailTupleSchemeFactory

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.