Basic zone: the System Guest network offering can be created from any Shared Guest network offering.

Limitation:
* in order to make the networkOffering choice, only one Shared network has to be Enabled at the moment when Basic zone is being created
This commit is contained in:
alena 2011-11-02 15:39:29 -07:00
parent 3fc9b149e4
commit f42c9e434f
12 changed files with 108 additions and 83 deletions

View File

@ -32,7 +32,6 @@ import com.cloud.api.BaseCmd;
import com.cloud.api.Implementation;
import com.cloud.api.Parameter;
import com.cloud.api.ServerApiException;
import com.cloud.api.BaseCmd.CommandType;
import com.cloud.api.response.NetworkOfferingResponse;
import com.cloud.offering.NetworkOffering;
import com.cloud.offering.NetworkOffering.Availability;
@ -95,7 +94,7 @@ public class UpdateNetworkOfferingCmd extends BaseCmd {
@Parameter(name = ApiConstants.SERVICE_PROVIDER_LIST, type = CommandType.MAP, description = "provider to service mapping. If not specified, the provider for the service will be mapped to the default provider on the physical network")
private Map serviceProviderList;
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="list network offerings by state")
@Parameter(name=ApiConstants.STATE, type=CommandType.STRING, description="update state for the network offering")
private String state;
/////////////////////////////////////////////////////

View File

