bug 13522: mark network for GC when domR starts with startRouter command, not as a part of user vm start/deploy

status 13522: resolved fixed
This commit is contained in:
Alena Prokharchyk 2012-02-08 13:32:14 -08:00
parent 30f9d1d82e
commit fad3c7eab4
4 changed files with 20 additions and 2 deletions

View File

@ -1754,6 +1754,11 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
s_logger.debug("Changing active number of nics for network id=" + networkId + " on " + count);
_networksDao.changeActiveNicsBy(networkId, count);
}
if (nic.getVmType() == VirtualMachine.Type.User || (nic.getVmType() == VirtualMachine.Type.DomainRouter && getNetwork(networkId).getTrafficType() == TrafficType.Guest)) {
_networksDao.setCheckForGc(networkId);
}
txn.commit();
}

View File

@ -92,4 +92,6 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
List<NetworkVO> listByZoneAndTrafficType(long zoneId, TrafficType trafficType);
void setCheckForGc(long networkId);
}

View File

@ -311,6 +311,11 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
public void clearCheckForGc(long networkId) {
_opDao.clearCheckForGc(networkId);
}
@Override
public void setCheckForGc(long networkId) {
_opDao.setCheckForGc(networkId);
}
@Override
public List<NetworkVO> listByOwner(long ownerId) {

View File

@ -75,17 +75,23 @@ public class NetworkOpDaoImpl extends GenericDaoBase<NetworkOpVO, Long> implemen
}
public void changeActiveNicsBy(long networkId, int count) {
SearchCriteria<NetworkOpVO> sc = AllFieldsSearch.create();
sc.setParameters("network", networkId);
NetworkOpVO vo = createForUpdate();
vo.setCheckForGc(true);
UpdateBuilder builder = getUpdateBuilder(vo);
builder.incr(_activeNicsAttribute, count);
update(builder, sc, null);
}
public void setCheckForGc(long networkId) {
NetworkOpVO vo = createForUpdate();
vo.setCheckForGc(true);
update(networkId, vo);
}
public void clearCheckForGc(long networkId) {
NetworkOpVO vo = createForUpdate();
vo.setCheckForGc(false);