You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by alibazlamit <no...@github.com> on 2016/06/21 12:05:42 UTC

[jclouds/jclouds-labs] Pb compute api (#292)

@nacx if you came across this
`INFO: << configured node(1821134a-fa51-4d3a-8a3d-da1e891dc4d2/fc621963-76bc-495f-8585-afd0885d33a9) with bash: java: command not found and jetty head: cannot open '/usr/local/jetty/VERSION.txt' for reading: No such file or directory in 27s `
`could not connect to any ip address port 8080 on node bash: line 0: cd: /usr/local/jetty: No such file or directory`
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs/pull/292

-- Commit Summary --

  * Profitbricks REST - LAN API
  * pb-ipblock-api
  * pb-compute-api
  * pb-compute-api
  * Merge branch 'master' of https://github.com/jclouds/jclouds-labs into pb-compute-api

-- File Changes --

    M profitbricks-rest/pom.xml (19)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApi.java (41)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksApiMetadata.java (7)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ProfitBricksProviderMetadata.java (134)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/ProfitBricksComputeServiceAdapter.java (568)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/concurrent/ProvisioningJob.java (62)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/concurrent/ProvisioningManager.java (87)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/config/ProfitBricksComputeServiceContextModule.java (333)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/DataCenterToLocation.java (52)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/LocationToLocation.java (46)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/ProvisionableToImage.java (209)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/ServerInDataCenterToNodeMetadata.java (177)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/ServerToNodeMetadata.java (169)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/compute/function/VolumeToVolume.java (44)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/config/ProfitBricksComputeProperties.java (21)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/DataCenter.java (2)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Firewall.java (4)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Image.java (2)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/IpBlock.java (104)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Location.java (11)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Server.java (449)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/Snapshot.java (2)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/VolumeType.java (8)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/zonescoped/DataCenterAndId.java (92)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/domain/zonescoped/ServerInDataCenter.java (49)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/features/IpBlockApi.java (89)
    A profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/ids/NicRef.java (34)
    M profitbricks-rest/src/main/java/org/apache/jclouds/profitbricks/rest/util/ApiPredicatesModule.java (18)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/BaseTest.java (948)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/ProfitBricksComputeServiceLiveTest.java (156)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/ProfitBricksTemplateBuilderLiveTest.java (37)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/concurrent/ProvisioningManagerTest.java (118)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/config/StatusPredicateTest.java (122)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/function/DataCenterToLocationTest.java (76)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/function/LocationToLocationTest.java (62)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/function/ProvisionableToImageTest.java (203)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/function/ServerInDataCenterToNodeMetadataTest.java (142)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/compute/function/VolumeToVolumeTest.java (59)
    M profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiLiveTest.java (2)
    M profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/DataCenterApiMockTest.java (3)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/IpBlockApiMockTest.java (150)
    A profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/IpblockApiLiveTest.java (96)
    M profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/features/ServerApiLiveTest.java (3)
    M profitbricks-rest/src/test/java/org/apache/jclouds/profitbricks/rest/internal/BaseProfitBricksLiveTest.java (8)
    A profitbricks-rest/src/test/resources/compute/datacenter.json (123)
    A profitbricks-rest/src/test/resources/compute/image.json (32)
    A profitbricks-rest/src/test/resources/compute/image1.json (32)
    A profitbricks-rest/src/test/resources/compute/image2.json (32)
    A profitbricks-rest/src/test/resources/compute/image3.json (32)
    A profitbricks-rest/src/test/resources/compute/predicate/datacenter-inprocess.json (41)
    A profitbricks-rest/src/test/resources/compute/predicate/datacenter.json (41)
    A profitbricks-rest/src/test/resources/compute/predicate/server-inprocess.json (173)
    A profitbricks-rest/src/test/resources/compute/predicate/server.json (173)
    A profitbricks-rest/src/test/resources/compute/predicate/snapshot-inprocess.json (30)
    A profitbricks-rest/src/test/resources/compute/predicate/snapshot.json (30)
    A profitbricks-rest/src/test/resources/compute/server.json (140)
    A profitbricks-rest/src/test/resources/compute/snapshot1.json (30)
    A profitbricks-rest/src/test/resources/compute/snapshot2.json (30)
    A profitbricks-rest/src/test/resources/compute/volume.json (33)
    A profitbricks-rest/src/test/resources/ipblock/get.json (19)
    A profitbricks-rest/src/test/resources/ipblock/list.depth-5.json (42)
    A profitbricks-rest/src/test/resources/ipblock/list.json (14)

-- Patch Links --

https://github.com/jclouds/jclouds-labs/pull/292.patch
https://github.com/jclouds/jclouds-labs/pull/292.diff

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

e98ea68  Missing two files added


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/b7314b1685ab64f3135c3e5a7bae190b05ba3e3d..e98ea68598b5cafff0bdc7d54a6b03142b6d31f6

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
devcsrj commented on this pull request.



> -      properties.setProperty(PROPERTY_ZONE + ".FRA." + ISO3166_CODES, "DE-HE");
-      properties.setProperty(PROPERTY_ZONE + ".LAS." + ISO3166_CODES, "US-NV");
-      properties.setProperty(PROPERTY_ZONE + ".LASDEV." + ISO3166_CODES, "US-NV");
-      
+
+      properties.setProperty(PROPERTY_REGIONS, "de,us");
+      properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra");
+      properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev");
+      properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev");
+      properties.setProperty(PROPERTY_ISO3166_CODES, "DE-BW,DE-HE,US_NV");
+      properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-BW,DE-HE");
+      properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-NV");
+      properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW");
+      properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE");
+      properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV");
+      properties.setProperty(PROPERTY_ZONE + ".us/lasdebv." + ISO3166_CODES, "US-NV");

`.us/lasdebv` is this intentional?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#pullrequestreview-1307986

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

9ecf22e  minor fix


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/12a9a959ffc4343e260c4123091b9d5de5d972ea..9ecf22eec6ee480a81f989007465edbe872c19f7

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +                .volumeId(bootVolume.id())
> +                .build());
> +
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
> +        waitDcUntilAvailable.apply(dataCenterId);
> +
> +        //fetch an existing lan and creat if non was found
> +        Lan lan = null;
> +
> +        List<Lan> lans = api.lanApi().list(dataCenterId);
> +        if (lans != null && !lans.isEmpty()) {
> +            lan = FluentIterable.from(lans).firstMatch(new Predicate<Lan>() {
> +                @Override
> +                public boolean apply(Lan input) {
> +                    input = api.lanApi().get(dataCenterId, input.id(), new DepthOptions().depth(3));
> +                    boolean match = input.properties().isPublic();

Just `return input.properties().isPublic();`

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311182

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

3e79df9  pb-compute-api


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/b5805fcfebc1593117510dde5134a8482afb8d4c..3e79df9c8d1d358fa8d4b6b11e59b587213d6099

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -36,6 +36,7 @@
>          <test.profitbricks-rest.identity>FIXME</test.profitbricks-rest.identity>
>          <test.profitbricks-rest.credential>FIXME</test.profitbricks-rest.credential>
>          <test.profitbricks-rest.api-version>1.3</test.profitbricks-rest.api-version>
> +        <checkstyle.skip>true</checkstyle.skip>

This needs to be removed

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73310515

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +        if (image != null) {
> +            logger.trace(">> found image [%s].", image.properties().name());
> +            return image;
> +        }
> +        // try search snapshots
> +        logger.trace("<< not found from images. searching for snapshot with id=%s", id);
> +        Snapshot snapshot = api.snapshotApi().get(id);
> +        if (snapshot != null) {
> +            logger.trace(">> found snapshot [%s]", snapshot.properties().name());
> +            return snapshot;
> +        }
> +        throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
> +    }
> +
> +    @Override
> +    public Iterable<DataCenter> listLocations() {

Sure. Have a look at https://github.com/jclouds/jclouds/commit/7202e0557f620c272feaca3e9a49b6e45a77a791 . That commit configures the compute service to get the locations from the properties defined in the provider metadata. The important bits there are:

* The jclouds location properties configured in the provider metadata.
* The type for the locations in the generics of the adapter changes from DataCenter to the jclouds Location.
* The `LocationsFromComputeServiceAdapterModule` must be removed from the compute module. This will make the default jclouds location suppliers active and return the locations from the configured properties. You no longer need the listLocations method, so you can safely make it throw an exception.
* Since ProfitBricks needs a Datacenter, that commit declares a custom `CreateNodesInGroupThenAddToSet` strategy to take care of creating the datacenter if none exists in the selected location *before* creating any node. You can have a look at the binding and copy most of the code in that strategy (if not all).
* To let the datacenter be created *before* the adapter is called, that commit introduces an internal class that adds the created DataCenter to the jclouds Template, so it can be directly passed to the adapter, removing the need to perform additional calls.

Feel free to ask if you have any doubts or need some more guidance!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r76685558

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@devcsrj I removed all the formatting changes, i agree lets focus on the compute changes, all the changes in the commit are related to the Compute API .

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-247569116

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +import org.testng.annotations.Test;
> +
> +@Test(groups = "live", testName = "ProfitBricksTemplateBuilderLiveTest")
> +public class ProfitBricksTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
> +
> +    private static final String TEST_DC_NAME = "templateBuilderLiveTest-" + System.currentTimeMillis();
> +    private DataCenter dataCenter;
> +
> +    public ProfitBricksTemplateBuilderLiveTest() {
> +        this.provider = "profitbricks-rest";
> +        System.setProperty("http.proxyHost", "127.0.0.1");
> +        System.setProperty("https.proxyHost", "127.0.0.1");
> +        System.setProperty("http.proxyPort", "8888");
> +        System.setProperty("https.proxyPort", "8888");
> +        System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\jdk1.8.0_73\\jre\\lib\\security\\FiddlerKeystore");
> +        System.setProperty("javax.net.ssl.trustStorePassword", "testme");

Remove all these properties.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312984

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +                    return match;
> +                }
> +            }).orNull();
> +        }
> +        if (lan == null) {
> +            logger.warn("Could not find an existing lan Creating one....");
> +            lan = api.lanApi().create(Lan.Request.creatingBuilder()
> +                    .dataCenterId(dataCenterId)
> +                    .isPublic(Boolean.TRUE)
> +                    .name("lan " + name)
> +                    .build());
> +        }
> +
> +        //add a NIC to the server
> +        waitDcUntilAvailable.apply(dataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));

Is this needed? The server was not touched since the last wait operation.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311232

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> +         public List<Snapshot> call() throws Exception {
+            logger.trace("<< fetching snapshots");
+            List<Snapshot> remoteSnapshots = api.snapshotApi().list(new DepthOptions().depth(1));
+            logger.trace(">> snapshots feched.");
+
+            return remoteSnapshots;
+         }
+
+      });
+
+      return Iterables.concat(getUnchecked(images), getUnchecked(snapshots));
+   }
+
+   @Override
+   public Provisionable getImage(String id
+   ) {

Fixed and pushed :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Closed #292.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#event-811585869

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +        //add a NIC to the server
> +        waitDcUntilAvailable.apply(dataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
> +        int lanId = DEFAULT_LAN_ID;
> +        if (options.getNetworks() != null) {
> +            try {
> +                String networkId = Iterables.get(options.getNetworks(), 0);
> +                lanId = Integer.valueOf(networkId);
> +            } catch (Exception ex) {
> +                logger.warn("no valid network id found from options. using default id='%d'", DEFAULT_LAN_ID);
> +            }
> +        }
> +
> +        waitDcUntilAvailable.apply(dataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));

No need to wait again here

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311314

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

7b4fcf2  Added CpuFamily for servers option and SSD option for volumes


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/a3fd971a6328c48f6a6024f88e9c6ab38b6ddc23..7b4fcf216128abb84fe18740449c27c2d7fdec1b

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +    @Override
> +    protected void configure() {
> +        super.configure();
> +
> +        install(new LocationsFromComputeServiceAdapterModule<ServerInDataCenter, Hardware, Provisionable, DataCenter>() {
> +        });
> +
> +        install(new FactoryModuleBuilder().build(ProvisioningJob.Factory.class));
> +
> +        bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Singleton.class);
> +
> +        bind(new TypeLiteral<ComputeServiceAdapter<ServerInDataCenter, Hardware, Provisionable, DataCenter>>() {
> +        }).to(ProfitBricksComputeServiceAdapter.class);
> +
> +        bind(new TypeLiteral<Function<org.apache.jclouds.profitbricks.rest.domain.Location, Location>>() {
> +        }).to(LocationToLocation.class);

This can be removed too.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312085

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

8785a5d  Added TemplateBuilderLIveTest Implementation


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/7930af3e52bdf19e29c29dbc045231a91cfe3d4f..8785a5d0f20860cef5597f84054f3e3802ee233d

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

d133573  Changed from the review applied


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/c3f28d9abcde2a559db575133ff3486296b28fec..d133573b659d3e5461b23f1ed37aaee75bd852da

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
It looks like we should update the [install jdk script](https://github.com/jclouds/jclouds/blob/master/scriptbuilder/src/main/resources/functions/installOpenJDK.sh). Could you file a JIRA issue for this?

Meanwhile, could you test with an older Ubuntu version? You can force an image by running the tests with: `-Djclouds.template="osVersionMatches=15.*"` or `-Djclouds.template="imageId=an-image-id"`, to force a lookup of an Ubuntu 15.* image or to explicitly pass the id of an image.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-228903221

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

68a7157  Added the creation of Lan if does not exist


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688..68a7157f67bb281aaeb06a4c2259649edad65782

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +@Test(groups = "live", singleThreaded = true, testName = "ProfitBricksComputeServiceLiveTest")
> +public class ProfitBricksComputeServiceLiveTest extends BaseComputeServiceLiveTest {
> +
> +//    private static final String TEST_DC_NAME = "computeServiceLiveTest" + System.currentTimeMillis();
> +    private static final String TEST_DC_NAME = "computeServiceLiveTest";
> +
> +    private DataCenter dataCenter;
> +
> +    public ProfitBricksComputeServiceLiveTest() {
> +        provider = "profitbricks-rest";
> +//        System.setProperty("http.proxyHost", "127.0.0.1");
> +//        System.setProperty("https.proxyHost", "127.0.0.1");
> +//        System.setProperty("http.proxyPort", "8888");
> +//        System.setProperty("https.proxyPort", "8888");
> +//        System.setProperty("javax.net.ssl.trustStore", "C:\\Program Files\\Java\\jdk1.8.0_73\\jre\\lib\\security\\FiddlerKeystore");
> +//        System.setProperty("javax.net.ssl.trustStorePassword", "testme");

Remove these commented test values (including the `TEST_DC_NAME` field)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77746753

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx should i be following [this ](https://github.com/jclouds/jclouds/commit/7202e0557f620c272feaca3e9a49b6e45a77a791) apply those changes ?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-243193148

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
> +        if (image != null) {
> +            logger.trace(">> found image [%s].", image.properties().name());
> +            return image;
> +        }
> +        // try search snapshots
> +        logger.trace("<< not found from images. searching for snapshot with id=%s", id);
> +        Snapshot snapshot = api.snapshotApi().get(id);
> +        if (snapshot != null) {
> +            logger.trace(">> found snapshot [%s]", snapshot.properties().name());
> +            return snapshot;
> +        }
> +        throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
> +    }
> +
> +    @Override
> +    public Iterable<DataCenter> listLocations() {

@nacx  Can you give me an example on how to configure locations via properties?
Thanks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r76627699

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
I think that log is from a test that installs Jetty on a VM and then tries to connect to it, but it seems that it is failing to install Java on the node.

When jclouds configures nodes, it leaves the following files in `/tmp/bootstrap`:

* The executed script
* rc - A file with the script return code.
* stdout.log - The script output
* stderr.log - The script error output

Could you place a breakpoint in the test, so you can access the node *after* jclouds has run the scripts on it and *before* the test destroys the node? That way you should be able to retrieve those files. If you share them in a gist we'll be able to see what is going wrong in the script execution and determine the cause of the failure.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-227590846

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +                        return api.serverApi().attachVolume(
> +                                Server.Request.attachVolumeBuilder()
> +                                .dataCenterId(dataCenterId)
> +                                .serverId(serverId)
> +                                .volumeId(volumeId)
> +                                .build()
> +                        );
> +                    }
> +                }));
> +
> +                logger.trace(">> volume connected.");
> +            } catch (Exception ex) {
> +                // delete unconnected volume
> +                logger.warn(ex, ">> failed to connect volume '%s'. deleting..", volumeId);
> +                destroyVolume(volumeId, dataCenterId);
> +            }

