diff --git a/api/src/com/cloud/vm/NicProfile.java b/api/src/com/cloud/vm/NicProfile.java index 95eb958fae1..47dad45bf16 100644 --- a/api/src/com/cloud/vm/NicProfile.java +++ b/api/src/com/cloud/vm/NicProfile.java @@ -184,7 +184,7 @@ public class NicProfile { public NicProfile(Nic nic, Network network, URI broadcastUri, URI isolationUri) { this.id = nic.getId(); - this.gateway = network.getGateway(); + this.gateway = nic.getGateway(); this.mode = network.getMode(); this.format = null; this.broadcastType = network.getBroadcastDomainType(); @@ -198,6 +198,9 @@ public class NicProfile { this.defaultNic = nic.isDefaultNic(); this.broadcastUri = broadcastUri; this.isolationUri = isolationUri; + this.netmask = nic.getNetmask(); + this.dns1 = network.getDns1(); + this.dns2 = network.getDns2(); } public NicProfile(long id, BroadcastDomainType type, Mode mode, long vmId) { diff --git a/server/src/com/cloud/network/configuration/PodBasedNetworkGuru.java b/server/src/com/cloud/network/configuration/PodBasedNetworkGuru.java index 45b2e837241..ef77d4f3103 100644 --- a/server/src/com/cloud/network/configuration/PodBasedNetworkGuru.java +++ b/server/src/com/cloud/network/configuration/PodBasedNetworkGuru.java @@ -7,6 +7,7 @@ import javax.ejb.Local; import org.apache.log4j.Logger; +import com.cloud.dc.DataCenterVO; import com.cloud.dc.Pod; import com.cloud.dc.dao.DataCenterDao; import com.cloud.deploy.DeployDestination; @@ -46,7 +47,9 @@ public class PodBasedNetworkGuru extends AdapterBase implements NetworkGuru { } NetworkVO config = new NetworkVO(type, offering.getGuestIpType(), Mode.Static, BroadcastDomainType.Native, offering.getId(), plan.getDataCenterId()); - + DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); + config.setDns1(dc.getDns1()); + config.setDns2(dc.getDns2()); return config; } diff --git a/server/src/com/cloud/network/configuration/PublicNetworkGuru.java b/server/src/com/cloud/network/configuration/PublicNetworkGuru.java index 6a3c903513a..a83a03af718 100644 --- a/server/src/com/cloud/network/configuration/PublicNetworkGuru.java +++ b/server/src/com/cloud/network/configuration/PublicNetworkGuru.java @@ -8,6 +8,7 @@ import javax.ejb.Local; import org.apache.log4j.Logger; import com.cloud.dc.DataCenter; +import com.cloud.dc.DataCenterVO; import com.cloud.dc.Vlan.VlanType; import com.cloud.dc.VlanVO; import com.cloud.dc.dao.DataCenterDao; @@ -51,7 +52,11 @@ public class PublicNetworkGuru extends AdapterBase implements NetworkGuru { return null; } - return new NetworkVO(offering.getTrafficType(), offering.getGuestIpType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(), plan.getDataCenterId()); + NetworkVO network = new NetworkVO(offering.getTrafficType(), offering.getGuestIpType(), Mode.Static, BroadcastDomainType.Vlan, offering.getId(), plan.getDataCenterId()); + DataCenterVO dc = _dcDao.findById(plan.getDataCenterId()); + network.setDns1(dc.getDns1()); + network.setDns2(dc.getDns2()); + return network; } protected PublicNetworkGuru() {