}
@Override
public void reserve(NicProfile nic, Network config, VirtualMachineProfile<? extends VirtualMachine> vm, DeployDestination dest, ReservationContext context) throws InsufficientVirtualNetworkCapcityException,
InsufficientAddressCapacityException {
Pod pod = dest.getPod();
Pair<String, Long> ip = _dcDao.allocatePrivateIpAddress(dest.getDataCenter().getId(), dest.getPod().getId(), nic.getId(), context.getReservationId());
if (ip == null) {
throw new InsufficientAddressCapacityException("Unable to get a management ip address", Pod.class, pod.getId());
}
nic.setIp4Address(ip.first());
nic.setMacAddress(NetUtils.long2Mac(NetUtils.createSequenceBasedMacAddress(ip.second())));
nic.setGateway(pod.getGateway());
nic.setFormat(AddressFormat.Ip4);
String netmask = NetUtils.getCidrNetmask(pod.getCidrSize());
nic.setNetmask(netmask);
nic.setBroadcastType(BroadcastDomainType.Native);
nic.setBroadcastUri(null);
nic.setIsolationUri(null);