Shouldn't the entire process be rolled-back if we fail to create a volume?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311451

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Ticket here https://issues.apache.org/jira/browse/JCLOUDS-1133

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-229722276

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
rebuild please

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-243745073

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

61bee69  pb-compute-api


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/db0fb685f13c614e3ad02f0032fe85ac286ef848..61bee693c3361a42764f3480798f9606bd89ac7c

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@devcsrj the support for  arbitrary CPU, RAM and Storage was done something was not right with the branch i pushed, now i have updated it to the upstream and squashed all the changes in one commit, one issue i noticed is that its diffing white spaces and eol, i have configure eol to be lf but still its showing me a lot of changes maybe @nacx can help too on this one.
Other than the diff issue the branch is ready for reviewing.

Thanks

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-247327921

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> but anyways i tried to look for that branch, should build the same master branch or switch to another one?

You can build the branch on my fork. But anyway, I plan to merge the PR tomorrow. I just need some time to run some live tests with that change (the ProfitBricks SOAP ones) and verify it works as expected.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-232489009

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
> +        if (image != null) {
> +            logger.trace(">> found image [%s].", image.properties().name());
> +            return image;
> +        }
> +        // try search snapshots
> +        logger.trace("<< not found from images. searching for snapshot with id=%s", id);
> +        Snapshot snapshot = api.snapshotApi().get(id);
> +        if (snapshot != null) {
> +            logger.trace(">> found snapshot [%s]", snapshot.properties().name());
> +            return snapshot;
> +        }
> +        throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
> +    }
> +
> +    @Override
> +    public Iterable<DataCenter> listLocations() {

@nacx do i need to change the ProfitBricksComputeServiceLiveTest.java to like the one in the commit above?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r76749670

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx its not preventing other tests from running, but anyways i tried to look for that branch, should build the same master branch or switch to another one?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-232178019

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
rebuild please


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-250452632

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
Hmm. Now this kinda sucks. I was under the impression before that this exception [only occurred](https://github.com/jclouds/jclouds-labs/pull/224#issuecomment-172719660) for the SOAP version of the API (that maybe the REST API did a few more stuff in the PB backend to prevent this). 

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230458541

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

92cd5b7  Minor change to logger


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/fc4bdc2635bf28d061886e4520b1526f144bb76d..92cd5b7102f3c9146ebae2772fbf38c8bc470157

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
Closed #292.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#event-814592487

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
devcsrj commented on this pull request.



> +         logger.trace(">> provisioning complete for server. returned id='%s'", serverId);
+
+      } catch (Exception ex) {
+         logger.error(ex, ">> failed to provision server. rollbacking..");
+         destroyVolumes(volumeIds, dataCenterId);
+         throw Throwables.propagate(ex);
+      }
+
+      waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
+      waitDcUntilAvailable.apply(dataCenterId);
+
+      //attach bootVolume to Server
+      api.serverApi().attachVolume(Server.Request.attachVolumeBuilder()
+              .dataCenterId(dataCenterId)
+              .serverId(serverId)
+              .volumeId(bootVolume.id())

You didn't make changes in here... I assume this is intentional?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
please rebuild


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-250452726

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +        if (image != null) {
> +            logger.trace(">> found image [%s].", image.properties().name());
> +            return image;
> +        }
> +        // try search snapshots
> +        logger.trace("<< not found from images. searching for snapshot with id=%s", id);
> +        Snapshot snapshot = api.snapshotApi().get(id);
> +        if (snapshot != null) {
> +            logger.trace(">> found snapshot [%s]", snapshot.properties().name());
> +            return snapshot;
> +        }
> +        throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
> +    }
> +
> +    @Override
> +    public Iterable<DataCenter> listLocations() {

Yes :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r76751069

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

9d66ce5  reverted deletion of file


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/0e73461ab465e08e012f9a266d8c3fed0d3d72a2..9d66ce5e8f044953082dec3934f2ef35a0c666ea

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> + * 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.apache.jclouds.profitbricks.rest.compute.function;
> +
> +import com.google.common.base.Function;
> +import static com.google.common.base.Preconditions.checkNotNull;
> +import com.google.common.collect.ImmutableMap;
> +import com.google.inject.Inject;
> +import org.apache.jclouds.profitbricks.rest.domain.DataCenter;
> +import org.jclouds.domain.Location;
> +import org.jclouds.domain.LocationBuilder;
> +import org.jclouds.domain.LocationScope;
> +
> +public class DataCenterToLocation implements Function<DataCenter, Location> {

Locations are configured by properties. This class should no longer be needed and could be removed.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312316

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
nacx commented on this pull request.

Just one minor comment on my side regarding the logger. Once it is amended, I'm happy to finally merge this!
Great work @alibazlamit, and apologies for the late review! It is quite difficult to review big PRs like this.

> +                          .build()
+                  );
+               }
+            }));
+
+            logger.trace(">> volume connected.");
+         } catch (Exception ex) {
+            try {
+               // delete unconnected volume
+               logger.warn(ex, ">> failed to connect volume '%s'. deleting..", volumeId);
+               destroyVolume(volumeId, dataCenterId);
+               logger.warn(ex, ">> rolling back server..", serverId);
+               destroyServer(serverId, dataCenterId);
+               throw ex;
+            } catch (Exception ex1) {
+               java.util.logging.Logger.getLogger(ProfitBricksComputeServiceAdapter.class.getName()).log(Level.SEVERE, null, ex1);

Change to the jclouds logger used in this class.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#pullrequestreview-3071660

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

b1964a4  Arbitrary CPU/RAM support, is now supported.


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9ecf22eec6ee480a81f989007465edbe872c19f7..b1964a4717f2d46aa761087193e97d41fe1b90ea

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +                        return api.serverApi().attachVolume(
> +                                Server.Request.attachVolumeBuilder()
> +                                .dataCenterId(dataCenterId)
> +                                .serverId(serverId)
> +                                .volumeId(volumeId)
> +                                .build()
> +                        );
> +                    }
> +                }));
> +
> +                logger.trace(">> volume connected.");
> +            } catch (Exception ex) {
> +                // delete unconnected volume
> +                logger.warn(ex, ">> failed to connect volume '%s'. deleting..", volumeId);
> +                destroyVolume(volumeId, dataCenterId);
> +            }

