Пример #1
0
 @Override
 public void execute() {
   UserContext.current().setEventDetails("Vm Id: " + getId());
   VirtualMachine instance = _mgr.startSystemVM(getId());
   if (instance != null) {
     SystemVmResponse response = _responseGenerator.createSystemVmResponse(instance);
     response.setResponseName(getCommandName());
     this.setResponseObject(response);
   } else {
     throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Fail to start system vm");
   }
 }
Пример #2
0
  @Override
  public void execute() {
    Pair<List<? extends VirtualMachine>, Integer> systemVMs = _mgr.searchForSystemVm(this);
    ListResponse<SystemVmResponse> response = new ListResponse<SystemVmResponse>();
    List<SystemVmResponse> vmResponses = new ArrayList<SystemVmResponse>();
    for (VirtualMachine systemVM : systemVMs.first()) {
      SystemVmResponse vmResponse = _responseGenerator.createSystemVmResponse(systemVM);
      vmResponse.setObjectName("systemvm");
      vmResponses.add(vmResponse);
    }

    response.setResponses(vmResponses, systemVMs.second());
    response.setResponseName(getCommandName());
    setResponseObject(response);
  }