bug 6361: more name changes from network group to security group

This commit is contained in:
abhishek 2010-10-19 14:42:09 -07:00
parent 486417e880
commit 7cc8087fa6
12 changed files with 83 additions and 83 deletions

View File

@ -13,7 +13,7 @@ import javax.persistence.Table;
@Table(name=("network_group"))
@SecondaryTable(name="network_ingress_rule", join="left",
pkJoinColumns={@PrimaryKeyJoinColumn(name="id", referencedColumnName="network_group_id")})
public class NetworkGroupRulesVO {
public class SecurityGroupRulesVO {
@Id
@GeneratedValue(strategy=GenerationType.IDENTITY)
@Column(name="id")
@ -58,9 +58,9 @@ public class NetworkGroupRulesVO {
@Column(name="allowed_ip_cidr", table="network_ingress_rule", insertable=false, updatable=false, nullable=true)
private String allowedSourceIpCidr = null;
public NetworkGroupRulesVO() { }
public SecurityGroupRulesVO() { }
public NetworkGroupRulesVO(Long id, String name, String description, Long domainId, Long accountId, String accountName, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId, String allowedNetworkGroup, String allowedNetGrpAcct, String allowedSourceIpCidr) {
public SecurityGroupRulesVO(Long id, String name, String description, Long domainId, Long accountId, String accountName, Long ruleId, int startPort, int endPort, String protocol, Long allowedNetworkId, String allowedNetworkGroup, String allowedNetGrpAcct, String allowedSourceIpCidr) {
this.id = id;
this.name = name;
this.description = description;

View File

@ -34,7 +34,7 @@ import com.cloud.utils.db.GenericDao;
@Entity
@Table(name="op_nwgrp_work")
public class NetworkGroupWorkVO {
public class SecurityGroupWorkVO {
public enum Step {
Scheduled,
Processing,
@ -70,7 +70,7 @@ public class NetworkGroupWorkVO {
private Long logsequenceNumber = null;
protected NetworkGroupWorkVO() {
protected SecurityGroupWorkVO() {
}
public Long getId() {
@ -97,7 +97,7 @@ public class NetworkGroupWorkVO {
public NetworkGroupWorkVO(Long instanceId, Long serverId, Date created,
public SecurityGroupWorkVO(Long instanceId, Long serverId, Date created,
Step step, Date dateTaken) {
super();
this.instanceId = instanceId;

View File

@ -2,28 +2,28 @@ package com.cloud.network.security.dao;
import java.util.List;
import com.cloud.network.security.NetworkGroupRulesVO;
import com.cloud.network.security.SecurityGroupRulesVO;
import com.cloud.utils.db.GenericDao;
public interface NetworkGroupRulesDao extends GenericDao<NetworkGroupRulesVO, Long> {
public interface NetworkGroupRulesDao extends GenericDao<SecurityGroupRulesVO, Long> {
/**
* List a network group and associated ingress rules
* @param accountId the account id of the owner of the network group
* @param groupName the name of the group for which to list rules
* @return the list of ingress rules associated with the network group (and network group info)
*/
List<NetworkGroupRulesVO> listNetworkGroupRules(long accountId, String groupName);
List<SecurityGroupRulesVO> listNetworkGroupRules(long accountId, String groupName);
/**
* List network groups and associated ingress rules
* @param accountId the id of the account for which to list groups and associated rules
* @return the list of network groups with associated ingress rules
*/
List<NetworkGroupRulesVO> listNetworkGroupRules(long accountId);
List<SecurityGroupRulesVO> listNetworkGroupRules(long accountId);
/**
* List all network groups and associated ingress rules
* @return the list of network groups with associated ingress rules
*/
List<NetworkGroupRulesVO> listNetworkGroupRules();
List<SecurityGroupRulesVO> listNetworkGroupRules();
}

View File

@ -4,16 +4,16 @@ import java.util.List;
import javax.ejb.Local;
import com.cloud.network.security.NetworkGroupRulesVO;
import com.cloud.network.security.SecurityGroupRulesVO;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
import com.cloud.utils.db.SearchCriteria;
@Local(value={NetworkGroupRulesDao.class})
public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO, Long> implements NetworkGroupRulesDao {
private SearchBuilder<NetworkGroupRulesVO> AccountGroupNameSearch;
private SearchBuilder<NetworkGroupRulesVO> AccountSearch;
public class NetworkGroupRulesDaoImpl extends GenericDaoBase<SecurityGroupRulesVO, Long> implements NetworkGroupRulesDao {
private SearchBuilder<SecurityGroupRulesVO> AccountGroupNameSearch;
private SearchBuilder<SecurityGroupRulesVO> AccountSearch;
protected NetworkGroupRulesDaoImpl() {
AccountGroupNameSearch = createSearchBuilder();
@ -27,16 +27,16 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
}
@Override
public List<NetworkGroupRulesVO> listNetworkGroupRules() {
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
public List<SecurityGroupRulesVO> listNetworkGroupRules() {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
return listAll(searchFilter);
}
@Override
public List<NetworkGroupRulesVO> listNetworkGroupRules(long accountId, String groupName) {
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
public List<SecurityGroupRulesVO> listNetworkGroupRules(long accountId, String groupName) {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
SearchCriteria<NetworkGroupRulesVO> sc = AccountGroupNameSearch.create();
SearchCriteria<SecurityGroupRulesVO> sc = AccountGroupNameSearch.create();
sc.setParameters("accountId", accountId);
sc.setParameters("name", groupName);
@ -44,9 +44,9 @@ public class NetworkGroupRulesDaoImpl extends GenericDaoBase<NetworkGroupRulesVO
}
@Override
public List<NetworkGroupRulesVO> listNetworkGroupRules(long accountId) {
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, null, null);
SearchCriteria<NetworkGroupRulesVO> sc = AccountSearch.create();
public List<SecurityGroupRulesVO> listNetworkGroupRules(long accountId) {
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, null, null);
SearchCriteria<SecurityGroupRulesVO> sc = AccountSearch.create();
sc.setParameters("accountId", accountId);
return listBy(sc, searchFilter);

View File

@ -21,17 +21,17 @@ package com.cloud.network.security.dao;
import java.util.Date;
import java.util.List;
import com.cloud.network.security.NetworkGroupWorkVO;
import com.cloud.network.security.NetworkGroupWorkVO.Step;
import com.cloud.network.security.SecurityGroupWorkVO;
import com.cloud.network.security.SecurityGroupWorkVO.Step;
import com.cloud.utils.db.GenericDao;
public interface NetworkGroupWorkDao extends GenericDao<NetworkGroupWorkVO, Long> {
NetworkGroupWorkVO findByVmId(long vmId, boolean taken);
public interface NetworkGroupWorkDao extends GenericDao<SecurityGroupWorkVO, Long> {
SecurityGroupWorkVO findByVmId(long vmId, boolean taken);
NetworkGroupWorkVO findByVmIdStep(long vmId, Step step);
SecurityGroupWorkVO findByVmIdStep(long vmId, Step step);
NetworkGroupWorkVO take(long serverId);
SecurityGroupWorkVO take(long serverId);
void updateStep(Long vmId, Long logSequenceNumber, Step done);
@ -39,7 +39,7 @@ public interface NetworkGroupWorkDao extends GenericDao<NetworkGroupWorkVO, Long
int deleteFinishedWork(Date timeBefore);
List<NetworkGroupWorkVO> findUnfinishedWork(Date timeBefore);
List<SecurityGroupWorkVO> findUnfinishedWork(Date timeBefore);
}

View File

@ -24,8 +24,8 @@ import java.util.List;
import javax.ejb.Local;
import com.cloud.ha.WorkVO;
import com.cloud.network.security.NetworkGroupWorkVO;
import com.cloud.network.security.NetworkGroupWorkVO.Step;
import com.cloud.network.security.SecurityGroupWorkVO;
import com.cloud.network.security.SecurityGroupWorkVO.Step;
import com.cloud.utils.db.Filter;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.SearchBuilder;
@ -35,13 +35,13 @@ import com.cloud.utils.db.SearchCriteria.Op;
import com.cloud.utils.exception.CloudRuntimeException;
@Local(value={NetworkGroupWorkDao.class})
public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO, Long> implements NetworkGroupWorkDao {
private SearchBuilder<NetworkGroupWorkVO> VmIdTakenSearch;
private SearchBuilder<NetworkGroupWorkVO> VmIdSeqNumSearch;
private SearchBuilder<NetworkGroupWorkVO> VmIdUnTakenSearch;
private SearchBuilder<NetworkGroupWorkVO> UntakenWorkSearch;
private SearchBuilder<NetworkGroupWorkVO> VmIdStepSearch;
private SearchBuilder<NetworkGroupWorkVO> CleanupSearch;
public class NetworkGroupWorkDaoImpl extends GenericDaoBase<SecurityGroupWorkVO, Long> implements NetworkGroupWorkDao {
private SearchBuilder<SecurityGroupWorkVO> VmIdTakenSearch;
private SearchBuilder<SecurityGroupWorkVO> VmIdSeqNumSearch;
private SearchBuilder<SecurityGroupWorkVO> VmIdUnTakenSearch;
private SearchBuilder<SecurityGroupWorkVO> UntakenWorkSearch;
private SearchBuilder<SecurityGroupWorkVO> VmIdStepSearch;
private SearchBuilder<SecurityGroupWorkVO> CleanupSearch;
protected NetworkGroupWorkDaoImpl() {
@ -86,29 +86,29 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
}
@Override
public NetworkGroupWorkVO findByVmId(long vmId, boolean taken) {
SearchCriteria<NetworkGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
public SecurityGroupWorkVO findByVmId(long vmId, boolean taken) {
SearchCriteria<SecurityGroupWorkVO> sc = taken?VmIdTakenSearch.create():VmIdUnTakenSearch.create();
sc.setParameters("vmId", vmId);
return findOneIncludingRemovedBy(sc);
}
@Override
public NetworkGroupWorkVO take(long serverId) {
public SecurityGroupWorkVO take(long serverId) {
final Transaction txn = Transaction.currentTxn();
try {
final SearchCriteria<NetworkGroupWorkVO> sc = UntakenWorkSearch.create();
final SearchCriteria<SecurityGroupWorkVO> sc = UntakenWorkSearch.create();
sc.setParameters("step", Step.Scheduled);
final Filter filter = new Filter(NetworkGroupWorkVO.class, null, true, 0l, 1l);//FIXME: order desc by update time?
final Filter filter = new Filter(SecurityGroupWorkVO.class, null, true, 0l, 1l);//FIXME: order desc by update time?
txn.start();
final List<NetworkGroupWorkVO> vos = lock(sc, filter, true);
final List<SecurityGroupWorkVO> vos = lock(sc, filter, true);
if (vos.size() == 0) {
txn.commit();
return null;
}
NetworkGroupWorkVO work = null;
for (NetworkGroupWorkVO w: vos) {
SecurityGroupWorkVO work = null;
for (SecurityGroupWorkVO w: vos) {
//ensure that there is no job in Processing state for the same VM
if ( findByVmIdStep(w.getInstanceId(), Step.Processing) == null) {
work = w;
@ -121,7 +121,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
}
work.setServerId(serverId);
work.setDateTaken(new Date());
work.setStep(NetworkGroupWorkVO.Step.Processing);
work.setStep(SecurityGroupWorkVO.Step.Processing);
update(work.getId(), work);
@ -138,18 +138,18 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
public void updateStep(Long vmId, Long logSequenceNumber, Step step) {
final Transaction txn = Transaction.currentTxn();
txn.start();
SearchCriteria<NetworkGroupWorkVO> sc = VmIdSeqNumSearch.create();
SearchCriteria<SecurityGroupWorkVO> sc = VmIdSeqNumSearch.create();
sc.setParameters("vmId", vmId);
sc.setParameters("seqno", logSequenceNumber);
final Filter filter = new Filter(WorkVO.class, null, true, 0l, 1l);
final List<NetworkGroupWorkVO> vos = lock(sc, filter, true);
final List<SecurityGroupWorkVO> vos = lock(sc, filter, true);
if (vos.size() == 0) {
txn.commit();
return;
}
NetworkGroupWorkVO work = vos.get(0);
SecurityGroupWorkVO work = vos.get(0);
work.setStep(step);
update(work.getId(), work);
@ -157,8 +157,8 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
}
@Override
public NetworkGroupWorkVO findByVmIdStep(long vmId, Step step) {
SearchCriteria<NetworkGroupWorkVO> sc = VmIdStepSearch.create();
public SecurityGroupWorkVO findByVmIdStep(long vmId, Step step) {
SearchCriteria<SecurityGroupWorkVO> sc = VmIdStepSearch.create();
sc.setParameters("vmId", vmId);
sc.setParameters("step", step);
return findOneIncludingRemovedBy(sc);
@ -169,7 +169,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
final Transaction txn = Transaction.currentTxn();
txn.start();
NetworkGroupWorkVO work = lock(workId, true);
SecurityGroupWorkVO work = lock(workId, true);
if (work == null) {
txn.commit();
return;
@ -183,7 +183,7 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
@Override
public int deleteFinishedWork(Date timeBefore) {
final SearchCriteria<NetworkGroupWorkVO> sc = CleanupSearch.create();
final SearchCriteria<SecurityGroupWorkVO> sc = CleanupSearch.create();
sc.setParameters("taken", timeBefore);
sc.setParameters("step", Step.Done);
@ -191,14 +191,14 @@ public class NetworkGroupWorkDaoImpl extends GenericDaoBase<NetworkGroupWorkVO,
}
@Override
public List<NetworkGroupWorkVO> findUnfinishedWork(Date timeBefore) {
final SearchCriteria<NetworkGroupWorkVO> sc = CleanupSearch.create();
public List<SecurityGroupWorkVO> findUnfinishedWork(Date timeBefore) {
final SearchCriteria<SecurityGroupWorkVO> sc = CleanupSearch.create();
sc.setParameters("taken", timeBefore);
sc.setParameters("step", Step.Processing);
List<NetworkGroupWorkVO> result = listIncludingRemovedBy(sc);
List<SecurityGroupWorkVO> result = listIncludingRemovedBy(sc);
NetworkGroupWorkVO work = createForUpdate();
SecurityGroupWorkVO work = createForUpdate();
work.setStep(Step.Error);
update(work, sc);

View File

@ -32,7 +32,7 @@ import com.cloud.api.response.ListResponse;
import com.cloud.api.response.NetworkGroupResponse;
import com.cloud.async.executor.IngressRuleResultObject;
import com.cloud.async.executor.NetworkGroupResultObject;
import com.cloud.network.security.NetworkGroupRulesVO;
import com.cloud.network.security.SecurityGroupRulesVO;
@Implementation(method="searchForNetworkGroupRules", manager=Manager.NetworkGroupManager)
public class ListNetworkGroupsCmd extends BaseListCmd {
@ -87,7 +87,7 @@ public class ListNetworkGroupsCmd extends BaseListCmd {
@Override @SuppressWarnings("unchecked")
public ListResponse<NetworkGroupResponse> getResponse() {
List<NetworkGroupRulesVO> networkGroups = (List<NetworkGroupRulesVO>)getResponseObject();
List<SecurityGroupRulesVO> networkGroups = (List<SecurityGroupRulesVO>)getResponseObject();
List<NetworkGroupResultObject> groupResultObjs = NetworkGroupResultObject.transposeNetworkGroups(networkGroups);
ListResponse<NetworkGroupResponse> response = new ListResponse<NetworkGroupResponse>();

View File

@ -11,7 +11,7 @@ import com.cloud.async.AsyncJobResult;
import com.cloud.async.AsyncJobVO;
import com.cloud.async.BaseAsyncJobExecutor;
import com.cloud.network.security.IngressRuleVO;
import com.cloud.network.security.NetworkGroupRulesVO;
import com.cloud.network.security.SecurityGroupRulesVO;
import com.cloud.network.security.NetworkGroupVO;
import com.cloud.serializer.GsonHelper;
import com.cloud.server.ManagementServer;
@ -67,9 +67,9 @@ public class AuthorizeNetworkGroupIngressExecutor extends BaseAsyncJobExecutor {
private NetworkGroupResultObject composeResultObject(ManagementServer ms, Long accountId, String groupName, List<IngressRuleVO> addedRules) {
NetworkGroupVO networkGroup = ms.findNetworkGroupByName(accountId, groupName);
List<NetworkGroupRulesVO> groupRules = new ArrayList<NetworkGroupRulesVO>();
List<SecurityGroupRulesVO> groupRules = new ArrayList<SecurityGroupRulesVO>();
for (IngressRuleVO ingressRule : addedRules) {
NetworkGroupRulesVO groupRule = new NetworkGroupRulesVO(networkGroup.getId(), networkGroup.getName(), networkGroup.getDescription(), networkGroup.getDomainId(),
SecurityGroupRulesVO groupRule = new SecurityGroupRulesVO(networkGroup.getId(), networkGroup.getName(), networkGroup.getDescription(), networkGroup.getDomainId(),
networkGroup.getAccountId(), networkGroup.getAccountName(), ingressRule.getId(), ingressRule.getStartPort(), ingressRule.getEndPort(),
ingressRule.getProtocol(), ingressRule.getAllowedNetworkId(), ingressRule.getAllowedNetworkGroup(), ingressRule.getAllowedNetGrpAcct(),
ingressRule.getAllowedSourceIpCidr());

View File

@ -3,7 +3,7 @@ package com.cloud.async.executor;
import java.util.ArrayList;
import java.util.List;
import com.cloud.network.security.NetworkGroupRulesVO;
import com.cloud.network.security.SecurityGroupRulesVO;
import com.cloud.serializer.Param;
public class NetworkGroupResultObject {
@ -96,7 +96,7 @@ public class NetworkGroupResultObject {
this.ingressRules = ingressRules;
}
public static List<NetworkGroupResultObject> transposeNetworkGroups(List<NetworkGroupRulesVO> groups) {
public static List<NetworkGroupResultObject> transposeNetworkGroups(List<SecurityGroupRulesVO> groups) {
List<NetworkGroupResultObject> resultObjects = new ArrayList<NetworkGroupResultObject>();
if ((groups != null) && !groups.isEmpty()) {
@ -104,7 +104,7 @@ public class NetworkGroupResultObject {
NetworkGroupResultObject currentGroup = null;
List<Long> processedGroups = new ArrayList<Long>();
for (NetworkGroupRulesVO netGroupRule : groups) {
for (SecurityGroupRulesVO netGroupRule : groups) {
Long groupId = netGroupRule.getId();
if (!processedGroups.contains(groupId)) {
processedGroups.add(groupId);

View File

@ -34,7 +34,7 @@ import com.cloud.agent.api.PingRoutingWithNwGroupsCommand;
import com.cloud.agent.api.StartupCommand;
import com.cloud.host.HostVO;
import com.cloud.host.Status;
import com.cloud.network.security.NetworkGroupWorkVO.Step;
import com.cloud.network.security.SecurityGroupWorkVO.Step;
import com.cloud.network.security.dao.NetworkGroupWorkDao;
/**

View File

@ -70,7 +70,7 @@ public interface SecurityGroupManager extends Manager {
* The search terms are specified in the search criteria.
* @return the list of network groups and associated ingress rules
*/
public List<NetworkGroupRulesVO> searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException;
public List<SecurityGroupRulesVO> searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException;
public void fullSync(long agentId, HashMap<String, Pair<Long, Long>> newGroupStates);

View File

@ -57,7 +57,7 @@ import com.cloud.exception.AgentUnavailableException;
import com.cloud.exception.InvalidParameterValueException;
import com.cloud.exception.PermissionDeniedException;
import com.cloud.exception.ResourceInUseException;
import com.cloud.network.security.NetworkGroupWorkVO.Step;
import com.cloud.network.security.SecurityGroupWorkVO.Step;
import com.cloud.network.security.dao.IngressRuleDao;
import com.cloud.network.security.dao.NetworkGroupDao;
import com.cloud.network.security.dao.NetworkGroupRulesDao;
@ -319,7 +319,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
Transaction txn = Transaction.currentTxn();
txn.start();
VmRulesetLogVO log = null;
NetworkGroupWorkVO work = null;
SecurityGroupWorkVO work = null;
UserVm vm = null;
try {
vm = _userVMDao.acquire(vmId);
@ -339,7 +339,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
}
work = _workDao.findByVmIdStep(vmId, Step.Scheduled);
if (work == null) {
work = new NetworkGroupWorkVO(vmId, null, null, NetworkGroupWorkVO.Step.Scheduled, null);
work = new SecurityGroupWorkVO(vmId, null, null, SecurityGroupWorkVO.Step.Scheduled, null);
work = _workDao.persist(work);
}
@ -998,7 +998,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
if (s_logger.isTraceEnabled()) {
s_logger.trace("Checking the database");
}
final NetworkGroupWorkVO work = _workDao.take(_serverId);
final SecurityGroupWorkVO work = _workDao.take(_serverId);
if (work == null) {
return;
}
@ -1192,7 +1192,7 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
}
@Override
public List<NetworkGroupRulesVO> searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException {
public List<SecurityGroupRulesVO> searchForNetworkGroupRules(ListNetworkGroupsCmd cmd) throws PermissionDeniedException, InvalidParameterValueException {
Account account = (Account)UserContext.current().getAccountObject();
Long domainId = cmd.getDomainId();
String accountName = cmd.getAccountName();
@ -1250,10 +1250,10 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
}
}
Filter searchFilter = new Filter(NetworkGroupRulesVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
Filter searchFilter = new Filter(SecurityGroupRulesVO.class, "id", true, cmd.getStartIndex(), cmd.getPageSizeVal());
Object keyword = cmd.getKeyword();
SearchBuilder<NetworkGroupRulesVO> sb = _networkGroupRulesDao.createSearchBuilder();
SearchBuilder<SecurityGroupRulesVO> sb = _networkGroupRulesDao.createSearchBuilder();
sb.and("accountId", sb.entity().getAccountId(), SearchCriteria.Op.EQ);
sb.and("name", sb.entity().getName(), SearchCriteria.Op.EQ);
sb.and("domainId", sb.entity().getDomainId(), SearchCriteria.Op.EQ);
@ -1265,13 +1265,13 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
sb.join("domainSearch", domainSearch, sb.entity().getDomainId(), domainSearch.entity().getId(), JoinBuilder.JoinType.INNER);
}
SearchCriteria<NetworkGroupRulesVO> sc = sb.create();
SearchCriteria<SecurityGroupRulesVO> sc = sb.create();
if (accountId != null) {
sc.setParameters("accountId", accountId);
if (networkGroup != null) {
sc.setParameters("name", networkGroup);
} else if (keyword != null) {
SearchCriteria<NetworkGroupRulesVO> ssc = _networkGroupRulesDao.createSearchCriteria();
SearchCriteria<SecurityGroupRulesVO> ssc = _networkGroupRulesDao.createSearchCriteria();
ssc.addOr("name", SearchCriteria.Op.LIKE, "%" + keyword + "%");
ssc.addOr("description", SearchCriteria.Op.LIKE, "%" + keyword + "%");
sc.addAnd("name", SearchCriteria.Op.SC, ssc);
@ -1290,13 +1290,13 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
return _networkGroupRulesDao.search(sc, searchFilter);
}
private List<NetworkGroupRulesVO> listNetworkGroupRulesByVM(long vmId) {
List<NetworkGroupRulesVO> results = new ArrayList<NetworkGroupRulesVO>();
private List<SecurityGroupRulesVO> listNetworkGroupRulesByVM(long vmId) {
List<SecurityGroupRulesVO> results = new ArrayList<SecurityGroupRulesVO>();
List<NetworkGroupVMMapVO> networkGroupMappings = _networkGroupVMMapDao.listByInstanceId(vmId);
if (networkGroupMappings != null) {
for (NetworkGroupVMMapVO networkGroupMapping : networkGroupMappings) {
NetworkGroupVO group = _networkGroupDao.findById(networkGroupMapping.getNetworkGroupId());
List<NetworkGroupRulesVO> rules = _networkGroupRulesDao.listNetworkGroupRules(group.getAccountId(), networkGroupMapping.getGroupName());
List<SecurityGroupRulesVO> rules = _networkGroupRulesDao.listNetworkGroupRules(group.getAccountId(), networkGroupMapping.getGroupName());
if (rules != null) {
results.addAll(rules);
}
@ -1337,11 +1337,11 @@ public class SecurityGroupManagerImpl implements SecurityGroupManager {
private void cleanupUnfinishedWork() {
Date before = new Date(System.currentTimeMillis() - 30*1000l);
List<NetworkGroupWorkVO> unfinished = _workDao.findUnfinishedWork(before);
List<SecurityGroupWorkVO> unfinished = _workDao.findUnfinishedWork(before);
if (unfinished.size() > 0) {
s_logger.info("Network Group Work cleanup found " + unfinished.size() + " unfinished work items older than " + before.toString());
Set<Long> affectedVms = new HashSet<Long>();
for (NetworkGroupWorkVO work: unfinished) {
for (SecurityGroupWorkVO work: unfinished) {
affectedVms.add(work.getInstanceId());
}
scheduleRulesetUpdateToHosts(affectedVms, false, null);