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