From f4d0e18320a6131b4a325bcdfb712f743a328e60 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Sun, 18 Mar 2012 20:18:01 +0000 Subject: [PATCH 1/6] prevented tests from failing due to missing property ! --- .../VirtualBoxPropertiesBuilder.java | 2 +- .../BaseVirtualBoxClientLiveTest.java | 19 +++++++------------ .../functions/CreateAndInstallVmLiveTest.java | 1 + 3 files changed, 9 insertions(+), 13 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java index 4f6c728155..89776388c2 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java @@ -19,7 +19,7 @@ package org.jclouds.virtualbox; -import static org.jclouds.Constants.PROPERTY_API_VERSION; +import static org.jclouds.Constants.*; import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_IMAGE_AUTHENTICATE_SUDO; diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index ab3ece2872..1342ba9816 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -70,9 +70,9 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { public BaseVirtualBoxClientLiveTest() { provider = "virtualbox"; } - + protected ComputeServiceContext context; - + @Inject protected MachineController machineController; @@ -106,8 +106,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { protected PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate; @Inject protected LoadingCache mastersCache; - - private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); + + private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); @Override protected void setupCredentials() { @@ -119,10 +119,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { } protected void ensureIdentityPropertyIsSpecifiedOrTakeFromDefaults() { - Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build(); if (!System.getProperties().containsKey("test." + provider + ".identity")) - System.setProperty("test." + provider + ".identity", - defaultVBoxProperties.getProperty(Constants.PROPERTY_IDENTITY)); + System.setProperty("test." + provider + ".identity", "administrator"); } @BeforeClass(groups = "live") @@ -133,7 +131,7 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet . of(new SLF4JLoggingModule(), new SshjSshClientModule(), new ExecutorServiceModule( singleThreadExec, singleThreadExec)), overrides); - + context.utils().injector().injectMembers(this); imageId = "ubuntu-11.04-server-i386"; @@ -142,21 +140,18 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0); operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId); guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion); - + // try and get a master from the cache, this will initialize the config/download isos and // prepare everything IF a master is not available, subsequent calls should be pretty fast Template template = context.getComputeService().templateBuilder().build(); checkNotNull(mastersCache.apply(template.getImage())); } - protected void undoVm(VmSpec vmSpecification) { machineUtils.unlockMachineAndApplyOrReturnNullIfNotRegistered(vmSpecification.getVmId(), new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpecification)); } - - public String adminDisk(String vmName) { return workingDir + File.separator + vmName + ".vdi"; } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 4396848ac2..0d2c3ad939 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -133,6 +133,7 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { machineUtils.applyForMachine(machine.getName(), new LaunchMachineIfNotAlreadyRunning(manager.get(), ExecutionType.GUI, "")); + sshClientForIMachine = injector.getInstance(IMachineToSshClient.class); SshClient client = sshClientForIMachine.apply(machine); From d742d53f6b062e01ecaeca083fdbee40b50d8342 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 21:55:42 +0000 Subject: [PATCH 2/6] reverted formatting changes --- .../VirtualBoxPropertiesBuilder.java | 2 +- .../BaseVirtualBoxClientLiveTest.java | 19 ++++++++++++------- .../functions/CreateAndInstallVmLiveTest.java | 1 - 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java index 89776388c2..4f6c728155 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/VirtualBoxPropertiesBuilder.java @@ -19,7 +19,7 @@ package org.jclouds.virtualbox; -import static org.jclouds.Constants.*; +import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_BUILD_VERSION; import static org.jclouds.Constants.PROPERTY_ENDPOINT; import static org.jclouds.compute.reference.ComputeServiceConstants.PROPERTY_IMAGE_AUTHENTICATE_SUDO; diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index 1342ba9816..ab3ece2872 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -70,9 +70,9 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { public BaseVirtualBoxClientLiveTest() { provider = "virtualbox"; } - + protected ComputeServiceContext context; - + @Inject protected MachineController machineController; @@ -106,8 +106,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { protected PrioritizeCredentialsFromTemplate prioritizeCredentialsFromTemplate; @Inject protected LoadingCache mastersCache; - - private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); + + private final ExecutorService singleThreadExec = MoreExecutors.sameThreadExecutor(); @Override protected void setupCredentials() { @@ -119,8 +119,10 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { } protected void ensureIdentityPropertyIsSpecifiedOrTakeFromDefaults() { + Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build(); if (!System.getProperties().containsKey("test." + provider + ".identity")) - System.setProperty("test." + provider + ".identity", "administrator"); + System.setProperty("test." + provider + ".identity", + defaultVBoxProperties.getProperty(Constants.PROPERTY_IDENTITY)); } @BeforeClass(groups = "live") @@ -131,7 +133,7 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { context = new ComputeServiceContextFactory().createContext(provider, identity, credential, ImmutableSet . of(new SLF4JLoggingModule(), new SshjSshClientModule(), new ExecutorServiceModule( singleThreadExec, singleThreadExec)), overrides); - + context.utils().injector().injectMembers(this); imageId = "ubuntu-11.04-server-i386"; @@ -140,18 +142,21 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0); operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId); guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion); - + // try and get a master from the cache, this will initialize the config/download isos and // prepare everything IF a master is not available, subsequent calls should be pretty fast Template template = context.getComputeService().templateBuilder().build(); checkNotNull(mastersCache.apply(template.getImage())); } + protected void undoVm(VmSpec vmSpecification) { machineUtils.unlockMachineAndApplyOrReturnNullIfNotRegistered(vmSpecification.getVmId(), new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpecification)); } + + public String adminDisk(String vmName) { return workingDir + File.separator + vmName + ".vdi"; } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java index 0d2c3ad939..4396848ac2 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/CreateAndInstallVmLiveTest.java @@ -133,7 +133,6 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest { machineUtils.applyForMachine(machine.getName(), new LaunchMachineIfNotAlreadyRunning(manager.get(), ExecutionType.GUI, "")); - sshClientForIMachine = injector.getInstance(IMachineToSshClient.class); SshClient client = sshClientForIMachine.apply(machine); From 68290ba2b24483faa1a89ffc3fe789d859a56f51 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 21:58:35 +0000 Subject: [PATCH 3/6] added mock identity prop to prevent NPE in some cases --- .../org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java index ab3ece2872..33c55a390d 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/BaseVirtualBoxClientLiveTest.java @@ -119,10 +119,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest { } protected void ensureIdentityPropertyIsSpecifiedOrTakeFromDefaults() { - Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build(); if (!System.getProperties().containsKey("test." + provider + ".identity")) - System.setProperty("test." + provider + ".identity", - defaultVBoxProperties.getProperty(Constants.PROPERTY_IDENTITY)); + System.setProperty("test." + provider + ".identity", "administrator"); } @BeforeClass(groups = "live") From 92a940e95dcc3979bacc83c306822ce9c0aa7c0c Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 21:59:45 +0000 Subject: [PATCH 4/6] guests are now accessible because host-only ips are assigned in the same network as the default vbox host-only network (vboxnet0) --- .../functions/IMachineToNodeMetadata.java | 6 +- .../virtualbox/functions/NodeCreator.java | 64 +++++++++++-------- 2 files changed, 41 insertions(+), 29 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java index c65c41872a..e95d405543 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadata.java @@ -88,17 +88,17 @@ public class IMachineToNodeMetadata implements Function for (String nameProtocolnumberAddressInboudportGuestTargetport : natAdapter.getNatDriver().getRedirects()) { Iterable stuff = Splitter.on(',').split(nameProtocolnumberAddressInboudportGuestTargetport); String protocolNumber = Iterables.get(stuff, 1); - String hostAddress = Iterables.get(stuff, 2); String inboundPort = Iterables.get(stuff, 3); String targetPort = Iterables.get(stuff, 5); if ("1".equals(protocolNumber) && "22".equals(targetPort)) { int inPort = Integer.parseInt(inboundPort); - ipTermination = inPort % NodeCreator.NODE_PORT_INIT; - nodeMetadataBuilder.publicAddresses(ImmutableSet.of(hostAddress)).loginPort(inPort); + ipTermination = inPort % NodeCreator.NODE_PORT_INIT + 2; +// nodeMetadataBuilder.publicAddresses(ImmutableSet.of(hostAddress)).loginPort(inPort); } } nodeMetadataBuilder.privateAddresses(ImmutableSet.of((NodeCreator.VMS_NETWORK + ipTermination) + "")); + nodeMetadataBuilder.publicAddresses(ImmutableSet.of((NodeCreator.VMS_NETWORK + ipTermination) + "")); LoginCredentials loginCredentials = new LoginCredentials("toor", "password", null, true); nodeMetadataBuilder.credentials(loginCredentials); diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java index 9372e9bbca..6414f9e07d 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/functions/NodeCreator.java @@ -23,7 +23,6 @@ import static com.google.common.base.Preconditions.checkNotNull; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX; import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_NODE_PREFIX; -import java.util.List; import java.util.concurrent.atomic.AtomicInteger; import javax.inject.Inject; @@ -32,9 +31,10 @@ import javax.inject.Singleton; import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials; import org.jclouds.compute.callables.RunScriptOnNode; import org.jclouds.compute.domain.NodeMetadata; +import org.jclouds.compute.domain.NodeMetadataBuilder; import org.jclouds.compute.options.RunScriptOptions; import org.jclouds.domain.LoginCredentials; -import org.jclouds.virtualbox.domain.BridgedIf; +import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule; import org.jclouds.virtualbox.domain.CloneSpec; import org.jclouds.virtualbox.domain.ExecutionType; import org.jclouds.virtualbox.domain.Master; @@ -48,13 +48,17 @@ import org.jclouds.virtualbox.statements.SetIpAddress; import org.jclouds.virtualbox.util.MachineUtils; import org.virtualbox_4_1.CleanupMode; import org.virtualbox_4_1.IMachine; +import org.virtualbox_4_1.INetworkAdapter; import org.virtualbox_4_1.IProgress; import org.virtualbox_4_1.ISession; import org.virtualbox_4_1.NetworkAttachmentType; import org.virtualbox_4_1.VirtualBoxManager; import com.google.common.base.Function; +import com.google.common.base.Splitter; import com.google.common.base.Supplier; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; /** * Creates nodes, by cloning a master vm and based on the provided {@link NodeSpec}. Must be @@ -70,7 +74,7 @@ public class NodeCreator implements Function hostSupplier) { this.manager = manager; this.cloner = cloner; - this.nodePorts = new AtomicInteger(NODE_PORT_INIT + 1); - this.nodeIps = new AtomicInteger(1); + this.nodePorts = new AtomicInteger(NODE_PORT_INIT); + this.nodeIps = new AtomicInteger(2); this.machineUtils = machineUtils; this.imachineToNodeMetadata = imachineToNodeMetadata; this.scriptRunnerFactory = scriptRunnerFactory; @@ -145,10 +149,6 @@ public class NodeCreator implements Function stuff = Splitter.on(',').split(nameProtocolnumberAddressInboudportGuestTargetport); + String protocolNumber = Iterables.get(stuff, 1); + String inboundPort = Iterables.get(stuff, 3); + String targetPort = Iterables.get(stuff, 5); + if ("1".equals(protocolNumber) && "22".equals(targetPort)) { + int inPort = Integer.parseInt(inboundPort); + nodeMetadataBuilder.loginPort(inPort); + } + } + + LoginCredentials loginCredentials = new LoginCredentials("toor", "password", null, true); + nodeMetadataBuilder.credentials(loginCredentials); + + return nodeMetadataBuilder.build(); + } private NetworkSpec createNetworkSpecForHostOnlyNATNICs(NetworkInterfaceCard natIfaceCard, NetworkInterfaceCard hostOnlyIfaceCard) { return NetworkSpec.builder().addNIC(natIfaceCard).addNIC(hostOnlyIfaceCard).build(); } - private NetworkSpec createNetworkSpecForBridgedNIC() { - List activeBridgedInterfaces = new RetrieveActiveBridgedInterfaces(scriptRunnerFactory) - .apply(hostSupplier.get()); - BridgedIf bridgedActiveInterface = checkNotNull(activeBridgedInterfaces.get(0), "activeBridgedIf"); - - NetworkAdapter bridgedAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.Bridged) - .build(); - NetworkInterfaceCard bridgedNIC = NetworkInterfaceCard.builder().addNetworkAdapter(bridgedAdapter) - .addHostInterfaceName(bridgedActiveInterface.getName()).slot(0L).build(); - - NetworkSpec networkSpec = NetworkSpec.builder().addNIC(bridgedNIC).build(); - return networkSpec; - } } From 5bca27923ca76bb1f654f3f2680f7aa191c95c51 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 22:19:03 +0000 Subject: [PATCH 5/6] corrected IMachineToNodeMetadata to comply with the new non-natted ip --- .../VirtualBoxComputeServiceContextModule.java | 16 ++++++++++------ .../functions/IMachineToNodeMetadataTest.java | 10 +++++----- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java index e00cc5ace4..7ca72d7108 100644 --- a/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java +++ b/labs/virtualbox/src/main/java/org/jclouds/virtualbox/config/VirtualBoxComputeServiceContextModule.java @@ -248,7 +248,8 @@ public class VirtualBoxComputeServiceContextModule extends @VisibleForTesting public static final Map machineToNodeState = ImmutableMap - . builder().put(MachineState.Running, NodeState.RUNNING) + . builder() + .put(MachineState.Running, NodeState.RUNNING) .put(MachineState.PoweredOff, NodeState.SUSPENDED) .put(MachineState.DeletingSnapshot, NodeState.PENDING) .put(MachineState.DeletingSnapshotOnline, NodeState.PENDING) @@ -260,12 +261,15 @@ public class VirtualBoxComputeServiceContextModule extends .put(MachineState.Stopping, NodeState.PENDING) .put(MachineState.Restoring, NodeState.PENDING) // TODO What to map these states to? - .put(MachineState.FirstOnline, NodeState.PENDING).put(MachineState.FirstTransient, NodeState.PENDING) - .put(MachineState.LastOnline, NodeState.PENDING).put(MachineState.LastTransient, NodeState.PENDING) - .put(MachineState.Teleported, NodeState.PENDING).put(MachineState.TeleportingIn, NodeState.PENDING) - .put(MachineState.TeleportingPausedVM, NodeState.PENDING).put(MachineState.Aborted, NodeState.ERROR) + .put(MachineState.FirstOnline, NodeState.PENDING) + .put(MachineState.FirstTransient, NodeState.PENDING) + .put(MachineState.LastOnline, NodeState.PENDING) + .put(MachineState.LastTransient, NodeState.PENDING) + .put(MachineState.Teleported, NodeState.PENDING) + .put(MachineState.TeleportingIn, NodeState.PENDING) + .put(MachineState.TeleportingPausedVM, NodeState.PENDING) + .put(MachineState.Aborted, NodeState.ERROR) .put(MachineState.Stuck, NodeState.ERROR) - .put(MachineState.Null, NodeState.UNRECOGNIZED).build(); } diff --git a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java index 177a108f70..390a43e373 100644 --- a/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java +++ b/labs/virtualbox/src/test/java/org/jclouds/virtualbox/functions/IMachineToNodeMetadataTest.java @@ -44,7 +44,7 @@ public class IMachineToNodeMetadataTest { IMachine vm = createNiceMock(IMachine.class); expect(vm.getName()).andReturn("mocked-vm").anyTimes(); - expect(vm.getState()).andReturn(MachineState.PoweredOff).once(); + expect(vm.getState()).andReturn(MachineState.PoweredOff).anyTimes(); INetworkAdapter nat = createNiceMock(INetworkAdapter.class); INATEngine natEng = createNiceMock(INATEngine.class); @@ -53,7 +53,7 @@ public class IMachineToNodeMetadataTest { expect(nat.getAttachmentType()).andReturn(NetworkAttachmentType.NAT).once(); expect(nat.getNatDriver()).andReturn(natEng).anyTimes(); expect(natEng.getHostIP()).andReturn("127.0.0.1").once(); - expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,3001,,22")); + expect(natEng.getRedirects()).andReturn(ImmutableList.of("0,1,127.0.0.1,3000,,22")); INetworkAdapter hostOnly = createNiceMock(INetworkAdapter.class); @@ -63,9 +63,9 @@ public class IMachineToNodeMetadataTest { assertEquals("mocked-vm", node.getName()); assertEquals(1, node.getPrivateAddresses().size()); - assertEquals((NodeCreator.VMS_NETWORK + 1), Iterables.get(node.getPrivateAddresses(), 0)); + assertEquals((NodeCreator.VMS_NETWORK + 2), Iterables.get(node.getPrivateAddresses(), 0)); assertEquals(1, node.getPublicAddresses().size()); - assertEquals("127.0.0.1", Iterables.get(node.getPublicAddresses(), 0)); - assertEquals(3001, node.getLoginPort()); + assertEquals((NodeCreator.VMS_NETWORK + 2), Iterables.get(node.getPublicAddresses(), 0)); + assertEquals(22, node.getLoginPort()); } } From aceaaf0eb041106348d2c64403c4eb4d14743d74 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 21 Mar 2012 22:36:14 +0000 Subject: [PATCH 6/6] updated readme --- labs/virtualbox/README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/labs/virtualbox/README.md b/labs/virtualbox/README.md index 28f45e58d2..bbad852a73 100644 --- a/labs/virtualbox/README.md +++ b/labs/virtualbox/README.md @@ -17,8 +17,8 @@ That's it! Enjoy local cluster goodness by running: For java guidance look into src/test/java/org/jclouds/virtualbox/compute/VirtualBoxExperimentLiveTest.java. For now nat+host-only is the only available network configuration, nodes should be accessible from the host by: -> ssh -i ~/.ssh/id_rsa -o "UserKnownHostsFile /dev/null" -o StrictHostKeyChecking=no dralves@127.0.0.1 -p 300X -where X is the node index with regard to creation order (0,1,2,etc...) +> ssh -i ~/.ssh/id_rsa -o "UserKnownHostsFile /dev/null" -o StrictHostKeyChecking=no me@192.168.86.X +where X is the node index with regard to creation order starting at 2 (2,3,4, etc...) It *should* behave as anyother provider, if not please report. @@ -26,4 +26,5 @@ It *should* behave as anyother provider, if not please report. - jclouds-vbox is still at alpha stage please report any issues you find. - jclouds-vbox has been mostly tested on Mac OSX, it might work on Linux, but it won't work on windows for the moment. -- cached isos, vm's and most configs are kept at ~/.jclouds-vbox/ by default. \ No newline at end of file +- cached isos, vm's and most configs are kept at ~/.jclouds-vbox/ by default. +- jclouds-vbox assumes vbox has the default host-only network vboxnet0, that the network is in 192.168.86.0/255.255.255.0 and that the host as address 1 in this network. \ No newline at end of file