Hi Ignasi,

that looks like a good plan, thanks for the directions. I'll have a look at it 
and will likely submit a PR in the future.

R.

----- Original Message -----
From: "Ignasi Barrera" <n...@apache.org>
To: user@jclouds.apache.org
Cc: "Josef Cacek" <jca...@redhat.com>
Sent: Thursday, September 1, 2016 12:15:53 AM
Subject: Re: DnsNameValidator and EC2

Hi Richard,

Having a look at the DnsNameValidator, it looks like it is prepared to
be configurable [1]. The problem is that the
FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat class (the
one that uses the group prefix to generate names), instantiates it
directly with fixed values.

I'd suggest a different approach:
* Change that strategy to not assign a DnsNameValidator by default, to
let the Guice injector provide one.
* Configure the min/max variables in the DnsNameValidator to be
optionally injectable and assign the default values there.
* Add constants for the min/max existing property names in the jcloud
Constants class so they are more easily discoverable and configurable.

This way we keep the current behavior but would be allowing users to
set the min/max length as properties when creating the context, in
case they need longer names.

WDYT?


[1] 
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/predicates/validators/DnsNameValidator.java#L42-L43
[2] 
https://github.com/jclouds/jclouds/blob/8053abb5302641a6500cb3f46e7c9e58de3b0ebe/compute/src/main/java/org/jclouds/compute/internal/FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.java#L79

On 31 August 2016 at 14:12, Richard Janik <rja...@redhat.com> wrote:
> Hello everyone,
>
> I've run into [2] some time ago. First off, it's not a problem for me to just 
> shorten the group names. However, I've brought this up with a colleague of 
> mine and it's been suggested, that the limit of 63 characters is in there due 
> to [1], which is obsolete, and that maybe the limit could be removed. I 
> searched briefly through the RFCs that update [1], but couldn't find any 
> clear proof that that the limit has been removed or is higher now.
>
> I've rebuilt JClouds with DnsNameValidator with its max value = 200. The 
> JClouds unit tests are passing and EC2 has no problems with long instance 
> names (~150 characters) either. Other cloud providers might have some issues 
> with that, but I wouldn't know.
>
> So the question is: could the limit of 63 characters on DnsNameValidator be 
> removed or increased without impacting something I'm not aware of? If it 
> could be increased, how high can we go? If its there for a reason, what is 
> the reason?
>
> Thanks for any insights,
> R.
>
> [1]: https://tools.ietf.org/html/rfc1035#section-2.3.4
> [2]: <<< stacktrace begin >>>
> java.lang.IllegalArgumentException: Object 
> 'a-very-long-node-group-name-that-is-definitely-longer-than-sixty-three-characters-and-will-require-postprocessing'
>  doesn't match dns naming constraints. Reason: Can't be null or empty. Length 
> must be 3 to 63 symbols..
>         at 
> org.jclouds.predicates.validators.DnsNameValidator.exception(DnsNameValidator.java:74)
>  ~[jclouds-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.predicates.validators.DnsNameValidator.validate(DnsNameValidator.java:51)
>  ~[jclouds-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.predicates.validators.DnsNameValidator.validate(DnsNameValidator.java:36)
>  ~[jclouds-core-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.compute.internal.FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.checkGroup(FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.java:124)
>  ~[jclouds-compute-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.compute.internal.FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.sharedNameForGroup(FormatSharedNamesAndAppendUniqueStringToThoseWhichRepeat.java:120)
>  ~[jclouds-compute-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.getSecurityGroupsForTagAndOptions(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:168)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.addSecurityGroups(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:199)
>  ~[aws-ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.strategy.CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java:80)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:88)
>  ~[aws-ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.aws.ec2.compute.strategy.CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.execute(CreateKeyPairPlacementAndSecurityGroupsAsNeededAndReturnRunOptions.java:55)
>  ~[aws-ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.createKeyPairAndSecurityGroupsAsNeededThenRunInstances(EC2CreateNodesInGroupThenAddToSet.java:213)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.runInstancesAndWarnOnInvisible(EC2CreateNodesInGroupThenAddToSet.java:151)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.strategy.EC2CreateNodesInGroupThenAddToSet.execute(EC2CreateNodesInGroupThenAddToSet.java:132)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.compute.internal.BaseComputeService.createNodesInGroup(BaseComputeService.java:217)
>  ~[jclouds-compute-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.jclouds.ec2.compute.EC2ComputeService.createNodesInGroup(EC2ComputeService.java:148)
>  ~[ec2-2.0.0-SNAPSHOT.jar:2.0.0-SNAPSHOT]
>         at 
> org.wildfly.extras.sunstone.api.impl.AbstractJCloudsNode.createNode(AbstractJCloudsNode.java:154)
>  ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.api.impl.ec2.EC2Node.<init>(EC2Node.java:81) 
> ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.api.impl.ec2.EC2CloudProvider.createNodeInternal(EC2CloudProvider.java:74)
>  ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.api.impl.AbstractJCloudsCloudProvider.lambda$createNode$3(AbstractJCloudsCloudProvider.java:101)
>  ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.api.impl.AbstractJCloudsCloudProvider$$Lambda$9/2121317689.apply(Unknown
>  Source) ~[na:na]
>         at 
> java.util.concurrent.ConcurrentHashMap.compute(ConcurrentHashMap.java:1853) 
> ~[na:1.8.0_45]
>         at 
> org.wildfly.extras.sunstone.api.impl.AbstractJCloudsCloudProvider.createNode(AbstractJCloudsCloudProvider.java:96)
>  ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.api.impl.AbstractJCloudsCloudProvider.createNode(AbstractJCloudsCloudProvider.java:84)
>  ~[classes/:na]
>         at 
> org.wildfly.extras.sunstone.tests.ec2.EC2LongNodeGroupTest.testLongNodeGroup(EC2LongNodeGroupTest.java:36)
>  ~[test-classes/:na]
>         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
> ~[na:1.8.0_45]
>         at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 
> ~[na:1.8.0_45]
>         at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>  ~[na:1.8.0_45]
>         at java.lang.reflect.Method.invoke(Method.java:497) ~[na:1.8.0_45]
>         at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>  [junit-4.12.jar:4.12]
>         at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>  [junit-4.12.jar:4.12]
>         at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>  [junit-4.12.jar:4.12]
>         at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>  [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325) 
> [junit-4.12.jar:4.12]
>         at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>  [junit-4.12.jar:4.12]
>         at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>  [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290) 
> [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71) 
> [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288) 
> [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58) 
> [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268) 
> [junit-4.12.jar:4.12]
>         at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26) 
> [junit-4.12.jar:4.12]
>         at org.junit.runners.ParentRunner.run(ParentRunner.java:363) 
> [junit-4.12.jar:4.12]
>         at 
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:367)
>  [surefire-junit4-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:274)
>  [surefire-junit4-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
>  [surefire-junit4-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:161)
>  [surefire-junit4-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:290)
>  [surefire-booter-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:242)
>  [surefire-booter-2.19.1.jar:2.19.1]
>         at 
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:121) 
> [surefire-booter-2.19.1.jar:2.19.1]
> <<< stacktrace end >>>

Reply via email to