@ -34,6 +34,7 @@ import com.cloud.network.Network.Capability;
import com.cloud.network.Network.Provider;
import com.cloud.network.Network.Service;
import com.cloud.network.Networks.TrafficType;
import com.cloud.offering.NetworkOffering;
import com.cloud.user.Account;
public interface NetworkService {
@ -126,5 +127,4 @@ public interface NetworkService {
List<? extends PhysicalNetworkTrafficType> listTrafficTypes(Long physicalNetworkId);
PhysicalNetwork getDefaultPhysicalNetworkByZoneAndTrafficType(long zoneId, TrafficType trafficType);
}

View File

@ -1382,6 +1382,11 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
// the zone creation
if (zone != null) {
List<NetworkOfferingVO> ntwkOff = _networkOfferingDao.listSystemNetworkOfferings();
//for Advance security group enabled zone and Basic zone we have to find only one guest network offering enabled in the system
if (zone.getNetworkType() == NetworkType.Basic || isSecurityGroupEnabled) {
ntwkOff.add(_networkMgr.getExclusiveGuestNetworkOffering());
}
for (NetworkOfferingVO offering : ntwkOff) {
DataCenterDeployment plan = new DataCenterDeployment(zone.getId(), null, null, null, null, null);
@ -3254,9 +3259,10 @@ public class ConfigurationManagerImpl implements ConfigurationManager, Configura
txn.start();
// update network offering
success = success && _networkOfferingDao.update(id, offering);
_ntwkOffServiceMapDao.deleteByOfferingId(id);
// update services/providers - delete old ones, insert new ones
if (serviceProviderMap != null) {
if (!serviceProviderMap.isEmpty()) {
_ntwkOffServiceMapDao.deleteByOfferingId(id);
// update services/providers - delete old ones, insert new ones
for (Network.Service service : serviceProviderMap.keySet()) {
for (Network.Provider provider : serviceProviderMap.get(service)) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(offering.getId(), service, provider);

View File

@ -549,7 +549,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, ConsoleProx
List<NetworkOfferingVO> defaultOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemPublicNetwork);
if (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()) {
defaultOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemGuestNetwork);
defaultOffering.add(_networkMgr.getExclusiveGuestNetworkOffering());
}
List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemControlNetwork, NetworkOfferingVO.SystemManagementNetwork);

View File

@ -1,4 +1,5 @@
/**
* Copyright (C) 2010 Cloud.com, Inc. All rights reserved.
*
* This software is licensed under the GNU General Public License v3 or later.
@ -39,6 +40,7 @@ import com.cloud.network.element.UserDataServiceProvider;
import com.cloud.network.guru.NetworkGuru;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.StaticNat;
import com.cloud.offering.NetworkOffering;
import com.cloud.offerings.NetworkOfferingVO;
import com.cloud.user.Account;
import com.cloud.utils.Pair;
@ -233,6 +235,7 @@ public interface NetworkManager extends NetworkService {
List<Service> getElementServices(Provider provider);
boolean canElementEnableIndividualServices(Provider provider);
boolean canElementEnableIndividualServices(Provider provider);
NetworkOfferingVO getExclusiveGuestNetworkOffering();
}

View File

@ -890,22 +890,18 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
NetworkOfferingVO defaultGuestOffering = _networkOfferingDao.findByUniqueName(NetworkOffering.SystemGuestNetwork);
if (defaultGuestOffering == null) {
defaultGuestOffering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.SystemGuestNetwork, "System Offering for System-Guest-Network", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, true);
defaultGuestOffering.setState(NetworkOffering.State.Enabled);
defaultGuestOffering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.SystemGuestNetwork, "System Offering for System-Guest-Network", TrafficType.Guest, null, null, false, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, false);
_networkOfferingDao.update(defaultGuestOffering.getId(), defaultGuestOffering);
}
_systemNetworks.put(NetworkOfferingVO.SystemGuestNetwork, defaultGuestOffering);
NetworkOfferingVO offering = null;
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultVirtualizedNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM,NetworkOffering.DefaultVirtualizedNetworkOffering, "Virtual Vlan", TrafficType.Guest, null, null, false, Availability.Required, null, defaultVirtualNetworkOfferingProviders, true, Network.GuestType.Isolated, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
if (_networkOfferingDao.findByUniqueName(NetworkOffering.DefaultDirectNetworkOffering) == null) {
offering = _configMgr.createNetworkOffering(Account.ACCOUNT_ID_SYSTEM, NetworkOffering.DefaultDirectNetworkOffering, "Direct", TrafficType.Guest, null, null, true, Availability.Optional, null, defaultDirectNetworkOfferingProviders, true, Network.GuestType.Shared, false);
offering.setState(NetworkOffering.State.Enabled);
_networkOfferingDao.update(offering.getId(), offering);
}
@ -1130,6 +1126,22 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
}
return offerings;
}
@Override
public NetworkOfferingVO getExclusiveGuestNetworkOffering() {
//this method should return Guest network offering in Enabled state; and this network offering should be unique, otherwise Runtime exception is going to be thrown
List<NetworkOfferingVO> offerings = _networkOfferingDao.listByTrafficTypeGuestTypeAndState(NetworkOffering.State.Enabled, TrafficType.Guest, GuestType.Shared);
if (offerings.isEmpty()) {
throw new CloudRuntimeException("Unable to find network offering in state " + NetworkOffering.State.Enabled + ", traffic type " + TrafficType.Guest + " and guest type " + GuestType.Shared);
}
if (offerings.size() > 1) {
throw new CloudRuntimeException("Found more than 1 network offering in state " + NetworkOffering.State.Enabled + ", traffic type " + TrafficType.Guest + " and guest type " + GuestType.Shared);
}
return offerings.get(0);
}
@Override
@DB

View File

@ -572,12 +572,16 @@ public class ElasticLoadBalancerManagerImpl implements
@DB
public PublicIp allocIp(CreateLoadBalancerRuleCmd lb, Account account) throws InsufficientAddressCapacityException {
//TODO: this only works in the guest network. Handle the public network case also.
List<NetworkOfferingVO> offerings = _networkOfferingDao.listByTrafficTypeAndType(true, _frontendTrafficType, Network.GuestType.Shared);
if (offerings == null || offerings.size() == 0) {
s_logger.warn("ELB: Could not find system offering for direct networks of type " + _frontendTrafficType);
NetworkOfferingVO frontEndOffering = null;
if (_frontendTrafficType == TrafficType.Guest) {
frontEndOffering = _networkMgr.getExclusiveGuestNetworkOffering();
}
if (frontEndOffering == null) {
s_logger.warn("ELB: Could not find offering for direct networks of type " + _frontendTrafficType);
return null;
}
NetworkOffering frontEndOffering = offerings.get(0);
List<NetworkVO> networks = _networksDao.listBy(Account.ACCOUNT_ID_SYSTEM, frontEndOffering.getId(), lb.getZoneId());
if (networks == null || networks.size() == 0) {
s_logger.warn("ELB: Could not find network of offering type " + frontEndOffering + " in zone " + lb.getZoneId());

View File

@ -53,14 +53,14 @@ public interface NetworkOfferingDao extends GenericDao<NetworkOfferingVO, Long>
*/
NetworkOfferingVO persistDefaultNetworkOffering(NetworkOfferingVO offering);
List<NetworkOfferingVO> listNonSystemNetworkOfferings();
List<NetworkOfferingVO> listSystemNetworkOfferings();
List<NetworkOfferingVO> listByAvailability(Availability availability, boolean isSystem);
List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.GuestType type);
List<Long> getOfferingIdsToUpgradeFrom(NetworkOffering originalOffering);
List<NetworkOfferingVO> listByTrafficTypeGuestTypeAndState(NetworkOffering.State state, TrafficType trafficType, Network.GuestType type);
List<NetworkOfferingVO> listGuestNetworkOfferings(Network.GuestType type, boolean isDefault);
}

View File

@ -44,7 +44,7 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
final SearchBuilder<NetworkOfferingVO> NameSearch;
final SearchBuilder<NetworkOfferingVO> SystemOfferingSearch;
final SearchBuilder<NetworkOfferingVO> AvailabilitySearch;
final SearchBuilder<NetworkOfferingVO> TrafficTypeGuestTypeSearch;
final SearchBuilder<NetworkOfferingVO> AllFieldsSearch;
private final GenericSearchBuilder<NetworkOfferingVO, Long> UpgradeSearch;
protected NetworkOfferingDaoImpl() {
@ -64,11 +64,12 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
AvailabilitySearch.and("isSystem", AvailabilitySearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
AvailabilitySearch.done();
TrafficTypeGuestTypeSearch = createSearchBuilder();
TrafficTypeGuestTypeSearch.and("trafficType", TrafficTypeGuestTypeSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.and("guestType", TrafficTypeGuestTypeSearch.entity().getGuestType(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.and("isSystem", TrafficTypeGuestTypeSearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
TrafficTypeGuestTypeSearch.done();
AllFieldsSearch = createSearchBuilder();
AllFieldsSearch.and("trafficType", AllFieldsSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("guestType", AllFieldsSearch.entity().getGuestType(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("isSystem", AllFieldsSearch.entity().isSystemOnly(), SearchCriteria.Op.EQ);
AllFieldsSearch.and("state", AllFieldsSearch.entity().getState(), SearchCriteria.Op.EQ);
AllFieldsSearch.done();
UpgradeSearch = createSearchBuilder(Long.class);
UpgradeSearch.selectField(UpgradeSearch.entity().getId());
@ -106,13 +107,6 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
}
}
@Override
public List<NetworkOfferingVO> listNonSystemNetworkOfferings() {
SearchCriteria<NetworkOfferingVO> sc = SystemOfferingSearch.create();
sc.setParameters("system", false);
return this.listIncludingRemovedBy(sc, null);
}
@Override
public List<NetworkOfferingVO> listSystemNetworkOfferings() {
SearchCriteria<NetworkOfferingVO> sc = SystemOfferingSearch.create();
@ -128,15 +122,6 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
return listBy(sc, null);
}
@Override
public List<NetworkOfferingVO> listByTrafficTypeAndType(boolean isSystem, TrafficType trafficType, Network.GuestType type) {
SearchCriteria<NetworkOfferingVO> sc = TrafficTypeGuestTypeSearch.create();
sc.setParameters("trafficType", trafficType);
sc.setParameters("guestType", type);
sc.setParameters("isSystem", isSystem);
return listBy(sc, null);
}
@Override
public boolean remove(Long networkOfferingId){
NetworkOfferingVO offering = findById(networkOfferingId);
@ -164,4 +149,22 @@ public class NetworkOfferingDaoImpl extends GenericDaoBase<NetworkOfferingVO, Lo
return customSearch(sc, null);
}
@Override
public List<NetworkOfferingVO> listByTrafficTypeGuestTypeAndState(NetworkOffering.State state, TrafficType trafficType, Network.GuestType type) {
SearchCriteria<NetworkOfferingVO> sc = AllFieldsSearch.create();
sc.setParameters("trafficType", trafficType);
sc.setParameters("guestType", type);
sc.setParameters("state", state);
return listBy(sc, null);
}
@Override
public List<NetworkOfferingVO> listGuestNetworkOfferings(Network.GuestType type, boolean isDefault) {
SearchCriteria<NetworkOfferingVO> sc = AllFieldsSearch.create();
sc.setParameters("trafficType", TrafficType.Guest);
sc.setParameters("guestType", type);
sc.setParameters("isDefault", isDefault);
return listBy(sc, null);
}
}

View File

@ -833,75 +833,73 @@ public class ConfigurationServerImpl implements ConfigurationServer {
storageNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(storageNetworkOffering);
//populate providers
Map<Network.Service, Network.Provider> defaultDirectNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultDirectNetworkOfferingProviders.put(Service.Dhcp, Provider.DhcpServer);
defaultDirectNetworkOfferingProviders.put(Service.Dns, Provider.DhcpServer);
defaultDirectNetworkOfferingProviders.put(Service.UserData, Provider.DhcpServer);
Map<Network.Service, Network.Provider> defaultSharedNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultSharedNetworkOfferingProviders.put(Service.Dhcp, Provider.DhcpServer);
defaultSharedNetworkOfferingProviders.put(Service.Dns, Provider.DhcpServer);
defaultSharedNetworkOfferingProviders.put(Service.UserData, Provider.DhcpServer);
Map<Network.Service, Network.Provider> defaultDirectGuestNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultDirectGuestNetworkOfferingProviders.put(Service.Dhcp, Provider.DhcpServer);
defaultDirectGuestNetworkOfferingProviders.put(Service.Dns, Provider.DhcpServer);
defaultDirectGuestNetworkOfferingProviders.put(Service.UserData, Provider.DhcpServer);
defaultDirectGuestNetworkOfferingProviders.put(Service.SecurityGroup, Provider.SecurityGroupProvider);
Map<Network.Service, Network.Provider> defaultSharedSGNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultSharedSGNetworkOfferingProviders.put(Service.Dhcp, Provider.DhcpServer);
defaultSharedSGNetworkOfferingProviders.put(Service.Dns, Provider.DhcpServer);
defaultSharedSGNetworkOfferingProviders.put(Service.UserData, Provider.DhcpServer);
defaultSharedSGNetworkOfferingProviders.put(Service.SecurityGroup, Provider.SecurityGroupProvider);
Map<Network.Service, Network.Provider> defaultVirtualNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultVirtualNetworkOfferingProviders.put(Service.Dhcp, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.Firewall, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.Gateway, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.Lb, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.SourceNat, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.StaticNat, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.PortForwarding, Provider.VirtualRouter);
defaultVirtualNetworkOfferingProviders.put(Service.Vpn, Provider.VirtualRouter);
Map<Network.Service, Network.Provider> defaultIsolatedNetworkOfferingProviders = new HashMap<Network.Service, Network.Provider>();
defaultIsolatedNetworkOfferingProviders.put(Service.Dhcp, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.Dns, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.UserData, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.Firewall, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.Gateway, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.Lb, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.SourceNat, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.StaticNat, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.PortForwarding, Provider.VirtualRouter);
defaultIsolatedNetworkOfferingProviders.put(Service.Vpn, Provider.VirtualRouter);
NetworkOfferingVO guestNetworkOffering = new NetworkOfferingVO(
//The only one diff between 1 and 3 network offerings is that the first one has SG enabled. In Basic zone only first network offering has to be enabled, in Advance zone - the third one
NetworkOfferingVO deafultSharedSGNetworkOffering = new NetworkOfferingVO(
NetworkOffering.SystemGuestNetwork,
"System-Guest-Network",
TrafficType.Guest,
true, false, null, null, null, true,
false, false, null, null, null, true,
Availability.Optional, null, Network.GuestType.Shared);
guestNetworkOffering.setState(NetworkOffering.State.Enabled);
guestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(guestNetworkOffering);
deafultSharedSGNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(deafultSharedSGNetworkOffering);
for (Service service : defaultDirectGuestNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(guestNetworkOffering.getId(), service, defaultDirectGuestNetworkOfferingProviders.get(service));
for (Service service : defaultSharedSGNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(deafultSharedSGNetworkOffering.getId(), service, defaultSharedSGNetworkOfferingProviders.get(service));
_offeringServiceMapDao.persist(offService);
s_logger.trace("Added service for the network offering: " + offService);
}
NetworkOfferingVO defaultGuestNetworkOffering = new NetworkOfferingVO(
NetworkOfferingVO defaultIsolatedNetworkOffering = new NetworkOfferingVO(
NetworkOffering.DefaultVirtualizedNetworkOffering,
"Virtual Vlan",
TrafficType.Guest,
false, false, null, null, null, true,
Availability.Required, null, Network.GuestType.Isolated);
defaultGuestNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultGuestNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultGuestNetworkOffering);
defaultIsolatedNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultIsolatedNetworkOffering);
for (Service service : defaultVirtualNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultGuestNetworkOffering.getId(), service, defaultVirtualNetworkOfferingProviders.get(service));
for (Service service : defaultIsolatedNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultIsolatedNetworkOffering.getId(), service, defaultIsolatedNetworkOfferingProviders.get(service));
_offeringServiceMapDao.persist(offService);
s_logger.trace("Added service for the network offering: " + offService);
}
NetworkOfferingVO defaultGuestDirectNetworkOffering = new NetworkOfferingVO(
NetworkOfferingVO defaultSharedNetworkOffering = new NetworkOfferingVO(
NetworkOffering.DefaultDirectNetworkOffering,
"Direct",
TrafficType.Guest,
false, true, null, null, null, true,
false, false, null, null, null, true,
Availability.Optional, null, Network.GuestType.Shared);
defaultGuestDirectNetworkOffering.setState(NetworkOffering.State.Enabled);
defaultGuestDirectNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultGuestDirectNetworkOffering);
defaultSharedNetworkOffering = _networkOfferingDao.persistDefaultNetworkOffering(defaultSharedNetworkOffering);
for (Service service : defaultDirectNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultGuestDirectNetworkOffering.getId(), service, defaultDirectNetworkOfferingProviders.get(service));
for (Service service : defaultSharedNetworkOfferingProviders.keySet()) {
NetworkOfferingServiceMapVO offService = new NetworkOfferingServiceMapVO(defaultSharedNetworkOffering.getId(), service, defaultSharedNetworkOfferingProviders.get(service));
_offeringServiceMapDao.persist(offService);
s_logger.trace("Added service for the network offering: " + offService);
}

View File

@ -495,7 +495,7 @@ public class SecondaryStorageManagerImpl implements SecondaryStorageVmManager, V
List<NetworkOfferingVO> defaultOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemPublicNetwork);
if (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()) {
defaultOffering = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemGuestNetwork);
defaultOffering.add(_networkMgr.getExclusiveGuestNetworkOffering());
}
List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemControlNetwork, NetworkOfferingVO.SystemManagementNetwork);

View File

@ -2176,7 +2176,7 @@ public class UserVmManagerImpl implements UserVmManager, UserVmService, Manager
// 2) If Availability=Optional, search for default networks for the account. If it's more than 1, throw an error.
// If it's 0, and there are no default direct networks, create default Guest Virtual network
List<NetworkOfferingVO> defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeAndType(false, TrafficType.Guest, Network.GuestType.Isolated);
List<NetworkOfferingVO> defaultVirtualOffering = _networkOfferingDao.listByTrafficTypeGuestTypeAndState(NetworkOffering.State.Enabled, TrafficType.Guest, Network.GuestType.Isolated);
PhysicalNetwork physicalNetwork = _networkMgr.translateZoneIdToPhysicalNetwork(zone.getId());
if (defaultVirtualOffering.get(0).getAvailability() == Availability.Required) {
// get Virtual netowrks