mirror of https://github.com/apache/jclouds.git
still failing matching the default image to the yaml images
This commit is contained in:
parent
51e24096fe
commit
40a95be772
|
@ -29,6 +29,8 @@ import java.util.Map;
|
||||||
import javax.inject.Inject;
|
import javax.inject.Inject;
|
||||||
|
|
||||||
import org.jclouds.compute.ComputeServiceAdapter;
|
import org.jclouds.compute.ComputeServiceAdapter;
|
||||||
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.Template;
|
import org.jclouds.compute.domain.Template;
|
||||||
import org.jclouds.domain.Location;
|
import org.jclouds.domain.Location;
|
||||||
|
@ -192,4 +194,5 @@ public class VirtualBoxComputeServiceAdapter implements ComputeServiceAdapter<IM
|
||||||
throw Throwables.propagate(e);
|
throw Throwables.propagate(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,9 @@ import static org.jclouds.virtualbox.config.VirtualBoxConstants.VIRTUALBOX_PRECO
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
|
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
|
@ -37,6 +39,7 @@ import org.jclouds.compute.ComputeServiceAdapter;
|
||||||
import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
|
import org.jclouds.compute.ComputeServiceAdapter.NodeAndInitialCredentials;
|
||||||
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
||||||
import org.jclouds.compute.domain.Hardware;
|
import org.jclouds.compute.domain.Hardware;
|
||||||
|
import org.jclouds.compute.domain.HardwareBuilder;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.compute.domain.NodeMetadata;
|
import org.jclouds.compute.domain.NodeMetadata;
|
||||||
import org.jclouds.compute.domain.NodeState;
|
import org.jclouds.compute.domain.NodeState;
|
||||||
|
@ -61,7 +64,7 @@ import org.jclouds.virtualbox.functions.MasterImages;
|
||||||
import org.jclouds.virtualbox.functions.MasterLoader;
|
import org.jclouds.virtualbox.functions.MasterLoader;
|
||||||
import org.jclouds.virtualbox.functions.NodeCreator;
|
import org.jclouds.virtualbox.functions.NodeCreator;
|
||||||
import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
|
import org.jclouds.virtualbox.functions.YamlImagesFromFileConfig;
|
||||||
import org.jclouds.virtualbox.functions.admin.ImageFromYamlString;
|
import org.jclouds.virtualbox.functions.admin.ImagesToYamlImagesFromYamlDescriptor;
|
||||||
import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning;
|
import org.jclouds.virtualbox.functions.admin.StartJettyIfNotAlreadyRunning;
|
||||||
import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
|
import org.jclouds.virtualbox.functions.admin.StartVBoxIfNotAlreadyRunning;
|
||||||
import org.jclouds.virtualbox.predicates.SshResponds;
|
import org.jclouds.virtualbox.predicates.SshResponds;
|
||||||
|
@ -80,7 +83,6 @@ import com.google.common.cache.CacheBuilder;
|
||||||
import com.google.common.cache.CacheLoader;
|
import com.google.common.cache.CacheLoader;
|
||||||
import com.google.common.cache.LoadingCache;
|
import com.google.common.cache.LoadingCache;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.Iterables;
|
|
||||||
import com.google.inject.Injector;
|
import com.google.inject.Injector;
|
||||||
import com.google.inject.Provides;
|
import com.google.inject.Provides;
|
||||||
import com.google.inject.TypeLiteral;
|
import com.google.inject.TypeLiteral;
|
||||||
|
@ -90,143 +92,166 @@ import com.google.inject.TypeLiteral;
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||||
public class VirtualBoxComputeServiceContextModule extends
|
public class VirtualBoxComputeServiceContextModule extends
|
||||||
ComputeServiceAdapterContextModule<Supplier, Supplier, IMachine, IMachine, Image, Location> {
|
ComputeServiceAdapterContextModule<Supplier, Supplier, IMachine, IMachine, Image, Location> {
|
||||||
|
|
||||||
public VirtualBoxComputeServiceContextModule() {
|
public VirtualBoxComputeServiceContextModule() {
|
||||||
super(Supplier.class, Supplier.class);
|
super(Supplier.class, Supplier.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void configure() {
|
protected void configure() {
|
||||||
super.configure();
|
super.configure();
|
||||||
bind(new TypeLiteral<ComputeServiceAdapter<IMachine, IMachine, Image, Location>>() {
|
bind(new TypeLiteral<ComputeServiceAdapter<IMachine, IMachine, Image, Location>>() {
|
||||||
}).to(VirtualBoxComputeServiceAdapter.class);
|
}).to(VirtualBoxComputeServiceAdapter.class);
|
||||||
bind(new TypeLiteral<Function<IMachine, NodeMetadata>>() {
|
bind(new TypeLiteral<Function<IMachine, NodeMetadata>>() {
|
||||||
}).to(IMachineToNodeMetadata.class);
|
}).to(IMachineToNodeMetadata.class);
|
||||||
bind(new TypeLiteral<Function<Location, Location>>() {
|
bind(new TypeLiteral<Function<Location, Location>>() {
|
||||||
}).to((Class) IdentityFunction.class);
|
}).to((Class) IdentityFunction.class);
|
||||||
bind(new TypeLiteral<Function<Image, Image>>() {
|
bind(new TypeLiteral<Function<Image, Image>>() {
|
||||||
}).to((Class) IdentityFunction.class);
|
}).to((Class) IdentityFunction.class);
|
||||||
bind(new TypeLiteral<Function<IMachine, Hardware>>() {
|
bind(new TypeLiteral<Function<IMachine, Hardware>>() {
|
||||||
}).to(IMachineToHardware.class);
|
}).to(IMachineToHardware.class);
|
||||||
bind(new TypeLiteral<Function<IMachine, Image>>() {
|
bind(new TypeLiteral<Function<IMachine, Image>>() {
|
||||||
}).to(IMachineToImage.class);
|
}).to(IMachineToImage.class);
|
||||||
bind(new TypeLiteral<CacheLoader<IsoSpec, URI>>() {
|
bind(new TypeLiteral<CacheLoader<IsoSpec, URI>>() {
|
||||||
}).to((Class) StartJettyIfNotAlreadyRunning.class);
|
}).to((Class) StartJettyIfNotAlreadyRunning.class);
|
||||||
bind(new TypeLiteral<Supplier<VirtualBoxManager>>() {
|
bind(new TypeLiteral<Supplier<VirtualBoxManager>>() {
|
||||||
}).to((Class) StartVBoxIfNotAlreadyRunning.class);
|
}).to((Class) StartVBoxIfNotAlreadyRunning.class);
|
||||||
// the yaml config to image mapper
|
// the yaml config to image mapper
|
||||||
bind(new TypeLiteral<Supplier<Map<Image, YamlImage>>>() {
|
bind(new TypeLiteral<Supplier<Map<Image, YamlImage>>>() {
|
||||||
}).to((Class) ImageFromYamlString.class);
|
}).to((Class) ImagesToYamlImagesFromYamlDescriptor.class);
|
||||||
// the yaml config provider
|
// the yaml config provider
|
||||||
bind(new TypeLiteral<Supplier<String>>() {
|
bind(new TypeLiteral<Supplier<String>>() {
|
||||||
}).to((Class)YamlImagesFromFileConfig.class);
|
}).to((Class) YamlImagesFromFileConfig.class);
|
||||||
// the master machines cache
|
// the master machines cache
|
||||||
bind(new TypeLiteral<LoadingCache<Image, IMachine>>() {
|
bind(new TypeLiteral<LoadingCache<Image, IMachine>>() {
|
||||||
}).to((Class)MasterImages.class);
|
}).to((Class) MasterImages.class);
|
||||||
// the master machines loading/creating function
|
// the master machines loading/creating function
|
||||||
bind(new TypeLiteral<Function<MasterSpec, IMachine>>() {
|
bind(new TypeLiteral<Function<MasterSpec, IMachine>>() {
|
||||||
}).to((Class)MasterLoader.class);
|
}).to((Class) MasterLoader.class);
|
||||||
// the machine cloning function
|
// the machine cloning function
|
||||||
bind(new TypeLiteral<Function<IMachine, NodeAndInitialCredentials<IMachine>>>() {
|
bind(new TypeLiteral<Function<IMachine, NodeAndInitialCredentials<IMachine>>>() {
|
||||||
}).to((Class)NodeCreator.class);
|
}).to((Class) NodeCreator.class);
|
||||||
|
|
||||||
// for byon
|
|
||||||
bind(new TypeLiteral<Function<URI, InputStream>>() {
|
|
||||||
}).to(SupplyFromProviderURIOrNodesProperty.class);
|
|
||||||
|
|
||||||
bind(new TypeLiteral<Function<IMachine, SshClient>>() {
|
// for byon
|
||||||
}).to(IMachineToSshClient.class);
|
bind(new TypeLiteral<Function<URI, InputStream>>() {
|
||||||
|
}).to(SupplyFromProviderURIOrNodesProperty.class);
|
||||||
|
|
||||||
bind(ExecutionType.class).toInstance(ExecutionType.GUI);
|
bind(new TypeLiteral<Function<IMachine, SshClient>>() {
|
||||||
bind(LockType.class).toInstance(LockType.Write);
|
}).to(IMachineToSshClient.class);
|
||||||
|
|
||||||
}
|
bind(ExecutionType.class).toInstance(ExecutionType.GUI);
|
||||||
|
bind(LockType.class).toInstance(LockType.Write);
|
||||||
@Provides
|
}
|
||||||
@Singleton
|
|
||||||
@Preconfiguration
|
|
||||||
protected LoadingCache<IsoSpec, URI> preconfiguration(CacheLoader<IsoSpec, URI> cacheLoader) {
|
|
||||||
return CacheBuilder.newBuilder().build(cacheLoader);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Server providesJettyServer(@Named(VIRTUALBOX_PRECONFIGURATION_URL) String preconfigurationUrl) {
|
@Preconfiguration
|
||||||
return new Server(URI.create(preconfigurationUrl).getPort());
|
protected LoadingCache<IsoSpec, URI> preconfiguration(CacheLoader<IsoSpec, URI> cacheLoader) {
|
||||||
}
|
return CacheBuilder.newBuilder().build(cacheLoader);
|
||||||
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Function<Supplier<NodeMetadata>, VirtualBoxManager> provideVBox() {
|
protected Server providesJettyServer(@Named(VIRTUALBOX_PRECONFIGURATION_URL) String preconfigurationUrl) {
|
||||||
return new Function<Supplier<NodeMetadata>, VirtualBoxManager>() {
|
return new Server(URI.create(preconfigurationUrl).getPort());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Provides
|
||||||
public VirtualBoxManager apply(Supplier<NodeMetadata> nodeSupplier) {
|
@Singleton
|
||||||
return VirtualBoxManager.createInstance(nodeSupplier.get().getId());
|
protected Function<Supplier<NodeMetadata>, VirtualBoxManager> provideVBox() {
|
||||||
}
|
return new Function<Supplier<NodeMetadata>, VirtualBoxManager>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VirtualBoxManager apply(Supplier<NodeMetadata> nodeSupplier) {
|
||||||
|
return VirtualBoxManager.createInstance(nodeSupplier.get().getId());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "createInstanceByNodeId()";
|
return "createInstanceByNodeId()";
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Supplier defaultClient(Supplier<VirtualBoxManager> in) {
|
protected Supplier defaultClient(Supplier<VirtualBoxManager> in) {
|
||||||
return in;
|
return in;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Provides
|
@Provides
|
||||||
@Singleton
|
@Singleton
|
||||||
protected Predicate<SshClient> sshResponds(SshResponds sshResponds, Timeouts timeouts) {
|
protected Predicate<SshClient> sshResponds(SshResponds sshResponds, Timeouts timeouts) {
|
||||||
return new RetryablePredicate<SshClient>(sshResponds, timeouts.nodeRunning);
|
return new RetryablePredicate<SshClient>(sshResponds, timeouts.nodeRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
protected Supplier provideHardware(
|
||||||
Supplier<Map<Image, YamlImage>> imagesSupplier = injector.getInstance(Supplier.class);
|
ComputeServiceAdapter<IMachine, IMachine, Image, Location> adapter, Function<IMachine, Hardware> transformer) {
|
||||||
// get the first image from the supplier
|
return Suppliers.ofInstance(Collections.singleton(new HardwareBuilder().id("").build()));
|
||||||
Image image = Iterables.getFirst(imagesSupplier.get().keySet(), null);
|
}
|
||||||
template.fromImage(image);
|
|
||||||
return template;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Provides
|
@Override
|
||||||
@Singleton
|
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||||
protected Supplier<NodeMetadata> host(Supplier<LoadingCache<String, Node>> nodes, NodeToNodeMetadata converter)
|
return template.osFamily(OsFamily.UBUNTU).osVersionMatches("11.04");
|
||||||
throws ExecutionException {
|
}
|
||||||
return Suppliers.compose(Functions.compose(converter, new Function<LoadingCache<String, Node>, Node>() {
|
|
||||||
|
|
||||||
@Override
|
@Provides
|
||||||
public Node apply(LoadingCache<String, Node> arg0) {
|
@Singleton
|
||||||
return arg0.apply("host");
|
protected Supplier<NodeMetadata> host(Supplier<LoadingCache<String, Node>> nodes, NodeToNodeMetadata converter)
|
||||||
}
|
throws ExecutionException {
|
||||||
}), nodes);
|
return Suppliers.compose(Functions.compose(converter, new Function<LoadingCache<String, Node>, Node>() {
|
||||||
}
|
|
||||||
|
|
||||||
@VisibleForTesting
|
@Override
|
||||||
public static final Map<MachineState, NodeState> machineToNodeState = ImmutableMap
|
public Node apply(LoadingCache<String, Node> arg0) {
|
||||||
.<MachineState, NodeState>builder().put(MachineState.Running, NodeState.RUNNING).put(
|
return arg0.apply("host");
|
||||||
MachineState.PoweredOff, NodeState.SUSPENDED)
|
}
|
||||||
.put(MachineState.DeletingSnapshot, NodeState.PENDING).put(MachineState.DeletingSnapshotOnline,
|
}), nodes);
|
||||||
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)
|
|
||||||
// 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.Stuck, NodeState.ERROR)
|
@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)
|
||||||
|
.put(MachineState.Starting, NodeState.PENDING)
|
||||||
|
.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.Stuck, NodeState.ERROR)
|
||||||
|
|
||||||
.put(MachineState.Null, NodeState.UNRECOGNIZED).build();
|
.put(MachineState.Null,
|
||||||
|
NodeState.UNRECOGNIZED).build();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,7 +35,6 @@ import javax.inject.Named;
|
||||||
|
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
import org.jclouds.config.ValueOfConfigurationKeyOrNull;
|
|
||||||
import org.jclouds.virtualbox.domain.HardDisk;
|
import org.jclouds.virtualbox.domain.HardDisk;
|
||||||
import org.jclouds.virtualbox.domain.IsoSpec;
|
import org.jclouds.virtualbox.domain.IsoSpec;
|
||||||
import org.jclouds.virtualbox.domain.MasterSpec;
|
import org.jclouds.virtualbox.domain.MasterSpec;
|
||||||
|
@ -66,20 +65,21 @@ public class MasterImages extends AbstractLoadingCache<Image, IMachine> {
|
||||||
private final Map<Image, IMachine> masters = Maps.newHashMap();
|
private final Map<Image, IMachine> masters = Maps.newHashMap();
|
||||||
private final Function<MasterSpec, IMachine> mastersLoader;
|
private final Function<MasterSpec, IMachine> mastersLoader;
|
||||||
private final Map<Image, YamlImage> imageMapping;
|
private final Map<Image, YamlImage> imageMapping;
|
||||||
private final ValueOfConfigurationKeyOrNull cfg;
|
|
||||||
private final String workingDir;
|
private final String workingDir;
|
||||||
private final String adminDisk;
|
private final String adminDisk;
|
||||||
private String guestAdditionsIso;
|
private String guestAdditionsIso;
|
||||||
|
private String installationKeySequence;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public MasterImages(@Named(Constants.PROPERTY_BUILD_VERSION) String version,
|
public MasterImages(@Named(Constants.PROPERTY_BUILD_VERSION) String version,
|
||||||
Function<MasterSpec, IMachine> masterLoader, ValueOfConfigurationKeyOrNull cfg,
|
@Named(VIRTUALBOX_INSTALLATION_KEY_SEQUENCE) String installationKeySequence,
|
||||||
|
@Named(VIRTUALBOX_WORKINGDIR) String workingDir, Function<MasterSpec, IMachine> masterLoader,
|
||||||
Supplier<Map<Image, YamlImage>> yamlMapper) {
|
Supplier<Map<Image, YamlImage>> yamlMapper) {
|
||||||
checkNotNull(version, "version");
|
checkNotNull(version, "version");
|
||||||
|
checkNotNull(installationKeySequence, "installationKeySequence");
|
||||||
this.mastersLoader = masterLoader;
|
this.mastersLoader = masterLoader;
|
||||||
this.cfg = cfg;
|
this.installationKeySequence = installationKeySequence;
|
||||||
this.workingDir = cfg.apply(VIRTUALBOX_WORKINGDIR) == null ? VIRTUALBOX_DEFAULT_DIR : cfg
|
this.workingDir = workingDir == null ? VIRTUALBOX_DEFAULT_DIR : workingDir;
|
||||||
.apply(VIRTUALBOX_WORKINGDIR);
|
|
||||||
File wdFile = new File(workingDir);
|
File wdFile = new File(workingDir);
|
||||||
if (!wdFile.exists()) {
|
if (!wdFile.exists()) {
|
||||||
wdFile.mkdirs();
|
wdFile.mkdirs();
|
||||||
|
@ -96,10 +96,13 @@ public class MasterImages extends AbstractLoadingCache<Image, IMachine> {
|
||||||
return masters.get(key);
|
return masters.get(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkNotNull(key, key);
|
||||||
checkState(new File(guestAdditionsIso).exists(), "guest additions iso does not exist at: " + guestAdditionsIso);
|
checkState(new File(guestAdditionsIso).exists(), "guest additions iso does not exist at: " + guestAdditionsIso);
|
||||||
|
|
||||||
YamlImage yamlImage = imageMapping.get(key);
|
YamlImage yamlImage = imageMapping.get(key);
|
||||||
|
|
||||||
|
checkNotNull(yamlImage, "could not find yaml image for image: " + key);
|
||||||
|
|
||||||
String vmName = VIRTUALBOX_IMAGE_PREFIX + yamlImage.id;
|
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();
|
||||||
|
@ -114,12 +117,8 @@ public class MasterImages extends AbstractLoadingCache<Image, IMachine> {
|
||||||
.builder()
|
.builder()
|
||||||
.vm(vmSpecification)
|
.vm(vmSpecification)
|
||||||
.iso(
|
.iso(
|
||||||
IsoSpec
|
IsoSpec.builder().sourcePath(yamlImage.iso)
|
||||||
.builder()
|
.installationScript(installationKeySequence.replace("HOSTNAME", vmSpecification.getVmName())).build())
|
||||||
.sourcePath(yamlImage.iso)
|
|
||||||
.installationScript(
|
|
||||||
cfg.apply(VIRTUALBOX_INSTALLATION_KEY_SEQUENCE).replace("HOSTNAME", vmSpecification.getVmName()))
|
|
||||||
.build())
|
|
||||||
.network(
|
.network(
|
||||||
NetworkSpec.builder()
|
NetworkSpec.builder()
|
||||||
.natNetworkAdapter(0, NatAdapter.builder().tcpRedirectRule("127.0.0.1", 2222, "", 22).build()).build())
|
.natNetworkAdapter(0, NatAdapter.builder().tcpRedirectRule("127.0.0.1", 2222, "", 22).build()).build())
|
||||||
|
|
|
@ -41,12 +41,12 @@ import com.google.common.collect.Maps;
|
||||||
* @author Andrea Turli
|
* @author Andrea Turli
|
||||||
*/
|
*/
|
||||||
@Singleton
|
@Singleton
|
||||||
public class ImageFromYamlString implements Supplier<Map<Image, YamlImage>> {
|
public class ImagesToYamlImagesFromYamlDescriptor implements Supplier<Map<Image, YamlImage>> {
|
||||||
|
|
||||||
private String yamlDescriptor;
|
private String yamlDescriptor;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
public ImageFromYamlString(Supplier<String> yamlDescriptorSupplier) {
|
public ImagesToYamlImagesFromYamlDescriptor(Supplier<String> yamlDescriptorSupplier) {
|
||||||
this.yamlDescriptor = yamlDescriptorSupplier.get();
|
this.yamlDescriptor = yamlDescriptorSupplier.get();
|
||||||
checkNotNull(yamlDescriptor, "yaml descriptor");
|
checkNotNull(yamlDescriptor, "yaml descriptor");
|
||||||
checkState(!yamlDescriptor.equals(""), "yaml descriptor is empty");
|
checkState(!yamlDescriptor.equals(""), "yaml descriptor is empty");
|
|
@ -55,7 +55,7 @@ public class ImageFromYamlStringTest {
|
||||||
yamlFileLines.append(line).append("\n");
|
yamlFileLines.append(line).append("\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageFromYamlString parser = new ImageFromYamlString(new Supplier<String>() {
|
ImagesToYamlImagesFromYamlDescriptor parser = new ImagesToYamlImagesFromYamlDescriptor(new Supplier<String>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String get() {
|
public String get() {
|
||||||
|
|
Loading…
Reference in New Issue