You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2017/03/28 06:33:07 UTC
[1/4] jclouds-labs git commit: JCLOUDS-1254 Filters storage account
by current available locations
Repository: jclouds-labs
Updated Branches:
refs/heads/master 84ebe3d33 -> 35c968e94
JCLOUDS-1254 Filters storage account by current available locations
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/76353e75
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/76353e75
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/76353e75
Branch: refs/heads/master
Commit: 76353e75a548269654633825761972e612feee8f
Parents: 84ebe3d
Author: Dani Estevez <co...@danielestevez.com>
Authored: Tue Mar 14 10:59:57 2017 -0400
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 28 08:23:46 2017 +0200
----------------------------------------------------------------------
.../arm/compute/AzureComputeServiceAdapter.java | 42 +++++++++++---------
1 file changed, 24 insertions(+), 18 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/76353e75/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
----------------------------------------------------------------------
diff --git a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
index f510109..572e2be 100644
--- a/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
+++ b/azurecompute-arm/src/main/java/org/jclouds/azurecompute/arm/compute/AzureComputeServiceAdapter.java
@@ -16,10 +16,23 @@
*/
package org.jclouds.azurecompute.arm.compute;
+import static com.google.common.base.Preconditions.checkState;
+import static com.google.common.collect.Iterables.contains;
+import static com.google.common.collect.Iterables.filter;
+import static com.google.common.collect.Iterables.find;
+import static com.google.common.collect.Iterables.getOnlyElement;
+import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME;
+import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER;
+import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.decodeFieldsFromUniqueId;
+import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueIdCustom;
+import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.getMarketplacePlanFromImageMetadata;
+import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS;
+import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
+import static org.jclouds.util.Closeables2.closeQuietly;
+
import java.util.List;
import java.util.Map;
import java.util.Set;
-
import javax.annotation.Resource;
import javax.inject.Inject;
import javax.inject.Named;
@@ -84,20 +97,6 @@ import com.google.common.collect.ImmutableMap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import static com.google.common.base.Preconditions.checkState;
-import static com.google.common.collect.Iterables.contains;
-import static com.google.common.collect.Iterables.filter;
-import static com.google.common.collect.Iterables.find;
-import static com.google.common.collect.Iterables.getOnlyElement;
-import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CONTAINER_NAME;
-import static org.jclouds.azurecompute.arm.compute.extensions.AzureComputeImageExtension.CUSTOM_IMAGE_OFFER;
-import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.decodeFieldsFromUniqueId;
-import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.encodeFieldsToUniqueIdCustom;
-import static org.jclouds.azurecompute.arm.compute.functions.VMImageToImage.getMarketplacePlanFromImageMetadata;
-import static org.jclouds.azurecompute.arm.config.AzureComputeProperties.IMAGE_PUBLISHERS;
-import static org.jclouds.compute.util.ComputeServiceUtils.metadataAndTagsAsCommaDelimitedValue;
-import static org.jclouds.util.Closeables2.closeQuietly;
-
/**
* Defines the connection between the {@link AzureComputeApi} implementation and
* the jclouds {@link org.jclouds.compute.ComputeService}.
@@ -226,8 +225,15 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Virtual
public Iterable<VMImage> listImages() {
final List<VMImage> osImages = Lists.newArrayList();
- for (Location location : listLocations()) {
- osImages.addAll(listImagesByLocation(location.name()));
+ final List<String> availableLocationNames = FluentIterable.from(listLocations())
+ .transform(new Function<Location, String>() {
+ @Override public String apply(Location location) {
+ return location.name();
+ }
+ }).toList();
+
+ for (String locationName : availableLocationNames) {
+ osImages.addAll(listImagesByLocation(locationName));
}
// list custom images
@@ -239,7 +245,7 @@ public class AzureComputeServiceAdapter implements ComputeServiceAdapter<Virtual
try {
String name = storage.name();
StorageService storageService = api.getStorageAccountApi(azureGroup).get(name);
- if (storageService != null
+ if (storageService != null && availableLocationNames.contains(storageService.location())
&& Status.Succeeded == storageService.storageServiceProperties().provisioningState()) {
String key = api.getStorageAccountApi(azureGroup).getKeys(name).key1();
BlobHelper blobHelper = new BlobHelper(storage.name(), key);
[2/4] jclouds-labs git commit: Make the windows image optional
Posted by na...@apache.org.
Make the windows image optional
Skip tests if not present.
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/57690d2b
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/57690d2b
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/57690d2b
Branch: refs/heads/master
Commit: 57690d2b2522c98e6d54c33f2936794cb2cdee13
Parents: 76353e7
Author: Svetoslav Neykov <sv...@neykov.name>
Authored: Sun Mar 19 17:30:06 2017 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 28 08:24:37 2017 +0200
----------------------------------------------------------------------
.../org/jclouds/vagrant/functions/BoxToImage.java | 4 ++++
.../org/jclouds/vagrant/compute/WindowsLiveTest.java | 15 ++++++++++++++-
2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/57690d2b/vagrant/src/main/java/org/jclouds/vagrant/functions/BoxToImage.java
----------------------------------------------------------------------
diff --git a/vagrant/src/main/java/org/jclouds/vagrant/functions/BoxToImage.java b/vagrant/src/main/java/org/jclouds/vagrant/functions/BoxToImage.java
index bf0f155..017d23e 100644
--- a/vagrant/src/main/java/org/jclouds/vagrant/functions/BoxToImage.java
+++ b/vagrant/src/main/java/org/jclouds/vagrant/functions/BoxToImage.java
@@ -41,6 +41,10 @@ public class BoxToImage implements Function<Box, Image> {
@Override
public Image apply(Box input) {
+ if (input == null) {
+ return null;
+ }
+
OperatingSystem os = new OperatingSystem(inferOsFamily(input), input.getName(), input.getVersion(), null, input.getName(), true);
return new ImageBuilder()
.ids(input.getName())
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/57690d2b/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
----------------------------------------------------------------------
diff --git a/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java b/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
index a8887e7..4cef15f 100644
--- a/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
+++ b/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
@@ -20,6 +20,7 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
+import java.util.NoSuchElementException;
import java.util.Set;
import org.jclouds.compute.ComputeService;
@@ -33,6 +34,7 @@ import org.jclouds.compute.internal.BaseComputeServiceContextLiveTest;
import org.jclouds.domain.LoginCredentials;
import org.jclouds.vagrant.internal.BoxConfig;
import org.jclouds.vagrant.reference.VagrantConstants;
+import org.testng.SkipException;
import org.testng.annotations.Test;
import com.google.common.base.Optional;
@@ -70,7 +72,7 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
}
private String getImageId() {
- return "boxcutter/eval-win7x86-enterprise";
+ return "boxcutter/eval-win2012r2-standard";
}
protected Template buildTemplate(TemplateBuilder templateBuilder) {
@@ -79,6 +81,8 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
@Test
public void testGet() throws Exception {
+ skipIfImageNotPresent();
+
Set<? extends NodeMetadata> nodes = client.createNodesInGroup("vagrant-win", 1, buildTemplate(templateBuilder()));
NodeMetadata node = Iterables.getOnlyElement(nodes);
OperatingSystem os = node.getOperatingSystem();
@@ -95,6 +99,8 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
@Test
public void testBoxConfig() {
+ skipIfImageNotPresent();
+
Image image = view.getComputeService().getImage(getImageId());
BoxConfig.Factory boxConfigFactory = new BoxConfig.Factory();
@@ -103,4 +109,11 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
assertEquals(boxConfig.getStringKey(".vm.communicator"), Optional.of("winrm"));
assertEquals(boxConfig.getKey(VagrantConstants.KEY_VM_GUEST), Optional.of(VagrantConstants.VM_GUEST_WINDOWS));
}
+
+ private void skipIfImageNotPresent() {
+ Image image = view.getComputeService().getImage(getImageId());
+ if (image == null) {
+ throw new SkipException("Image " + getImageId() + " not available. Skipping windows tests.");
+ }
+ }
}
[4/4] jclouds-labs git commit: Add name tag to DimensionData pom
Posted by na...@apache.org.
Add name tag to DimensionData pom
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/35c968e9
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/35c968e9
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/35c968e9
Branch: refs/heads/master
Commit: 35c968e94489be21e2dab73b5cdf5c37f37073e6
Parents: 8475e63
Author: Ignasi Barrera <na...@apache.org>
Authored: Tue Mar 28 08:25:57 2017 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 28 08:25:57 2017 +0200
----------------------------------------------------------------------
dimensiondata/pom.xml | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/35c968e9/dimensiondata/pom.xml
----------------------------------------------------------------------
diff --git a/dimensiondata/pom.xml b/dimensiondata/pom.xml
index 964f52a..b0acd1c 100644
--- a/dimensiondata/pom.xml
+++ b/dimensiondata/pom.xml
@@ -30,6 +30,7 @@
<!-- TODO: when out of labs, switch to org.jclouds.provider -->
<artifactId>dimensiondata-cloudcontrol</artifactId>
+ <name>jclouds Dimension Data CloudControl API</name>
<description>jclouds components to access an implementation of Dimension Data CloudControl</description>
<packaging>bundle</packaging>
@@ -152,4 +153,4 @@
</build>
</profile>
</profiles>
-</project>
\ No newline at end of file
+</project>
[3/4] jclouds-labs git commit: Improve vagrant docs
Posted by na...@apache.org.
Improve vagrant docs
Project: http://git-wip-us.apache.org/repos/asf/jclouds-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/8475e633
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-labs/tree/8475e633
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-labs/diff/8475e633
Branch: refs/heads/master
Commit: 8475e633542308277f8bc9b7b9c1cb221b691662
Parents: 57690d2
Author: Svetoslav Neykov <sv...@neykov.name>
Authored: Sun Mar 19 17:30:17 2017 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Tue Mar 28 08:24:41 2017 +0200
----------------------------------------------------------------------
vagrant/README.md | 17 +++++
vagrant/pom.xml | 2 +-
.../vagrant/internal/VagrantNodeRegistry.java | 69 ++++++++++++++++++++
.../vagrant/compute/WindowsLiveTest.java | 12 ++--
4 files changed, 91 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/8475e633/vagrant/README.md
----------------------------------------------------------------------
diff --git a/vagrant/README.md b/vagrant/README.md
index 36194dd..141f5b6 100644
--- a/vagrant/README.md
+++ b/vagrant/README.md
@@ -89,9 +89,26 @@ Testing
-----------
```
+vagrant box add ubuntu/xenial64
+vagrant box add ubuntu/trusty64
+# Refer to the "Windows boxes" section below on how to create the "boxcutter/eval-win7x86-enterprise" image (optional)
mvn clean install -Plive
```
+Windows boxes
+-----------
+
+The easiest way to create a Windows Vagrant test image is using the [boxcutter-windows](https://github.com/boxcutter/windows)
+packer templates.
+
+```
+brew install packer # or the corresponding alternative for your distribution
+git clone https://github.com/boxcutter/windows.git boxcutter-windows
+cd boxcutter-windows
+make virtualbox/eval-win2012r2-standard
+vagrant box add boxcutter/eval-win2012r2-standard ./box/virtualbox/eval-win2012r2-standard-nocm-1.0.4.box
+```
+
Cleaning up
-----------
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/8475e633/vagrant/pom.xml
----------------------------------------------------------------------
diff --git a/vagrant/pom.xml b/vagrant/pom.xml
index 7b2d450..3c38a19 100644
--- a/vagrant/pom.xml
+++ b/vagrant/pom.xml
@@ -27,7 +27,7 @@
</parent>
<artifactId>vagrant</artifactId>
- <name>Vagrant provider</name>
+ <name>jclouds Vagrant provider</name>
<packaging>bundle</packaging>
<properties>
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/8475e633/vagrant/src/main/java/org/jclouds/vagrant/internal/VagrantNodeRegistry.java
----------------------------------------------------------------------
diff --git a/vagrant/src/main/java/org/jclouds/vagrant/internal/VagrantNodeRegistry.java b/vagrant/src/main/java/org/jclouds/vagrant/internal/VagrantNodeRegistry.java
index d9447c8..8834f5b 100644
--- a/vagrant/src/main/java/org/jclouds/vagrant/internal/VagrantNodeRegistry.java
+++ b/vagrant/src/main/java/org/jclouds/vagrant/internal/VagrantNodeRegistry.java
@@ -27,6 +27,75 @@ import com.google.common.base.Suppliers;
import com.google.inject.Inject;
import com.google.inject.Singleton;
+/**
+ * <p>
+ * The provider serves the following purposes:
+ * <ol>
+ * <li>holds information that's not available elsewhere - hostname and IPs</li>
+ * <li>cache of available machines</li>
+ * <li>cache of the machine state</li>
+ * </ol>
+ * <p>
+ * To expand on each one:
+ * <p>
+ * 1. Hostname and IPs of the machine are fetched on boot using vagrant's provisioning scripts.
+ * There are a couple of reasons for that. First vagrant calls are very expensive (relatively
+ * for a local call). Each exec takes at least several seconds. Integrating them with the boot
+ * saves a couple of ssh calls. Second the windows winrm transport is available only through the
+ * provisioning scripts. Can't call "vagrant powershell " later. This makes the information
+ * available only when creating the machine.
+ * <p>
+ * Possible solutions:
+ * <ul>
+ * <li>
+ * Store those in the yaml file that's already being created, containing the machine specs
+ * to be passed to the Vagrantfile script. We are already storing some additional info in there
+ * like imageId and hardwareId. A drawback is that the information could change
+ * so those values would become stale.
+ * </li>
+ * <li>
+ * Query the machine when we need them. Not possible with Windows; not possible if the machine
+ * is halted.
+ * </li>
+ * <li>
+ * Keep them as is (in memory only). When the process stops the information is lost. On a new
+ * start if doesn't know the hostname and IPs. Depending on the intended usage of the provider
+ * could be enough.
+ * Possibly a combination of the above would work best, depending on the OS. Perhaps coupled
+ * with a refreshing mechanism.
+ * The file could store other information like the tags and the metadata.
+ * </li>
+ * </ul>
+ * <p>
+ * 2. Existing machines list can be reconstructed easily - just listing the files on the disk.
+ * Worth mentioning that machines created by jclouds follow some conventions. Manually
+ * created machines are not considered. The provider creates a yaml file describing the requirements
+ * and some meta, then a generic Vagrantfile reads those and creates a machine based on them.
+ * Presently the provider is only interested in machines it creates or machines created
+ * from previous runs. That's a local "service" and no concurrent modifications of the machines
+ * is expected. There could be parallel processes running but still each one would
+ * manage its own machines. That's even strongly discouraged that since virtualbox (vboxmanage) has
+ * problems when it's executed in parallel. Currently the vagrant bindings explicitly serialise
+ * execs of vagrant.
+ * <p>
+ * 3. Machine status can reliably be inferred. The key here is that the vagrant commands are
+ * synchronous. If "vagrant up" completes successfully then the status is RUNNING. If it fails
+ * an exception propagates and signals an error. This makes it possible to save on expensive
+ * state polling. It gets more obvious when several machines are spun up in parallel. Since
+ * vagrant commands are executed sequentially a vagrant up would block other vagrant status
+ * commands for quite a while.
+ * Possible improvements: time out the status value, refreshing it after some period on request
+ * <p>
+ * The registry allows us to really streamline machine creation. All it takes is a single
+ * "vagrant up". It needs around a minute to return a usable machine (obviously depends on the
+ * image and is dominated by OS boot). Whereas before introducing the registry it would take
+ * at least 50% more. And it gets worse with the more machines being created in parallel.
+ * <p>
+ * Expiring (and refreshing) machine list while running might not be wanted - would result in
+ * parallel execution of vagrant command against another's process machines. Virtualbox (vboxmanage)
+ * fails indeterministically when executed in parallel. Expiring the status would be a nice
+ * improvement.
+ */
@Singleton
public class VagrantNodeRegistry {
http://git-wip-us.apache.org/repos/asf/jclouds-labs/blob/8475e633/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
----------------------------------------------------------------------
diff --git a/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java b/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
index 4cef15f..9215573 100644
--- a/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
+++ b/vagrant/src/test/java/org/jclouds/vagrant/compute/WindowsLiveTest.java
@@ -20,7 +20,6 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import java.util.NoSuchElementException;
import java.util.Set;
import org.jclouds.compute.ComputeService;
@@ -44,8 +43,8 @@ import com.google.common.collect.Iterables;
* Building the image:
* $ git clone https://github.com/boxcutter/windows.git boxcutter-windows
* $ cd boxcutter-windows
- * $ make virtualbox/eval-win7x86-enterprise
- * $ vagrant box add boxcutter/eval-win7x86-enterprise box/virtualbox/eval-win7x86-enterprise-nocm-1.0.4.box
+ * $ make virtualbox/eval-win2012r2-standard
+ * $ vagrant box add boxcutter/eval-win2012r2-standard ./box/virtualbox/eval-win2012r2-standard-nocm-1.0.4.box
*/
@Test(groups = "live", singleThreaded = true, enabled = true, testName = "WindowsLiveTest")
public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
@@ -60,6 +59,7 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
protected void initializeContext() {
super.initializeContext();
client = view.getComputeService();
+ skipIfImageNotPresent();
}
protected TemplateBuilder templateBuilder() {
@@ -81,8 +81,6 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
@Test
public void testGet() throws Exception {
- skipIfImageNotPresent();
-
Set<? extends NodeMetadata> nodes = client.createNodesInGroup("vagrant-win", 1, buildTemplate(templateBuilder()));
NodeMetadata node = Iterables.getOnlyElement(nodes);
OperatingSystem os = node.getOperatingSystem();
@@ -99,8 +97,6 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
@Test
public void testBoxConfig() {
- skipIfImageNotPresent();
-
Image image = view.getComputeService().getImage(getImageId());
BoxConfig.Factory boxConfigFactory = new BoxConfig.Factory();
@@ -111,7 +107,7 @@ public class WindowsLiveTest extends BaseComputeServiceContextLiveTest {
}
private void skipIfImageNotPresent() {
- Image image = view.getComputeService().getImage(getImageId());
+ Image image = client.getImage(getImageId());
if (image == null) {
throw new SkipException("Image " + getImageId() + " not available. Skipping windows tests.");
}