mirror of https://github.com/apache/cloudstack.git
VPC: CS-15821 - corrected mac address format for vpc private network
This commit is contained in:
parent
eb93ebf6a1
commit
a3b00a7535
|
|
@ -4783,7 +4783,7 @@ public class NetworkManagerImpl implements NetworkManager, NetworkService, Manag
|
|||
NetworkOffering ntwkOff = _configMgr.getNetworkOffering(network.getNetworkOfferingId());
|
||||
|
||||
// For default userVm Default network and domR guest/public network, get rate information from the service
|
||||
// offering; for other situations get information
|
||||
// offering; for other situations get information
|
||||
// from the network offering
|
||||
boolean isUserVmsDefaultNetwork = false;
|
||||
boolean isDomRGuestOrPublicNetwork = false;
|
||||
|
|
|
|||
|
|
@ -179,7 +179,8 @@ public class PrivateNetworkGuru extends AdapterBase implements NetworkGuru {
|
|||
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(network.getDataCenterId(), network.getId(), null);
|
||||
String vlanTag = network.getBroadcastUri().getHost();
|
||||
String netmask = NetUtils.getCidrNetmask(network.getCidr());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, ipVO.getMacAddress());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask,
|
||||
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress())));
|
||||
|
||||
nic.setIp4Address(ip.getIpAddress());
|
||||
nic.setGateway(ip.getGateway());
|
||||
|
|
|
|||
|
|
@ -842,7 +842,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
Network network = _networkDao.findById(guestNic.getNetworkId());
|
||||
String vlanTag = network.getBroadcastUri().getHost();
|
||||
String netmask = NetUtils.getCidrNetmask(network.getCidr());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, ipVO.getMacAddress());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, guestNic.getMacAddress());
|
||||
|
||||
List<PrivateIpAddress> privateIps = new ArrayList<PrivateIpAddress>(1);
|
||||
privateIps.add(ip);
|
||||
|
|
@ -970,7 +970,7 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
Network network = _networkDao.findById(privateNic.getNetworkId());
|
||||
String vlanTag = network.getBroadcastUri().getHost();
|
||||
String netmask = NetUtils.getCidrNetmask(network.getCidr());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, ipVO.getMacAddress());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, privateNic.getMacAddress());
|
||||
|
||||
List<PrivateIpAddress> privateIps = new ArrayList<PrivateIpAddress>(1);
|
||||
privateIps.add(ip);
|
||||
|
|
@ -1249,24 +1249,36 @@ public class VpcVirtualNetworkApplianceManagerImpl extends VirtualNetworkApplian
|
|||
|
||||
@DB
|
||||
protected NicProfile createPrivateNicProfileForGateway(VpcGateway privateGateway) {
|
||||
Network network = _networkMgr.getNetwork(privateGateway.getNetworkId());
|
||||
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(network.getDataCenterId(), network.getId(), privateGateway.getIp4Address());
|
||||
Network privateNetwork = _networkMgr.getNetwork(privateGateway.getNetworkId());
|
||||
PrivateIpVO ipVO = _privateIpDao.allocateIpAddress(privateNetwork.getDataCenterId(), privateNetwork.getId(), privateGateway.getIp4Address());
|
||||
Nic privateNic = _nicDao.findByIp4AddressAndNetworkId(ipVO.getIpAddress(), privateNetwork.getId());
|
||||
|
||||
NicProfile privateNic = new NicProfile();
|
||||
String vlanTag = network.getBroadcastUri().getHost();
|
||||
String netmask = NetUtils.getCidrNetmask(network.getCidr());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, network.getGateway(), netmask, ipVO.getMacAddress());
|
||||
NicProfile privateNicProfile = new NicProfile();
|
||||
|
||||
privateNic.setIp4Address(ip.getIpAddress());
|
||||
privateNic.setGateway(ip.getGateway());
|
||||
privateNic.setNetmask(ip.getNetmask());
|
||||
privateNic.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
||||
privateNic.setBroadcastUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
||||
privateNic.setBroadcastType(BroadcastDomainType.Vlan);
|
||||
privateNic.setFormat(AddressFormat.Ip4);
|
||||
privateNic.setReservationId(String.valueOf(ip.getVlanTag()));
|
||||
privateNic.setMacAddress(ip.getMacAddress());
|
||||
return privateNic;
|
||||
if (privateNic != null) {
|
||||
VirtualMachine vm = _vmDao.findById(privateNic.getId());
|
||||
privateNicProfile = new NicProfile(privateNic, privateNetwork, privateNic.getBroadcastUri(), privateNic.getIsolationUri(),
|
||||
_networkMgr.getNetworkRate(privateNetwork.getId(), vm.getId()),
|
||||
_networkMgr.isSecurityGroupSupportedInNetwork(privateNetwork),
|
||||
_networkMgr.getNetworkTag(vm.getHypervisorType(), privateNetwork));
|
||||
} else {
|
||||
String vlanTag = privateNetwork.getBroadcastUri().getHost();
|
||||
String netmask = NetUtils.getCidrNetmask(privateNetwork.getCidr());
|
||||
PrivateIpAddress ip = new PrivateIpAddress(ipVO, vlanTag, privateNetwork.getGateway(), netmask,
|
||||
NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ipVO.getMacAddress())));
|
||||
|
||||
privateNicProfile.setIp4Address(ip.getIpAddress());
|
||||
privateNicProfile.setGateway(ip.getGateway());
|
||||
privateNicProfile.setNetmask(ip.getNetmask());
|
||||
privateNicProfile.setIsolationUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
||||
privateNicProfile.setBroadcastUri(IsolationType.Vlan.toUri(ip.getVlanTag()));
|
||||
privateNicProfile.setBroadcastType(BroadcastDomainType.Vlan);
|
||||
privateNicProfile.setFormat(AddressFormat.Ip4);
|
||||
privateNicProfile.setReservationId(String.valueOf(ip.getVlanTag()));
|
||||
privateNicProfile.setMacAddress(ip.getMacAddress());
|
||||
}
|
||||
|
||||
return privateNicProfile;
|
||||
}
|
||||
|
||||
protected NicProfile createGuestNicProfileForVpcRouter(Network guestNetwork) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,6 @@
|
|||
// Automatically generated by addcopyright.py at 04/03/2012
|
||||
package com.cloud.network.vpc;
|
||||
|
||||
import com.cloud.utils.net.NetUtils;
|
||||
|
||||
/**
|
||||
* @author Alena Prokharchyk
|
||||
|
|
@ -33,13 +32,13 @@ public class PrivateIpAddress implements PrivateIp{
|
|||
* @param macAddress TODO
|
||||
* @param physicalNetworkId TODO
|
||||
*/
|
||||
public PrivateIpAddress(PrivateIpVO privateIp, String vlanTag, String gateway, String netmask, long macAddress) {
|
||||
public PrivateIpAddress(PrivateIpVO privateIp, String vlanTag, String gateway, String netmask, String macAddress) {
|
||||
super();
|
||||
this.ipAddress = privateIp.getIpAddress();
|
||||
this.vlanTag = vlanTag;
|
||||
this.gateway = gateway;
|
||||
this.netmask = netmask;
|
||||
this.macAddress = NetUtils.long2Mac(macAddress);
|
||||
this.macAddress = macAddress;
|
||||
this.networkId = privateIp.getNetworkId();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue