From 7ff5f4ece276fcfc89fc786e06ddc60ef680697f Mon Sep 17 00:00:00 2001 From: bee0005 Date: Wed, 31 Aug 2016 14:42:14 +0000 Subject: [PATCH] update --- app/controllers/volume_controller.rb | 26 +++++++++++++++----------- app/views/volume/index.html.erb | 25 ++++++++++++++++--------- config/routes.rb | 4 +++- 3 files changed, 34 insertions(+), 21 deletions(-) diff --git a/app/controllers/volume_controller.rb b/app/controllers/volume_controller.rb index 21ed4ad..1433545 100644 --- a/app/controllers/volume_controller.rb +++ b/app/controllers/volume_controller.rb @@ -93,25 +93,29 @@ class VolumeController < ApplicationController render :json => {:file => files , :current => @current_dir} end - def mount + def volume_mount conf_list = get_conf host_ip = String.new - conf_list.each do |t| - if t.include? "host_ip=" - host_ip = t.split("host_ip=")[1] - end - end - volume_name = params[:volume_name] - volume_name = volume_name.delete(' ') - puts "mount -t glusterfs " + host_ip + ":/" + volume_name + " /mnt/glusterfs" + conf_list.each do |t| + if t.include? "host_ip=" + host_ip = t.split("host_ip=")[1] + end + end + volume_name = params[:volume_name] + volume_name = volume_name.delete(' ') + puts "mount -t glusterfs " + host_ip + ":/" + volume_name + " /mnt/glusterfs" redirect_to '/volume/index' end def volume_stop - puts "gluster volume stop volume_name" + volume_name = params[:volume_name] + volume_name = volume_name.delete(' ') + puts "gluster volume stop " + volume_name end def volume_start - puts "gluster volume start volume_name" + volume_name = params[:volume_name] + volume_name = volume_name.delete(' ') + puts "gluster volume start " + volume_name end end diff --git a/app/views/volume/index.html.erb b/app/views/volume/index.html.erb index 7236bbb..e1699f7 100644 --- a/app/views/volume/index.html.erb +++ b/app/views/volume/index.html.erb @@ -52,16 +52,23 @@ Bricks : <%=t["Bricks"]%>
Bricks1 : <%=t["Brick1"]%>
Options Reconfigured : <%=t["Options Reconfigured"]%>
- performance.readdir-ahead : <%=t["performance.readdir-ahead"]%>


- <% if t["Status"] == " start" %> - - <% else %> - - + performance.readdir-ahead : <%=t["performance.readdir-ahead"]%> +


+ <% if t["Status"] == " start" %> +
+ Start + + + <% else %> + + Stop + + + Mount - - <% end %> - + + <% end %> +

Drag multiple files to the box below for multi upload or click to select files.

diff --git a/config/routes.rb b/config/routes.rb index 8dcb35f..804d9e7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -21,7 +21,9 @@ Rails.application.routes.draw do post 'volume/changeDir' => 'volume#checkDir' - get 'volume/mount/:volume_name' => "volume#mount" + get 'volume/mount/:volume_name' => "volume#volume_mount" + get 'volume/start/:volume_name' => "volume#volume_start" + get 'volume/stop/:volume_name' => "volume#volume_stop" get 'peer/index' => 'peer#index'