changes from testing

This commit is contained in:
Alex Huang 2010-12-10 09:29:23 -08:00
parent 3f9d797594
commit 8ac694bf55
5 changed files with 10 additions and 5 deletions

View File

@ -248,7 +248,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
@Override
public PublicIp assignSourceNatIpAddress(Account owner, Network network, long callerId) throws ConcurrentOperationException, InsufficientAddressCapacityException {
assert ((network.getTrafficType() == TrafficType.Public) || (network.getTrafficType() == TrafficType.Guest && network.getGuestType() == GuestIpType.Direct)) : "You're asking for a source nat but your network can't participate in source nat. What do you have to say for yourself?";
assert (network.getTrafficType() != null) : "You're asking for a source nat but your network can't participate in source nat. What do you have to say for yourself?";
long dcId = network.getDataCenterId();
long ownerId = owner.getId();
@ -880,7 +880,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
NetworkVO vo = new NetworkVO(id, config, offering.getId(), plan.getDataCenterId(), guru.getName(), owner.getDomainId(), owner.getId(), related, name, displayText, isShared);
configs.add(_networksDao.persist(vo));
configs.add(_networksDao.persist(vo, vo.getGuestType() != null));
}
if (configs.size() < 1) {

View File

@ -34,6 +34,9 @@ public interface NetworkDao extends GenericDao<NetworkVO, Long> {
SearchBuilder<NetworkAccountVO> createSearchBuilderForAccount();
List<NetworkVO> getNetworksForOffering(long offeringId, long dataCenterId, long accountId);
List<NetworkVO> getRelatedNetworks(long related);
@Override @Deprecated
NetworkVO persist(NetworkVO vo);
/**
* Retrieves the next available mac address in this network configuration.

View File

@ -30,6 +30,7 @@ import com.cloud.network.Networks.BroadcastDomainType;
import com.cloud.network.Networks.Mode;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering.GuestIpType;
import com.cloud.utils.component.ComponentLocator;
import com.cloud.utils.db.DB;
import com.cloud.utils.db.GenericDaoBase;
import com.cloud.utils.db.JoinBuilder;
@ -49,8 +50,8 @@ public class NetworkDaoImpl extends GenericDaoBase<NetworkVO, Long> implements N
final SearchBuilder<NetworkVO> AccountNetworkSearch;
final SearchBuilder<NetworkVO> ZoneBroadcastUriSearch;
NetworkAccountDaoImpl _accountsDao = new NetworkAccountDaoImpl();
NetworkOpDaoImpl _opDao = new NetworkOpDaoImpl();
NetworkAccountDaoImpl _accountsDao = ComponentLocator.inject(NetworkAccountDaoImpl.class);
NetworkOpDaoImpl _opDao = ComponentLocator.inject(NetworkOpDaoImpl.class);
final TableGenerator _tgMacAddress;
Random _rand = new Random(System.currentTimeMillis());
long _prefix = 0x2;

View File

@ -410,6 +410,7 @@ CREATE TABLE `cloud`.`op_dc_ip_address_alloc` (
`data_center_id` bigint unsigned NOT NULL COMMENT 'data center it belongs to',
`pod_id` bigint unsigned NOT NULL COMMENT 'pod it belongs to',
`instance_id` bigint unsigned NULL COMMENT 'instance id',
`mac_address` bigint unsigned NOT NULL COMMENT 'mac_address',
`reservation_id` char(40) NULL COMMENT 'reservation id',
`taken` datetime COMMENT 'Date taken',
PRIMARY KEY (`id`)

View File

@ -215,7 +215,7 @@ public class SearchCriteria<K> {
}
public Pair<GroupBy<?, ?>, List<Object>> getGroupBy() {
return new Pair<GroupBy<?, ?>, List<Object>>(_groupBy, _groupByValues);
return _groupBy == null ? null : new Pair<GroupBy<?, ?>, List<Object>>(_groupBy, _groupByValues);
}
public void setGroupByValues(Object... values) {