mirror of https://github.com/apache/cloudstack.git
bug 5764: checkin before I switch to work on 2.1.x
This commit is contained in:
parent
5fb852f0ca
commit
415bc8ae20
|
|
@ -44,6 +44,7 @@ public class Network {
|
||||||
Native,
|
Native,
|
||||||
Vlan,
|
Vlan,
|
||||||
Vswitch,
|
Vswitch,
|
||||||
|
LinkLocal,
|
||||||
Vnet;
|
Vnet;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -54,7 +55,7 @@ public class Network {
|
||||||
Public,
|
Public,
|
||||||
Guest,
|
Guest,
|
||||||
Storage,
|
Storage,
|
||||||
LinkLocal,
|
Control,
|
||||||
Vpn,
|
Vpn,
|
||||||
Management
|
Management
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -700,7 +700,7 @@ public abstract class CitrixResourceBase implements StoragePoolResource, ServerR
|
||||||
Pair<Network, String> getNetworkForTraffic(Connection conn, TrafficType type) throws XenAPIException, XmlRpcException {
|
Pair<Network, String> getNetworkForTraffic(Connection conn, TrafficType type) throws XenAPIException, XmlRpcException {
|
||||||
if (type == TrafficType.Guest) {
|
if (type == TrafficType.Guest) {
|
||||||
return new Pair<Network, String>(Network.getByUuid(conn, _host.guestNetwork), _host.guestPif);
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.guestNetwork), _host.guestPif);
|
||||||
} else if (type == TrafficType.LinkLocal) {
|
} else if (type == TrafficType.Control) {
|
||||||
return new Pair<Network, String>(Network.getByUuid(conn, _host.linkLocalNetwork), null);
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.linkLocalNetwork), null);
|
||||||
} else if (type == TrafficType.Management) {
|
} else if (type == TrafficType.Management) {
|
||||||
return new Pair<Network, String>(Network.getByUuid(conn, _host.privateNetwork), _host.privatePif);
|
return new Pair<Network, String>(Network.getByUuid(conn, _host.privateNetwork), _host.privatePif);
|
||||||
|
|
|
||||||
|
|
@ -2357,7 +2357,7 @@ public class ConsoleProxyManagerImpl implements ConsoleProxyManager, VirtualMach
|
||||||
_publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering);
|
_publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering);
|
||||||
_managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null);
|
_managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null);
|
||||||
_managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering);
|
_managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering);
|
||||||
_linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.LinkLocal, null);
|
_linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.Control, null);
|
||||||
_linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering);
|
_linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering);
|
||||||
|
|
||||||
_capacityScanScheduler.scheduleAtFixedRate(getCapacityScanTask(), STARTUP_DELAY, _capacityScanInterval, TimeUnit.MILLISECONDS);
|
_capacityScanScheduler.scheduleAtFixedRate(getCapacityScanTask(), STARTUP_DELAY, _capacityScanInterval, TimeUnit.MILLISECONDS);
|
||||||
|
|
|
||||||
|
|
@ -53,15 +53,14 @@ import com.cloud.host.dao.HostDao;
|
||||||
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
|
import com.cloud.hypervisor.xen.resource.CitrixResourceBase;
|
||||||
import com.cloud.hypervisor.xen.resource.XcpServerResource;
|
import com.cloud.hypervisor.xen.resource.XcpServerResource;
|
||||||
import com.cloud.hypervisor.xen.resource.XenServerConnectionPool;
|
import com.cloud.hypervisor.xen.resource.XenServerConnectionPool;
|
||||||
import com.cloud.hypervisor.xen.resource.XenServerResource;
|
|
||||||
import com.cloud.resource.Discoverer;
|
import com.cloud.resource.Discoverer;
|
||||||
import com.cloud.resource.DiscovererBase;
|
import com.cloud.resource.DiscovererBase;
|
||||||
import com.cloud.resource.ServerResource;
|
import com.cloud.resource.ServerResource;
|
||||||
|
import com.cloud.storage.Storage.FileSystem;
|
||||||
|
import com.cloud.storage.Storage.ImageFormat;
|
||||||
import com.cloud.storage.VMTemplateHostVO;
|
import com.cloud.storage.VMTemplateHostVO;
|
||||||
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
import com.cloud.storage.VMTemplateStorageResourceAssoc;
|
||||||
import com.cloud.storage.VMTemplateVO;
|
import com.cloud.storage.VMTemplateVO;
|
||||||
import com.cloud.storage.Storage.FileSystem;
|
|
||||||
import com.cloud.storage.Storage.ImageFormat;
|
|
||||||
import com.cloud.storage.dao.VMTemplateDao;
|
import com.cloud.storage.dao.VMTemplateDao;
|
||||||
import com.cloud.storage.dao.VMTemplateHostDao;
|
import com.cloud.storage.dao.VMTemplateHostDao;
|
||||||
import com.cloud.storage.template.TemplateInfo;
|
import com.cloud.storage.template.TemplateInfo;
|
||||||
|
|
@ -383,8 +382,8 @@ public class XcpServerDiscoverer extends DiscovererBase implements Discoverer, L
|
||||||
if(prodBrand.equals("XenCloudPlatform") && prodVersion.equals("0.1.1"))
|
if(prodBrand.equals("XenCloudPlatform") && prodVersion.equals("0.1.1"))
|
||||||
return new XcpServerResource();
|
return new XcpServerResource();
|
||||||
|
|
||||||
if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
|
// if(prodBrand.equals("XenServer") && prodVersion.equals("5.6.0"))
|
||||||
return new XenServerResource();
|
// return new XenServerResource();
|
||||||
|
|
||||||
String msg = "Only support XCP 0.1.1 and Xerver 5.6.0, but this one is " + prodBrand + " " + prodVersion;
|
String msg = "Only support XCP 0.1.1 and Xerver 5.6.0, but this one is " + prodBrand + " " + prodVersion;
|
||||||
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
|
_alertMgr.sendAlert(AlertManager.ALERT_TYPE_HOST, dcId, podId, msg, msg);
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ import com.cloud.network.Network.TrafficType;
|
||||||
import com.cloud.network.dao.FirewallRulesDao;
|
import com.cloud.network.dao.FirewallRulesDao;
|
||||||
import com.cloud.network.dao.IPAddressDao;
|
import com.cloud.network.dao.IPAddressDao;
|
||||||
import com.cloud.network.dao.LoadBalancerDao;
|
import com.cloud.network.dao.LoadBalancerDao;
|
||||||
|
import com.cloud.network.dao.NetworkProfileDao;
|
||||||
import com.cloud.network.dao.SecurityGroupVMMapDao;
|
import com.cloud.network.dao.SecurityGroupVMMapDao;
|
||||||
import com.cloud.offering.NetworkOffering;
|
import com.cloud.offering.NetworkOffering;
|
||||||
import com.cloud.offering.NetworkOffering.GuestIpType;
|
import com.cloud.offering.NetworkOffering.GuestIpType;
|
||||||
|
|
@ -193,6 +194,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
@Inject ServiceOfferingDao _serviceOfferingDao = null;
|
@Inject ServiceOfferingDao _serviceOfferingDao = null;
|
||||||
@Inject UserStatisticsDao _statsDao = null;
|
@Inject UserStatisticsDao _statsDao = null;
|
||||||
@Inject NetworkOfferingDao _networkOfferingDao = null;
|
@Inject NetworkOfferingDao _networkOfferingDao = null;
|
||||||
|
@Inject NetworkProfileDao _networkProfileDao = null;
|
||||||
|
|
||||||
Adapters<NetworkProfiler> _networkProfilers;
|
Adapters<NetworkProfiler> _networkProfilers;
|
||||||
|
|
||||||
|
|
@ -1835,7 +1837,7 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
_publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering);
|
_publicNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_publicNetworkOffering);
|
||||||
_managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null);
|
_managementNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmManagementNetwork, TrafficType.Management, null);
|
||||||
_managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering);
|
_managementNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_managementNetworkOffering);
|
||||||
_linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.LinkLocal, null);
|
_linkLocalNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmLinkLocalNetwork, TrafficType.Control, null);
|
||||||
_linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering);
|
_linkLocalNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_linkLocalNetworkOffering);
|
||||||
_guestNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmGuestNetwork, TrafficType.Guest, GuestIpType.Virtualized);
|
_guestNetworkOffering = new NetworkOfferingVO(NetworkOfferingVO.SystemVmGuestNetwork, TrafficType.Guest, GuestIpType.Virtualized);
|
||||||
_guestNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_guestNetworkOffering);
|
_guestNetworkOffering = _networkOfferingDao.persistSystemNetworkOffering(_guestNetworkOffering);
|
||||||
|
|
@ -1848,6 +1850,29 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setupNetworkProfiles(List<NetworkOfferingVO> offerings, AccountVO account) {
|
||||||
|
List<? extends NetworkProfile> profiles = null;
|
||||||
|
for (NetworkProfiler profiler : _networkProfilers) {
|
||||||
|
if (s_logger.isDebugEnabled()) {
|
||||||
|
s_logger.debug("Sending network profiles to " + profiler.getName());
|
||||||
|
}
|
||||||
|
profiles = profiler.convert(offerings, account);
|
||||||
|
if (profiles != null) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (profiles == null) {
|
||||||
|
s_logger.debug("Unable to resolve the network profiles");
|
||||||
|
throw new CloudRuntimeException("Uanble to convert network offerings to network profiles for that account");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (NetworkProfile profile : profiles) {
|
||||||
|
NetworkProfileVO vo = new NetworkProfileVO(profile, account.getId());
|
||||||
|
vo = _networkProfileDao.persist(vo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
|
|
@ -1861,9 +1886,12 @@ public class NetworkManagerImpl implements NetworkManager, VirtualMachineManager
|
||||||
offerings.add(_guestNetworkOffering);
|
offerings.add(_guestNetworkOffering);
|
||||||
offerings.add(_linkLocalNetworkOffering);
|
offerings.add(_linkLocalNetworkOffering);
|
||||||
offerings.add(_managementNetworkOffering);
|
offerings.add(_managementNetworkOffering);
|
||||||
|
|
||||||
for (NetworkProfiler profiler : _networkProfilers) {
|
try {
|
||||||
List<? extends NetworkProfile> profiles = profiler.convert(offerings, _accountMgr.getSystemAccount());
|
setupNetworkProfiles(offerings, _accountMgr.getSystemAccount());
|
||||||
|
} catch (Exception e) {
|
||||||
|
s_logger.warn("Unable to setup the system network profiles");
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
_executor.scheduleAtFixedRate(new RouterCleanupTask(), _routerCleanupInterval, _routerCleanupInterval, TimeUnit.SECONDS);
|
_executor.scheduleAtFixedRate(new RouterCleanupTask(), _routerCleanupInterval, _routerCleanupInterval, TimeUnit.SECONDS);
|
||||||
_executor.scheduleAtFixedRate(new NetworkUsageTask(), _routerStatsInterval, _routerStatsInterval, TimeUnit.SECONDS);
|
_executor.scheduleAtFixedRate(new NetworkUsageTask(), _routerStatsInterval, _routerStatsInterval, TimeUnit.SECONDS);
|
||||||
|
|
|
||||||
|
|
@ -57,8 +57,8 @@ public class NetworkProfileVO implements OwnedBy {
|
||||||
@Enumerated(value=EnumType.STRING)
|
@Enumerated(value=EnumType.STRING)
|
||||||
TrafficType trafficType;
|
TrafficType trafficType;
|
||||||
|
|
||||||
@Column(name="vlanIds")
|
@Column(name="vlan_id")
|
||||||
String vlanIds;
|
Long vlanId;
|
||||||
|
|
||||||
@Column(name="gateway")
|
@Column(name="gateway")
|
||||||
String gateway;
|
String gateway;
|
||||||
|
|
@ -69,6 +69,10 @@ public class NetworkProfileVO implements OwnedBy {
|
||||||
public NetworkProfileVO() {
|
public NetworkProfileVO() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public NetworkProfileVO(NetworkProfile that, long accountId) {
|
||||||
|
this(accountId, that.getTrafficType(), that.getMode(), that.getBroadcastDomainType());
|
||||||
|
}
|
||||||
|
|
||||||
public NetworkProfileVO(long accountId, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType) {
|
public NetworkProfileVO(long accountId, TrafficType trafficType, Mode mode, BroadcastDomainType broadcastDomainType) {
|
||||||
this.accountId = accountId;
|
this.accountId = accountId;
|
||||||
this.trafficType = trafficType;
|
this.trafficType = trafficType;
|
||||||
|
|
@ -129,4 +133,11 @@ public class NetworkProfileVO implements OwnedBy {
|
||||||
this.cidr = cidr;
|
this.cidr = cidr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Long getVlanId() {
|
||||||
|
return vlanId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVlanId(Long vlanId) {
|
||||||
|
this.vlanId = vlanId;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -27,6 +27,7 @@ public class NetworkProfilerImpl extends AdapterBase implements NetworkProfiler
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<? extends NetworkProfile> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner) {
|
public List<? extends NetworkProfile> convert(Collection<? extends NetworkOffering> networkOfferings, Account owner) {
|
||||||
|
List<NetworkProfileVO> profiles = _profileDao.listBy(owner.getId());
|
||||||
for (NetworkOffering offering : networkOfferings) {
|
for (NetworkOffering offering : networkOfferings) {
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
|
||||||
|
|
@ -17,9 +17,11 @@
|
||||||
*/
|
*/
|
||||||
package com.cloud.network.dao;
|
package com.cloud.network.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import com.cloud.network.NetworkProfileVO;
|
import com.cloud.network.NetworkProfileVO;
|
||||||
import com.cloud.utils.db.GenericDao;
|
import com.cloud.utils.db.GenericDao;
|
||||||
|
|
||||||
public interface NetworkProfileDao extends GenericDao<NetworkProfileVO, Long> {
|
public interface NetworkProfileDao extends GenericDao<NetworkProfileVO, Long> {
|
||||||
|
List<NetworkProfileVO> listBy(long accountId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,11 @@
|
||||||
*/
|
*/
|
||||||
package com.cloud.network.dao;
|
package com.cloud.network.dao;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import javax.ejb.Local;
|
import javax.ejb.Local;
|
||||||
|
|
||||||
|
import com.cloud.network.Network.BroadcastDomainType;
|
||||||
import com.cloud.network.Network.Mode;
|
import com.cloud.network.Network.Mode;
|
||||||
import com.cloud.network.Network.TrafficType;
|
import com.cloud.network.Network.TrafficType;
|
||||||
import com.cloud.network.NetworkProfileVO;
|
import com.cloud.network.NetworkProfileVO;
|
||||||
|
|
@ -29,6 +32,7 @@ import com.cloud.utils.db.SearchCriteria;
|
||||||
@Local(value=NetworkProfileDao.class)
|
@Local(value=NetworkProfileDao.class)
|
||||||
public class NetworkProfileDaoImpl extends GenericDaoBase<NetworkProfileVO, Long> implements NetworkProfileDao {
|
public class NetworkProfileDaoImpl extends GenericDaoBase<NetworkProfileVO, Long> implements NetworkProfileDao {
|
||||||
final SearchBuilder<NetworkProfileVO> ProfileSearch;
|
final SearchBuilder<NetworkProfileVO> ProfileSearch;
|
||||||
|
final SearchBuilder<NetworkProfileVO> AccountSearch;
|
||||||
|
|
||||||
protected NetworkProfileDaoImpl() {
|
protected NetworkProfileDaoImpl() {
|
||||||
super();
|
super();
|
||||||
|
|
@ -38,10 +42,28 @@ public class NetworkProfileDaoImpl extends GenericDaoBase<NetworkProfileVO, Long
|
||||||
ProfileSearch.and("trafficType", ProfileSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("trafficType", ProfileSearch.entity().getTrafficType(), SearchCriteria.Op.EQ);
|
||||||
ProfileSearch.and("cidr", ProfileSearch.entity().getCidr(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("cidr", ProfileSearch.entity().getCidr(), SearchCriteria.Op.EQ);
|
||||||
ProfileSearch.and("broadcastType", ProfileSearch.entity().getBroadcastDomainType(), SearchCriteria.Op.EQ);
|
ProfileSearch.and("broadcastType", ProfileSearch.entity().getBroadcastDomainType(), SearchCriteria.Op.EQ);
|
||||||
|
ProfileSearch.done();
|
||||||
|
|
||||||
|
AccountSearch = createSearchBuilder();
|
||||||
|
AccountSearch.and("account", AccountSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
|
||||||
|
AccountSearch.done();
|
||||||
}
|
}
|
||||||
|
|
||||||
public NetworkProfileVO findBy(TrafficType trafficType, Mode mode, long accountId) {
|
public NetworkProfileVO findBy(TrafficType trafficType, Mode mode, BroadcastDomainType broadcastType, long accountId) {
|
||||||
|
SearchCriteria<NetworkProfileVO> sc = ProfileSearch.create();
|
||||||
|
sc.setParameters("account", accountId);
|
||||||
|
sc.setParameters("trafficType", trafficType);
|
||||||
|
sc.setParameters("broadcastType", broadcastType);
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<NetworkProfileVO> listBy(long accountId) {
|
||||||
|
SearchCriteria<NetworkProfileVO> sc = AccountSearch.create();
|
||||||
|
sc.setParameters("account", accountId);
|
||||||
|
|
||||||
|
return listActiveBy(sc);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -95,6 +95,7 @@ CREATE TABLE `cloud`.`network_profiles` (
|
||||||
`gateway` varchar(15) NOT NULL COMMENT 'gateway for this network profile',
|
`gateway` varchar(15) NOT NULL COMMENT 'gateway for this network profile',
|
||||||
`cidr` varchar(32) NOT NULL COMMENT 'network cidr',
|
`cidr` varchar(32) NOT NULL COMMENT 'network cidr',
|
||||||
`mode` varchar(32) NOT NULL COMMENT 'How to retrieve ip address in this network',
|
`mode` varchar(32) NOT NULL COMMENT 'How to retrieve ip address in this network',
|
||||||
|
`vlan_id` bigint unsigned NULL COMMENT 'vlan id if the broadcast_domain_type is the vlan',
|
||||||
PRIMARY KEY (`id`)
|
PRIMARY KEY (`id`)
|
||||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue