You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@jclouds.apache.org by VRanga000 <no...@github.com> on 2015/05/13 00:18:04 UTC
[jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
You can view, comment on, or merge this pull request online at:
https://github.com/jclouds/jclouds/pull/748
-- Commit Summary --
* initial commit of openstack scheduler hints feature
* minor fixes + checkstyle
* live test for serverapi create with scheduler hints
* Externalized server group test param for live test for creating scheduler hints, cleaned up test code, renamed variable for clarity
* live test for serverapi create with scheduler hints
* Merge pull request #1 from VRanga000/master
* Merge remote-tracking branch 'upstream/master'
* JCLOUDS-903 - Support nova compute api extension server groups
-- File Changes --
M apis/cloudstack/src/test/java/org/jclouds/cloudstack/features/VolumeApiLiveTest.java (4)
M apis/ec2/src/test/java/org/jclouds/ec2/compute/EC2ComputeServiceLiveTest.java (18)
M apis/ec2/src/test/java/org/jclouds/ec2/features/ElasticBlockStoreApiLiveTest.java (6)
M apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/NovaApi.java (24)
A apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/SchedulerHints.java (111)
A apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/domain/ServerGroup.java (128)
M apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ExtensionNamespaces.java (7)
A apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/extensions/ServerGroupApi.java (102)
M apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/options/CreateServerOptions.java (34)
M apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/compute/NovaComputeServiceLiveTest.java (13)
A apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerGroupApiExpectTest.java (162)
A apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/extensions/ServerGroupApiLiveTest.java (105)
M apis/openstack-nova/src/test/java/org/jclouds/openstack/nova/v2_0/features/ServerApiLiveTest.java (66)
M apis/openstack-nova/src/test/resources/extension_list_full.json (8)
M apis/openstack-nova/src/test/resources/extension_list_openstack.json (8)
A apis/openstack-nova/src/test/resources/servergroup_create.json (9)
A apis/openstack-nova/src/test/resources/servergroup_created.json (12)
A apis/openstack-nova/src/test/resources/servergroup_list.json (13)
M compute/src/test/java/org/jclouds/compute/internal/BaseComputeServiceLiveTest.java (240)
M core/src/test/java/org/jclouds/apis/BaseContextLiveTest.java (19)
M providers/aws-ec2/src/test/java/org/jclouds/aws/ec2/compute/AWSEC2ComputeServiceLiveTest.java (8)
M providers/gogrid/src/test/java/org/jclouds/gogrid/compute/GoGridComputeServiceLiveTest.java (6)
M skeletons/standalone-compute/src/test/java/org/jclouds/servermanager/compute/ServerManagerComputeServiceLiveTest.java (2)
-- Patch Links --
https://github.com/jclouds/jclouds/pull/748.patch
https://github.com/jclouds/jclouds/pull/748.diff
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> @@ -132,7 +134,57 @@ public void testCreateWithNetworkOptions() {
> }
> }
>
> - /**
> + /**
> + * This test creates a server with a scheduler hint that sets the server group
> + * used for <a href="http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html#groupaffinityfilter"GroupAffinity</a>
I rather have the info directly in here in addition to the links
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30763006
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> +@Beta
> +@Extension(of = ServiceType.COMPUTE, namespace = ExtensionNamespaces.SERVER_GROUPS)
> +@RequestFilters(AuthenticateRequest.class)
> +@Consumes(MediaType.APPLICATION_JSON)
> +public interface ServerGroupApi {
> + /**
> + * List all Security Groups.
> + *
> + * @return all Security Groups
> + */
> + @Named("ServerGroup:list")
> + @GET
> + @Path("/os-server-groups")
> + @SelectJson("server_groups")
> + @Fallback(EmptyFluentIterableOnNotFoundOr404.class)
> + FluentIterable<ServerGroup> list();
We should avoid using guava collections in user-facing interfaces. Also - does this need paging support?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30762622
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> @@ -914,7 +912,7 @@ protected void tearDownContext() {
> // Destroy all nodes in the group but also make sure to destroy other created nodes that might not be in it.
> // The "testCreateTwoNodesWithOneSpecifiedName" creates nodes with an explicit name that puts them outside the group,
> // so the list of nodes should also be taken into account when destroying the nodes.
> - client.destroyNodesMatching(Predicates.<NodeMetadata> or(inGroup(group), in(nodes)));
> + computeService.destroyNodesMatching(Predicates.<NodeMetadata>or(inGroup(group), in(nodes)));
> }
> } catch (Exception e) {
>
Thanks for the cleanup!
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30763106
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> +import org.testng.annotations.Test;
> +
> +import java.net.URI;
> +import java.util.Set;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +
> +/**
> + * Tests ServerGroupApi guice wiring and parsing
> + */
> +@Test(groups = "unit", testName = "ServerGroupApiExpectTest")
> +public class ServerGroupApiExpectTest extends BaseNovaApiExpectTest {
Is it feasible to switch to mock tests here in line with how new code is being implemented? Or do we want to keep expect tests for consistency.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30762831
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> +
> + public T fromSecurityGroup(ServerGroup in) {
> + return this
> + .id(in.getId())
> + .policies(in.getPolicies());
> + }
> + }
> +
> + private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
> + @Override
> + protected ConcreteBuilder self() {
> + return this;
> + }
> + }
> +
> + private final String id;
Formatting looks strange
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30762560
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> + * Scheduler hints extension (alias "OS-SCH-HNT"): Hints passed directly to the scheduler via /servers POST
> + *
> + * @see <a href="http://developer.openstack.org/api-ref-compute-v2-ext.html#createServer" />
> + *
> + * Currently contains support for server group based filters only
> + * <a href="http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html#groupaffinityfilter"GroupAffinity</a>
> + * and <a href="http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html#groupantiaffinityfilter"GroupAntiAffinity</a>
> + * Can be easily augmented to add support for other filters that can be configured via scheduler hints
> +*/
> +public class SchedulerHints {
> +
> + public static Builder builder() {
> + return new ConcreteBuilder();
> + }
> +
> + public Builder toBuilder() {
Do we want to move to the autovalue builders for this?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30762533
Re: [jclouds/jclouds] JCLOUDS-903 - Support nova compute api
extension server groups (#748)
Posted by Andrew Gaul <no...@github.com>.
Closed due to inactivity.
--
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/pull/748#issuecomment-338272496
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by VRanga000 <no...@github.com>.
> +
> + public T fromSecurityGroup(ServerGroup in) {
> + return this
> + .id(in.getId())
> + .policies(in.getPolicies());
> + }
> + }
> +
> + private static class ConcreteBuilder extends Builder<ConcreteBuilder> {
> + @Override
> + protected ConcreteBuilder self() {
> + return this;
> + }
> + }
> +
> + private final String id;
Will fix - odd that it got past checkstyle.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30802535
Re: [jclouds/jclouds] JCLOUDS-903 - Support nova compute api
extension server groups (#748)
Posted by Andrew Gaul <no...@github.com>.
Closed #748.
--
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/pull/748#event-1303436258
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Ignasi Barrera <no...@github.com>.
> +import org.testng.annotations.Test;
> +
> +import java.net.URI;
> +import java.util.Set;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +
> +/**
> + * Tests ServerGroupApi guice wiring and parsing
> + */
> +@Test(groups = "unit", testName = "ServerGroupApiExpectTest")
> +public class ServerGroupApiExpectTest extends BaseNovaApiExpectTest {
We should be using mock tests in any new features we add, regardless of how existing tests are implemented.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30781943
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by VRanga000 <no...@github.com>.
> +import org.testng.annotations.Test;
> +
> +import java.net.URI;
> +import java.util.Set;
> +
> +import static org.testng.Assert.assertEquals;
> +import static org.testng.Assert.assertFalse;
> +import static org.testng.Assert.assertNull;
> +import static org.testng.Assert.assertTrue;
> +
> +
> +/**
> + * Tests ServerGroupApi guice wiring and parsing
> + */
> +@Test(groups = "unit", testName = "ServerGroupApiExpectTest")
> +public class ServerGroupApiExpectTest extends BaseNovaApiExpectTest {
Wildo
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30802809
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by VRanga000 <no...@github.com>.
> @@ -914,7 +912,7 @@ protected void tearDownContext() {
> // Destroy all nodes in the group but also make sure to destroy other created nodes that might not be in it.
> // The "testCreateTwoNodesWithOneSpecifiedName" creates nodes with an explicit name that puts them outside the group,
> // so the list of nodes should also be taken into account when destroying the nodes.
> - client.destroyNodesMatching(Predicates.<NodeMetadata> or(inGroup(group), in(nodes)));
> + computeService.destroyNodesMatching(Predicates.<NodeMetadata>or(inGroup(group), in(nodes)));
> }
> } catch (Exception e) {
>
No problem. Thanks for the review.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30802846
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by VRanga000 <no...@github.com>.
> + * Scheduler hints extension (alias "OS-SCH-HNT"): Hints passed directly to the scheduler via /servers POST
> + *
> + * @see <a href="http://developer.openstack.org/api-ref-compute-v2-ext.html#createServer" />
> + *
> + * Currently contains support for server group based filters only
> + * <a href="http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html#groupaffinityfilter"GroupAffinity</a>
> + * and <a href="http://docs.openstack.org/havana/config-reference/content/scheduler-filters.html#groupantiaffinityfilter"GroupAntiAffinity</a>
> + * Can be easily augmented to add support for other filters that can be configured via scheduler hints
> +*/
> +public class SchedulerHints {
> +
> + public static Builder builder() {
> + return new ConcreteBuilder();
> + }
> +
> + public Builder toBuilder() {
Thanks for the suggestion. Would you mind pointing me to an example?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30802478
Re: [jclouds/jclouds] JCLOUDS-903 - Support nova compute api
extension server groups (#748)
Posted by Andrew Gaul <no...@github.com>.
@vapgar200 do we have a path forward on this pull request?
--
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/pull/748#issuecomment-331354957
Re: [jclouds] JCLOUDS-903 - Support nova compute api extension server
groups (#748)
Posted by Zack Shoylev <no...@github.com>.
> @@ -36,7 +35,7 @@ public NovaComputeServiceLiveTest() {
> provider = "openstack-nova";
> }
>
> - @Override
> + @Override
?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/748/files#r30762757