Esempio n. 1
0
  private boolean isAllVMRunning(Client oneClient) {

    int vmID;
    boolean allRunning = true;
    for (int i = 0; i < vecTempID.size(); i++) {
      vmID = vecTempID.elementAt(i).intValue();

      VirtualMachine vm = new VirtualMachine(vmID, oneClient);

      /* to load the data first using the info method */
      OneResponse rc = vm.info();
      String status = vm.status();

      PrintMsg.print(
          DMsgType.MSG, "vm " + vm.getName() + ", id " + vm.getId() + ", status = " + status);

      VMElement element = findVMElement(vmID);
      VMState newVMState = getVMState(status);
      if (newVMState != element.getState()) {

        PrintMsg.print(DMsgType.MSG, "state update: " + element.getState() + " --> " + newVMState);

        /* update vm state */
        updateVMState(vmList.get(vmID), newVMState);

        PrintMsg.print(DMsgType.MSG, "new state, " + vmList.get(vmID).getState());
      }

      if (status == null || !status.equalsIgnoreCase("runn")) allRunning = false;
    }
    return allRunning;
  }