brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] incubator-brooklyn git commit: Minor changes to help downstream Riak project
Date Fri, 14 Nov 2014 16:45:17 GMT
Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master c77f9ff4b -> e22b5bfb7


Minor changes to help downstream Riak project


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3275d369
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3275d369
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3275d369

Branch: refs/heads/master
Commit: 3275d36930811d98baa55954f066514992267fe4
Parents: 50e3cbc
Author: Martin Harris <github@nakomis.com>
Authored: Fri Nov 14 16:39:13 2014 +0000
Committer: Martin Harris <github@nakomis.com>
Committed: Fri Nov 14 16:39:13 2014 +0000

----------------------------------------------------------------------
 .../brooklyn/location/jclouds/JcloudsLocation.java    | 14 +++++++++++++-
 .../brooklyn/entity/nosql/riak/RiakClusterImpl.java   |  2 +-
 .../brooklyn/entity/nosql/riak/RiakNodeSshDriver.java | 12 ++++++++----
 3 files changed, 22 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3275d369/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
----------------------------------------------------------------------
diff --git a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
index e77fb81..98daca0 100644
--- a/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
+++ b/locations/jclouds/src/main/java/brooklyn/location/jclouds/JcloudsLocation.java
@@ -718,7 +718,19 @@ public class JcloudsLocation extends AbstractCloudMachineProvisioningLocation
im
                     
                     List<String> iptablesRules = createIptablesRulesForNetworkInterface((Iterable<Integer>)
setup.get(INBOUND_PORTS));
                     iptablesRules.add(IptablesCommands.saveIptablesRules());
-                    sshMachineLocation.execCommands("Inserting iptables rules", iptablesRules);
+                    List<String> batch = Lists.newArrayList();
+                    // Some entities, such as Riak (erlang based) have a huge range of ports,
which leads to a script that
+                    // is too large to run (fails with a broken pipe). Batch the rules into
batches of 50
+                    for (String rule : iptablesRules) {
+                        batch.add(rule);
+                        if (batch.size() == 50) {
+                            sshMachineLocation.execCommands("Inserting iptables rules, 50
command batch", batch);
+                            batch.clear();
+                        }
+                    }
+                    if (batch.size() > 0) {
+                        sshMachineLocation.execCommands("Inserting iptables rules", batch);
+                    }
                     sshMachineLocation.execCommands("List iptables rules", ImmutableList.of(IptablesCommands.listIptablesRule()));
                 }
                 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3275d369/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java
index 4ffec3f..f16932b 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakClusterImpl.java
@@ -79,7 +79,7 @@ public class RiakClusterImpl extends DynamicClusterImpl implements RiakCluster
{
 
         if (anyNode.isPresent()) {
             log.info("Planning and Committing cluster changes on node: {}, cluster: {}",
anyNode.get().getId(), getId());
-            Entities.invokeEffector(this, anyNode.get(), RiakNode.COMMIT_RIAK_CLUSTER);
+            Entities.invokeEffector(this, anyNode.get(), RiakNode.COMMIT_RIAK_CLUSTER).blockUntilEnded();
             setAttribute(IS_CLUSTER_INIT, true);
         } else {
             log.warn("No Riak Nodes are found on the cluster: {}. Initialization Failed",
getId());

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3275d369/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
----------------------------------------------------------------------
diff --git a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
index 8e45424..090a85a 100644
--- a/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
+++ b/software/nosql/src/main/java/brooklyn/entity/nosql/riak/RiakNodeSshDriver.java
@@ -287,11 +287,11 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver
implemen
         return isPackageInstall ? "/etc/riak" : Urls.mergePaths(getExpandedInstallDir(),
"etc");
     }
 
-    private String getRiakCmd() {
+    protected String getRiakCmd() {
         return isPackageInstall ? "riak" : Urls.mergePaths(getExpandedInstallDir(), "bin/riak");
     }
 
-    private String getRiakAdminCmd() {
+    protected String getRiakAdminCmd() {
         return isPackageInstall ? "riak-admin" : Urls.mergePaths(getExpandedInstallDir(),
"bin/riak-admin");
     }
 
@@ -414,12 +414,16 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver
implemen
         return ((RiakNode) entity).hasJoinedCluster();
     }
 
-    private boolean isRiakOnPath() {
+    protected boolean isRiakOnPath() {
         return (newScript("riakOnPath")
                 .body.append("which riak")
                 .execute() == 0);
     }
 
+    protected boolean isPackageInstall() {
+        return isPackageInstall;
+    }
+
     private String getRiakName() {
         return entity.getAttribute(RiakNode.RIAK_NODE_NAME);
     }
@@ -429,7 +433,7 @@ public class RiakNodeSshDriver extends AbstractSoftwareProcessSshDriver
implemen
         return isPackageInstall ? "/var/lib/riak/ring" : Urls.mergePaths(getExpandedInstallDir(),
"lib/ring");
     }
 
-    private boolean isVersion1() {
+    protected boolean isVersion1() {
         return getVersion().startsWith("1.");
     }
 


Mime
View raw message