Update volume create

This commit is contained in:
Youngkyun Kim
2016-09-11 12:46:58 -04:00
parent 1f8e23e6a5
commit 5fd211e56b
2 changed files with 33 additions and 16 deletions

View File

@@ -64,16 +64,33 @@ class VolumeController < ApplicationController
end
def volume_create
@config = get_conf
volume_name = params[:volume_name]
volume_type = params[:volume_type]
num_of_brick = params[:num_of_brick]
bricks = params[:bricks]
bricks_str = ""
command = String.new
command << "sshpass"
command << " -p"
command << @config["host_password"].to_s
command << " ssh "
command << @config["host_port"].to_s
command << " "
command << @config["host_user"].to_s
command << "@"
command << @config["host_ip"].to_s
command << " gluster volume create "
command << volume_name + " "
if !volume_type.include? "Distribute"
command << volume_type + " " + num_of_brick + " "
end
bricks.each do |t|
bricks_str << t
bricks_str << " "
command << t
command << " "
end
puts "gluster volume create " + volume_name + " " + bricks_str + "force"
`sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} \
gluster volume create #{volume_name} #{bricks_str} force`
command << "force"
puts command
`#{command}`
redirect_to '/volume/index'
end