[SoftLayer] use FQDN as hostname

This commit is contained in:
Andrea Turli 2015-05-15 16:03:25 +02:00
parent 1a64a1f0fe
commit 443ca4300c
2 changed files with 3 additions and 2 deletions

View File

@ -70,7 +70,7 @@ public class VirtualGuestToNodeMetadata implements Function<VirtualGuest, NodeMe
NodeMetadataBuilder builder = new NodeMetadataBuilder(); NodeMetadataBuilder builder = new NodeMetadataBuilder();
builder.ids(from.getId() + ""); builder.ids(from.getId() + "");
builder.name(from.getHostname()); builder.name(from.getHostname());
builder.hostname(from.getHostname() + from.getDomain()); builder.hostname(from.getFullyQualifiedDomainName());
if (from.getDatacenter() != null) { if (from.getDatacenter() != null) {
builder.location(from(locations.get()).firstMatch( builder.location(from(locations.get()).firstMatch(
LocationPredicates.idEquals(from.getDatacenter().getName())).orNull()); LocationPredicates.idEquals(from.getDatacenter().getName())).orNull());

View File

@ -67,7 +67,7 @@ public class VirtualGuestToNodeMetadataTest {
assertEquals(nodeMetadata.getName(), virtualGuest.getHostname()); assertEquals(nodeMetadata.getName(), virtualGuest.getHostname());
assertNotNull(nodeMetadata.getLocation()); assertNotNull(nodeMetadata.getLocation());
assertEquals(nodeMetadata.getLocation().getId(), location.getId()); assertEquals(nodeMetadata.getLocation().getId(), location.getId());
assertEquals(nodeMetadata.getHostname(), virtualGuest.getHostname() + virtualGuest.getDomain()); assertEquals(nodeMetadata.getHostname(), virtualGuest.getFullyQualifiedDomainName());
assertEquals(nodeMetadata.getHardware().getRam(), virtualGuest.getMaxMemory()); assertEquals(nodeMetadata.getHardware().getRam(), virtualGuest.getMaxMemory());
assertTrue(nodeMetadata.getHardware().getProcessors().size() == 1); assertTrue(nodeMetadata.getHardware().getProcessors().size() == 1);
assertEquals(Iterables.get(nodeMetadata.getHardware().getProcessors(), 0).getCores(), (double) virtualGuest.getStartCpus()); assertEquals(Iterables.get(nodeMetadata.getHardware().getProcessors(), 0).getCores(), (double) virtualGuest.getStartCpus());
@ -80,6 +80,7 @@ public class VirtualGuestToNodeMetadataTest {
return VirtualGuest.builder() return VirtualGuest.builder()
.domain("example.com") .domain("example.com")
.hostname("host1") .hostname("host1")
.fullyQualifiedDomainName("host1.example.com")
.id(1301396) .id(1301396)
.maxMemory(1024) .maxMemory(1024)
.startCpus(1) .startCpus(1)