Prior this volume-creating code block, a [*bootVolume*](https://github.com/jclouds/jclouds-labs/pull/292/files#diff-3cfe9775f2121ca815ae0fce43f9d211R187) is attached to the server. That server-volume pair already constitutes a jcloud node. The additional volumes here are more like, additional storages, not necessarily making the node unusable if they fail in attaching.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r77744780

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +import org.jclouds.scriptbuilder.statements.java.InstallJDK;
> +import org.jclouds.scriptbuilder.statements.login.AdminAccess;
> +import org.jclouds.ssh.SshClient;
> +import org.jclouds.ssh.SshException;
> +import static org.jclouds.util.Predicates2.retry;
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertNotNull;
> +import static org.testng.Assert.assertTrue;
> +import static org.testng.Assert.fail;
> +import org.testng.annotations.AfterClass;
> +import org.testng.annotations.BeforeGroups;
> +import org.testng.annotations.Test;
> +
> +@Test(groups = {"integration", "live"}, singleThreaded = true)
> +public abstract class BaseTest extends BaseComputeServiceContextLiveTest {

The ssh-related issue was already fixed by @nacx with [https://github.com/jclouds/jclouds/pull/995], so you can revert the the overridden methods in this test class.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77746649

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> -      properties.setProperty(PROPERTY_ZONE + ".FRA." + ISO3166_CODES, "DE-HE");
-      properties.setProperty(PROPERTY_ZONE + ".LAS." + ISO3166_CODES, "US-NV");
-      properties.setProperty(PROPERTY_ZONE + ".LASDEV." + ISO3166_CODES, "US-NV");
-      
+
+      properties.setProperty(PROPERTY_REGIONS, "de,us");
+      properties.setProperty(PROPERTY_REGION + ".de.zones", "de/fkb,de/fra");
+      properties.setProperty(PROPERTY_REGION + ".us.zones", "us/las,us/lasdev");
+      properties.setProperty(PROPERTY_ZONES, "de/fkb,de/fra,us/las,us/lasdev");
+      properties.setProperty(PROPERTY_ISO3166_CODES, "DE-BW,DE-HE,US_NV");
+      properties.setProperty(PROPERTY_REGION + ".de." + ISO3166_CODES, "DE-BW,DE-HE");
+      properties.setProperty(PROPERTY_REGION + ".us." + ISO3166_CODES, "US-NV");
+      properties.setProperty(PROPERTY_ZONE + ".de/fkb." + ISO3166_CODES, "DE-BW");
+      properties.setProperty(PROPERTY_ZONE + ".de/fra." + ISO3166_CODES, "DE-HE");
+      properties.setProperty(PROPERTY_ZONE + ".us/las." + ISO3166_CODES, "US-NV");
+      properties.setProperty(PROPERTY_ZONE + ".us/lasdebv." + ISO3166_CODES, "US-NV");

Mistake it should be `.us/lasdev`

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

12a9a95  Fixed formatting issue


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/d133573b659d3e5461b23f1ed37aaee75bd852da..12a9a959ffc4343e260c4123091b9d5de5d972ea

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Updated to the latest just let me know if you need me to squash this, Thanks for the review.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-251908880

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
@alibazlamit I've just opened https://github.com/jclouds/jclouds/pull/979 to isolate the task cancellation in a specific test, so it does not prevent other tests from running. Could you try building that branch and run the live tests again with that change, to se the *real* state of them?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-231865496

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

e108738  fix build


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9d66ce5e8f044953082dec3934f2ef35a0c666ea..e108738c448cd76a519e62127b85e23dec454aa4

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx i have applied the changes above please take a look.
Thanks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-243755473

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
rebuild please


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-250140544

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
` loginUser=foo, ssh=445447871` its passing the credentials as you see in the log meesage.

I was able to debug the test and it fails when reaching this line 

https://github.com/jclouds/jclouds/blob/master/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java#L305

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230279065

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> I was able to debug the test and it fails when reaching this line

Ok, then you're hitting [JCLOUDS-1058](https://issues.apache.org/jira/browse/JCLOUDS-1058). I'll add a change to the base test class to isolate the "wait" thing in a test so it does not block the other ones. This will help having better feedback on the rest of the skipped tests.

@devcsrj At some point we'll need to have a deeper look at this.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230400744

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

a3fd971  Uncommented live compute tests


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/e98ea68598b5cafff0bdc7d54a6b03142b6d31f6..a3fd971a6328c48f6a6024f88e9c6ab38b6ddc23

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> +         public List<Snapshot> call() throws Exception {
+            logger.trace("<< fetching snapshots");
+            List<Snapshot> remoteSnapshots = api.snapshotApi().list(new DepthOptions().depth(1));
+            logger.trace(">> snapshots feched.");
+
+            return remoteSnapshots;
+         }
+
+      });
+
+      return Iterables.concat(getUnchecked(images), getUnchecked(snapshots));
+   }
+
+   @Override
+   public Provisionable getImage(String id
+   ) {

It is true that's the case, for some reason doing that cause the live tests to fail, more specifically when trying to ssh into the servers and test operations, as if the server was not ready yet, i tried using long sleep's and checks nothing helped except for this approach, it does the job don't you agree?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 2 commits.

f597512  pb-compue-api fix
0e73461  Merge branch 'pb-compute-api' of https://github.com/StackPointCloud/jclouds-labs into pb-compute-api


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/a6d5323cc613ecef69a605918bfc9b5ca4115bc5..0e73461ab465e08e012f9a266d8c3fed0d3d72a2

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> +         logger.trace(">> provisioning complete for server. returned id='%s'", serverId);
+
+      } catch (Exception ex) {
+         logger.error(ex, ">> failed to provision server. rollbacking..");
+         destroyVolumes(volumeIds, dataCenterId);
+         throw Throwables.propagate(ex);
+      }
+
+      waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
+      waitDcUntilAvailable.apply(dataCenterId);
+
+      //attach bootVolume to Server
+      api.serverApi().attachVolume(Server.Request.attachVolumeBuilder()
+              .dataCenterId(dataCenterId)
+              .serverId(serverId)
+              .volumeId(bootVolume.id())

Sorry the comment below was supposed to be here :)

> It is true that's the case, for some reason doing that cause the live tests to fail, more specifically when trying to ssh into the servers and test operations, as if the server was not ready yet, i tried using long sleep's and checks nothing helped except for this approach, it does the job don't you agree?


