mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Merge remote-tracking branch 'origin/4.14'
This commit is contained in:
commit
749e302e0e
@ -423,6 +423,7 @@ public class NicProfile implements InternalIdentity, Serializable {
|
||||
.append(iPv4Address)
|
||||
.append("-")
|
||||
.append(broadcastUri)
|
||||
.append("]")
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -2445,6 +2445,9 @@ public class NetworkServiceImpl extends ManagerBase implements NetworkService, C
|
||||
// log assign usage events for new offering
|
||||
List<NicVO> nics = _nicDao.listByNetworkId(networkId);
|
||||
for (NicVO nic : nics) {
|
||||
if (nic.getReservationStrategy() == Nic.ReservationStrategy.PlaceHolder) {
|
||||
continue;
|
||||
}
|
||||
long vmId = nic.getInstanceId();
|
||||
VMInstanceVO vm = _vmDao.findById(vmId);
|
||||
if (vm == null) {
|
||||
|
||||
@ -30,6 +30,8 @@ import com.cloud.exception.InsufficientVirtualNetworkCapacityException;
|
||||
import com.cloud.network.IpAddressManager;
|
||||
import com.cloud.network.Network;
|
||||
import com.cloud.network.Network.GuestType;
|
||||
import com.cloud.network.Network.Provider;
|
||||
import com.cloud.network.Network.Service;
|
||||
import com.cloud.network.Network.State;
|
||||
import com.cloud.network.Networks.BroadcastDomainType;
|
||||
import com.cloud.network.PhysicalNetwork;
|
||||
@ -51,10 +53,12 @@ import com.cloud.utils.db.DB;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.Ip;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.Nic.ReservationStrategy;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.NicVO;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import com.cloud.vm.VirtualMachineProfile;
|
||||
import org.apache.cloudstack.context.CallContext;
|
||||
import org.apache.cloudstack.engine.orchestration.service.NetworkOrchestrationService;
|
||||
@ -261,6 +265,17 @@ public class ExternalGuestNetworkGuru extends GuestNetworkGuru {
|
||||
profile.setIPv4Netmask(null);
|
||||
}
|
||||
|
||||
if (config.getVpcId() == null && vm.getType() == VirtualMachine.Type.DomainRouter) {
|
||||
boolean isPublicNetwork = _networkModel.isProviderSupportServiceInNetwork(config.getId(), Service.SourceNat, Provider.VirtualRouter);
|
||||
if (!isPublicNetwork) {
|
||||
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(config, null);
|
||||
if (placeholderNic == null) {
|
||||
s_logger.debug("Saving placeholder nic with ip4 address " + profile.getIPv4Address() +
|
||||
" and ipv6 address " + profile.getIPv6Address() + " for the network " + config);
|
||||
_networkMgr.savePlaceholderNic(config, profile.getIPv4Address(), profile.getIPv6Address(), VirtualMachine.Type.DomainRouter);
|
||||
}
|
||||
}
|
||||
}
|
||||
return profile;
|
||||
}
|
||||
|
||||
|
||||
@ -75,6 +75,7 @@ import com.cloud.utils.db.TransactionCallbackNoReturn;
|
||||
import com.cloud.utils.db.TransactionStatus;
|
||||
import com.cloud.utils.exception.CloudRuntimeException;
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
import com.cloud.vm.Nic;
|
||||
import com.cloud.vm.Nic.ReservationStrategy;
|
||||
import com.cloud.vm.NicProfile;
|
||||
import com.cloud.vm.ReservationContext;
|
||||
@ -372,15 +373,25 @@ public abstract class GuestNetworkGuru extends AdapterBase implements NetworkGur
|
||||
|
||||
if (isGateway) {
|
||||
guestIp = network.getGateway();
|
||||
} else if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
|
||||
guestIp = _ipAddrMgr.acquireGuestIpAddressByPlacement(network, nic.getRequestedIPv4());
|
||||
} else {
|
||||
guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4());
|
||||
}
|
||||
|
||||
if (!isGateway && guestIp == null && network.getGuestType() != GuestType.L2 && !_networkModel.listNetworkOfferingServices(network.getNetworkOfferingId()).isEmpty()) {
|
||||
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,
|
||||
dc.getId());
|
||||
if (network.getGuestType() != GuestType.L2 && vm.getType() == VirtualMachine.Type.DomainRouter) {
|
||||
Nic placeholderNic = _networkModel.getPlaceholderNicForRouter(network, null);
|
||||
if (placeholderNic != null) {
|
||||
s_logger.debug("Nic got an ip address " + placeholderNic.getIPv4Address() + " stored in placeholder nic for the network " + network);
|
||||
guestIp = placeholderNic.getIPv4Address();
|
||||
}
|
||||
}
|
||||
if (guestIp == null) {
|
||||
if (vm.getVirtualMachine().getType() == VirtualMachine.Type.DomainRouter) {
|
||||
guestIp = _ipAddrMgr.acquireGuestIpAddressByPlacement(network, nic.getRequestedIPv4());
|
||||
} else {
|
||||
guestIp = _ipAddrMgr.acquireGuestIpAddress(network, nic.getRequestedIPv4());
|
||||
}
|
||||
}
|
||||
if (guestIp == null && network.getGuestType() != GuestType.L2 && !_networkModel.listNetworkOfferingServices(network.getNetworkOfferingId()).isEmpty()) {
|
||||
throw new InsufficientVirtualNetworkCapacityException("Unable to acquire Guest IP" + " address for network " + network, DataCenter.class,
|
||||
dc.getId());
|
||||
}
|
||||
}
|
||||
|
||||
nic.setIPv4Address(guestIp);
|
||||
|
||||
@ -710,8 +710,8 @@ public class NetworkHelperImpl implements NetworkHelper {
|
||||
if (guestNetwork != null) {
|
||||
s_logger.debug("Adding nic for Virtual Router in Guest network " + guestNetwork);
|
||||
String defaultNetworkStartIp = null, defaultNetworkStartIpv6 = null;
|
||||
final Nic placeholder = _networkModel.getPlaceholderNicForRouter(guestNetwork, routerDeploymentDefinition.getPodId());
|
||||
if (!routerDeploymentDefinition.isPublicNetwork()) {
|
||||
final Nic placeholder = _networkModel.getPlaceholderNicForRouter(guestNetwork, routerDeploymentDefinition.getPodId());
|
||||
if (guestNetwork.getCidr() != null) {
|
||||
if (placeholder != null && placeholder.getIPv4Address() != null) {
|
||||
s_logger.debug("Requesting ipv4 address " + placeholder.getIPv4Address() + " stored in placeholder nic for the network "
|
||||
@ -744,6 +744,9 @@ public class NetworkHelperImpl implements NetworkHelper {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (placeholder != null) {
|
||||
// Remove placeholder nic if router has public network
|
||||
_nicDao.remove(placeholder.getId());
|
||||
}
|
||||
|
||||
final NicProfile gatewayNic = new NicProfile(defaultNetworkStartIp, defaultNetworkStartIpv6);
|
||||
|
||||
@ -2666,7 +2666,11 @@
|
||||
return;
|
||||
|
||||
if (selectedServiceofferingObj.iscustomized == true) {
|
||||
$form.find('.form-item[rel=cpuSpeed]').css('display', 'inline-block');
|
||||
if (selectedServiceofferingObj.cpuspeed) {
|
||||
$form.find('.form-item[rel=cpuSpeed]').hide();
|
||||
} else {
|
||||
$form.find('.form-item[rel=cpuSpeed]').css('display', 'inline-block');
|
||||
}
|
||||
$form.find('.form-item[rel=cpuNumber]').css('display', 'inline-block');
|
||||
$form.find('.form-item[rel=memory]').css('display', 'inline-block');
|
||||
} else {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user