update
This commit is contained in:
parent
e65e3e4f3a
commit
132cb5cef5
@ -159,4 +159,32 @@ class VolumeController < ApplicationController
|
|||||||
output = `sshpass -p#{host_password} ssh #{host_port} #{host_user}@#{host_ip} gluster volume start #{volume_name}`
|
output = `sshpass -p#{host_password} ssh #{host_port} #{host_user}@#{host_ip} gluster volume start #{volume_name}`
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def volume_delete
|
||||||
|
volume_name = params[:volume_name]
|
||||||
|
volume_name = volume_name.delete(' ')
|
||||||
|
|
||||||
|
|
||||||
|
host_user = "root"
|
||||||
|
host_ip = "127.0.0.1"
|
||||||
|
host_password = "secret"
|
||||||
|
host_port = ""
|
||||||
|
|
||||||
|
@conf_list.each do |t|
|
||||||
|
if t.include? "host_name="
|
||||||
|
host_user = t.split("host_user=")[1]
|
||||||
|
elsif t.include? "host_ip="
|
||||||
|
host_ip = t.split("host_ip=")[1]
|
||||||
|
elsif t.include? "host_port=" and !t.split("host_port=")[1].nil?
|
||||||
|
host_port = "-p " + t.split("host_port=")[1] + " "
|
||||||
|
elsif t.include? "host_password="
|
||||||
|
host_password = t.split("host_password=")[1]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
puts "gluster volume start " + volume_name
|
||||||
|
output = `sshpass -p#{host_password} ssh #{host_port} #{host_user}@#{host_ip} gluster volume delete #{volume_name}`
|
||||||
|
redirect_to '/volume/index'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -58,12 +58,13 @@
|
|||||||
<a class="btn btn-round btn-success btn-lg" href="/volume/start/<%=t['Volume Name']%>">
|
<a class="btn btn-round btn-success btn-lg" href="/volume/start/<%=t['Volume Name']%>">
|
||||||
<i class="fa fa-play"></i> Start
|
<i class="fa fa-play"></i> Start
|
||||||
</a>
|
</a>
|
||||||
<!--<button type="button" class="btn btn-round btn-success btn-lg"><i class="fa fa-play"></i> Start</button> -->
|
<a class="btn btn-app" href="/volume/delete/<%=t['Volume Name']%>">
|
||||||
|
<i class="fa fa-trash"></i> Delete
|
||||||
|
</a>
|
||||||
<% else %>
|
<% else %>
|
||||||
<a class="btn btn-round btn-danger btn-lg" href="/volume/stop/<%=t['Volume Name']%>">
|
<a class="btn btn-round btn-danger btn-lg" href="/volume/stop/<%=t['Volume Name']%>">
|
||||||
<i class="fa fa-pause"></i> Stop
|
<i class="fa fa-pause"></i> Stop
|
||||||
</a>
|
</a>
|
||||||
<!--<button type="button" class="btn btn-round btn-danger btn-lg"><i class="fa fa-pause"></i> Stop</button>-->
|
|
||||||
<a class="btn btn-app" href="/volume/mount/<%=t['Volume Name']%>">
|
<a class="btn btn-app" href="/volume/mount/<%=t['Volume Name']%>">
|
||||||
<i class="fa fa-upload"></i> Mount
|
<i class="fa fa-upload"></i> Mount
|
||||||
</a>
|
</a>
|
||||||
|
@ -24,6 +24,7 @@ Rails.application.routes.draw do
|
|||||||
get 'volume/mount/:volume_name' => "volume#volume_mount"
|
get 'volume/mount/:volume_name' => "volume#volume_mount"
|
||||||
get 'volume/start/:volume_name' => "volume#volume_start"
|
get 'volume/start/:volume_name' => "volume#volume_start"
|
||||||
get 'volume/stop/:volume_name' => "volume#volume_stop"
|
get 'volume/stop/:volume_name' => "volume#volume_stop"
|
||||||
|
get 'volume/delete/:volume_name' => "volume#volume_delete"
|
||||||
|
|
||||||
|
|
||||||
get 'peer/index' => 'peer#index'
|
get 'peer/index' => 'peer#index'
|
||||||
|
Loading…
Reference in New Issue
Block a user