-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx All compute tests pass now except for the one above,could you please do a general review and check the state of this PR and give me back your feedback.
Thanks

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-231096630

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> + * 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.apache.jclouds.profitbricks.rest.compute.function;
> +
> +import com.google.common.base.Function;
> +import com.google.common.collect.Iterables;
> +import com.google.inject.Inject;
> +import org.apache.jclouds.profitbricks.rest.domain.Location;
> +import org.jclouds.domain.LocationBuilder;
> +import org.jclouds.domain.LocationScope;
> +import org.jclouds.location.suppliers.all.JustProvider;
> +
> +public class LocationToLocation implements Function<Location, org.jclouds.domain.Location> {

Same as before. Can this class be removed?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312378

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
Now that's a **LOT** of formatting noise, even GitHub couldn't render. :(

![](https://cloud.githubusercontent.com/assets/3963900/18572062/51bd9a1c-7bea-11e6-9d97-1a92f8b94a9f.png)

Assuming you used the IDE formatting profiles, then the formatting noise is most probably caused by earlier PB-related PRs not formatted properly. i.e.: Braces on single-line ifs:

![](https://cloud.githubusercontent.com/assets/3963900/18572146/205b894c-7beb-11e6-9db5-6e85acea279a.png)

..or untrimmed whitespaces:
![](https://cloud.githubusercontent.com/assets/3963900/18572159/47b3cf22-7beb-11e6-87dd-e5aaf9ac81b6.png)

Here's what I suggest, to move this PR into a reviewable state:
- Rebase this branch to `master`
- Re-apply **ONLY** the compute-api related changes, using the correct formatting

Don't reformat the rest of the codebase _yet_; only the once you've changed. After this gets merged, we'll dedicated a separate PR for the sole purpose of reformatting the rest of the codebase. That way we keep the changes to it's own PRs, making the review possible.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-247495155

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
devcsrj commented on this pull request.



> +         logger.trace(">> provisioning complete for server. returned id='%s'", serverId);
+
+      } catch (Exception ex) {
+         logger.error(ex, ">> failed to provision server. rollbacking..");
+         destroyVolumes(volumeIds, dataCenterId);
+         throw Throwables.propagate(ex);
+      }
+
+      waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
+      waitDcUntilAvailable.apply(dataCenterId);
+
+      //attach bootVolume to Server
+      api.serverApi().attachVolume(Server.Request.attachVolumeBuilder()
+              .dataCenterId(dataCenterId)
+              .serverId(serverId)
+              .volumeId(bootVolume.id())

> when trying to ssh into the servers and test operations..

Ohhhhhhhh. I guess we'll leave it at that! :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

1533bf2  remove checkstyle temp


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/2accf5b7321f7112022c301c95094769e4ed8a19..1533bf29a80f2c87834f501abd91ea399debd688

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

bb561f4  Ready for final review


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/8785a5d0f20860cef5597f84054f3e3802ee233d..bb561f466097bdb7b189241896454616fa04eb69

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +import org.jclouds.compute.domain.Hardware;
> +import org.jclouds.compute.domain.Image;
> +import org.jclouds.compute.domain.NodeMetadata;
> +import org.jclouds.compute.domain.Volume;
> +import org.jclouds.domain.Location;
> +import org.jclouds.functions.IdentityFunction;
> +import org.jclouds.lifecycle.Closer;
> +import org.jclouds.location.suppliers.ImplicitLocationSupplier;
> +import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
> +import static org.jclouds.util.Predicates2.retry;
> +
> +public class ProfitBricksComputeServiceContextModule extends
> +        ComputeServiceAdapterContextModule<ServerInDataCenter, Hardware, Provisionable, DataCenter> {
> +
> +    @Override
> +    protected void configure() {

Now that jclouds supports arbitrary CPU, RAM and Storage, configure the template builder here too! See [blog post](https://jclouds.apache.org/blog/2016/08/22/arbitrary-cpu-ram/) for details.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r78122825

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> +                          .build()
+                  );
+               }
+            }));
+
+            logger.trace(">> volume connected.");
+         } catch (Exception ex) {
+            try {
+               // delete unconnected volume
+               logger.warn(ex, ">> failed to connect volume '%s'. deleting..", volumeId);
+               destroyVolume(volumeId, dataCenterId);
+               logger.warn(ex, ">> rolling back server..", serverId);
+               destroyServer(serverId, dataCenterId);
+               throw ex;
+            } catch (Exception ex1) {
+               java.util.logging.Logger.getLogger(ProfitBricksComputeServiceAdapter.class.getName()).log(Level.SEVERE, null, ex1);

Done, changed.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
devcsrj commented on this pull request.



> +         public List<Snapshot> call() throws Exception {
+            logger.trace("<< fetching snapshots");
+            List<Snapshot> remoteSnapshots = api.snapshotApi().list(new DepthOptions().depth(1));
+            logger.trace(">> snapshots feched.");
+
+            return remoteSnapshots;
+         }
+
+      });
+
+      return Iterables.concat(getUnchecked(images), getUnchecked(snapshots));
+   }
+
+   @Override
+   public Provisionable getImage(String id
+   ) {

> ..for this approach

Uhm.. Which approach again? (Wrong comment thread?)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
Squashed and pushed to master as [5742745e](http://git-wip-us.apache.org/repos/asf/jclouds-labs/commit/5742745e). Thanks @alibazlamit @devcsrj!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-251932966

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +
> +            @Override
> +            public DataCenter get() {
> +                DataCenter dataCenter = api.create(TEST_DC_NAME, "desc,,,", Location.US_LAS.getId());
> +                predicate.apply(dataCenter.id());
> +
> +                return api.getDataCenter(dataCenter.id());
> +            }
> +        });
> +        
> +//         final TemplateBuilder templateBuilder = view.getComputeService().templateBuilder();
> +//        templateBuilder.osFamily(OsFamily.UBUNTU);
> +//        templateBuilder.osVersionMatches("16.04");
> +//        templateBuilder.locationId(dataCenter.id());
> +//        templateBuilder.hardwareId("cpu=4,ram=2,disk=30");
> +//        templateBuilder.imageId("02a49ebb-27b7-11e6-8e88-52540005ab80");

Remove these as well

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77746811

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 6 commits.

68a7157  Added the creation of Lan if does not exist
7930af3  Removed Dev code
8785a5d  Added TemplateBuilderLIveTest Implementation
bb561f4  Ready for final review
6ac2aee  Merge branch 'master' of https://github.com/jclouds/jclouds-labs into pb-compute-api
9251ab7  Merge branch 'master' of https://github.com/jclouds/jclouds-labs into pb-compute-api


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688..9251ab7434bcafb1dcbec5a718acc3c24517c94d

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

d32fb3c  fixed license text


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/e108738c448cd76a519e62127b85e23dec454aa4..d32fb3c68b03bb5a28527a9f1402aa584e9601cf

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +        bind(ImplicitLocationSupplier.class).to(OnlyLocationOrFirstZone.class).in(Singleton.class);
> +
> +        bind(new TypeLiteral<ComputeServiceAdapter<ServerInDataCenter, Hardware, Provisionable, DataCenter>>() {
> +        }).to(ProfitBricksComputeServiceAdapter.class);
> +
> +        bind(new TypeLiteral<Function<org.apache.jclouds.profitbricks.rest.domain.Location, Location>>() {
> +        }).to(LocationToLocation.class);
> +
> +        bind(new TypeLiteral<Function<DataCenter, Location>>() {
> +        }).to(DataCenterToLocation.class);
> +
> +        bind(new TypeLiteral<Function<ServerInDataCenter, NodeMetadata>>() {
> +        }).to(ServerInDataCenterToNodeMetadata.class);
> +        bind(new TypeLiteral<Function<Server, NodeMetadata>>() {
> +        }).to(ServerToNodeMetadata.class);

Is this function still used? If not, remove the binding and the function class.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312144

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +
> +import org.jclouds.collect.Memoized;
> +import org.jclouds.compute.domain.Hardware;
> +import org.jclouds.compute.domain.HardwareBuilder;
> +import org.jclouds.compute.domain.NodeMetadata;
> +import org.jclouds.compute.domain.NodeMetadataBuilder;
> +import org.jclouds.compute.domain.OperatingSystem;
> +import org.jclouds.compute.domain.OsFamily;
> +import org.jclouds.compute.domain.Processor;
> +import org.jclouds.compute.domain.Volume;
> +import org.jclouds.compute.functions.GroupNamingConvention;
> +import org.jclouds.domain.Location;
> +import org.jclouds.util.InetAddresses2.IsPrivateIPAddress;
> +import static com.google.common.base.Preconditions.checkNotNull;
> +
> +public class ServerToNodeMetadata implements Function<Server, NodeMetadata> {

If this function is not used (since the adapter uses the `ServerInDatacenter` class), remove it

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312800

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +                destroyVolume(volumeId, dataCenterId);
> +            }
> +        }
> +        // Last paranoid check
> +        waitDcUntilAvailable.apply(dataCenterId);
> +
> +        LoginCredentials serverCredentials = LoginCredentials.builder()
> +                .user(loginUser)
> +                .password(password)
> +                .build();
> +        String serverInDataCenterId = DataCenterAndId.fromDataCenterAndId(dataCenterId, serverId).slashEncode();
> +        rebootNode(serverInDataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
> +
> +        try {
> +            Thread.sleep(90000);

Also, why the need for 90-second sleep here? If the provisioning process still not done here (*sigh*), adjust instead the default values of the `waitServerUntilAvailable` predicate or datacenter, whichever applicable.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77745128

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

b7314b1  Changed to take locations from metadata configurations


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d..b7314b1685ab64f3135c3e5a7bae190b05ba3e3d

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by jasminSPC <no...@github.com>.
@nacx what is the status of this PR?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-236443618

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> should i be following this apply those changes ?

Yes. I just added a comment before having read this one :) I've tried to summarise the intent of the important bits in that commit, but feel free to ask for help/clarification, etc!

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-243253863

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
This might be because the create node method in the adapter or the function that transforms a server into a jclouds node don't properly populate the node credentials. jclouds uses those to access the node. Could you have a look at that?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230207907

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +import org.jclouds.domain.Location;
> +import org.jclouds.functions.IdentityFunction;
> +import org.jclouds.lifecycle.Closer;
> +import org.jclouds.location.suppliers.ImplicitLocationSupplier;
> +import org.jclouds.location.suppliers.implicit.OnlyLocationOrFirstZone;
> +import static org.jclouds.util.Predicates2.retry;
> +
> +public class ProfitBricksComputeServiceContextModule extends
> +        ComputeServiceAdapterContextModule<ServerInDataCenter, Hardware, Provisionable, DataCenter> {
> +
> +    @Override
> +    protected void configure() {
> +        super.configure();
> +
> +        install(new LocationsFromComputeServiceAdapterModule<ServerInDataCenter, Hardware, Provisionable, DataCenter>() {
> +        });

Remove this to let the locations be configured from the properties int he metadata.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73312054

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
Apologies for the delay @alibazlamit @jasminSPC, I've been on vacation.

@devcsrj Could you help reviewing this? I can mostly review syntax, etc, but you have a better knowledge of how the provider works for a proper functional review.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-237198613

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@devcsrj the gist results [here](https://gist.github.com/alibazlamit/c09d8fc26af8d615bf7f48c710a65254)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-248996349

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
Hi @alibazlamit !

The initial comments on this PR haven't been addressed yet; see [Files Changed](https://github.com/jclouds/jclouds-labs/pull/292/files) tab of this PR, most notably style-checks. The diff made it looked like that this PR changed *everything* due to the formatting changes. While this does not necessarily break code correctness, reviewing becomes 10x more times difficult (actually, 5700+ additions ;) ), as we're *might* be seeing changes not intentionally addressed by this PR (i.e.: Compute Service).

Could you take care of that first, by removing the disabled `<checkstyle.skip>`s, and reformatting the source? If you're using eclipse or idea, they have a profile you can format [here](https://cwiki.apache.org/confluence/display/JCLOUDS/Coding+Standards).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-245140170

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
devcsrj requested changes on this pull request.

Also, could you post a copy of your the build results of this module in a gist, or a pastie?

P.S.: Take care, and make sure **not** to include your credentials!

> +      TemplateOptions options = template.getOptions();
+      final String loginUser = isNullOrEmpty(options.getLoginUser()) ? "root" : options.getLoginUser();
+      final String password = options.hasLoginPassword() ? options.getLoginPassword() : Passwords.generate();
+      final org.jclouds.compute.domain.Image image = template.getImage();
+
+      // provision all volumes based on hardware
+      List<? extends Volume> volumes = hardware.getVolumes();
+      List<String> volumeIds = Lists.newArrayListWithExpectedSize(volumes.size());
+
+      int i = 1;
+      for (final Volume volume : volumes) {
+         try {
+            logger.trace("<< provisioning volume '%s'", volume);
+            final org.apache.jclouds.profitbricks.rest.domain.Volume.Request.CreatePayload request = org.apache.jclouds.profitbricks.rest.domain.Volume.Request.creatingBuilder()
+                    .dataCenterId(dataCenterId)
+                    .image(image.getId())

Is it intentional that here we provision every volume with an image? (i.e.: If we attached 5 volumes, each has a bootable OS?)

> +         logger.trace(">> provisioning complete for server. returned id='%s'", serverId);
+
+      } catch (Exception ex) {
+         logger.error(ex, ">> failed to provision server. rollbacking..");
+         destroyVolumes(volumeIds, dataCenterId);
+         throw Throwables.propagate(ex);
+      }
+
+      waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
+      waitDcUntilAvailable.apply(dataCenterId);
+
+      //attach bootVolume to Server
+      api.serverApi().attachVolume(Server.Request.attachVolumeBuilder()
+              .dataCenterId(dataCenterId)
+              .serverId(serverId)
+              .volumeId(bootVolume.id())

IIRC, if one creates a server (line 193) with the `bootVolume` param set, it'll be automatically attached after that server is provisioned. Is this not the case anymore?

> +         public List<Snapshot> call() throws Exception {
+            logger.trace("<< fetching snapshots");
+            List<Snapshot> remoteSnapshots = api.snapshotApi().list(new DepthOptions().depth(1));
+            logger.trace(">> snapshots feched.");
+
+            return remoteSnapshots;
+         }
+
+      });
+
+      return Iterables.concat(getUnchecked(images), getUnchecked(snapshots));
+   }
+
+   @Override
+   public Provisionable getImage(String id
+   ) {

Woops right paren

>     DE_FKB("de/fkb", "Germany, Karlsruhe"),
    DE_FRA("de/fra", "Germany, Frankfurt (M)"),
    US_LAS("us/las", "USA, Las Vegas"),
    US_LASDEV("us/lasdev", "USA Developer cluster"),
-   UNRECOGNIZED("unrecognized", "Unrecognized location");
+   UNRECOGNIZED("unrecognized", "Unrecognized location"),
+   Mock("mock", "mock");

[nit] All caps

>        return UNRECOGNIZED;
    }
+
+   @Override
+   public String toString() {
+      return id;

Make this more descriptive, something like:
```
   return "Location[id=" + id + ", description=" + description + "]";
```

..or don't override it at all, and use the actual `getId()` method, to print out the ID.

> @@ -61,9 +66,9 @@
             <scope>provided</scope>
         </dependency>
         <dependency>
-           <groupId>org.apache.jclouds.driver</groupId>
-           <artifactId>jclouds-okhttp</artifactId>
-           <version>${jclouds.version}</version>
+            <groupId>org.apache.jclouds.driver</groupId>
+            <artifactId>jclouds-okhttp</artifactId>
+            <version>${jclouds.version}</version>

[nit] Formatting

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#pullrequestreview-884467

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +        this.provisioningManager = provisioningManager;
> +    }
> +
> +    private void SetDataCenterId(String id) {
> +        dataCenterId = id;
> +    }
> +
> +    @Override
> +    public NodeAndInitialCredentials<ServerInDataCenter> createNodeWithGroupEncodedIntoName(String group, String name, Template template) {
> +        final String dataCenterId = template.getLocation().getId();
> +        SetDataCenterId(dataCenterId);
> +        Hardware hardware = template.getHardware();
> +        TemplateOptions options = template.getOptions();
> +        final String loginUser = isNullOrEmpty(options.getLoginUser()) ? "root" : options.getLoginUser();
> +//        final String password = options.hasLoginPassword() ? options.getLoginPassword() : Passwords.generate();
> +        final String password = "LTbAHNbcMt";

Is... this password suppose to be here?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77744270

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Reopened #292.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#event-811844281

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Changing to the ubuntu 15 made it work, all the test pass now except for one `testAScriptExecutionAfterBootWithBasicTemplate `with this error message, it seems like it cannot login with the user foo, i have tried to add a wait of two minutes after server creation but no luck any thoughts?

```
(foo:rsa[fingerprint(94:4d:28:84:3a:ae:1e:39:30:f0:bb:38:44:58:44:d4),sha1(f6:ce:f4:d2:e0:bd:8a:f6:48:6c:ba:e0:4b:08:d7:c1:42:96:ac:82)]@158.222.103.139:22) (foo:rsa[fingerprint(94:4d:28:84:3a:ae:1e:39:30:f0:bb:38:44:58:44:d4),sha1(f6:ce:f4:d2:e0:bd:8a:f6:48:6c:ba:e0:4b:08:d7:c1:42:96:ac:82)]@158.222.103.139:22) error acquiring {hostAndPort=158.222.103.139:22, loginUser=foo, ssh=445447871, connectTimeout=300000, sessionTimeout=300000} (not retryable): Exhausted available authentication methods
org.jclouds.rest.AuthorizationException
	at org.jclouds.sshj.SshjSshClient.propagate(SshjSshClient.java:394)
	at org.jclouds.sshj.SshjSshClient.acquire(SshjSshClient.java:215)
	at org.jclouds.sshj.SshjSshClient.connect(SshjSshClient.java:224)
```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230193392

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +        final String password = "LTbAHNbcMt";
> +
> +//        final org.jclouds.compute.domain.Image image = template.getImage();
> +
> +        // provision all volumes based on hardware
> +        List<? extends Volume> volumes = hardware.getVolumes();
> +        List<String> volumeIds = Lists.newArrayListWithExpectedSize(volumes.size());
> +
> +        int i = 1;
> +        for (final Volume volume : volumes) {
> +            try {
> +                logger.trace("<< provisioning volume '%s'", volume);
> +                final org.apache.jclouds.profitbricks.rest.domain.Volume.Request.CreatePayload request = org.apache.jclouds.profitbricks.rest.domain.Volume.Request.creatingBuilder()
> +                        .dataCenterId(dataCenterId)
> +                        // put image to first volume
> +                        .image("02a49ebb-27b7-11e6-8e88-52540005ab80")

Take the image id from the template options instead

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77744368

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -108,6 +121,13 @@
>              <artifactId>logback-classic</artifactId>
>              <scope>test</scope>
>          </dependency>
> +        <dependency>
> +            <groupId>org.apache.jclouds.driver</groupId>
> +            <artifactId>jclouds-log4j</artifactId>
> +            <version>2.0.0-SNAPSHOT</version>

Use `${jclouds.version}`

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73310603

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Matt Baldwin <no...@github.com>.
@devcsrj *nudge* ;)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-250526210

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +                destroyVolume(volumeId, dataCenterId);
> +            }
> +        }
> +        waitDcUntilAvailable.apply(dataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
> +
> +        LoginCredentials serverCredentials = LoginCredentials.builder()
> +                .user(loginUser)
> +                .password(password)
> +                .build();
> +
> +        String serverInDataCenterId = DataCenterAndId.fromDataCenterAndId(dataCenterId, serverId).slashEncode();
> +        ServerInDataCenter server = getNode(serverInDataCenterId);
> +        // Last paranoid check
> +        waitDcUntilAvailable.apply(dataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));

Really needed? They should be already available since last check.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311516

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> @@ -38,6 +38,7 @@
>  
>    <properties>
>      <jclouds.version>2.0.0-SNAPSHOT</jclouds.version>
> +	<checkstyle.skip>true</checkstyle.skip>

This needs to be removed

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73310501

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

25ab6d0  minor fix


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/23c285072ed22918cbdc374429e49ed60cfb5e91..25ab6d02d2f493b2488a32c21625f9f82586f6e9

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
Full Stack trace

```
(foo:rsa[fingerprint(34:3e:d9:0d:4f:c2:78:ed:e2:60:7e:6f:1c:42:c3:88),sha1(65:81:a8:37:1c:f5:c6:70:b0:d2:d5:60:05:eb:8b:ef:53:92:d9:57)]@158.222.103.136:22) (foo:rsa[fingerprint(34:3e:d9:0d:4f:c2:78:ed:e2:60:7e:6f:1c:42:c3:88),sha1(65:81:a8:37:1c:f5:c6:70:b0:d2:d5:60:05:eb:8b:ef:53:92:d9:57)]@158.222.103.136:22) error acquiring {hostAndPort=158.222.103.136:22, loginUser=foo, ssh=1169424009, connectTimeout=300000, sessionTimeout=300000} (not retryable): Exhausted available authentication methods
org.jclouds.rest.AuthorizationException
	at org.jclouds.sshj.SshjSshClient.propagate(SshjSshClient.java:394)
	at org.jclouds.sshj.SshjSshClient.acquire(SshjSshClient.java:215)
	at org.jclouds.sshj.SshjSshClient.connect(SshjSshClient.java:224)
	at org.jclouds.compute.callables.SudoAwareInitManager.refreshAndRunAction(SudoAwareInitManager.java:74)
	at org.jclouds.compute.callables.BlockUntilInitScriptStatusIsZeroThenReturnOutput.interruptTask(BlockUntilInitScriptStatusIsZeroThenReturnOutput.java:159)
	at com.google.common.util.concurrent.AbstractFuture.cancel(AbstractFuture.java:136)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.weCanCancelTasks(BaseComputeServiceLiveTest.java:305)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.testAScriptExecutionAfterBootWithBasicTemplate(BaseComputeServiceLiveTest.java:262)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods
	at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:335)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:163)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:49)
	at org.jclouds.sshj.SshjSshClient.acquire(SshjSshClient.java:195)
	at org.jclouds.sshj.SshjSshClient.connect(SshjSshClient.java:224)
	at org.jclouds.compute.callables.SudoAwareInitManager.refreshAndRunAction(SudoAwareInitManager.java:74)
	at org.jclouds.compute.callables.BlockUntilInitScriptStatusIsZeroThenReturnOutput.interruptTask(BlockUntilInitScriptStatusIsZeroThenReturnOutput.java:159)
	at com.google.common.util.concurrent.AbstractFuture.cancel(AbstractFuture.java:136)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.weCanCancelTasks(BaseComputeServiceLiveTest.java:305)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.testAScriptExecutionAfterBootWithBasicTemplate(BaseComputeServiceLiveTest.java:262)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: net.schmizz.sshj.userauth.UserAuthException: Timeout expired
	at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:33)
	at net.schmizz.sshj.userauth.UserAuthException$1.chain(UserAuthException.java:26)
	at net.schmizz.concurrent.Promise.retrieve(Promise.java:139)
	at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:69)
	at net.schmizz.sshj.SSHClient.auth(SSHClient.java:211)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:335)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:163)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:49)
	at org.jclouds.sshj.SshjSshClient.acquire(SshjSshClient.java:195)
	at org.jclouds.sshj.SshjSshClient.connect(SshjSshClient.java:224)
	at org.jclouds.compute.callables.SudoAwareInitManager.refreshAndRunAction(SudoAwareInitManager.java:74)
	at org.jclouds.compute.callables.BlockUntilInitScriptStatusIsZeroThenReturnOutput.interruptTask(BlockUntilInitScriptStatusIsZeroThenReturnOutput.java:159)
	at com.google.common.util.concurrent.AbstractFuture.cancel(AbstractFuture.java:136)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.weCanCancelTasks(BaseComputeServiceLiveTest.java:305)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.testAScriptExecutionAfterBootWithBasicTemplate(BaseComputeServiceLiveTest.java:262)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.util.concurrent.TimeoutException: Timeout expired
	at net.schmizz.concurrent.Promise.retrieve(Promise.java:139)
	at net.schmizz.sshj.userauth.UserAuthImpl.authenticate(UserAuthImpl.java:69)
	at net.schmizz.sshj.SSHClient.auth(SSHClient.java:211)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316)
	at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:335)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:163)
	at org.jclouds.sshj.SSHClientConnection.create(SSHClientConnection.java:49)
	at org.jclouds.sshj.SshjSshClient.acquire(SshjSshClient.java:195)
	at org.jclouds.sshj.SshjSshClient.connect(SshjSshClient.java:224)
	at org.jclouds.compute.callables.SudoAwareInitManager.refreshAndRunAction(SudoAwareInitManager.java:74)
	at org.jclouds.compute.callables.BlockUntilInitScriptStatusIsZeroThenReturnOutput.interruptTask(BlockUntilInitScriptStatusIsZeroThenReturnOutput.java:159)
	at com.google.common.util.concurrent.AbstractFuture.cancel(AbstractFuture.java:136)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.weCanCancelTasks(BaseComputeServiceLiveTest.java:305)
	at org.jclouds.compute.internal.BaseComputeServiceLiveTest.testAScriptExecutionAfterBootWithBasicTemplate(BaseComputeServiceLiveTest.java:262)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:85)
	at org.testng.internal.Invoker.invokeMethod(Invoker.java:696)
	at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:882)
	at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1189)
	at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:124)
	at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:108)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

```

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-230298271

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
rebuild please

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-227426325

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@devcsrj How close would you say we are to closing this PR?

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-249547764

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

2707084  commit


-- 
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/aaeb697c0e5d81667841e3f626a5ae15bb56dda9..27070843b4bd7b1932a423d6a692d0edf4064717

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx All tests passed except for testWeCanCancelTasks with the same error mentioned above

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-234660679

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@nacx the stderr.log had this 
dpkg-preconfigure: unable to re-open stdin: No such file or directory
W: --force-yes is deprecated, use one of the options starting with --allow instead.
E: Package 'openjdk-6-jdk' has no installation candidate
aborting: JDK installation failed


---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-228495314

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@alibazlamit pushed 1 commit.

7930af3  Removed Dev code


---
You are receiving this because you are subscribed to this thread.
View it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/68a7157f67bb281aaeb06a4c2259649edad65782..7930af3e52bdf19e29c29dbc045231a91cfe3d4f

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Ignasi Barrera <no...@github.com>.
> +        if (image != null) {
> +            logger.trace(">> found image [%s].", image.properties().name());
> +            return image;
> +        }
> +        // try search snapshots
> +        logger.trace("<< not found from images. searching for snapshot with id=%s", id);
> +        Snapshot snapshot = api.snapshotApi().get(id);
> +        if (snapshot != null) {
> +            logger.trace(">> found snapshot [%s]", snapshot.properties().name());
> +            return snapshot;
> +        }
> +        throw new ResourceNotFoundException("No image/snapshot with id '" + id + "' was found");
> +    }
> +
> +    @Override
> +    public Iterable<DataCenter> listLocations() {

Locations are configured via properties, so this method should never be invoked. Let this method just throw an Unsupported op exception.

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/9251ab7434bcafb1dcbec5a718acc3c24517c94d#r73311769

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
> +        }
> +        // Last paranoid check
> +        waitDcUntilAvailable.apply(dataCenterId);
> +
> +        LoginCredentials serverCredentials = LoginCredentials.builder()
> +                .user(loginUser)
> +                .password(password)
> +                .build();
> +        String serverInDataCenterId = DataCenterAndId.fromDataCenterAndId(dataCenterId, serverId).slashEncode();
> +        rebootNode(serverInDataCenterId);
> +        waitServerUntilAvailable.apply(ServerRef.create(dataCenterId, serverId));
> +
> +        try {
> +            Thread.sleep(90000);
> +        } catch (InterruptedException ex) {
> +            java.util.logging.Logger.getLogger(ProfitBricksComputeServiceAdapter.class.getName()).log(Level.SEVERE, null, ex);

Use the injected `logger` field

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292/files/1533bf29a80f2c87834f501abd91ea399debd688#r77744876

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by Reijhanniel Jearl Campos <no...@github.com>.
Hello! 

> How close would you say we are to closing this PR

I'd say it's long overdue! Seeing your live tests passing from your gist, I'd say the impl addresses the contract required by the `ComputeService`. Just some last nitpicks like that [overriden toString](https://github.com/jclouds/jclouds-labs/pull/292#discussion_r79763475), and the [formatting in pom](https://github.com/jclouds/jclouds-labs/pull/292#discussion_r79763965). Otherwise, I'd say this LGTM.

/cc @nacx PR now yours for last review?

---
What're your plans btw after this gets merged? I'd personally like to see:
- Arbitrary CPU/RAM support, as this is [now supported](https://jclouds.apache.org/blog/2016/08/22/arbitrary-cpu-ram/)
- [JCLOUDS-1082](https://issues.apache.org/jira/browse/JCLOUDS-1082) Firewall configurations
- [JCLOUDS-1083](https://issues.apache.org/jira/browse/JCLOUDS-1083) Inbound port configurations

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-251289003

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
alibazlamit commented on this pull request.



> +                          .build()
+                  );
+               }
+            }));
+
+            logger.trace(">> volume connected.");
+         } catch (Exception ex) {
+            try {
+               // delete unconnected volume
+               logger.warn(ex, ">> failed to connect volume '%s'. deleting..", volumeId);
+               destroyVolume(volumeId, dataCenterId);
+               logger.warn(ex, ">> rolling back server..", serverId);
+               destroyServer(serverId, dataCenterId);
+               throw ex;
+            } catch (Exception ex1) {
+               java.util.logging.Logger.getLogger(ProfitBricksComputeServiceAdapter.class.getName()).log(Level.SEVERE, null, ex1);

Updated to the latest just let me know if you need me to squash this, Thanks for the review.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by alibazlamit <no...@github.com>.
@devcsrj this is the gist including the arbitrary support tests [here ](https://gist.github.com/alibazlamit/0dcbdcf91009c0fc4c54b2878ed6b512), all the nitpicks have been changed and pushed, i hope we will be able to close this one soon as you said its long overdue.

Thanks.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-251405462

Re: [jclouds/jclouds-labs] Pb compute api (#292)

Posted by jasminSPC <no...@github.com>.
@nacx is the issue above blocking this PR?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs/pull/292#issuecomment-231145295