You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by Ignasi Barrera <no...@github.com> on 2015/05/27 15:51:40 UTC

[jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Although the ComputeService methods are called suspend/resume, they could perfectly map to the stop/start instance operations, given that we already [map the STOPPED state to SUSPENDED](https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java#L177). This would also fix the issue expressed in [this stackoverflow question](https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java#L177).

This is a WIP, as the `testSuspendResume` live test is failing [here](https://github.com/jclouds/jclouds/blob/master/compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java#L598). @danbroudy could you help debugging and fixing this test?

Note that this PR also fixes several ComputeServiceLiveTests that were not being executed and depends on https://github.com/jclouds/jclouds/pull/753 to fix the authorization live test.
You can view, comment on, or merge this pull request online at:

  https://github.com/jclouds/jclouds-labs-google/pull/141

-- Commit Summary --

  * Add support to start and stop instances in the ComputeService

-- File Changes --

    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java (8)
    M google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/functions/Resources.java (14)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceLiveTest.java (58)
    M google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceMockTest.java (2)
    A google-compute-engine/src/test/java/org/jclouds/googlecomputeengine/compute/functions/ResourcesMockTest.java (126)
    D google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/firewall_list.json (36)
    D google-compute-engine/src/test/resources/GoogleComputeEngineServiceExpectTest/network_get.json (10)
    A google-compute-engine/src/test/resources/test (27)

-- Patch Links --

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

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Andrew Bayer <no...@github.com>.
Ok, https://cloud.google.com/compute/docs/instances/#stop_job seems to explain it - TERMINATED is actually stopped here. https://github.com/jclouds/jclouds-labs-google/blob/master/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java#L178 needs to change.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-109352847

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Ignasi Barrera <no...@github.com>.
Pushed to master as [a3cb4490](http://git-wip-us.apache.org/repos/asf/jclouds-labs-google/commit/a3cb4490). I'll push it to 1.9.x later today as the merge there presented a couple conflicts.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-110015243

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

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

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#event-325309671

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by danbroudy <no...@github.com>.
I started coding this up and ran into the same problem. I'll look into it. 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-106641024

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Ignasi Barrera <no...@github.com>.
Many thanks @abayer, you rock! I've applied your fix and the tests are passing now. I've already squashed the commits and amended the message to include the jira issue reference.

The node status change was not trivial, though. I've had to change the "orphaned groups" predicate to consider unexisting nodes instead of nodes in TERMINATED state, and the GoogleComputeEngineService too. The "cleanupIncidentalResources" assumes that terminated nodes are also returned by the API, so I had to fix that too. Anyway everything seems to be in place now. Any feedback is welcome!

There are two unrelated test faliures, though (but I'll merge the PR anyway as they are not related to this change):

```
-------------------------------------------------------------------------------
Test set: TestSuite
-------------------------------------------------------------------------------
Tests run: 155, Failures: 2, Errors: 0, Skipped: 5, Time elapsed: 2,686.911 sec <<< FAILURE! - in TestSuite
testValidateUrlMap(org.jclouds.googlecomputeengine.features.UrlMapApiLiveTest)  Time elapsed: 1.465 sec  <<< FAILURE!
java.lang.AssertionError: expected [UrlMapValidateResult{result=UrlMapValidateResultInternal{loadSucceeded=true, loadErrors=null, testPassed=true, testFailures=null}}] but found [UrlMapValidateResult{result=UrlMapValidateResultInternal{loadSucceeded=true, loadErrors=null, testPassed=false, testFailures=[TestFailure{host=jclouds-test, path=/test/path, expectedService=https://www.googleapis.com/compute/v1/projects/jclouds-dev/global/backendServices/url-map-api-live-test-backend-service, actualService=url-map-api-live-test-backend-service}]}}]
    at org.testng.Assert.fail(Assert.java:94)
    at org.testng.Assert.failNotEquals(Assert.java:494)
    at org.testng.Assert.assertEquals(Assert.java:123)
    at org.testng.Assert.assertEquals(Assert.java:165)
    at org.jclouds.googlecomputeengine.features.UrlMapApiLiveTest.testValidateUrlMap(UrlMapApiLiveTest.java:151)

testValidateUrlMapWithOptions(org.jclouds.googlecomputeengine.features.UrlMapApiLiveTest)  Time elapsed: 0.71 sec  <<< FAILURE!
java.lang.AssertionError: expected [UrlMapValidateResult{result=UrlMapValidateResultInternal{loadSucceeded=true, loadErrors=null, testPassed=true, testFailures=null}}] but found [UrlMapValidateResult{result=UrlMapValidateResultInternal{loadSucceeded=true, loadErrors=null, testPassed=false, testFailures=[TestFailure{host=jclouds-test, path=/test/path, expectedService=https://www.googleapis.com/compute/v1/projects/jclouds-dev/global/backendServices/url-map-api-live-test-backend-service, actualService=url-map-api-live-test-backend-service}]}}]
    at org.testng.Assert.fail(Assert.java:94)
    at org.testng.Assert.failNotEquals(Assert.java:494)
    at org.testng.Assert.assertEquals(Assert.java:123)
    at org.testng.Assert.assertEquals(Assert.java:165)
    at org.jclouds.googlecomputeengine.features.UrlMapApiLiveTest.testValidateUrlMapWithOptions(UrlMapApiLiveTest.java:180)
```

It looks like an inconsistency with an expected service name, but I completely ignore how the url map stuff works. @danbroudy could you have a look at these failures?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-109552960

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Andrew Bayer <no...@github.com>.
yaaaay - passes with that changed. 

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-109359455

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Andrew Bayer <no...@github.com>.
To clarify - GCE doesn't show deleted instances at all. So TERMINATED == SUSPENDED from a NodeMetadata perspective under all conditions.

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-109353385

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Ignasi Barrera <no...@github.com>.
Looks like an internal Jenkins failure, rebuild please

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-106219464

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Ignasi Barrera <no...@github.com>.
rebuild please

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-106210151

Re: [jclouds-labs-google] WIP: Add support to start and stop instances in the ComputeService (#141)

Posted by Andrew Bayer <no...@github.com>.
Yeah, those ghost failures hit me too - not sure where they came from. But hey. Lemme know when this gets to 1.9.x so I can pull it into our internal app. =)

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-google/pull/141#issuecomment-110168828