@Override
  public void deployVirtualMachine(
      String reservationId, String caller, Map<VirtualMachineProfile.Param, Object> params)
      throws InsufficientCapacityException, ResourceUnavailableException {
    // grab the VM Id and destination using the reservationId.

    VMReservationVO vmReservation = _reservationDao.findByReservationId(reservationId);
    long vmId = vmReservation.getVmId();

    VMInstanceVO vm = _vmDao.findById(vmId);
    // Pass it down
    Long poolId = null;
    Map<Long, Long> storage = vmReservation.getVolumeReservation();
    if (storage != null) {
      List<Long> volIdList = new ArrayList<Long>(storage.keySet());
      if (volIdList != null && !volIdList.isEmpty()) {
        poolId = storage.get(volIdList.get(0));
      }
    }

    DataCenterDeployment reservedPlan =
        new DataCenterDeployment(
            vm.getDataCenterId(),
            vmReservation.getPodId(),
            vmReservation.getClusterId(),
            vmReservation.getHostId(),
            null,
            null);
    try {
      VMInstanceVO vmDeployed =
          _itMgr.start(
              vm,
              params,
              _userDao.findById(new Long(caller)),
              _accountDao.findById(vm.getAccountId()),
              reservedPlan);
    } catch (Exception ex) {
      // Retry the deployment without using the reservation plan
      DataCenterDeployment plan =
          new DataCenterDeployment(vm.getDataCenterId(), null, null, null, null, null);
      _itMgr.start(
          vm,
          params,
          _userDao.findById(new Long(caller)),
          _accountDao.findById(vm.getAccountId()),
          plan);
    }
  }
 private DomainRouterVO start(
     DomainRouterVO elbVm, User user, Account caller, Map<Param, Object> params)
     throws StorageUnavailableException, InsufficientCapacityException,
         ConcurrentOperationException, ResourceUnavailableException {
   s_logger.debug("Starting ELB VM " + elbVm);
   if (_itMgr.start(elbVm, params, user, caller) != null) {
     return _routerDao.findById(elbVm.getId());
   } else {
     return null;
   }
 }
 @Override
 public SecondaryStorageVmVO startSecStorageVm(long secStorageVmId) {
   try {
     SecondaryStorageVmVO secStorageVm = _secStorageVmDao.findById(secStorageVmId);
     Account systemAcct = _accountMgr.getSystemAccount();
     User systemUser = _accountMgr.getSystemUser();
     return _itMgr.start(secStorageVm, null, systemUser, systemAcct);
   } catch (StorageUnavailableException e) {
     s_logger.warn("Exception while trying to start secondary storage vm", e);
     return null;
   } catch (InsufficientCapacityException e) {
     s_logger.warn("Exception while trying to start secondary storage vm", e);
     return null;
   } catch (ResourceUnavailableException e) {
     s_logger.warn("Exception while trying to start secondary storage vm", e);
     return null;
   } catch (Exception e) {
     s_logger.warn("Exception while trying to start secondary storage vm", e);
     return null;
   }
 }