Skip to content

Commit 7c72aa6

Browse files
author
Sheng Yang
committed
CLOUDSTACK-1332: Pass IPv6 DNS to VR
1 parent 0760fdf commit 7c72aa6

6 files changed

Lines changed: 40 additions & 2 deletions

File tree

‎api/src/com/cloud/dc/DataCenter.java‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ public enum NetworkType {
3737

3838
String getDns2();
3939

40+
String getIp6Dns1();
41+
42+
String getIp6Dns2();
43+
4044
String getGuestNetworkCidr();
4145

4246
String getName();

‎api/src/com/cloud/vm/NicProfile.java‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public class NicProfile implements InternalIdentity {
5050
Integer deviceId;
5151
String dns1;
5252
String dns2;
53+
String ip6Dns1;
54+
String ip6Dns2;
5355
Integer networkRate;
5456
boolean isSecurityGroupEnabled;
5557
String name;
@@ -332,4 +334,20 @@ public void setRequestedIpv6(String requestedIpv6) {
332334
this.requestedIpv6 = requestedIpv6;
333335
}
334336

337+
public String getIp6Dns1() {
338+
return ip6Dns1;
339+
}
340+
341+
public void setIp6Dns1(String ip6Dns1) {
342+
this.ip6Dns1 = ip6Dns1;
343+
}
344+
345+
public String getIp6Dns2() {
346+
return ip6Dns2;
347+
}
348+
349+
public void setIp6Dns2(String ip6Dns2) {
350+
this.ip6Dns2 = ip6Dns2;
351+
}
352+
335353
}

‎server/src/com/cloud/dc/DataCenterVO.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ public void setMacAddress(long macAddress) {
440440
this.macAddress = macAddress;
441441
}
442442

443+
@Override
443444
public String getIp6Dns1() {
444445
return ip6Dns1;
445446
}
@@ -448,6 +449,7 @@ public void setIp6Dns1(String ip6Dns1) {
448449
this.ip6Dns1 = ip6Dns1;
449450
}
450451

452+
@Override
451453
public String getIp6Dns2() {
452454
return ip6Dns2;
453455
}

‎server/src/com/cloud/network/NetworkManagerImpl.java‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3402,6 +3402,8 @@ public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfil
34023402
nic.setReservationId(String.valueOf(ip.getVlanTag()));
34033403
nic.setMacAddress(ip.getMacAddress());
34043404
}
3405+
nic.setDns1(dc.getDns1());
3406+
nic.setDns2(dc.getDns2());
34053407
}
34063408

34073409
if (network.getIp6Gateway() != null) {
@@ -3423,10 +3425,10 @@ public void allocateDirectIp(NicProfile nic, DataCenter dc, VirtualMachineProfil
34233425
nic.setMacAddress(ip.getMacAddress());
34243426
}
34253427
}
3428+
nic.setIp6Dns1(dc.getIp6Dns1());
3429+
nic.setIp6Dns2(dc.getIp6Dns2());
34263430
}
34273431

3428-
nic.setDns1(dc.getDns1());
3429-
nic.setDns2(dc.getDns2());
34303432
}
34313433

34323434
@Override

‎server/src/com/cloud/network/guru/DirectNetworkGuru.java‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ public void updateNicProfile(NicProfile profile, Network network) {
173173
if (profile != null) {
174174
profile.setDns1(dc.getDns1());
175175
profile.setDns2(dc.getDns2());
176+
profile.setIp6Dns1(dc.getIp6Dns1());
177+
profile.setIp6Dns2(dc.getIp6Dns2());
176178
}
177179
}
178180

‎server/src/com/cloud/network/router/VirtualNetworkApplianceManagerImpl.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1922,6 +1922,8 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterV
19221922
NicProfile controlNic = null;
19231923
String defaultDns1 = null;
19241924
String defaultDns2 = null;
1925+
String defaultIp6Dns1 = null;
1926+
String defaultIp6Dns2 = null;
19251927
for (NicProfile nic : profile.getNics()) {
19261928
int deviceId = nic.getDeviceId();
19271929
boolean ipv4 = false, ipv6 = false;
@@ -1945,6 +1947,8 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterV
19451947
}
19461948
defaultDns1 = nic.getDns1();
19471949
defaultDns2 = nic.getDns2();
1950+
defaultIp6Dns1 = nic.getIp6Dns1();
1951+
defaultIp6Dns2 = nic.getIp6Dns2();
19481952
}
19491953

19501954
if (nic.getTrafficType() == TrafficType.Management) {
@@ -2040,6 +2044,12 @@ public boolean finalizeVirtualMachineProfile(VirtualMachineProfile<DomainRouterV
20402044
if (defaultDns2 != null) {
20412045
buf.append(" dns2=").append(defaultDns2);
20422046
}
2047+
if (defaultIp6Dns1 != null) {
2048+
buf.append(" ip6dns1=").append(defaultIp6Dns1);
2049+
}
2050+
if (defaultIp6Dns2 != null) {
2051+
buf.append(" ip6dns2=").append(defaultIp6Dns2);
2052+
}
20432053

20442054
boolean useExtDns = !dnsProvided;
20452055
/* For backward compatibility */

0 commit comments

Comments
 (0)