mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
IPv6: fix deploy vm issue in ipv6-only networks without VR (#5648)
* IPv6: fix deploy vm issue in ipv6-only networks * Update #5648: add method setNicPropertiesFromNetwork
This commit is contained in:
parent
c95f8e263a
commit
dd458feeb8
@ -31,6 +31,6 @@ public interface Ipv6AddressManager extends Manager {
|
||||
|
||||
public String acquireGuestIpv6Address(Network network, String requestedIpv6) throws InsufficientAddressCapacityException;
|
||||
|
||||
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network);
|
||||
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) throws InsufficientAddressCapacityException;
|
||||
|
||||
}
|
||||
|
||||
@ -195,13 +195,15 @@ public class Ipv6AddressManagerImpl extends ManagerBase implements Ipv6AddressMa
|
||||
* address information.
|
||||
*/
|
||||
@Override
|
||||
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) {
|
||||
public void setNicIp6Address(final NicProfile nic, final DataCenter dc, final Network network) throws InsufficientAddressCapacityException {
|
||||
if (network.getIp6Gateway() != null) {
|
||||
if (nic.getIPv6Address() == null) {
|
||||
s_logger.debug("Found IPv6 CIDR " + network.getIp6Cidr() + " for Network " + network);
|
||||
nic.setIPv6Cidr(network.getIp6Cidr());
|
||||
nic.setIPv6Gateway(network.getIp6Gateway());
|
||||
|
||||
setNicPropertiesFromNetwork(nic, network);
|
||||
|
||||
IPv6Address ipv6addr = NetUtils.EUI64Address(network.getIp6Cidr(), nic.getMacAddress());
|
||||
s_logger.info("Calculated IPv6 address " + ipv6addr + " using EUI-64 for NIC " + nic.getUuid());
|
||||
nic.setIPv6Address(ipv6addr.toString());
|
||||
@ -217,4 +219,15 @@ public class Ipv6AddressManagerImpl extends ManagerBase implements Ipv6AddressMa
|
||||
}
|
||||
}
|
||||
|
||||
private void setNicPropertiesFromNetwork(NicProfile nic, Network network) throws InsufficientAddressCapacityException {
|
||||
if (nic.getBroadcastType() == null) {
|
||||
nic.setBroadcastType(network.getBroadcastDomainType());
|
||||
}
|
||||
if (nic.getBroadCastUri() == null) {
|
||||
nic.setBroadcastUri(network.getBroadcastUri());
|
||||
}
|
||||
if (nic.getMacAddress() == null) {
|
||||
nic.setMacAddress(_networkModel.getNextAvailableMacAddressInNetwork(network.getId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -229,7 +229,7 @@ public class Ipv6AddressManagerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void setNICIPv6AddressTest() {
|
||||
public void setNICIPv6AddressTest() throws InsufficientAddressCapacityException {
|
||||
NicProfile nic = new NicProfile();
|
||||
Network network = mock(Network.class);
|
||||
DataCenter dc = mock(DataCenter.class);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user