mirror of https://github.com/apache/jclouds.git
clones are now booting, but without networking
This commit is contained in:
parent
2e1f1e5da8
commit
cf02e7dcaf
|
@ -22,7 +22,6 @@ package org.jclouds.virtualbox.functions;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
|
||||
|
@ -31,6 +30,7 @@ import org.jclouds.logging.Logger;
|
|||
import org.jclouds.virtualbox.config.VirtualBoxConstants;
|
||||
import org.jclouds.virtualbox.domain.CloneSpec;
|
||||
import org.jclouds.virtualbox.domain.NetworkInterfaceCard;
|
||||
import org.jclouds.virtualbox.domain.NetworkSpec;
|
||||
import org.jclouds.virtualbox.domain.VmSpec;
|
||||
import org.jclouds.virtualbox.util.MachineUtils;
|
||||
import org.virtualbox_4_1.CloneMode;
|
||||
|
@ -96,6 +96,7 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
|
||||
private IMachine cloneMachine(CloneSpec cloneSpec) {
|
||||
VmSpec vmSpec = cloneSpec.getVmSpec();
|
||||
NetworkSpec networkSpec = cloneSpec.getNetworkSpec();
|
||||
boolean isLinkedClone = cloneSpec.isLinked();
|
||||
IMachine master = cloneSpec.getMaster();
|
||||
String settingsFile = manager.get().getVBox()
|
||||
|
@ -120,22 +121,15 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
|
||||
progress.waitForCompletion(-1);
|
||||
logger.debug("clone done");
|
||||
|
||||
|
||||
// registering
|
||||
manager.get().getVBox().registerMachine(clonedMachine);
|
||||
|
||||
// Bridged#
|
||||
// for (NetworkInterfaceCard nic : cloneSpec.getNetworkSpec().getNetworkInterfaceCards()){
|
||||
// ensureBridgedNetworkingIsAppliedToMachine(clonedMachine.getName(), nic);
|
||||
// }
|
||||
|
||||
// Networking
|
||||
for (NetworkInterfaceCard networkInterfaceCard : networkSpec.getNetworkInterfaceCards()) {
|
||||
new AttachNicToMachine(vmSpec.getVmName(), machineUtils).apply(networkInterfaceCard);
|
||||
}
|
||||
|
||||
return clonedMachine;
|
||||
}
|
||||
|
||||
private void ensureBridgedNetworkingIsAppliedToMachine(String vmName,
|
||||
NetworkInterfaceCard nic) {
|
||||
|
||||
machineUtils.writeLockMachineAndApply(vmName,
|
||||
new AttachBridgedAdapterToMachine(nic));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -50,13 +50,11 @@ public class NodeCreator implements Function<NodeSpec, NodeAndInitialCredentials
|
|||
|
||||
private final Supplier<VirtualBoxManager> manager;
|
||||
private final Function<CloneSpec, IMachine> cloner;
|
||||
private MachineUtils machineUtils;
|
||||
|
||||
@Inject
|
||||
public NodeCreator(Supplier<VirtualBoxManager> manager, Function<CloneSpec, IMachine> cloner, MachineUtils machineUtils) {
|
||||
this.manager = manager;
|
||||
this.cloner = cloner;
|
||||
this.machineUtils = machineUtils;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -95,8 +93,6 @@ public class NodeCreator implements Function<NodeSpec, NodeAndInitialCredentials
|
|||
|
||||
IMachine cloned = cloner.apply(cloneSpec);
|
||||
|
||||
new AttachNicToMachine(cloneName, machineUtils).apply(networkInterfaceCard);
|
||||
|
||||
new LaunchMachineIfNotAlreadyRunning(manager.get(), ExecutionType.GUI, "").apply(cloned);
|
||||
|
||||
// TODO get credentials from somewhere else (they are also HC in IMachineToSshClient)
|
||||
|
|
Loading…
Reference in New Issue