You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by ahgittin <gi...@git.apache.org> on 2014/10/22 02:54:49 UTC

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

GitHub user ahgittin opened a pull request:

    https://github.com/apache/incubator-brooklyn/pull/265

    allow units to be passed for `minRam` and `minDisk`

    i have wanted to do this for so damn long.  @andreaturli @grkvlt wdyt?

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/ahgittin/incubator-brooklyn jclouds-units

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-brooklyn/pull/265.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #265
    
----
commit e157fdeb011d645cff424621e125ab41a3fdfbe8
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Date:   2014-10-22T00:53:08Z

    allow units to be passed for `minRam` and `minDisk`

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

Posted by grkvlt <gi...@git.apache.org>.
Github user grkvlt commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/265#discussion_r19212806
  
    --- Diff: locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java ---
    @@ -797,7 +798,7 @@ public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
                         }})
                 .put(MIN_DISK, new CustomizeTemplateBuilder() {
                         public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
    -                        tb.minDisk(TypeCoercions.coerce(v, Double.class));
    +                        tb.minDisk( (int)(ByteSizeStrings.parse(""+v, "g")/1024/1024/1024) );
    --- End diff --
    
    Also, we shouldn't be using `""+v` to coerce, prefer `v.toString()` or `Strings.toString(v)` to make intent clear, despite verbiage.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/265#discussion_r19205184
  
    --- Diff: locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java ---
    @@ -797,7 +798,7 @@ public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
                         }})
                 .put(MIN_DISK, new CustomizeTemplateBuilder() {
                         public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
    -                        tb.minDisk(TypeCoercions.coerce(v, Double.class));
    +                        tb.minDisk( (int)(ByteSizeStrings.parse(""+v, "g")/1024/1024/1024) );
    --- End diff --
    
    Why divide this by `1024`? Disk MB are normally `10^6` - see http://en.wikipedia.org/wiki/Megabyte#Definitions
    Same applies for GB (10^9 for disks, and 2^30 for RAM).
    Do we need different `ByteSizeStrings.parse` methods / configuration?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/incubator-brooklyn/pull/265


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

Posted by ahgittin <gi...@git.apache.org>.
Github user ahgittin commented on the pull request:

    https://github.com/apache/incubator-brooklyn/pull/265#issuecomment-60376792
  
    agree with all comments, esp the 1000 v 1024 to set jclouds values


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

[GitHub] incubator-brooklyn pull request: allow units to be passed for `min...

Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/265#discussion_r19205283
  
    --- Diff: locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java ---
    @@ -797,7 +798,7 @@ public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
                         }})
                 .put(MIN_DISK, new CustomizeTemplateBuilder() {
                         public void apply(TemplateBuilder tb, ConfigBag props, Object v) {
    -                        tb.minDisk(TypeCoercions.coerce(v, Double.class));
    +                        tb.minDisk( (int)(ByteSizeStrings.parse(""+v, "g")/1024/1024/1024) );
    --- End diff --
    
    Ah, I see we have ByteSizeStrings in an overloaded `ByteSizeStrings.parse`. Should we be using that, rather than relying on careful units (e.g. 1kB versus 1k etc)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---