mirror of https://github.com/apache/jclouds.git
formatted most changed classes to comply with jclouds formatting guildelines
This commit is contained in:
parent
c08cbc89f4
commit
fa26fe34f9
|
@ -78,7 +78,8 @@ public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
|
|||
System.getProperty("user.home") + File.separator
|
||||
+ System.getProperty("test.virtualbox.workingDir", ".jclouds-vbox"));
|
||||
|
||||
// allow to set the descriptor as a sysprop but default to just setting a default file path. The configured supplier
|
||||
// allow to set the descriptor as a sysprop but default to just setting a default file path.
|
||||
// The configured supplier
|
||||
// must be able to handle the chosen option.
|
||||
properties.put(
|
||||
VIRTUALBOX_IMAGES_DESCRIPTOR,
|
||||
|
|
|
@ -53,8 +53,8 @@ import com.google.common.collect.Iterables;
|
|||
import com.google.inject.Singleton;
|
||||
|
||||
/**
|
||||
* Defines the connection between the {@link org.virtualbox_4_1.VirtualBoxManager} implementation and the jclouds
|
||||
* {@link org.jclouds.compute.ComputeService}
|
||||
* Defines the connection between the {@link org.virtualbox_4_1.VirtualBoxManager} implementation
|
||||
* and the jclouds {@link org.jclouds.compute.ComputeService}
|
||||
*
|
||||
* @author Mattias Holmqvist, Andrea Turli
|
||||
*/
|
||||
|
|
|
@ -175,8 +175,10 @@ public class VirtualBoxComputeServiceContextModule extends
|
|||
"host",
|
||||
Node.builder().id("host").name("host installing virtualbox").hostname("localhost")
|
||||
.osFamily(OsFamily.LINUX.toString()).osDescription(System.getProperty("os.name"))
|
||||
.osVersion(System.getProperty("os.version")).group("ssh").username(System.getProperty("user.name"))
|
||||
.credentialUrl(URI.create("file://" + System.getProperty("user.home") + "/.ssh/id_rsa")).build()));
|
||||
.osVersion(System.getProperty("os.version")).group("ssh")
|
||||
.username(System.getProperty("user.name"))
|
||||
.credentialUrl(URI.create("file://" + System.getProperty("user.home") + "/.ssh/id_rsa"))
|
||||
.build()));
|
||||
return new ComputeServiceContextFactory().createContext(provider, identity, credential,
|
||||
ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule(), hostModule));
|
||||
}
|
||||
|
@ -243,45 +245,24 @@ public class VirtualBoxComputeServiceContextModule extends
|
|||
|
||||
@VisibleForTesting
|
||||
public static final Map<MachineState, NodeState> machineToNodeState = ImmutableMap
|
||||
.<MachineState, NodeState> builder()
|
||||
.put(MachineState.Running, NodeState.RUNNING)
|
||||
.put(MachineState.PoweredOff,
|
||||
NodeState.SUSPENDED)
|
||||
.put(MachineState.DeletingSnapshot,
|
||||
NodeState.PENDING)
|
||||
.put(MachineState.DeletingSnapshotOnline,
|
||||
NodeState.PENDING)
|
||||
.put(MachineState.DeletingSnapshotPaused,
|
||||
NodeState.PENDING)
|
||||
.put(MachineState.FaultTolerantSyncing,
|
||||
NodeState.PENDING)
|
||||
.put(MachineState.LiveSnapshotting,
|
||||
NodeState.PENDING)
|
||||
.put(MachineState.SettingUp,
|
||||
NodeState.PENDING)
|
||||
.<MachineState, NodeState> builder().put(MachineState.Running, NodeState.RUNNING)
|
||||
.put(MachineState.PoweredOff, NodeState.SUSPENDED)
|
||||
.put(MachineState.DeletingSnapshot, NodeState.PENDING)
|
||||
.put(MachineState.DeletingSnapshotOnline, NodeState.PENDING)
|
||||
.put(MachineState.DeletingSnapshotPaused, NodeState.PENDING)
|
||||
.put(MachineState.FaultTolerantSyncing, NodeState.PENDING)
|
||||
.put(MachineState.LiveSnapshotting, NodeState.PENDING)
|
||||
.put(MachineState.SettingUp, NodeState.PENDING)
|
||||
.put(MachineState.Starting, NodeState.PENDING)
|
||||
.put(MachineState.Stopping, NodeState.PENDING)
|
||||
.put(MachineState.Restoring,
|
||||
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();
|
||||
.put(MachineState.Null, NodeState.UNRECOGNIZED).build();
|
||||
|
||||
}
|
||||
|
|
|
@ -55,8 +55,8 @@ public interface VirtualBoxConstants {
|
|||
|
||||
public static final String VIRTUALBOX_WEBSERVER_CREDENTIAL = "jclouds.virtualbox.webserver.credential";
|
||||
|
||||
public static final String VIRTUALBOX_DEFAULT_DIR = System.getProperty("user.home")
|
||||
+ File.separator +".jclouds-vbox";
|
||||
public static final String VIRTUALBOX_DEFAULT_DIR = System.getProperty("user.home") + File.separator
|
||||
+ ".jclouds-vbox";
|
||||
|
||||
public static final String VIRTUALBOX_PROVIDER = "virtualbox";
|
||||
|
||||
|
|
|
@ -26,8 +26,8 @@ import org.virtualbox_4_1.IMachine;
|
|||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* A complete specification of a "clone" node with networking setup
|
||||
* and the physical machine specification.
|
||||
* A complete specification of a "clone" node with networking setup and the physical machine
|
||||
* specification.
|
||||
*/
|
||||
public class CloneSpec {
|
||||
|
||||
|
@ -101,11 +101,11 @@ public class CloneSpec {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o instanceof VmSpec) {
|
||||
CloneSpec other = (CloneSpec) o;
|
||||
return Objects.equal(vmSpec, other.vmSpec) &&
|
||||
Objects.equal(networkSpec, other.networkSpec);
|
||||
return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(networkSpec, other.networkSpec);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -117,9 +117,6 @@ public class CloneSpec {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IMachineSpec{" +
|
||||
"vmSpec= " + vmSpec +
|
||||
", networkSpec= " + networkSpec +
|
||||
'}';
|
||||
return "IMachineSpec{" + "vmSpec= " + vmSpec + ", networkSpec= " + networkSpec + '}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -24,8 +24,8 @@ import static com.google.common.base.Preconditions.checkNotNull;
|
|||
import com.google.common.base.Objects;
|
||||
|
||||
/**
|
||||
* A complete specification of a "master" node, including the ISO, networking setup
|
||||
* and the physical machine specification.
|
||||
* A complete specification of a "master" node, including the ISO, networking setup and the physical
|
||||
* machine specification.
|
||||
*/
|
||||
public class MasterSpec {
|
||||
|
||||
|
@ -87,12 +87,12 @@ public class MasterSpec {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o instanceof VmSpec) {
|
||||
MasterSpec other = (MasterSpec) o;
|
||||
return Objects.equal(vmSpec, other.vmSpec) &&
|
||||
Objects.equal(isoSpec, other.isoSpec) &&
|
||||
Objects.equal(networkSpec, other.networkSpec);
|
||||
return Objects.equal(vmSpec, other.vmSpec) && Objects.equal(isoSpec, other.isoSpec)
|
||||
&& Objects.equal(networkSpec, other.networkSpec);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -104,10 +104,6 @@ public class MasterSpec {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "IMachineSpec{" +
|
||||
"vmSpec=" + vmSpec +
|
||||
", isoSpec=" + isoSpec +
|
||||
", networkSpec=" + networkSpec +
|
||||
'}';
|
||||
return "IMachineSpec{" + "vmSpec=" + vmSpec + ", isoSpec=" + isoSpec + ", networkSpec=" + networkSpec + '}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -42,7 +42,8 @@ public class VmSpec {
|
|||
private final Set<StorageController> controllers;
|
||||
private final CleanupMode cleanupMode;
|
||||
|
||||
public VmSpec(String vmId, String vmName, String osTypeId, long memory, boolean forceOverwrite, Set<StorageController> controllers, CleanupMode cleanupMode) {
|
||||
public VmSpec(String vmId, String vmName, String osTypeId, long memory, boolean forceOverwrite,
|
||||
Set<StorageController> controllers, CleanupMode cleanupMode) {
|
||||
this.vmId = checkNotNull(vmId, "vmId");
|
||||
this.vmName = checkNotNull(vmName, "vmName");
|
||||
this.osTypeId = checkNotNull(osTypeId, "osTypeId");
|
||||
|
@ -141,16 +142,14 @@ public class VmSpec {
|
|||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (this == o)
|
||||
return true;
|
||||
if (o instanceof VmSpec) {
|
||||
VmSpec other = (VmSpec) o;
|
||||
return Objects.equal(vmId, other.vmId) &&
|
||||
Objects.equal(vmName, other.vmName) &&
|
||||
Objects.equal(osTypeId, other.osTypeId) &&
|
||||
Objects.equal(memory, other.memory) &&
|
||||
Objects.equal(forceOverwrite, other.forceOverwrite) &&
|
||||
Objects.equal(controllers, other.controllers) &&
|
||||
Objects.equal(cleanupMode, other.cleanupMode);
|
||||
return Objects.equal(vmId, other.vmId) && Objects.equal(vmName, other.vmName)
|
||||
&& Objects.equal(osTypeId, other.osTypeId) && Objects.equal(memory, other.memory)
|
||||
&& Objects.equal(forceOverwrite, other.forceOverwrite)
|
||||
&& Objects.equal(controllers, other.controllers) && Objects.equal(cleanupMode, other.cleanupMode);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -162,14 +161,8 @@ public class VmSpec {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "VmSpecification{" +
|
||||
"vmName='" + vmName + '\'' +
|
||||
", osTypeId='" + osTypeId + '\'' +
|
||||
", memory='" + memory + '\'' +
|
||||
", vmId='" + vmId + '\'' +
|
||||
", forceOverwrite=" + forceOverwrite +
|
||||
", controllers=" + controllers +
|
||||
", cleanupMode=" + cleanupMode +
|
||||
'}';
|
||||
return "VmSpecification{" + "vmName='" + vmName + '\'' + ", osTypeId='" + osTypeId + '\'' + ", memory='" + memory
|
||||
+ '\'' + ", vmId='" + vmId + '\'' + ", forceOverwrite=" + forceOverwrite + ", controllers="
|
||||
+ controllers + ", cleanupMode=" + cleanupMode + '}';
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,13 +46,12 @@ import com.google.common.base.Supplier;
|
|||
import com.google.inject.Inject;
|
||||
|
||||
/**
|
||||
* CloneAndRegisterMachineFromIMachineIfNotAlreadyExists will take care of the
|
||||
* followings: - cloning the master - register the clone machine -
|
||||
* CloneAndRegisterMachineFromIMachineIfNotAlreadyExists will take care of the followings: - cloning
|
||||
* the master - register the clone machine -
|
||||
*
|
||||
* @author Andrea Turli
|
||||
*/
|
||||
public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
||||
Function<CloneSpec, IMachine> {
|
||||
public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements Function<CloneSpec, IMachine> {
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
|
@ -63,10 +62,8 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
private final MachineUtils machineUtils;
|
||||
|
||||
@Inject
|
||||
public CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(
|
||||
Supplier<VirtualBoxManager> manager,
|
||||
@Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir,
|
||||
MachineUtils machineUtils) {
|
||||
public CloneAndRegisterMachineFromIMachineIfNotAlreadyExists(Supplier<VirtualBoxManager> manager,
|
||||
@Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir, MachineUtils machineUtils) {
|
||||
this.manager = manager;
|
||||
this.workingDir = workingDir;
|
||||
this.machineUtils = machineUtils;
|
||||
|
@ -77,8 +74,7 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
VmSpec vmSpec = cloneSpec.getVmSpec();
|
||||
try {
|
||||
manager.get().getVBox().findMachine(vmSpec.getVmName());
|
||||
throw new IllegalStateException("Machine " + vmSpec.getVmName()
|
||||
+ " is already registered.");
|
||||
throw new IllegalStateException("Machine " + vmSpec.getVmName() + " is already registered.");
|
||||
} catch (VBoxException e) {
|
||||
if (machineNotFoundException(e))
|
||||
return cloneMachine(cloneSpec);
|
||||
|
@ -88,10 +84,8 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
}
|
||||
|
||||
private boolean machineNotFoundException(VBoxException e) {
|
||||
return e.getMessage().contains(
|
||||
"VirtualBox error: Could not find a registered machine named ")
|
||||
|| e.getMessage().contains(
|
||||
"Could not find a registered machine with UUID {");
|
||||
return e.getMessage().contains("VirtualBox error: Could not find a registered machine named ")
|
||||
|| e.getMessage().contains("Could not find a registered machine with UUID {");
|
||||
}
|
||||
|
||||
private IMachine cloneMachine(CloneSpec cloneSpec) {
|
||||
|
@ -99,25 +93,22 @@ public class CloneAndRegisterMachineFromIMachineIfNotAlreadyExists implements
|
|||
NetworkSpec networkSpec = cloneSpec.getNetworkSpec();
|
||||
boolean isLinkedClone = cloneSpec.isLinked();
|
||||
IMachine master = cloneSpec.getMaster();
|
||||
String settingsFile = manager.get().getVBox()
|
||||
.composeMachineFilename(vmSpec.getVmName(), workingDir);
|
||||
String settingsFile = manager.get().getVBox().composeMachineFilename(vmSpec.getVmName(), workingDir);
|
||||
IMachine clonedMachine = manager
|
||||
.get()
|
||||
.getVBox()
|
||||
.createMachine(settingsFile, vmSpec.getVmName(),
|
||||
vmSpec.getOsTypeId(), vmSpec.getVmId(),
|
||||
.createMachine(settingsFile, vmSpec.getVmName(), vmSpec.getOsTypeId(), vmSpec.getVmId(),
|
||||
vmSpec.isForceOverwrite());
|
||||
List<CloneOptions> options = new ArrayList<CloneOptions>();
|
||||
if (isLinkedClone)
|
||||
options.add(CloneOptions.Link);
|
||||
|
||||
// TODO snapshot name
|
||||
ISnapshot currentSnapshot = new TakeSnapshotIfNotAlreadyAttached(
|
||||
manager, "snapshotName", "snapshotDesc").apply(master);
|
||||
ISnapshot currentSnapshot = new TakeSnapshotIfNotAlreadyAttached(manager, "snapshotName", "snapshotDesc")
|
||||
.apply(master);
|
||||
|
||||
// clone
|
||||
IProgress progress = currentSnapshot.getMachine().cloneTo(
|
||||
clonedMachine, CloneMode.MachineState, options);
|
||||
IProgress progress = currentSnapshot.getMachine().cloneTo(clonedMachine, CloneMode.MachineState, options);
|
||||
|
||||
progress.waitForCompletion(-1);
|
||||
logger.debug("clone done");
|
||||
|
|
|
@ -143,7 +143,8 @@ public class CreateAndInstallVm implements Function<MasterSpec, IMachine> {
|
|||
}
|
||||
|
||||
/**
|
||||
* ensureMachineHasPowerDown needs to have this delay just to ensure that the machine is completely powered off
|
||||
* ensureMachineHasPowerDown needs to have this delay just to ensure that the machine is
|
||||
* completely powered off
|
||||
*
|
||||
* @param vmName
|
||||
*/
|
||||
|
@ -159,7 +160,8 @@ public class CreateAndInstallVm implements Function<MasterSpec, IMachine> {
|
|||
}
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
// sometimes the machine might be powered of between the while test and the call to lockSessionOnMachineAndApply
|
||||
// sometimes the machine might be powered of between the while test and the call to
|
||||
// lockSessionOnMachineAndApply
|
||||
if (e.getMessage().contains("Invalid machine state: PoweredOff")) {
|
||||
return;
|
||||
} else if (e.getMessage().contains("VirtualBox error: The object is not ready")) {
|
||||
|
|
|
@ -70,8 +70,8 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExists implements Functi
|
|||
private final String workingDir;
|
||||
|
||||
@Inject
|
||||
public CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Supplier<VirtualBoxManager> manager, MachineUtils machineUtils,
|
||||
@Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir) {
|
||||
public CreateAndRegisterMachineFromIsoIfNotAlreadyExists(Supplier<VirtualBoxManager> manager,
|
||||
MachineUtils machineUtils, @Named(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR) String workingDir) {
|
||||
this.manager = manager;
|
||||
this.machineUtils = machineUtils;
|
||||
this.workingDir = workingDir;
|
||||
|
@ -132,22 +132,21 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExists implements Functi
|
|||
Set<IsoImage> dvds = controller.getIsoImages();
|
||||
for (IsoImage dvd : dvds) {
|
||||
String dvdSource = dvd.getSourcePath();
|
||||
final IMedium dvdMedium = manager.get().getVBox().openMedium(dvdSource, DeviceType.DVD, AccessMode.ReadOnly,
|
||||
vmSpecification.isForceOverwrite());
|
||||
final IMedium dvdMedium = manager.get().getVBox()
|
||||
.openMedium(dvdSource, DeviceType.DVD, AccessMode.ReadOnly, vmSpecification.isForceOverwrite());
|
||||
ensureMachineDevicesAttached(vmName, dvdMedium, dvd.getDeviceDetails(), controller.getName());
|
||||
}
|
||||
}
|
||||
|
||||
private void ensureMachineDevicesAttached(String vmName, IMedium medium, DeviceDetails deviceDetails,
|
||||
String controllerName) {
|
||||
machineUtils.writeLockMachineAndApply(vmName, new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails, medium,
|
||||
controllerName));
|
||||
machineUtils.writeLockMachineAndApply(vmName, new AttachMediumToMachineIfNotAlreadyAttached(deviceDetails,
|
||||
medium, controllerName));
|
||||
}
|
||||
|
||||
private String missingIDEControllersMessage(VmSpec vmSpecification) {
|
||||
return String
|
||||
.format(
|
||||
"First controller is not an IDE controller. Please verify that the VM spec is a correct master node: %s",
|
||||
.format("First controller is not an IDE controller. Please verify that the VM spec is a correct master node: %s",
|
||||
vmSpecification);
|
||||
}
|
||||
|
||||
|
@ -171,7 +170,7 @@ public class CreateAndRegisterMachineFromIsoIfNotAlreadyExists implements Functi
|
|||
}
|
||||
|
||||
public void ensureMachineHasStorageControllerNamed(String vmName, StorageController storageController) {
|
||||
machineUtils.writeLockMachineAndApply(vmName, new AddIDEControllerIfNotExists(checkNotNull(
|
||||
storageController, "storageController")));
|
||||
machineUtils.writeLockMachineAndApply(vmName,
|
||||
new AddIDEControllerIfNotExists(checkNotNull(storageController, "storageController")));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,8 +66,8 @@ public class IMachineToSshClient implements Function<IMachine, SshClient> {
|
|||
// TODO: we need a way to align the default login credentials from the iso with the
|
||||
// vmspec
|
||||
if ("1".equals(protocolNumber) && "22".equals(targetPort)) {
|
||||
client = sshClientFactory.create(new IPSocket(hostAddress, Integer.parseInt(inboundPort)),
|
||||
LoginCredentials.builder().user("toor").password("password").authenticateSudo(true).build());
|
||||
client = sshClientFactory.create(new IPSocket(hostAddress, Integer.parseInt(inboundPort)), LoginCredentials
|
||||
.builder().user("toor").password("password").authenticateSudo(true).build());
|
||||
}
|
||||
}
|
||||
checkNotNull(client);
|
||||
|
|
|
@ -58,13 +58,10 @@ public class IMachineToVmSpec implements Function<IMachine, VmSpec> {
|
|||
|
||||
// TODO some parameters are predefined cause the IMachine doesn't have the
|
||||
// concept i.e.: cleanUpMode
|
||||
org.jclouds.virtualbox.domain.VmSpec.Builder vmSpecBuilder = VmSpec
|
||||
.builder();
|
||||
org.jclouds.virtualbox.domain.VmSpec.Builder vmSpecBuilder = VmSpec.builder();
|
||||
|
||||
vmSpecBuilder.id(machine.getId()).name(machine.getName())
|
||||
.memoryMB(machine.getMemorySize().intValue())
|
||||
.osTypeId(machine.getOSTypeId()).forceOverwrite(true)
|
||||
.cleanUpMode(CleanupMode.Full);
|
||||
vmSpecBuilder.id(machine.getId()).name(machine.getName()).memoryMB(machine.getMemorySize().intValue())
|
||||
.osTypeId(machine.getOSTypeId()).forceOverwrite(true).cleanUpMode(CleanupMode.Full);
|
||||
|
||||
for (StorageController storageController : controllers) {
|
||||
vmSpecBuilder.controller(storageController);
|
||||
|
@ -76,28 +73,23 @@ public class IMachineToVmSpec implements Function<IMachine, VmSpec> {
|
|||
private List<StorageController> buildControllers(IMachine machine) {
|
||||
|
||||
List<StorageController> controllers = Lists.newArrayList();
|
||||
for (IStorageController iStorageController : machine
|
||||
.getStorageControllers()) {
|
||||
for (IStorageController iStorageController : machine.getStorageControllers()) {
|
||||
|
||||
Builder storageControlleBuiler = StorageController.builder();
|
||||
for (IMediumAttachment iMediumAttachment : machine
|
||||
.getMediumAttachmentsOfController(iStorageController.getName())) {
|
||||
for (IMediumAttachment iMediumAttachment : machine.getMediumAttachmentsOfController(iStorageController
|
||||
.getName())) {
|
||||
IMedium iMedium = iMediumAttachment.getMedium();
|
||||
if (iMedium.getDeviceType().equals(DeviceType.HardDisk)) {
|
||||
storageControlleBuiler.attachHardDisk(HardDisk.builder()
|
||||
.diskpath(iMedium.getLocation()).autoDelete(true)
|
||||
.controllerPort(iMediumAttachment.getPort())
|
||||
.deviceSlot(iMediumAttachment.getDevice().intValue())
|
||||
.build());
|
||||
storageControlleBuiler.attachHardDisk(HardDisk.builder().diskpath(iMedium.getLocation())
|
||||
.autoDelete(true).controllerPort(iMediumAttachment.getPort())
|
||||
.deviceSlot(iMediumAttachment.getDevice().intValue()).build());
|
||||
} else if (iMedium.getDeviceType().equals(DeviceType.DVD)) {
|
||||
storageControlleBuiler.attachISO(iMediumAttachment.getPort(),
|
||||
iMediumAttachment.getDevice().intValue(),
|
||||
storageControlleBuiler.attachISO(iMediumAttachment.getPort(), iMediumAttachment.getDevice().intValue(),
|
||||
iMedium.getLocation());
|
||||
}
|
||||
}
|
||||
controllers.add(storageControlleBuiler
|
||||
.name(iStorageController.getName())
|
||||
.bus(iStorageController.getBus()).build());
|
||||
controllers.add(storageControlleBuiler.name(iStorageController.getName()).bus(iStorageController.getBus())
|
||||
.build());
|
||||
}
|
||||
return controllers;
|
||||
}
|
||||
|
|
|
@ -123,7 +123,8 @@ public class MastersCache extends AbstractLoadingCache<Image, Master> {
|
|||
|
||||
String vmName = VIRTUALBOX_IMAGE_PREFIX + yamlImage.id;
|
||||
|
||||
HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true).controllerPort(0).deviceSlot(1).build();
|
||||
HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true).controllerPort(0).deviceSlot(1)
|
||||
.build();
|
||||
|
||||
StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
|
||||
.attachISO(0, 0, localIsoUrl).attachHardDisk(hardDisk).attachISO(1, 1, guestAdditionsIso).build();
|
||||
|
@ -142,10 +143,9 @@ public class MastersCache extends AbstractLoadingCache<Image, Master> {
|
|||
MasterSpec masterSpec = MasterSpec
|
||||
.builder()
|
||||
.vm(vmSpecification)
|
||||
.iso(
|
||||
IsoSpec.builder().sourcePath(localIsoUrl)
|
||||
.installationScript(installationKeySequence.replace("HOSTNAME", vmSpecification.getVmName())).build())
|
||||
.network(networkSpec).build();
|
||||
.iso(IsoSpec.builder().sourcePath(localIsoUrl)
|
||||
.installationScript(installationKeySequence.replace("HOSTNAME", vmSpecification.getVmName()))
|
||||
.build()).network(networkSpec).build();
|
||||
|
||||
IMachine masterMachine;
|
||||
|
||||
|
@ -156,8 +156,7 @@ public class MastersCache extends AbstractLoadingCache<Image, Master> {
|
|||
if (machineNotFoundException(e)) {
|
||||
// create the master machine if it can't be found
|
||||
masterMachine = masterCreatorAndInstaller.apply(masterSpec);
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ public class NodeCreator implements Function<NodeSpec, NodeAndInitialCredentials
|
|||
private final Function<CloneSpec, IMachine> cloner;
|
||||
|
||||
@Inject
|
||||
public NodeCreator(Supplier<VirtualBoxManager> manager, Function<CloneSpec, IMachine> cloner, MachineUtils machineUtils) {
|
||||
public NodeCreator(Supplier<VirtualBoxManager> manager, Function<CloneSpec, IMachine> cloner,
|
||||
MachineUtils machineUtils) {
|
||||
this.manager = manager;
|
||||
this.cloner = cloner;
|
||||
}
|
||||
|
|
|
@ -82,8 +82,8 @@ public class MachineUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Locks the machine and executes the given function using the machine matching the given id. Since the machine is
|
||||
* locked it is possible to perform some modifications to the IMachine.
|
||||
* Locks the machine and executes the given function using the machine matching the given id.
|
||||
* Since the machine is locked it is possible to perform some modifications to the IMachine.
|
||||
* <p/>
|
||||
* Unlocks the machine before returning.
|
||||
*
|
||||
|
@ -110,8 +110,8 @@ public class MachineUtils {
|
|||
}
|
||||
|
||||
/**
|
||||
* Locks the machine and executes the given function using the current session. Since the machine is locked it is
|
||||
* possible to perform some modifications to the IMachine.
|
||||
* Locks the machine and executes the given function using the current session. Since the machine
|
||||
* is locked it is possible to perform some modifications to the IMachine.
|
||||
* <p/>
|
||||
* Unlocks the machine before returning.
|
||||
*
|
||||
|
@ -132,8 +132,8 @@ public class MachineUtils {
|
|||
session.unlockMachine();
|
||||
}
|
||||
} catch (VBoxException e) {
|
||||
throw new RuntimeException(String.format("error applying %s to %s with %s lock: %s", function, machineId, type,
|
||||
e.getMessage()), e);
|
||||
throw new RuntimeException(String.format("error applying %s to %s with %s lock: %s", function, machineId,
|
||||
type, e.getMessage()), e);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -144,17 +144,19 @@ public class MachineUtils {
|
|||
private void unlockMachine(final String machineId) {
|
||||
IMachine immutableMachine = manager.get().getVBox().findMachine(machineId);
|
||||
if (immutableMachine.getSessionState().equals(SessionState.Locked)) {
|
||||
Statement kill = newStatementList(call("default"), findPid(immutableMachine.getSessionPid().toString()), kill());
|
||||
Statement kill = newStatementList(call("default"), findPid(immutableMachine.getSessionPid().toString()),
|
||||
kill());
|
||||
scriptRunner.create(host.get(), kill, runAsRoot(false).wrapInInitScript(false)).init().call();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlocks the machine and executes the given function using the machine matching the given id. Since the machine is
|
||||
* unlocked it is possible to delete the IMachine.
|
||||
* Unlocks the machine and executes the given function using the machine matching the given id.
|
||||
* Since the machine is unlocked it is possible to delete the IMachine.
|
||||
* <p/>
|
||||
* <p/>
|
||||
* <h3>Note!</h3> Currently, this can only unlock the machine, if the lock was created in the current session.
|
||||
* <h3>Note!</h3> Currently, this can only unlock the machine, if the lock was created in the
|
||||
* current session.
|
||||
*
|
||||
* @param machineId
|
||||
* the id of the machine
|
||||
|
@ -170,13 +172,14 @@ public class MachineUtils {
|
|||
return function.apply(immutableMachine);
|
||||
|
||||
} catch (VBoxException e) {
|
||||
throw new RuntimeException(String.format("error applying %s to %s: %s", function, machineId, e.getMessage()), e);
|
||||
throw new RuntimeException(String.format("error applying %s to %s: %s", function, machineId, e.getMessage()),
|
||||
e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Unlocks the machine and executes the given function, if the machine is registered. Since the machine is unlocked it
|
||||
* is possible to delete the machine.
|
||||
* Unlocks the machine and executes the given function, if the machine is registered. Since the
|
||||
* machine is unlocked it is possible to delete the machine.
|
||||
* <p/>
|
||||
*
|
||||
* @param machineId
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.jclouds.compute.ComputeServiceContextFactory;
|
|||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.functions.DefaultCredentialsFromImageOrOverridingCredentials;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.compute.strategy.PrioritizeCredentialsFromTemplate;
|
||||
import org.jclouds.config.ValueOfConfigurationKeyOrNull;
|
||||
import org.jclouds.logging.slf4j.config.SLF4JLoggingModule;
|
||||
|
@ -97,8 +96,7 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
|
|||
}
|
||||
|
||||
protected void ensureIdentityPropertyIsSpecifiedOrTakeFromDefaults() {
|
||||
Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder()
|
||||
.build();
|
||||
Properties defaultVBoxProperties = new VirtualBoxPropertiesBuilder().build();
|
||||
if (!System.getProperties().containsKey("test." + provider + ".identity"))
|
||||
System.setProperty("test." + provider + ".identity",
|
||||
defaultVBoxProperties.getProperty(Constants.PROPERTY_IDENTITY));
|
||||
|
@ -109,43 +107,32 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
|
|||
setupCredentials();
|
||||
Properties overrides = new VirtualBoxPropertiesBuilder(setupProperties()).build();
|
||||
|
||||
CacheNodeStoreModule hostModule = new CacheNodeStoreModule(
|
||||
ImmutableMap.of(
|
||||
CacheNodeStoreModule hostModule = new CacheNodeStoreModule(ImmutableMap.of(
|
||||
"host",
|
||||
Node.builder()
|
||||
.id("host")
|
||||
.name("host installing virtualbox")
|
||||
.hostname("localhost")
|
||||
.osFamily(OsFamily.LINUX.toString())
|
||||
.osDescription(System.getProperty("os.name"))
|
||||
.osVersion(System.getProperty("os.version"))
|
||||
.group("ssh")
|
||||
Node.builder().id("host").name("host installing virtualbox").hostname("localhost")
|
||||
.osFamily(OsFamily.LINUX.toString()).osDescription(System.getProperty("os.name"))
|
||||
.osVersion(System.getProperty("os.version")).group("ssh")
|
||||
.username(System.getProperty("user.name"))
|
||||
.credentialUrl(
|
||||
URI.create("file://"
|
||||
+ System.getProperty("user.home")
|
||||
+ "/.ssh/id_rsa")).build()));
|
||||
.credentialUrl(URI.create("file://" + System.getProperty("user.home") + "/.ssh/id_rsa"))
|
||||
.build()));
|
||||
|
||||
context = new ComputeServiceContextFactory().createContext(provider,
|
||||
identity, credential, ImmutableSet.<Module>of(
|
||||
new SLF4JLoggingModule(), new SshjSshClientModule(),
|
||||
hostModule), overrides);
|
||||
context = new ComputeServiceContextFactory().createContext(provider, identity, credential,
|
||||
ImmutableSet.<Module> of(new SLF4JLoggingModule(), new SshjSshClientModule(), hostModule), overrides);
|
||||
Function<String, String> configProperties = context.utils().injector()
|
||||
.getInstance(ValueOfConfigurationKeyOrNull.class);
|
||||
imageId = "ubuntu-11.04-server-i386";
|
||||
workingDir = configProperties
|
||||
.apply(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR);
|
||||
workingDir = configProperties.apply(VirtualBoxConstants.VIRTUALBOX_WORKINGDIR);
|
||||
isosDir = workingDir + File.separator + "isos";
|
||||
File isosDirFile = new File(isosDir);
|
||||
if (!isosDirFile.exists()) {
|
||||
isosDirFile.mkdirs();
|
||||
}
|
||||
host = context.utils().injector()
|
||||
.getInstance(Key.get(new TypeLiteral<Supplier<NodeMetadata>>() {
|
||||
host = context.utils().injector().getInstance(Key.get(new TypeLiteral<Supplier<NodeMetadata>>() {
|
||||
}));
|
||||
|
||||
// this will eagerly startup Jetty, note the impl will shut itself down
|
||||
preconfigurationUri = context.utils().injector().getInstance(Key.get(new TypeLiteral<LoadingCache<IsoSpec, URI>>() {
|
||||
preconfigurationUri = context.utils().injector()
|
||||
.getInstance(Key.get(new TypeLiteral<LoadingCache<IsoSpec, URI>>() {
|
||||
}, Preconfiguration.class));
|
||||
// this will eagerly startup Jetty, note the impl will shut itself down
|
||||
|
||||
|
@ -156,18 +143,14 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
|
|||
|
||||
machineUtils = context.utils().injector().getInstance(MachineUtils.class);
|
||||
|
||||
hostVersion = Iterables.get(
|
||||
Splitter.on('r').split(
|
||||
context.getProviderSpecificContext().getBuildVersion()), 0);
|
||||
hostVersion = Iterables.get(Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0);
|
||||
adminDisk = workingDir + "/testadmin.vdi";
|
||||
operatingSystemIso = String.format("%s/%s.iso", isosDir, imageId);
|
||||
guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso",
|
||||
isosDir, hostVersion);
|
||||
guestAdditionsIso = String.format("%s/VBoxGuestAdditions_%s.iso", isosDir, hostVersion);
|
||||
}
|
||||
|
||||
protected void undoVm(VmSpec vmSpecification) {
|
||||
machineUtils.unlockMachineAndApplyOrReturnNullIfNotRegistered(
|
||||
vmSpecification.getVmId(),
|
||||
machineUtils.unlockMachineAndApplyOrReturnNullIfNotRegistered(vmSpecification.getVmId(),
|
||||
new UnregisterMachineIfExistsAndDeleteItsMedia(vmSpecification));
|
||||
}
|
||||
|
||||
|
@ -183,7 +166,8 @@ public class BaseVirtualBoxClientLiveTest extends BaseVersionedServiceLiveTest {
|
|||
}
|
||||
});
|
||||
} catch (RuntimeException e) {
|
||||
// sometimes the machine might be powered of between the while test and the call to lockSessionOnMachineAndApply
|
||||
// sometimes the machine might be powered of between the while test and the call to
|
||||
// lockSessionOnMachineAndApply
|
||||
if (e.getMessage().contains("Invalid machine state: PoweredOff")) {
|
||||
return;
|
||||
} else if (e.getMessage().contains("VirtualBox error: The object is not ready")) {
|
||||
|
|
|
@ -20,16 +20,12 @@
|
|||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkState;
|
||||
import static com.google.common.base.Predicates.equalTo;
|
||||
import static com.google.common.collect.Iterables.any;
|
||||
import static com.google.common.collect.Iterables.transform;
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_IMAGE_PREFIX;
|
||||
import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_INSTALLATION_KEY_SEQUENCE;
|
||||
import static org.testng.Assert.assertTrue;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
|
@ -57,18 +53,15 @@ import org.testng.annotations.BeforeClass;
|
|||
import org.testng.annotations.Test;
|
||||
import org.virtualbox_4_1.CleanupMode;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
import org.virtualbox_4_1.IProgress;
|
||||
import org.virtualbox_4_1.ISession;
|
||||
import org.virtualbox_4_1.LockType;
|
||||
import org.virtualbox_4_1.NetworkAttachmentType;
|
||||
import org.virtualbox_4_1.StorageBus;
|
||||
import org.virtualbox_4_1.jaxws.MachineState;
|
||||
|
||||
import com.google.common.base.CaseFormat;
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.base.Throwables;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.inject.Guice;
|
||||
|
@ -81,8 +74,8 @@ import com.google.inject.Injector;
|
|||
public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
||||
|
||||
Map<OsFamily, Map<String, String>> map = new BaseComputeServiceContextModule() {
|
||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice
|
||||
.createInjector(new GsonModule()).getInstance(Json.class));
|
||||
}.provideOsVersionMap(new ComputeServiceConstants.ReferenceData(), Guice.createInjector(new GsonModule())
|
||||
.getInstance(Json.class));
|
||||
|
||||
private VmSpec vmSpecification;
|
||||
private MasterSpec masterSpec;
|
||||
|
@ -96,31 +89,24 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
public void setupClient() {
|
||||
super.setupClient();
|
||||
this.vmName = VIRTUALBOX_IMAGE_PREFIX
|
||||
+ CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass()
|
||||
.getSimpleName());
|
||||
+ CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_HYPHEN, getClass().getSimpleName());
|
||||
|
||||
HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk)
|
||||
.autoDelete(true).controllerPort(0).deviceSlot(1).build();
|
||||
StorageController ideController = StorageController.builder()
|
||||
.name("IDE Controller").bus(StorageBus.IDE)
|
||||
.attachISO(0, 0, operatingSystemIso).attachHardDisk(hardDisk)
|
||||
.attachISO(1, 1, guestAdditionsIso).build();
|
||||
vmSpecification = VmSpec.builder().id(vmName).name(vmName)
|
||||
.memoryMB(512).osTypeId("").controller(ideController)
|
||||
HardDisk hardDisk = HardDisk.builder().diskpath(adminDisk).autoDelete(true).controllerPort(0).deviceSlot(1)
|
||||
.build();
|
||||
StorageController ideController = StorageController.builder().name("IDE Controller").bus(StorageBus.IDE)
|
||||
.attachISO(0, 0, operatingSystemIso).attachHardDisk(hardDisk).attachISO(1, 1, guestAdditionsIso).build();
|
||||
vmSpecification = VmSpec.builder().id(vmName).name(vmName).memoryMB(512).osTypeId("").controller(ideController)
|
||||
.forceOverwrite(true).cleanUpMode(CleanupMode.Full).build();
|
||||
|
||||
injector = context.utils().injector();
|
||||
Function<String, String> configProperties = injector
|
||||
.getInstance(ValueOfConfigurationKeyOrNull.class);
|
||||
Function<String, String> configProperties = injector.getInstance(ValueOfConfigurationKeyOrNull.class);
|
||||
|
||||
NetworkAdapter networkAdapter = NetworkAdapter.builder()
|
||||
.networkAttachmentType(NetworkAttachmentType.NAT)
|
||||
NetworkAdapter networkAdapter = NetworkAdapter.builder().networkAttachmentType(NetworkAttachmentType.NAT)
|
||||
.tcpRedirectRule("127.0.0.1", 2222, "", 22).build();
|
||||
NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard
|
||||
.builder().addNetworkAdapter(networkAdapter).build();
|
||||
NetworkInterfaceCard networkInterfaceCard = NetworkInterfaceCard.builder().addNetworkAdapter(networkAdapter)
|
||||
.build();
|
||||
|
||||
NetworkSpec networkSpec = NetworkSpec.builder()
|
||||
.addNIC(0L, networkInterfaceCard).build();
|
||||
NetworkSpec networkSpec = NetworkSpec.builder().addNIC(0L, networkInterfaceCard).build();
|
||||
|
||||
masterSpec = MasterSpec
|
||||
.builder()
|
||||
|
@ -129,11 +115,8 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
.builder()
|
||||
.sourcePath(operatingSystemIso)
|
||||
.installationScript(
|
||||
configProperties.apply(
|
||||
VIRTUALBOX_INSTALLATION_KEY_SEQUENCE)
|
||||
.replace("HOSTNAME",
|
||||
vmSpecification.getVmName()))
|
||||
.build()).network(networkSpec).build();
|
||||
configProperties.apply(VIRTUALBOX_INSTALLATION_KEY_SEQUENCE).replace("HOSTNAME",
|
||||
vmSpecification.getVmName())).build()).network(networkSpec).build();
|
||||
|
||||
undoVm(vmSpecification);
|
||||
}
|
||||
|
@ -151,33 +134,22 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
try {
|
||||
IMachine machine = getVmWithGuestAdditionsInstalled();
|
||||
|
||||
machineUtils.applyForMachine(machine.getName(),
|
||||
new LaunchMachineIfNotAlreadyRunning(manager.get(),
|
||||
machineUtils.applyForMachine(machine.getName(), new LaunchMachineIfNotAlreadyRunning(manager.get(),
|
||||
ExecutionType.GUI, ""));
|
||||
sshClientForIMachine = injector
|
||||
.getInstance(IMachineToSshClient.class);
|
||||
sshClientForIMachine = injector.getInstance(IMachineToSshClient.class);
|
||||
SshClient client = sshClientForIMachine.apply(machine);
|
||||
|
||||
sshResponds = injector.getInstance(SshResponds.class);
|
||||
checkState(sshResponds.apply(client),
|
||||
"timed out waiting for guest %s to be accessible via ssh",
|
||||
checkState(sshResponds.apply(client), "timed out waiting for guest %s to be accessible via ssh",
|
||||
machine.getName());
|
||||
|
||||
assertTrue(machineUtils.lockSessionOnMachineAndApply(
|
||||
machine.getName(), LockType.Shared,
|
||||
assertTrue(machineUtils.lockSessionOnMachineAndApply(machine.getName(), LockType.Shared,
|
||||
new Function<ISession, Boolean>() {
|
||||
@Override
|
||||
public Boolean apply(ISession session) {
|
||||
String vboxVersion = Iterables
|
||||
.get(Splitter
|
||||
.on('r')
|
||||
.split(context
|
||||
.getProviderSpecificContext()
|
||||
.getBuildVersion()), 0);
|
||||
return session
|
||||
.getMachine()
|
||||
.getGuestPropertyValue(
|
||||
"/VirtualBox/GuestAdd/Version")
|
||||
String vboxVersion = Iterables.get(
|
||||
Splitter.on('r').split(context.getProviderSpecificContext().getBuildVersion()), 0);
|
||||
return session.getMachine().getGuestPropertyValue("/VirtualBox/GuestAdd/Version")
|
||||
.equals(vboxVersion);
|
||||
}
|
||||
}));
|
||||
|
@ -201,12 +173,10 @@ public class CreateAndInstallVmLiveTest extends BaseVirtualBoxClientLiveTest {
|
|||
private IMachine getVmWithGuestAdditionsInstalled() {
|
||||
try {
|
||||
Injector injector = context.utils().injector();
|
||||
return injector.getInstance(CreateAndInstallVm.class).apply(
|
||||
masterSpec);
|
||||
return injector.getInstance(CreateAndInstallVm.class).apply(masterSpec);
|
||||
} catch (IllegalStateException e) {
|
||||
// already created
|
||||
return manager.get().getVBox()
|
||||
.findMachine(masterSpec.getVmSpec().getVmId());
|
||||
return manager.get().getVBox().findMachine(masterSpec.getVmSpec().getVmId());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue