mirror of https://github.com/apache/jclouds.git
Added a couple of tests that are run from a main() instead of via TestNG. Added lots of plumbing (ongoing work) for virtualbox. To be reviewed and discussed.
This commit is contained in:
parent
cdd0c1784a
commit
aed4e72e49
|
@ -196,5 +196,8 @@ tiscali-storage.propertiesbuilder=org.jclouds.tiscali.storage.TiscaliStorageProp
|
|||
transient.contextbuilder=org.jclouds.blobstore.TransientBlobStoreContextBuilder
|
||||
transient.propertiesbuilder=org.jclouds.blobstore.TransientBlobStorePropertiesBuilder
|
||||
|
||||
virtualbox.contextbuilder=org.jclouds.virtualbox.VirtualBoxContextBuilder
|
||||
virtualbox.propertiesbuilder=org.jclouds.virtualbox.VirtualBoxPropertiesBuilder
|
||||
|
||||
filesystem.contextbuilder=org.jclouds.filesystem.FilesystemBlobStoreContextBuilder
|
||||
filesystem.propertiesbuilder=org.jclouds.filesystem.FilesystemBlobStorePropertiesBuilder
|
||||
|
|
|
@ -122,6 +122,12 @@
|
|||
<version>0.9.29</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.jclouds.driver</groupId>
|
||||
<artifactId>jclouds-log4j</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox;
|
||||
|
||||
public class VirtualBox {
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox;
|
||||
|
||||
import com.google.inject.Module;
|
||||
import org.jclouds.compute.StandaloneComputeServiceContextBuilder;
|
||||
import org.jclouds.virtualbox.config.VirtualBoxComputeServiceContextModule;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Creates compute service context for VirtualBox
|
||||
*
|
||||
* @author Mattias Holmqvist
|
||||
*/
|
||||
public class VirtualBoxContextBuilder extends StandaloneComputeServiceContextBuilder<VirtualBox> {
|
||||
|
||||
public VirtualBoxContextBuilder(Properties properties) {
|
||||
super(VirtualBox.class, properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void addContextModule(List<Module> modules) {
|
||||
modules.add(new VirtualBoxComputeServiceContextModule());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox;
|
||||
|
||||
import org.jclouds.PropertiesBuilder;
|
||||
import org.jclouds.virtualbox.config.VirtualBoxConstants;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static org.jclouds.Constants.*;
|
||||
|
||||
/**
|
||||
* Builds properties for VirtualBox integration.
|
||||
*
|
||||
* @author Mattias Holmqvist
|
||||
*/
|
||||
public class VirtualBoxPropertiesBuilder extends PropertiesBuilder {
|
||||
|
||||
public VirtualBoxPropertiesBuilder() {
|
||||
super();
|
||||
}
|
||||
|
||||
public VirtualBoxPropertiesBuilder(Properties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties defaultProperties() {
|
||||
Properties properties = super.defaultProperties();
|
||||
properties.put(PROPERTY_IDENTITY, "administrator");
|
||||
properties.put(PROPERTY_CREDENTIAL, "12345");
|
||||
properties.put(PROPERTY_ENDPOINT, "http://localhost:18083/");
|
||||
properties.put(VirtualBoxConstants.VIRTUALBOX_PRESEED_URL, "http://dl.dropbox.com/u/693111/preseed.cfg");
|
||||
properties.put(VirtualBoxConstants.VIRTUALBOX_SNAPSHOT_DESCRIPTION, "jclouds-virtualbox-snaphot");
|
||||
// TODO: Add more properties and use the wired properties from test code.
|
||||
return properties;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,94 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.compute;
|
||||
|
||||
import com.google.inject.Singleton;
|
||||
import org.jclouds.compute.ComputeServiceAdapter;
|
||||
import org.jclouds.compute.domain.Template;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.virtualbox.domain.VMSpec;
|
||||
import org.jclouds.virtualbox.domain.Host;
|
||||
import org.jclouds.virtualbox.domain.Image;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Defines the connection between the {@link org.jclouds.virtualbox.VirtualBox} implementation and the jclouds
|
||||
* {@link org.jclouds.compute.ComputeService}
|
||||
*
|
||||
* @author Mattias Holmqvist
|
||||
*/
|
||||
@Singleton
|
||||
public class VirtualBoxComputeServiceAdapter implements ComputeServiceAdapter<IMachine, VMSpec, Image, Host> {
|
||||
|
||||
@Override
|
||||
public IMachine createNodeWithGroupEncodedIntoNameThenStoreCredentials(String tag, String name, Template template, Map<String, Credentials> credentialStore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<VMSpec> listHardwareProfiles() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Image> listImages() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<Host> listLocations() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMachine getNode(String id) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyNode(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rebootNode(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resumeNode(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void suspendNode(String id) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<IMachine> listNodes() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,76 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.config;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.base.Supplier;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.TypeLiteral;
|
||||
import org.jclouds.compute.ComputeServiceAdapter;
|
||||
import org.jclouds.compute.config.ComputeServiceAdapterContextModule;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.domain.OsFamily;
|
||||
import org.jclouds.compute.domain.TemplateBuilder;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.location.suppliers.OnlyLocationOrFirstZone;
|
||||
import org.jclouds.virtualbox.VirtualBox;
|
||||
import org.jclouds.virtualbox.compute.VirtualBoxComputeServiceAdapter;
|
||||
import org.jclouds.virtualbox.domain.VMSpec;
|
||||
import org.jclouds.virtualbox.domain.Host;
|
||||
import org.jclouds.virtualbox.domain.Image;
|
||||
import org.jclouds.virtualbox.functions.HostToLocation;
|
||||
import org.jclouds.virtualbox.functions.IMachineToNodeMetadata;
|
||||
import org.jclouds.virtualbox.functions.ImageToImage;
|
||||
import org.jclouds.virtualbox.functions.VMSpecToHardware;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
|
||||
/**
|
||||
* @author Mattias Holmqvist
|
||||
*/
|
||||
public class VirtualBoxComputeServiceContextModule extends ComputeServiceAdapterContextModule<VirtualBox, VirtualBox, IMachine, VMSpec, Image, Host> {
|
||||
|
||||
public VirtualBoxComputeServiceContextModule() {
|
||||
super(VirtualBox.class, VirtualBox.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
super.configure();
|
||||
bind(new TypeLiteral<ComputeServiceAdapter<IMachine, VMSpec, Image, Host>>() {
|
||||
}).to(VirtualBoxComputeServiceAdapter.class);
|
||||
bind(new TypeLiteral<Function<IMachine, NodeMetadata>>() {
|
||||
}).to(IMachineToNodeMetadata.class);
|
||||
bind(new TypeLiteral<Function<Host, Location>>() {
|
||||
}).to(HostToLocation.class);
|
||||
bind(new TypeLiteral<Function<VMSpec, org.jclouds.compute.domain.Hardware>>() {
|
||||
}).to(VMSpecToHardware.class);
|
||||
bind(new TypeLiteral<Function<Image, org.jclouds.compute.domain.Image>>() {
|
||||
}).to(ImageToImage.class);
|
||||
bind(new TypeLiteral<Supplier<Location>>() {
|
||||
}).to(OnlyLocationOrFirstZone.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected TemplateBuilder provideTemplate(Injector injector, TemplateBuilder template) {
|
||||
return template.osFamily(OsFamily.UBUNTU).os64Bit(false).osVersionMatches("11.04-server");
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.config;
|
||||
|
||||
/**
|
||||
* Configuration properties used for interacting with VirtualBox instances.
|
||||
*
|
||||
* @author Mattias Holmqvist
|
||||
*
|
||||
*/
|
||||
public interface VirtualBoxConstants {
|
||||
|
||||
public static final String VIRTUALBOX_PRESEED_URL = "jclouds.virtualbox.preseedurl";
|
||||
|
||||
public static final String VIRTUALBOX_SNAPSHOT_DESCRIPTION = "jclouds.virtualbox.snapshotDescription";
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.domain;
|
||||
|
||||
public class Host {
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.domain;
|
||||
|
||||
public class Image {
|
||||
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.domain;
|
||||
|
||||
public class Snapshot {
|
||||
}
|
|
@ -0,0 +1,25 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.domain;
|
||||
|
||||
public class VMSpec {
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.domain.Location;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.virtualbox.domain.Host;
|
||||
|
||||
public class HostToLocation implements Function<Host, Location> {
|
||||
@Override
|
||||
public Location apply(@Nullable Host input) {
|
||||
LocationBuilder locationBuilder = new LocationBuilder();
|
||||
return locationBuilder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,124 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.compute.domain.*;
|
||||
import org.jclouds.compute.reference.ComputeServiceConstants;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.domain.LocationBuilder;
|
||||
import org.jclouds.domain.LocationScope;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.virtualbox_4_1.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.inject.Named;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class IMachineToNodeMetadata implements Function<IMachine, NodeMetadata> {
|
||||
|
||||
@Resource
|
||||
@Named(ComputeServiceConstants.COMPUTE_LOGGER)
|
||||
protected Logger logger = Logger.NULL;
|
||||
|
||||
@Override
|
||||
public NodeMetadata apply(@Nullable IMachine vm) {
|
||||
|
||||
NodeMetadataBuilder nodeMetadataBuilder = new NodeMetadataBuilder();
|
||||
String s = vm.getName();
|
||||
nodeMetadataBuilder.name(s);
|
||||
|
||||
// TODO Set up location properly
|
||||
LocationBuilder locationBuilder = new LocationBuilder();
|
||||
locationBuilder.description("");
|
||||
locationBuilder.id("");
|
||||
locationBuilder.scope(LocationScope.HOST);
|
||||
nodeMetadataBuilder.location(locationBuilder.build());
|
||||
HardwareBuilder hardwareBuilder = new HardwareBuilder();
|
||||
hardwareBuilder.ram(vm.getMemorySize().intValue());
|
||||
|
||||
// TODO: Get more processor information
|
||||
Set<Processor> processors = new HashSet<Processor>();
|
||||
for (int i = 0; i < vm.getCPUCount(); i++) {
|
||||
Processor processor = new Processor(1, 0);
|
||||
processors.add(processor);
|
||||
}
|
||||
hardwareBuilder.processors(processors);
|
||||
|
||||
// TODO: How to get this?
|
||||
hardwareBuilder.is64Bit(false);
|
||||
|
||||
nodeMetadataBuilder.hostname(vm.getName());
|
||||
nodeMetadataBuilder.loginPort(18083);
|
||||
|
||||
Map<MachineState, NodeState> nodeStateMap = new HashMap<MachineState, NodeState>();
|
||||
nodeStateMap.put(MachineState.Running, NodeState.RUNNING);
|
||||
|
||||
nodeStateMap.put(MachineState.PoweredOff, NodeState.SUSPENDED);
|
||||
nodeStateMap.put(MachineState.DeletingSnapshot, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.DeletingSnapshotOnline, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.DeletingSnapshotPaused, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.FaultTolerantSyncing, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.LiveSnapshotting, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.SettingUp, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.Starting, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.Stopping, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.Restoring, NodeState.PENDING);
|
||||
|
||||
// TODO What to map these states to?
|
||||
nodeStateMap.put(MachineState.FirstOnline, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.FirstTransient, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.LastOnline, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.LastTransient, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.Teleported, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.TeleportingIn, NodeState.PENDING);
|
||||
nodeStateMap.put(MachineState.TeleportingPausedVM, NodeState.PENDING);
|
||||
|
||||
|
||||
nodeStateMap.put(MachineState.Aborted, NodeState.ERROR);
|
||||
nodeStateMap.put(MachineState.Stuck, NodeState.ERROR);
|
||||
|
||||
nodeStateMap.put(MachineState.Null, NodeState.UNRECOGNIZED);
|
||||
|
||||
MachineState vmState = vm.getState();
|
||||
NodeState nodeState = nodeStateMap.get(vmState);
|
||||
if(nodeState == null)
|
||||
nodeState = NodeState.UNRECOGNIZED;
|
||||
nodeMetadataBuilder.state(nodeState);
|
||||
|
||||
logger.debug("Setting virtualbox node to: " + nodeState + " from machine state: " + vmState);
|
||||
|
||||
// nodeMetadataBuilder.imageId("");
|
||||
// nodeMetadataBuilder.group("");
|
||||
|
||||
String provider = "virtualbox";
|
||||
String identity = System.getProperty("test." + provider + ".identity", "administrator");
|
||||
String credential = System.getProperty("test." + provider + ".credential", "12345");
|
||||
|
||||
nodeMetadataBuilder.credentials(new Credentials(identity, credential));
|
||||
nodeMetadataBuilder.id(vm.getId());
|
||||
return nodeMetadataBuilder.build();
|
||||
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.compute.domain.ImageBuilder;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.virtualbox.domain.Image;
|
||||
|
||||
public class ImageToImage implements Function<Image, org.jclouds.compute.domain.Image> {
|
||||
@Override
|
||||
public org.jclouds.compute.domain.Image apply(@Nullable Image from) {
|
||||
ImageBuilder imageBuilder = new ImageBuilder();
|
||||
return imageBuilder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import org.jclouds.compute.domain.HardwareBuilder;
|
||||
import org.jclouds.javax.annotation.Nullable;
|
||||
import org.jclouds.virtualbox.domain.VMSpec;
|
||||
|
||||
public class VMSpecToHardware implements Function<VMSpec, org.jclouds.compute.domain.Hardware> {
|
||||
|
||||
@Override
|
||||
public org.jclouds.compute.domain.Hardware apply(@Nullable VMSpec input) {
|
||||
HardwareBuilder hardwareBuilder = new HardwareBuilder();
|
||||
return hardwareBuilder.build();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,89 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.compute;
|
||||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Module;
|
||||
import org.jclouds.compute.BaseComputeServiceLiveTest;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.ComputeServiceContextFactory;
|
||||
import org.jclouds.compute.StandaloneComputeServiceContextSpec;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.virtualbox.VirtualBox;
|
||||
import org.jclouds.virtualbox.VirtualBoxContextBuilder;
|
||||
import org.jclouds.virtualbox.domain.VMSpec;
|
||||
import org.jclouds.virtualbox.domain.Host;
|
||||
import org.jclouds.virtualbox.domain.Image;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Test;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
|
||||
@Test(groups = "live")
|
||||
public class VirtualBoxComputeServiceLiveTest extends BaseComputeServiceLiveTest {
|
||||
|
||||
public VirtualBoxComputeServiceLiveTest() {
|
||||
provider = "virtualbox";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Module getSshModule() {
|
||||
return new SshjSshClientModule();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Properties setupRestProperties() {
|
||||
Properties restProperties = new Properties();
|
||||
restProperties.setProperty("virtualbox.contextbuilder", VirtualBoxContextBuilder.class.getName());
|
||||
restProperties.setProperty("virtualbox.endpoint", "http://localhost:18083/");
|
||||
restProperties.setProperty("virtualbox.apiversion", "4.1.2r73507");
|
||||
return restProperties;
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
protected void setupCredentials() {
|
||||
identity = checkNotNull(System.getProperty("test." + provider + ".identity"), "test." + provider + ".identity");
|
||||
credential = System.getProperty("test." + provider + ".credential");
|
||||
endpoint = System.getProperty("test." + provider + ".endpoint");
|
||||
apiversion = System.getProperty("test." + provider + ".apiversion");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAndExperiment() {
|
||||
ComputeServiceContext context = null;
|
||||
try {
|
||||
context = new ComputeServiceContextFactory()
|
||||
.createContext(new StandaloneComputeServiceContextSpec<VirtualBox, IMachine, VMSpec, Image, Host>(
|
||||
"virtualbox", endpoint, apiversion, "", identity, credential, VirtualBox.class,
|
||||
VirtualBoxContextBuilder.class, ImmutableSet.<Module>of()));
|
||||
|
||||
context.getComputeService().listNodes();
|
||||
|
||||
} finally {
|
||||
if (context != null)
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,528 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.experiment;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.base.Splitter;
|
||||
import com.google.common.collect.Iterables;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Closeables;
|
||||
import org.eclipse.jetty.server.Handler;
|
||||
import org.eclipse.jetty.server.Server;
|
||||
import org.eclipse.jetty.server.handler.DefaultHandler;
|
||||
import org.eclipse.jetty.server.handler.HandlerList;
|
||||
import org.eclipse.jetty.server.handler.ResourceHandler;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.compute.options.RunScriptOptions;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.scriptbuilder.domain.OsFamily;
|
||||
import org.jclouds.scriptbuilder.statements.login.AdminAccess;
|
||||
import org.jclouds.scriptbuilder.statements.login.DefaultConfiguration;
|
||||
import org.jclouds.ssh.SshException;
|
||||
import org.jclouds.virtualbox.experiment.settings.KeyboardScancodes;
|
||||
import org.jclouds.virtualbox.functions.IMachineToNodeMetadata;
|
||||
import org.virtualbox_4_1.*;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URI;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static com.google.common.base.Throwables.propagate;
|
||||
import static org.jclouds.compute.options.RunScriptOptions.Builder.runAsRoot;
|
||||
import static org.jclouds.compute.options.RunScriptOptions.Builder.wrapInInitScript;
|
||||
|
||||
public class KickstartTest2 {
|
||||
|
||||
|
||||
protected String provider = "virtualbox";
|
||||
protected String identity;
|
||||
protected String credential;
|
||||
protected URI endpoint;
|
||||
protected String apiVersion;
|
||||
protected String vmName;
|
||||
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
|
||||
protected String settingsFile; // Fully qualified path where the settings
|
||||
protected String osTypeId; // Guest OS Type ID.
|
||||
protected String vmId; // Machine UUID (optional).
|
||||
protected boolean forceOverwrite;
|
||||
protected String diskFormat;
|
||||
|
||||
protected String workingDir;
|
||||
protected String adminDisk;
|
||||
|
||||
protected String guestAdditionsDvd;
|
||||
private URI gaIsoUrl;
|
||||
|
||||
private String gaIsoName;
|
||||
private URI distroIsoUrl;
|
||||
private String distroIsoName;
|
||||
private String controllerIDE;
|
||||
private String keyboardSequence;
|
||||
|
||||
private ComputeServiceContext context;
|
||||
private String hostId = "host";
|
||||
private String guestId = "guest";
|
||||
private String majorVersion;
|
||||
private URI vboxDmg;
|
||||
private String vboxVersionName;
|
||||
private String snapshotDescription;
|
||||
|
||||
protected void setupCredentials() {
|
||||
identity = System.getProperty("test." + provider + ".identity", "administrator");
|
||||
credential = System.getProperty("test." + provider + ".credential", "12345");
|
||||
endpoint = URI.create(System.getProperty("test." + provider + ".endpoint", "http://localhost:18083/"));
|
||||
apiVersion = System.getProperty("test." + provider + ".apiversion", "4.1.2r73507");
|
||||
majorVersion = Iterables.get(Splitter.on('r').split(apiVersion), 0);
|
||||
}
|
||||
|
||||
protected Logger logger() {
|
||||
return context.utils().loggerFactory().getLogger("jclouds.compute");
|
||||
}
|
||||
|
||||
protected void setupConfigurationProperties() {
|
||||
|
||||
controllerIDE = System.getProperty("test." + provider + ".controllerIde", "IDE Controller");
|
||||
diskFormat = System.getProperty("test." + provider + ".diskformat", "");
|
||||
|
||||
// VBOX
|
||||
settingsFile = null;
|
||||
osTypeId = System.getProperty("test." + provider + ".osTypeId", "");
|
||||
vmId = System.getProperty("test." + provider + ".vmId", null);
|
||||
forceOverwrite = true;
|
||||
vmName = System.getProperty("test." + provider + ".vmname", "jclouds-virtualbox-kickstart-admin");
|
||||
|
||||
workingDir = System.getProperty("user.home")
|
||||
+ File.separator
|
||||
+ System.getProperty("test." + provider + ".workingDir",
|
||||
"jclouds-virtualbox-test");
|
||||
|
||||
gaIsoName = System.getProperty("test." + provider + ".gaIsoName", "VBoxGuestAdditions_" + majorVersion + ".iso");
|
||||
gaIsoUrl = URI.create(System.getProperty("test." + provider + ".gaIsoUrl", "http://download.virtualbox.org/virtualbox/" + majorVersion + "/" + gaIsoName));
|
||||
|
||||
distroIsoName = System.getProperty("test." + provider + ".distroIsoName", "ubuntu-11.04-server-i386.iso");
|
||||
distroIsoUrl = URI
|
||||
.create(System
|
||||
.getProperty("test." + provider + ".distroIsoUrl",
|
||||
"http://releases.ubuntu.com/11.04/ubuntu-11.04-server-i386.iso"));
|
||||
vboxDmg = URI.create(System.getProperty("test." + provider + ".vboxDmg", "http://download.virtualbox.org/virtualbox/4.1.2/VirtualBox-4.1.2-73507-OSX.dmg"));
|
||||
vboxVersionName = System.getProperty("test" + provider + ".vboxVersionName", "VirtualBox-4.1.2-73507-OSX.dmg");
|
||||
|
||||
adminDisk = workingDir
|
||||
+ File.separator
|
||||
+ System.getProperty("test." + provider + ".adminDisk",
|
||||
"admin.vdi");
|
||||
guestAdditionsDvd = workingDir
|
||||
+ File.separator
|
||||
+ System.getProperty("test." + provider + ".guestAdditionsDvd",
|
||||
"VBoxGuestAdditions_" + majorVersion + ".iso");
|
||||
|
||||
snapshotDescription = System.getProperty("test." + provider + "snapshotdescription", "jclouds-virtualbox-snaphot");
|
||||
|
||||
keyboardSequence = System
|
||||
.getProperty(
|
||||
"test." + provider + ".keyboardSequence",
|
||||
"<Esc><Esc><Enter> "
|
||||
+ "/install/vmlinuz noapic preseed/url=http://10.0.2.2:8080/src/test/resources/preseed.cfg "
|
||||
+ "debian-installer=en_US auto locale=en_US kbd-chooser/method=us "
|
||||
+ "hostname="
|
||||
+ vmName
|
||||
+ " "
|
||||
+ "fb=false debconf/frontend=noninteractive "
|
||||
+ "keyboard-configuration/layout=USA keyboard-configuration/variant=USA console-setup/ask_detect=false "
|
||||
+ "initrd=/install/initrd.gz -- <Enter>");
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
KickstartTest2 test = new KickstartTest2();
|
||||
|
||||
try {
|
||||
test.runAll();
|
||||
System.out.println("over");
|
||||
} catch (Exception e) {
|
||||
System.out.println(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void runAll() throws Exception {
|
||||
context = TestUtils.computeServiceForLocalhost();
|
||||
socketTester = new RetryablePredicate<IPSocket>(
|
||||
new InetSocketAddressConnect(), 130, 10, TimeUnit.SECONDS);
|
||||
setupCredentials();
|
||||
setupConfigurationProperties();
|
||||
downloadFileUnlessPresent(distroIsoUrl, workingDir, distroIsoName);
|
||||
downloadFileUnlessPresent(gaIsoUrl, workingDir, gaIsoName);
|
||||
|
||||
installVbox();
|
||||
configureJettyServer();
|
||||
|
||||
VirtualBoxManager manager = VirtualBoxManager.createInstance("mach");
|
||||
manager.connect(endpoint.toASCIIString(), identity, credential);
|
||||
|
||||
// Create machine
|
||||
IMachine newVM = manager.getVBox().createMachine(settingsFile, vmName, osTypeId, vmId, forceOverwrite);
|
||||
manager.getVBox().registerMachine(newVM);
|
||||
|
||||
// Change RAM
|
||||
Long memorySize = new Long(1024);
|
||||
ISession session = manager.getSessionObject();
|
||||
IMachine machine = manager.getVBox().findMachine(vmName);
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
IMachine mutable = session.getMachine();
|
||||
mutable.setMemorySize(memorySize);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
logMachineStatus(machine);
|
||||
|
||||
// Create IDE Controller
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
mutable.addStorageController(controllerIDE, StorageBus.IDE);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
IMedium hd = null;
|
||||
if (!new File(adminDisk).exists()) {
|
||||
hd = manager.getVBox().createHardDisk(diskFormat, adminDisk);
|
||||
long size = 4L * 1024L * 1024L * 1024L - 4L;
|
||||
IProgress progress = hd.createBaseStorage(new Long(size), new Long(
|
||||
org.virtualbox_4_1.jaxws.MediumVariant.STANDARD.ordinal()));
|
||||
System.out.println(progress);
|
||||
} else {
|
||||
// TODO disk already exist: open it
|
||||
}
|
||||
|
||||
logMachineStatus(machine);
|
||||
|
||||
// Attach ISO DVD
|
||||
IMedium distroMedium = manager.getVBox().openMedium(
|
||||
workingDir + "/" + distroIsoName, DeviceType.DVD,
|
||||
AccessMode.ReadOnly, forceOverwrite);
|
||||
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
mutable.attachDevice(controllerIDE, 0, 0, DeviceType.DVD, distroMedium);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
logger().debug("Setting up hard drive...");
|
||||
// Create and attach hard disk
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
mutable.attachDevice(controllerIDE, 0, 1, DeviceType.HardDisk, hd);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
logMachineStatus(machine);
|
||||
|
||||
// Configure NIC
|
||||
// NAT
|
||||
logger().debug("Configuring NIC...");
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
mutable.getNetworkAdapter(new Long(0)).setAttachmentType(
|
||||
NetworkAttachmentType.NAT);
|
||||
mutable.getNetworkAdapter(new Long(0))
|
||||
.getNatDriver()
|
||||
.addRedirect("guestssh", NATProtocol.TCP, "127.0.0.1", 2222,
|
||||
"", 22);
|
||||
mutable.getNetworkAdapter(new Long(0)).setEnabled(true);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
// Attach guest additions
|
||||
logger().debug("Attaching guest additions medium...");
|
||||
distroMedium = manager.getVBox().openMedium(guestAdditionsDvd, DeviceType.DVD, AccessMode.ReadOnly, forceOverwrite);
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
mutable.attachDevice(controllerIDE, 1, 1, DeviceType.DVD, distroMedium);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
// Start virtual machine
|
||||
logMachineStatus(machine);
|
||||
logger().debug("Starting virtual machine...");
|
||||
IProgress prog = machine.launchVMProcess(session, "gui", "");
|
||||
prog.waitForCompletion(-1);
|
||||
try {
|
||||
Thread.sleep(5000);
|
||||
} catch (InterruptedException e) {
|
||||
propagate(e);
|
||||
}
|
||||
|
||||
logMachineStatus(machine);
|
||||
sendKeyboardSequence(keyboardSequence);
|
||||
|
||||
// test if the sshd on the guest is ready and meanwhile apply AdminAccess
|
||||
boolean sshDeamonIsRunning = false;
|
||||
while (!sshDeamonIsRunning) {
|
||||
try {
|
||||
AdminAccess.standard().init(new DefaultConfiguration()).render(OsFamily.UNIX);
|
||||
if (runScriptOnNode(guestId, "id").getExitCode() == 0)
|
||||
sshDeamonIsRunning = true;
|
||||
} catch (SshException e) {
|
||||
System.err.println("connection reset");
|
||||
}
|
||||
}
|
||||
|
||||
logMachineStatus(machine);
|
||||
logger().debug("Configuring guest additions...");
|
||||
|
||||
// Configure guest additions
|
||||
// TODO generalize
|
||||
if (isUbuntu(guestId)) {
|
||||
runScriptOnNode(guestId, "m-a prepare -i", wrapInInitScript(true));
|
||||
runScriptOnNode(guestId, "mount -o loop /dev/dvd /media/cdrom");
|
||||
runScriptOnNode(guestId, "sh /media/cdrom/VBoxLinuxAdditions.run");
|
||||
runScriptOnNode(guestId, "rm /etc/udev/rules.d/70-persistent-net.rules");
|
||||
runScriptOnNode(guestId, "mkdir /etc/udev/rules.d/70-persistent-net.rules");
|
||||
runScriptOnNode(guestId, "rm -rf /dev/.udev/");
|
||||
runScriptOnNode(guestId, "rm /lib/udev/rules.d/75-persistent-net-generator.rules");
|
||||
}
|
||||
|
||||
logMachineStatus(machine);
|
||||
logger().debug("Powering down...");
|
||||
|
||||
machine = manager.getVBox().findMachine(vmName);
|
||||
try {
|
||||
session = manager.getSessionObject();
|
||||
IProgress progress = session.getConsole().powerDown();
|
||||
progress.waitForCompletion(-1);
|
||||
session.unlockMachine();
|
||||
|
||||
while (!machine.getSessionState().equals(SessionState.Unlocked)) {
|
||||
try {
|
||||
System.out
|
||||
.println("waiting for unlocking session - session state: "
|
||||
+ machine.getSessionState());
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
logMachineStatus(machine);
|
||||
logger().debug("Changing to bridged networking...");
|
||||
session = manager.getSessionObject();
|
||||
IMachine adminNode = manager.getVBox().findMachine(vmName);
|
||||
adminNode.lockMachine(session, LockType.Write);
|
||||
mutable = session.getMachine();
|
||||
// network
|
||||
String hostInterface = null;
|
||||
String command = "vboxmanage list bridgedifs";
|
||||
try {
|
||||
Process child = Runtime.getRuntime().exec(command);
|
||||
BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(child.getInputStream()));
|
||||
String line = "";
|
||||
boolean found = false;
|
||||
|
||||
while ((line = bufferedReader.readLine()) != null && !found) {
|
||||
if (line.split(":")[0].contains("Name")) {
|
||||
hostInterface = line.split(":")[1];
|
||||
}
|
||||
if (line.split(":")[0].contains("Status") && line.split(":")[1].contains("Up")) {
|
||||
System.out.println("bridge: " + hostInterface.trim());
|
||||
found = true;
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
mutable.getNetworkAdapter(new Long(0)).setAttachmentType(NetworkAttachmentType.Bridged);
|
||||
mutable.getNetworkAdapter(new Long(0)).setAdapterType(NetworkAdapterType.Am79C973);
|
||||
mutable.getNetworkAdapter(new Long(0)).setMACAddress(manager.getVBox().getHost().generateMACAddress());
|
||||
mutable.getNetworkAdapter(new Long(0)).setBridgedInterface(hostInterface.trim());
|
||||
mutable.getNetworkAdapter(new Long(0)).setEnabled(true);
|
||||
mutable.saveSettings();
|
||||
session.unlockMachine();
|
||||
|
||||
logMachineStatus(machine);
|
||||
logger().debug("Taking snapshot of machine...");
|
||||
session = manager.getSessionObject();
|
||||
machine.lockMachine(session, LockType.Write);
|
||||
if (machine.getCurrentSnapshot() == null || !machine.getCurrentSnapshot().getDescription().equals(snapshotDescription)) {
|
||||
manager.getSessionObject().getConsole().takeSnapshot(machine.getId(), snapshotDescription);
|
||||
}
|
||||
session.unlockMachine();
|
||||
|
||||
logMachineStatus(machine);
|
||||
manager.disconnect();
|
||||
manager.cleanup();
|
||||
|
||||
}
|
||||
|
||||
private void logMachineStatus(IMachine machine) {
|
||||
NodeMetadata node = new IMachineToNodeMetadata().apply(machine);
|
||||
logger().debug("Machine status: " + node.toString());
|
||||
}
|
||||
|
||||
void installVbox() throws Exception {
|
||||
if (runScriptOnNode(hostId, "VBoxManage --version", runAsRoot(false).wrapInInitScript(false)).getExitCode() != 0) {
|
||||
logger().debug("installing virtualbox");
|
||||
if (isOSX(hostId)) {
|
||||
downloadFileUnlessPresent(vboxDmg, workingDir, vboxVersionName);
|
||||
runScriptOnNode(hostId, "hdiutil attach " + workingDir + "/" + vboxVersionName);
|
||||
runScriptOnNode(hostId, "installer -pkg /Volumes/VirtualBox/VirtualBox.mpkg -target /Volumes/Macintosh\\ HD");
|
||||
} else {
|
||||
// TODO other platforms
|
||||
runScriptOnNode(hostId, "cat > /etc/apt/sources.list.d/TODO");
|
||||
runScriptOnNode(
|
||||
hostId,
|
||||
"wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | apt-key add -");
|
||||
runScriptOnNode(hostId, "apt-get update");
|
||||
runScriptOnNode(hostId, "apt-get --yes install virtualbox-4.1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Server configureJettyServer() throws Exception {
|
||||
Server server = new Server(8080);
|
||||
|
||||
ResourceHandler resource_handler = new ResourceHandler();
|
||||
resource_handler.setDirectoriesListed(true);
|
||||
resource_handler.setWelcomeFiles(new String[]{"index.html"});
|
||||
|
||||
resource_handler.setResourceBase(".");
|
||||
logger().info("serving " + resource_handler.getBaseResource());
|
||||
|
||||
HandlerList handlers = new HandlerList();
|
||||
handlers.setHandlers(new Handler[]{resource_handler,
|
||||
new DefaultHandler()});
|
||||
server.setHandler(handlers);
|
||||
|
||||
server.start();
|
||||
return server;
|
||||
}
|
||||
|
||||
protected boolean isOSX(String id) {
|
||||
return context.getComputeService().getNodeMetadata(hostId)
|
||||
.getOperatingSystem().getDescription().equals("Mac OS X");
|
||||
}
|
||||
|
||||
protected boolean isUbuntu(String id) {
|
||||
return context.getComputeService().getNodeMetadata(id)
|
||||
.getOperatingSystem().getDescription().contains("ubuntu");
|
||||
}
|
||||
|
||||
|
||||
protected ExecResponse runScriptOnNode(String nodeId, String command,
|
||||
RunScriptOptions options) {
|
||||
ExecResponse toReturn = context.getComputeService().runScriptOnNode(
|
||||
nodeId, command, options);
|
||||
assert toReturn.getExitCode() == 0 : toReturn;
|
||||
return toReturn;
|
||||
}
|
||||
|
||||
protected ExecResponse runScriptOnNode(String nodeId, String command) {
|
||||
return runScriptOnNode(nodeId, command, wrapInInitScript(false));
|
||||
}
|
||||
|
||||
private File downloadFileUnlessPresent(URI sourceURL,
|
||||
String destinationDir, String filename) throws Exception {
|
||||
|
||||
File iso = new File(destinationDir, filename);
|
||||
|
||||
if (!iso.exists()) {
|
||||
InputStream is = context.utils().http().get(sourceURL);
|
||||
checkNotNull(is, "%s not found", sourceURL);
|
||||
try {
|
||||
ByteStreams.copy(is, new FileOutputStream(iso));
|
||||
} finally {
|
||||
Closeables.closeQuietly(is);
|
||||
}
|
||||
}
|
||||
return iso;
|
||||
}
|
||||
|
||||
private void sendKeyboardSequence(String keyboardSequence)
|
||||
throws InterruptedException {
|
||||
String[] sequenceSplited = keyboardSequence.split(" ");
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String line : sequenceSplited) {
|
||||
String converted = stringToKeycode(line);
|
||||
for (String word : converted.split(" ")) {
|
||||
sb.append("vboxmanage controlvm " + vmName
|
||||
+ " keyboardputscancode " + word + "; ");
|
||||
|
||||
if (word.endsWith(KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP.get("<Enter>"))) {
|
||||
runScriptOnNode(hostId, sb.toString(), runAsRoot(false)
|
||||
.wrapInInitScript(false));
|
||||
sb.delete(0, sb.length() - 1);
|
||||
}
|
||||
|
||||
|
||||
if (word.endsWith(KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP.get("<Return>"))) {
|
||||
runScriptOnNode(hostId, sb.toString(), runAsRoot(false)
|
||||
.wrapInInitScript(false));
|
||||
sb.delete(0, sb.length() - 1);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String stringToKeycode(String s) {
|
||||
StringBuilder keycodes = new StringBuilder();
|
||||
if (s.startsWith("<")) {
|
||||
String[] specials = s.split("<");
|
||||
for (int i = 1; i < specials.length; i++) {
|
||||
keycodes.append(KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP
|
||||
.get("<" + specials[i]) + " ");
|
||||
}
|
||||
return keycodes.toString();
|
||||
}
|
||||
|
||||
|
||||
int i = 0;
|
||||
while (i < s.length()) {
|
||||
String digit = s.substring(i, i + 1);
|
||||
String hex = KeyboardScancodes.NORMAL_KEYBOARD_BUTTON_MAP
|
||||
.get(digit);
|
||||
keycodes.append(hex + " ");
|
||||
if (i != 0 && i % 14 == 0)
|
||||
keycodes.append(" ");
|
||||
i++;
|
||||
}
|
||||
keycodes.append(KeyboardScancodes.SPECIAL_KEYBOARD_BUTTON_MAP
|
||||
.get("<Spacebar>") + " ");
|
||||
|
||||
return keycodes.toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,238 @@
|
|||
/*
|
||||
* *
|
||||
* * Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* * contributor license agreements. See the NOTICE file
|
||||
* * distributed with this work for additional information
|
||||
* * regarding copyright ownership. jclouds licenses this file
|
||||
* * to you under the Apache License, Version 2.0 (the
|
||||
* * "License"); you may not use this file except in compliance
|
||||
* * with the License. You may obtain a copy of the License at
|
||||
* *
|
||||
* * http://www.apache.org/licenses/LICENSE-2.0
|
||||
* *
|
||||
* * Unless required by applicable law or agreed to in writing,
|
||||
* * software distributed under the License is distributed on an
|
||||
* * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* * KIND, either express or implied. See the License for the
|
||||
* * specific language governing permissions and limitations
|
||||
* * under the License.
|
||||
*
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.experiment;
|
||||
|
||||
import com.google.common.base.Predicate;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.google.inject.Injector;
|
||||
import com.google.inject.Module;
|
||||
import org.jclouds.compute.ComputeServiceContext;
|
||||
import org.jclouds.compute.domain.ExecResponse;
|
||||
import org.jclouds.compute.domain.NodeMetadata;
|
||||
import org.jclouds.domain.Credentials;
|
||||
import org.jclouds.logging.Logger;
|
||||
import org.jclouds.logging.log4j.config.Log4JLoggingModule;
|
||||
import org.jclouds.net.IPSocket;
|
||||
import org.jclouds.predicates.InetSocketAddressConnect;
|
||||
import org.jclouds.predicates.RetryablePredicate;
|
||||
import org.jclouds.rest.RestContextFactory;
|
||||
import org.jclouds.ssh.SshClient;
|
||||
import org.jclouds.sshj.config.SshjSshClientModule;
|
||||
import org.jclouds.virtualbox.functions.IMachineToNodeMetadata;
|
||||
import org.virtualbox_4_1.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkNotNull;
|
||||
import static org.testng.Assert.assertEquals;
|
||||
|
||||
public class VirtualBoxLiveTest2 {
|
||||
|
||||
|
||||
protected String provider = "virtualbox";
|
||||
protected String identity;
|
||||
protected String credential;
|
||||
protected URI endpoint;
|
||||
protected String vmName;
|
||||
|
||||
VirtualBoxManager manager = VirtualBoxManager.createInstance("");
|
||||
|
||||
protected Predicate<IPSocket> socketTester;
|
||||
protected SshClient.Factory sshFactory;
|
||||
|
||||
protected String osUsername;
|
||||
protected String osPassword;
|
||||
protected String controller;
|
||||
protected String diskFormat;
|
||||
|
||||
protected String settingsFile;
|
||||
protected String osTypeId;
|
||||
protected String vmId;
|
||||
protected boolean forceOverwrite;
|
||||
protected String workingDir;
|
||||
protected String clonedDiskPath;
|
||||
protected int numberOfVirtualMachine;
|
||||
protected String originalDisk;
|
||||
private String clonedDisk;
|
||||
private ComputeServiceContext context;
|
||||
|
||||
private String adminNodeName;
|
||||
private Injector injector;
|
||||
|
||||
protected Logger logger() {
|
||||
return context.utils().loggerFactory().getLogger("jclouds.compute");
|
||||
}
|
||||
|
||||
protected void setupCredentials() {
|
||||
identity = System.getProperty("test." + provider + ".identity",
|
||||
"administrator");
|
||||
credential = System.getProperty("test." + provider + ".credential",
|
||||
"12345");
|
||||
endpoint = URI.create(System.getProperty("test." + provider
|
||||
+ ".endpoint", "http://localhost:18083/"));
|
||||
}
|
||||
|
||||
protected void setupConfigurationProperties() {
|
||||
// VBOX
|
||||
settingsFile = null;
|
||||
osTypeId = System.getProperty("test." + provider + ".osTypeId", "");
|
||||
vmId = System.getProperty("test." + provider + ".vmId", null);
|
||||
forceOverwrite = true;
|
||||
// OS specific information
|
||||
adminNodeName = System.getProperty("test." + provider + ".adminnodename", "jclouds-virtualbox-kickstart-admin");
|
||||
vmName = checkNotNull(System.getProperty("test." + provider + ".vmname", "jclouds-virtualbox-node"));
|
||||
osUsername = System.getProperty("test." + provider + ".osusername", "toor");
|
||||
osPassword = System.getProperty("test." + provider + ".ospassword", "password");
|
||||
controller = System.getProperty("test." + provider + ".controller", "IDE Controller");
|
||||
diskFormat = System.getProperty("test." + provider + ".diskformat", "");
|
||||
|
||||
workingDir = System.getProperty("user.home")
|
||||
+ File.separator
|
||||
+ System.getProperty("test." + provider + ".workingDir",
|
||||
"jclouds-virtualbox-test");
|
||||
|
||||
originalDisk = System.getProperty("test." + provider + ".originalDisk", "admin.vdi");
|
||||
|
||||
clonedDisk = System.getProperty("test." + provider + ".clonedDisk", "clone.vdi");
|
||||
clonedDiskPath = workingDir + File.separator + clonedDisk;
|
||||
numberOfVirtualMachine = Integer.parseInt(checkNotNull(System.getProperty("test." + provider
|
||||
+ ".numberOfVirtualMachine", "3")));
|
||||
injector = new RestContextFactory().createContextBuilder(provider,
|
||||
ImmutableSet.<Module> of(new Log4JLoggingModule(), new SshjSshClientModule())).buildInjector();
|
||||
|
||||
sshFactory = injector.getInstance(SshClient.Factory.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
VirtualBoxLiveTest2 virtualBoxLiveTest2 = new VirtualBoxLiveTest2();
|
||||
try {
|
||||
virtualBoxLiveTest2.runAll();
|
||||
} catch (IOException e) {
|
||||
virtualBoxLiveTest2.logger().error(e, "error", null);
|
||||
} catch (InterruptedException e) {
|
||||
virtualBoxLiveTest2.logger().error(e, "error", null);
|
||||
}
|
||||
}
|
||||
|
||||
private void runAll() throws IOException, InterruptedException {
|
||||
context = TestUtils.computeServiceForLocalhost();
|
||||
socketTester = new RetryablePredicate<IPSocket>(
|
||||
new InetSocketAddressConnect(), 130, 10, TimeUnit.SECONDS);
|
||||
setupCredentials();
|
||||
setupConfigurationProperties();
|
||||
|
||||
manager.connect(endpoint.toASCIIString(), identity, credential);
|
||||
|
||||
for (int i = 1; i < numberOfVirtualMachine + 1; i++) {
|
||||
createAndLaunchVirtualMachine(i);
|
||||
}
|
||||
|
||||
for (int i = 1; i < numberOfVirtualMachine + 1; i++) {
|
||||
String instanceName = vmName + "_" + i;
|
||||
IMachine machine = manager.getVBox().findMachine(instanceName);
|
||||
logMachineStatus(machine);
|
||||
try {
|
||||
ISession machineSession = manager.openMachineSession(machine);
|
||||
IProgress progress = machineSession.getConsole().powerDown();
|
||||
progress.waitForCompletion(-1);
|
||||
machineSession.unlockMachine();
|
||||
while (!machine.getSessionState().equals(SessionState.Unlocked)) {
|
||||
try {
|
||||
logger().debug("Waiting for unlocking session - session state: " + machine.getSessionState());
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
logMachineStatus(machine);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void createAndLaunchVirtualMachine(int i) throws InterruptedException {
|
||||
String instanceName = vmName + "_" + i;
|
||||
IMachine adminNode = manager.getVBox().findMachine(adminNodeName);
|
||||
|
||||
IMachine clonedVM = manager.getVBox().createMachine(settingsFile, instanceName, osTypeId, vmId, forceOverwrite);
|
||||
List<CloneOptions> options = new ArrayList<CloneOptions>();
|
||||
options.add(CloneOptions.Link);
|
||||
IProgress progress = adminNode.getCurrentSnapshot().getMachine().cloneTo(clonedVM, CloneMode.MachineState, options);
|
||||
if (progress.getCompleted())
|
||||
logger().debug("clone done");
|
||||
|
||||
manager.getVBox().registerMachine(clonedVM);
|
||||
|
||||
System.out.println("\nLaunching VM named " + clonedVM.getName() + " ...");
|
||||
launchVMProcess(clonedVM, manager.getSessionObject());
|
||||
String ipAddress = null;
|
||||
while (ipAddress == null || ipAddress.equals("")) {
|
||||
try {
|
||||
ipAddress = clonedVM.getGuestPropertyValue("/VirtualBox/GuestInfo/Net/0/V4/IP");
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
logger().debug(ipAddress + " is the IP address of " + clonedVM.getName());
|
||||
|
||||
// TODO: This does not work yet.
|
||||
// IPSocket socket = new IPSocket(ipAddress, 22);
|
||||
// checkSSH(socket);
|
||||
|
||||
}
|
||||
|
||||
private void checkSSH(IPSocket socket) {
|
||||
socketTester.apply(socket);
|
||||
SshClient client = sshFactory.create(socket, new Credentials(osUsername, osPassword));
|
||||
logger().debug(client.toString());
|
||||
try {
|
||||
client.connect();
|
||||
ExecResponse exec = client.exec("echo hello");
|
||||
System.out.println(exec);
|
||||
assertEquals(exec.getOutput().trim(), "hello");
|
||||
} finally {
|
||||
if (client != null)
|
||||
client.disconnect();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void launchVMProcess(IMachine machine, ISession session) {
|
||||
IProgress prog = machine.launchVMProcess(session, "gui", "");
|
||||
prog.waitForCompletion(-1);
|
||||
session.unlockMachine();
|
||||
}
|
||||
|
||||
private void logMachineStatus(IMachine machine) {
|
||||
NodeMetadata node = new IMachineToNodeMetadata().apply(machine);
|
||||
logger().debug("Machine status: " + node.toString());
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Licensed to jclouds, Inc. (jclouds) under one or more
|
||||
* contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. jclouds licenses this file
|
||||
* to you under the Apache License, Version 2.0 (the
|
||||
* "License"); you may not use this file except in compliance
|
||||
* with the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.jclouds.virtualbox.functions;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.virtualbox_4_1.IMachine;
|
||||
import org.virtualbox_4_1.VirtualBoxManager;
|
||||
|
||||
public class IMachineToNodeMetadataTest {
|
||||
|
||||
@Test
|
||||
public void testCreate() throws Exception {
|
||||
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue