@Override
  @DB
  public boolean revokeSecurityGroupIngress(RevokeSecurityGroupIngressCmd cmd) {
    // input validation
    Account caller = UserContext.current().getCaller();
    Long id = cmd.getId();

    IngressRuleVO rule = _ingressRuleDao.findById(id);
    if (rule == null) {
      s_logger.debug("Unable to find ingress rule with id " + id);
      throw new InvalidParameterValueException("Unable to find ingress rule with id " + id);
    }

    // Check permissions
    SecurityGroup securityGroup = _securityGroupDao.findById(rule.getSecurityGroupId());
    _accountMgr.checkAccess(caller, null, securityGroup);

    SecurityGroupVO groupHandle = null;
    final Transaction txn = Transaction.currentTxn();

    try {
      txn.start();
      // acquire lock on parent group (preserving this logic)
      groupHandle = _securityGroupDao.acquireInLockTable(rule.getSecurityGroupId());
      if (groupHandle == null) {
        s_logger.warn("Could not acquire lock on security group id: " + rule.getSecurityGroupId());
        return false;
      }

      _ingressRuleDao.remove(id);
      s_logger.debug("revokeSecurityGroupIngress succeeded for ingress rule id: " + id);

      final ArrayList<Long> affectedVms = new ArrayList<Long>();
      affectedVms.addAll(_securityGroupVMMapDao.listVmIdsBySecurityGroup(groupHandle.getId()));
      scheduleRulesetUpdateToHosts(affectedVms, true, null);

      return true;
    } catch (Exception e) {
      s_logger.warn("Exception caught when deleting ingress rules ", e);
      throw new CloudRuntimeException("Exception caught when deleting ingress rules", e);
    } finally {
      if (groupHandle != null) {
        _securityGroupDao.releaseFromLockTable(groupHandle.getId());
      }
      txn.commit();
    }
  }