mirror of https://github.com/apache/cloudstack.git
more changes
This commit is contained in:
parent
0ecb0118ec
commit
91573b6252
|
|
@ -160,6 +160,8 @@ public enum Config {
|
|||
NetworkGcWait("Advanced", ManagementServer.class, Integer.class, "network.gc.wait", "600", "Seconds to wait before shutting down a network that's not in used", null),
|
||||
NetworkGcInterval("Advanced", ManagementServer.class, Integer.class, "network.gc.interval", "600", "Seconds to wait before checking for networks to shutdown", null),
|
||||
|
||||
VmTransitionWaitInterval("Advanced", ManagementServer.class, Integer.class, "vm.tranisition.wait.interval", "3600", "Seconds to wait before taking over a VM in transition state", null),
|
||||
|
||||
ControlCidr("Advanced", ManagementServer.class, String.class, "control.cidr", "169.254.0.0/16", "Changes the cidr for the control network traffic. Defaults to using link local. Must be unique within pods", null),
|
||||
ControlGateway("Advanced", ManagementServer.class, String.class, "control.gateway", "169.254.0.1", "gateway for the control network traffic", null),
|
||||
|
||||
|
|
|
|||
|
|
@ -1036,6 +1036,9 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
}
|
||||
|
||||
NetworkOfferingVO offering = _networkOfferingDao.findById(network.getNetworkOfferingId());
|
||||
network.setState(Network.State.Implementing);
|
||||
network.setReservationId(context.getReservationId());
|
||||
_networksDao.update(networkId, network);
|
||||
|
||||
Network result = guru.implement(network, offering, dest, context);
|
||||
network.setCidr(result.getCidr());
|
||||
|
|
@ -1044,8 +1047,6 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
network.setDns1(result.getDns1());
|
||||
network.setDns2(result.getDns2());
|
||||
network.setMode(result.getMode());
|
||||
network.setReservationId(context.getReservationId());
|
||||
network.setState(Network.State.Implementing);
|
||||
_networksDao.update(networkId, network);
|
||||
|
||||
for (NetworkElement element : _networkElements) {
|
||||
|
|
|
|||
|
|
@ -128,7 +128,7 @@ public class GuestNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
|
||||
@Override
|
||||
public Network implement(Network network, NetworkOffering offering, DeployDestination dest, ReservationContext context) {
|
||||
assert (network.getState() == State.Allocated) : "Why implement are we implementing " + network;
|
||||
assert (network.getState() == State.Implementing) : "Why are we implementing " + network;
|
||||
|
||||
long dcId = dest.getDataCenter().getId();
|
||||
NetworkVO implemented = new NetworkVO(network.getTrafficType(), network.getGuestType(), network.getMode(), network.getBroadcastDomainType(), network.getNetworkOfferingId(), network.getDataCenterId());
|
||||
|
|
|
|||
|
|
@ -1331,27 +1331,28 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
|
||||
@Override
|
||||
public VirtualRouter deployVirtualRouter(Network guestConfig, DeployDestination dest, Account owner) throws InsufficientCapacityException,
|
||||
public VirtualRouter deployVirtualRouter(Network guestNetwork, DeployDestination dest, Account owner) throws InsufficientCapacityException,
|
||||
ConcurrentOperationException, ResourceUnavailableException {
|
||||
long dcId = dest.getDataCenter().getId();
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Starting a router for network configurations: virtual=" + guestConfig + " in " + dest);
|
||||
s_logger.debug("Starting a router for network configurations: virtual=" + guestNetwork + " in " + dest);
|
||||
}
|
||||
assert guestConfig.getState() == Network.State.Implemented || guestConfig.getState() == Network.State.Setup : "Network is not yet fully implemented: "
|
||||
+ guestConfig;
|
||||
assert guestConfig.getTrafficType() == TrafficType.Guest;
|
||||
|
||||
assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing: "Network is not yet fully implemented: "
|
||||
+ guestNetwork;
|
||||
assert guestNetwork.getTrafficType() == TrafficType.Guest;
|
||||
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dcId);
|
||||
|
||||
DomainRouterVO router = _routerDao.findByNetworkConfiguration(guestConfig.getId());
|
||||
DomainRouterVO router = _routerDao.findByNetworkConfiguration(guestNetwork.getId());
|
||||
if (router == null) {
|
||||
long id = _routerDao.getNextInSequence(Long.class, "id");
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Creating the router " + id);
|
||||
}
|
||||
|
||||
PublicIp sourceNatIp = _networkMgr.assignSourceNatIpAddress(owner, guestConfig, _accountService.getSystemUser().getId());
|
||||
PublicIp sourceNatIp = _networkMgr.assignSourceNatIpAddress(owner, guestNetwork, _accountService.getSystemUser().getId());
|
||||
|
||||
List<NetworkOfferingVO> offerings = _networkMgr.getSystemAccountNetworkOfferings(NetworkOfferingVO.SystemVmControlNetwork);
|
||||
NetworkOfferingVO controlOffering = offerings.get(0);
|
||||
|
|
@ -1377,17 +1378,17 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
defaultNic.setDeviceId(2);
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(publicConfigs.get(0), defaultNic));
|
||||
NicProfile gatewayNic = new NicProfile();
|
||||
gatewayNic.setIp4Address(guestConfig.getGateway());
|
||||
gatewayNic.setBroadcastUri(guestConfig.getBroadcastUri());
|
||||
gatewayNic.setBroadcastType(guestConfig.getBroadcastDomainType());
|
||||
gatewayNic.setIsolationUri(guestConfig.getBroadcastUri());
|
||||
gatewayNic.setMode(guestConfig.getMode());
|
||||
gatewayNic.setNetmask(NetUtils.getCidrSubNet(guestConfig.getCidr()));
|
||||
networks.add(new Pair<NetworkVO, NicProfile>((NetworkVO) guestConfig, gatewayNic));
|
||||
gatewayNic.setIp4Address(guestNetwork.getGateway());
|
||||
gatewayNic.setBroadcastUri(guestNetwork.getBroadcastUri());
|
||||
gatewayNic.setBroadcastType(guestNetwork.getBroadcastDomainType());
|
||||
gatewayNic.setIsolationUri(guestNetwork.getBroadcastUri());
|
||||
gatewayNic.setMode(guestNetwork.getMode());
|
||||
gatewayNic.setNetmask(NetUtils.getCidrSubNet(guestNetwork.getCidr()));
|
||||
networks.add(new Pair<NetworkVO, NicProfile>((NetworkVO) guestNetwork, gatewayNic));
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
|
||||
|
||||
router = new DomainRouterVO(id, _offering.getId(), VirtualMachineName.getRouterName(id, _instance), _template.getId(),
|
||||
_template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestConfig.getId(), _offering.getOfferHA());
|
||||
_template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestNetwork.getId(), _offering.getOfferHA());
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, null, owner);
|
||||
}
|
||||
|
||||
|
|
@ -1395,19 +1396,19 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
}
|
||||
|
||||
@Override
|
||||
public VirtualRouter deployDhcp(Network guestConfig, DeployDestination dest, Account owner) throws InsufficientCapacityException,
|
||||
public VirtualRouter deployDhcp(Network guestNetwork, DeployDestination dest, Account owner) throws InsufficientCapacityException,
|
||||
StorageUnavailableException, ConcurrentOperationException, ResourceUnavailableException {
|
||||
long dcId = dest.getDataCenter().getId();
|
||||
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
s_logger.debug("Starting a dhcp for network configurations: dhcp=" + guestConfig + " in " + dest);
|
||||
s_logger.debug("Starting a dhcp for network configurations: dhcp=" + guestNetwork + " in " + dest);
|
||||
}
|
||||
assert guestConfig.getState() == Network.State.Implemented || guestConfig.getState() == Network.State.Setup : "Network is not yet fully implemented: "
|
||||
+ guestConfig;
|
||||
assert guestNetwork.getState() == Network.State.Implemented || guestNetwork.getState() == Network.State.Setup || guestNetwork.getState() == Network.State.Implementing : "Network is not yet fully implemented: "
|
||||
+ guestNetwork;
|
||||
|
||||
DataCenterDeployment plan = new DataCenterDeployment(dcId);
|
||||
|
||||
DomainRouterVO router = _routerDao.findByNetworkConfiguration(guestConfig.getId());
|
||||
DomainRouterVO router = _routerDao.findByNetworkConfiguration(guestNetwork.getId());
|
||||
if (router == null) {
|
||||
long id = _routerDao.getNextInSequence(Long.class, "id");
|
||||
if (s_logger.isDebugEnabled()) {
|
||||
|
|
@ -1421,11 +1422,11 @@ public class VirtualNetworkApplianceManagerImpl implements VirtualNetworkApplian
|
|||
List<Pair<NetworkVO, NicProfile>> networks = new ArrayList<Pair<NetworkVO, NicProfile>>(3);
|
||||
NicProfile gatewayNic = new NicProfile();
|
||||
gatewayNic.setDefaultNic(true);
|
||||
networks.add(new Pair<NetworkVO, NicProfile>((NetworkVO) guestConfig, gatewayNic));
|
||||
networks.add(new Pair<NetworkVO, NicProfile>((NetworkVO) guestNetwork, gatewayNic));
|
||||
networks.add(new Pair<NetworkVO, NicProfile>(controlConfig, null));
|
||||
|
||||
router = new DomainRouterVO(id, _offering.getId(), VirtualMachineName.getRouterName(id, _instance), _template.getId(),
|
||||
_template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestConfig.getId(), _offering.getOfferHA());
|
||||
_template.getGuestOSId(), owner.getDomainId(), owner.getId(), guestNetwork.getId(), _offering.getOfferHA());
|
||||
router.setRole(Role.DHCP_USERDATA);
|
||||
router = _itMgr.allocate(router, _template, _offering, networks, plan, null, owner);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,6 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
|||
|
||||
@Inject(adapter=DeploymentPlanner.class)
|
||||
private Adapters<DeploymentPlanner> _planners;
|
||||
private boolean _useNewNetworking;
|
||||
|
||||
Map<VirtualMachine.Type, VirtualMachineGuru<? extends VMInstanceVO>> _vmGurus = new HashMap<VirtualMachine.Type, VirtualMachineGuru<? extends VMInstanceVO>>();
|
||||
Map<HypervisorType, HypervisorGuru> _hvGurus = new HashMap<HypervisorType, HypervisorGuru>();
|
||||
|
|
@ -302,8 +301,7 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
|||
|
||||
_nodeId = _clusterMgr.getId();
|
||||
_clusterMgr.registerListener(this);
|
||||
_useNewNetworking = Boolean.parseBoolean(configDao.getValue("use.new.networking"));
|
||||
|
||||
|
||||
setStateMachine();
|
||||
|
||||
return true;
|
||||
|
|
@ -603,30 +601,16 @@ public class VirtualMachineManagerImpl implements VirtualMachineManager, Cluster
|
|||
|
||||
@Override
|
||||
public boolean stateTransitTo(VMInstanceVO vm, VirtualMachine.Event e, Long id) {
|
||||
if (_useNewNetworking) {
|
||||
if (vm instanceof UserVmVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _userVmDao);
|
||||
} else if (vm instanceof ConsoleProxyVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _consoleDao);
|
||||
} else if (vm instanceof SecondaryStorageVmVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _secondaryDao);
|
||||
} else if (vm instanceof DomainRouterVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _routerDao);
|
||||
} else {
|
||||
return _stateMachine.transitTO(vm, e, id, _vmDao);
|
||||
}
|
||||
} else {
|
||||
if (vm instanceof UserVmVO) {
|
||||
return _userVmDao.updateIf((UserVmVO)vm, e, id);
|
||||
} else if (vm instanceof ConsoleProxyVO) {
|
||||
return _consoleDao.updateIf((ConsoleProxyVO)vm, e, id);
|
||||
} else if (vm instanceof SecondaryStorageVmVO) {
|
||||
return _secondaryDao.updateIf((SecondaryStorageVmVO)vm, e, id);
|
||||
} else if (vm instanceof DomainRouterVO) {
|
||||
return _routerDao.updateIf((DomainRouterVO)vm, e, id);
|
||||
} else {
|
||||
return _vmDao.updateIf(vm, e, id);
|
||||
}
|
||||
}
|
||||
if (vm instanceof UserVmVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _userVmDao);
|
||||
} else if (vm instanceof ConsoleProxyVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _consoleDao);
|
||||
} else if (vm instanceof SecondaryStorageVmVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _secondaryDao);
|
||||
} else if (vm instanceof DomainRouterVO) {
|
||||
return _stateMachine.transitTO(vm, e, id, _routerDao);
|
||||
} else {
|
||||
return _stateMachine.transitTO(vm, e, id, _vmDao);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue