up
This commit is contained in:
parent
9f6d0d2d7d
commit
a028efd790
@ -39,24 +39,34 @@ class VolumeController < ApplicationController
|
||||
def volume_mount
|
||||
node = Node.take
|
||||
volume_name = params[:volume_name]
|
||||
index = params[:index]
|
||||
mount_point = params[:mount_point]
|
||||
# make command string
|
||||
command = String.new
|
||||
command << "sudo mount -t glusterfs #{node.host_ip}:/#{volume_name} #{mount_point}"
|
||||
puts command
|
||||
`#{command}`
|
||||
redirect_to '/volume/index'
|
||||
#redirect_to '/volume/index'
|
||||
|
||||
render :json => {
|
||||
:volume_info => volume_info(volume_name, index),
|
||||
}
|
||||
end
|
||||
|
||||
def volume_unmount
|
||||
node = Node.take
|
||||
volume_name = params[:volume_name]
|
||||
index = params[:index]
|
||||
# make command string
|
||||
command = String.new
|
||||
command << "sudo umount #{node.host_ip}:/#{volume_name}"
|
||||
puts command
|
||||
`#{command}`
|
||||
redirect_to '/volume/index'
|
||||
#redirect_to '/volume/index'
|
||||
|
||||
render :json => {
|
||||
:volume_info => volume_info(volume_name, index),
|
||||
}
|
||||
end
|
||||
|
||||
def volume_create
|
||||
@ -94,6 +104,7 @@ class VolumeController < ApplicationController
|
||||
def volume_stop
|
||||
node = Node.take
|
||||
volume_name = params[:volume_name]
|
||||
index = params[:index]
|
||||
# make command string
|
||||
command = String.new
|
||||
command << "yes | sshpass -p#{node.user_password} "
|
||||
@ -101,12 +112,17 @@ class VolumeController < ApplicationController
|
||||
command << "gluster volume stop #{volume_name}"
|
||||
puts command
|
||||
`#{command}`
|
||||
redirect_to '/volume/index'
|
||||
#redirect_to '/volume/index'
|
||||
|
||||
render :json => {
|
||||
:volume_info => volume_info(volume_name, index),
|
||||
}
|
||||
end
|
||||
|
||||
def volume_start
|
||||
node = Node.take
|
||||
volume_name = params[:volume_name]
|
||||
index = params[:index]
|
||||
# make command string
|
||||
command = String.new
|
||||
command << "sshpass -p#{node.user_password} "
|
||||
@ -114,7 +130,11 @@ class VolumeController < ApplicationController
|
||||
command << " gluster volume start #{volume_name}"
|
||||
puts command
|
||||
`#{command}`
|
||||
redirect_to '/volume/index'
|
||||
#redirect_to '/volume/index'
|
||||
|
||||
render :json => {
|
||||
:volume_info => volume_info(volume_name, index),
|
||||
}
|
||||
end
|
||||
|
||||
def volume_delete
|
||||
|
@ -48,18 +48,18 @@ module VolumeHelper
|
||||
html << "</div>"
|
||||
# buttons
|
||||
if volume["Mount State"] == "mounted"
|
||||
html << "<button class='btn_mount btn btn-app' value='#{index}'><i class='fa fa-upload'></i> Unmount</button>"
|
||||
html << "<button class='btn_unmount btn btn-app' value='#{index}'><i class='fa fa-upload'></i> Unmount</button>"
|
||||
elsif volume["Status"] == " Started"
|
||||
html << "<a class='btn btn-app' href='/volume/stop/#{volume['Volume Name'].delete(' ')}'>"
|
||||
html << "<button class='btn_stop btn btn-app' value='#{index}'>"
|
||||
html << "<i class='fa fa-pause' style='color:#d9534f;'></i>"
|
||||
html << "<p style='color:#d9534f;'>Stop</p>"
|
||||
html << "</a>"
|
||||
html << "<a class='btn btn-app' href='?volume_name=#{volume['Volume Name'].delete(' ')}#popup_mount'><i class='fa fa-download'></i> Mount</a>"
|
||||
html << "</button>"
|
||||
html << "<button class='btn_mount btn btn-app' value='#{index}'><i class='fa fa-download'></i> Mount</button>"
|
||||
else
|
||||
html << "<a class='btn btn-app' href='/volume/start/#{volume['Volume Name'].delete(' ')}'>"
|
||||
html << "<button class='btn_start btn btn-app'>"
|
||||
html << "<i class='fa fa-play' style='color:#26B99A;'></i>"
|
||||
html << "<p style='color:#26B99A;'>Start</p>"
|
||||
html << "</a>"
|
||||
html << "</button>"
|
||||
html << "<a class='btn btn-app' href='/volume/delete/#{volume['Volume Name'].delete(' ')}'>"
|
||||
html << "<i class='fa fa-trash'></i> Delete"
|
||||
html << "</a>"
|
||||
|
Loading…
Reference in New Issue
Block a user