protected String hostNameOfVirtualMachine(VirtualMachineProfile vm) { return vm.getHostName().toLowerCase(); }
@Override public boolean prepare(Network network, NicProfile nic, VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { // signal to the dns server that this vm is up and running and set the ip address to hostname mapping. vm.getHostName(); nic.getIPv4Address(); nic.getIPv6Address(); return true; }
@Override public boolean release(Network network, NicProfile nic, VirtualMachineProfile vm, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException { vm.getHostName(); nic.getIPv4Address(); nic.getIPv6Address(); // signal to the dns server that the vm is being shutdown and remove the mapping. return true; }
buf.append(" name=").append(profile.getHostName());
buf.append(" name=").append(profile.getHostName()); NicProfile controlNic = null; String defaultDns1 = null;
buf.append(" name=").append(profile.getHostName());
@Override @DB public boolean prepare(final Network network, final NicProfile nic, final VirtualMachineProfile vm, DeployDestination dest, ReservationContext context) throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException { if (!isTypeSupported(vm.getType())) { s_logger.info("GloboDNS only manages records for VMs of type User, ConsoleProxy and DomainRouter. VM " + vm + " is " + vm.getType()); return false; } Long zoneId = network.getDataCenterId(); final DataCenter zone = _dcDao.findById(zoneId); if (zone == null) { throw new CloudRuntimeException("Could not find zone associated to this network"); } /* Create new A record in GloboDNS */ // We allow only lower case names in DNS, so force lower case names for VMs String vmName = vm.getHostName(); String vmHostname = hostNameOfVirtualMachine(vm); if (!vmName.equals(vmHostname) && vm.getType() == VirtualMachine.Type.User) { throw new InvalidParameterValueException("VM name should contain only lower case letters and digits: " + vmName + " - " + vm); } CreateOrUpdateRecordAndReverseCommand cmd = new CreateOrUpdateRecordAndReverseCommand(vmHostname, nic.getIPv4Address(), network.getNetworkDomain(), GloboDNSTemplateId.value(), GloboDNSOverride.value()); callCommand(cmd, zoneId); return true; }