@Override
public boolean finalizeDeployment(Commands cmds, VirtualMachineProfile profile, DeployDestination dest, ReservationContext context) {
finalizeCommandsOnStart(cmds, profile);
ConsoleProxyVO proxy = _consoleProxyDao.findById(profile.getId());
DataCenter dc = dest.getDataCenter();
List<NicProfile> nics = profile.getNics();
for (NicProfile nic : nics) {
if ((nic.getTrafficType() == TrafficType.Public && dc.getNetworkType() == NetworkType.Advanced)
|| (nic.getTrafficType() == TrafficType.Guest && (dc.getNetworkType() == NetworkType.Basic || dc.isSecurityGroupEnabled()))) {
proxy.setPublicIpAddress(nic.getIp4Address());
proxy.setPublicNetmask(nic.getNetmask());
proxy.setPublicMacAddress(nic.getMacAddress());
} else if (nic.getTrafficType() == TrafficType.Management) {
proxy.setPrivateIpAddress(nic.getIp4Address());
proxy.setPrivateMacAddress(nic.getMacAddress());
}
}
_consoleProxyDao.update(proxy.getId(), proxy);
return true;
}