Create and start a gluster volume.
authorMichael Adam <obnox@samba.org>
Mon, 23 Feb 2015 19:18:29 +0000 (20:18 +0100)
committerMichael Adam <obnox@samba.org>
Mon, 23 Feb 2015 19:18:29 +0000 (20:18 +0100)
Vagrantfile

index 848021e0543ee87f65d4cf2a8c7445ef945b5f01..f5af3ee85ada25210811ea65291d2a759b8b2924 100644 (file)
@@ -232,6 +232,18 @@ do
 done
 SCRIPT
 
+GLUSTER_CREATEVOL_SCRIPT = <<SCRIPT
+set -e
+VOLNAME=$1
+shift
+REP=$1
+shift
+
+echo "gluster volume create $VOLNAME rep $REP transport tcp $@"
+gluster volume create $VOLNAME rep $REP transport tcp $@
+
+gluster volume start $VOLNAME
+SCRIPT
 
 #
 # The vagrant machine definitions
@@ -304,6 +316,11 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
         s.args = cluster_internal_ips
       end
 
+      node.vm.provision "gluster_createvol", type: "shell" do |s|
+        mount_points = cluster_internal_ips.map { |ip| "#{ip}:/export/vdb1/brick" }
+        s.inline = GLUSTER_CREATEVOL_SCRIPT
+        s.args = [ "gv0", "3" ] + mount_points
+      end
     end
   end