Update
This commit is contained in:
parent
8a25ee99ff
commit
6d1813933f
@ -3,9 +3,8 @@ class VolumeController < ApplicationController
|
|||||||
def index
|
def index
|
||||||
file_directory("/mnt")
|
file_directory("/mnt")
|
||||||
get_conf
|
get_conf
|
||||||
info = get_info.split("\n")
|
info = get_volume_info.split("\n")
|
||||||
|
if info.blank?
|
||||||
if info.blank?
|
|
||||||
flash[:danger] = "Check Server"
|
flash[:danger] = "Check Server"
|
||||||
else
|
else
|
||||||
parse_info(info)
|
parse_info(info)
|
||||||
@ -16,34 +15,26 @@ class VolumeController < ApplicationController
|
|||||||
@volumes = Array.new
|
@volumes = Array.new
|
||||||
volume = Hash.new
|
volume = Hash.new
|
||||||
df = get_df
|
df = get_df
|
||||||
|
info << "\n"
|
||||||
info.each do |t|
|
info.each do |t|
|
||||||
next if t.equal? info.first
|
next if t.equal? info.first
|
||||||
|
|
||||||
if t.include? ":"
|
if t.include? ":"
|
||||||
temp = t.split(":")
|
temp = t.split(":")
|
||||||
volume[temp[0]] = temp[1]
|
volume[temp[0]] = temp[1]
|
||||||
else
|
else
|
||||||
if df.include? volume['Volume Name'].delete(' ')
|
String state = (df.include? volume['Volume Name'].delete(' ')) ? "Mounted" : "UnMounted"
|
||||||
volume['Mount State'] = "Mounted"
|
volume['Mount State'] = state
|
||||||
else
|
|
||||||
volume['Mount State'] = "UnMounted"
|
|
||||||
end
|
|
||||||
puts volume['Volume Name'] + ": " + volume['Mount State']
|
|
||||||
|
|
||||||
@volumes << volume
|
@volumes << volume
|
||||||
volume = Hash.new
|
volume = Hash.new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@volumes << volume
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_df
|
def get_df
|
||||||
return `df -P`
|
return `df -P`
|
||||||
end
|
end
|
||||||
|
|
||||||
def get_info
|
def get_volume_info
|
||||||
return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume info`
|
return `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume info`
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -69,7 +60,7 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
volume_name = volume_name.delete(' ')
|
volume_name = volume_name.delete(' ')
|
||||||
puts "gluster volume stop " + volume_name
|
puts "gluster volume stop " + volume_name
|
||||||
output = `yes | sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume stop #{volume_name}`
|
`yes | sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume stop #{volume_name}`
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -78,7 +69,7 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
volume_name = volume_name.delete(' ')
|
volume_name = volume_name.delete(' ')
|
||||||
puts "gluster volume start " + volume_name
|
puts "gluster volume start " + volume_name
|
||||||
output = `sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume start #{volume_name}`
|
`sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume start #{volume_name}`
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -88,7 +79,7 @@ class VolumeController < ApplicationController
|
|||||||
volume_name = params[:volume_name]
|
volume_name = params[:volume_name]
|
||||||
volume_name = volume_name.delete(' ')
|
volume_name = volume_name.delete(' ')
|
||||||
puts "gluster volume delete " + volume_name
|
puts "gluster volume delete " + volume_name
|
||||||
output = `yes | sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume delete #{volume_name}`
|
`yes | sshpass -p#{@config["host_password"]} ssh #{@config["host_port"]} #{@config["host_user"]}@#{@config["host_ip"]} gluster volume delete #{volume_name}`
|
||||||
redirect_to '/volume/index'
|
redirect_to '/volume/index'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -116,7 +116,7 @@
|
|||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<%@volumes.each do |t|%>
|
<%@volumes.each do |t|%>
|
||||||
<div class="col-md-12 col-sm-12 col-xs-12">
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||||
<div class="x_panel">
|
<div class="x_panel">
|
||||||
<div class="x_title">
|
<div class="x_title">
|
||||||
<h2>Infomation <small><%=t["Volume Name"]%></small></h2>
|
<h2>Infomation <small><%=t["Volume Name"]%></small></h2>
|
||||||
@ -141,9 +141,9 @@
|
|||||||
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
|
<div class="x_content" <%if t!=@volumes[0]%> style="display: none;" <%end%> >
|
||||||
|
|
||||||
<!-- left content -->
|
<!-- left content -->
|
||||||
<div class="col-md-4 col-sm-4 col-xs-4">
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||||
|
|
||||||
<div>
|
<div style="margin: 10px">
|
||||||
<p class="text-muted font-13 m-b-30"><code>Volume Info</code></p>
|
<p class="text-muted font-13 m-b-30"><code>Volume Info</code></p>
|
||||||
Type : <%=t["Type"]%> <br>
|
Type : <%=t["Type"]%> <br>
|
||||||
Volume ID : <%=t["Volume ID"]%> <br>
|
Volume ID : <%=t["Volume ID"]%> <br>
|
||||||
@ -153,11 +153,11 @@
|
|||||||
Bricks : <%=t["Bricks"]%> <br>
|
Bricks : <%=t["Bricks"]%> <br>
|
||||||
Bricks1 : <%=t["Brick1"]%> <br>
|
Bricks1 : <%=t["Brick1"]%> <br>
|
||||||
Options Reconfigured : <%=t["Options Reconfigured"]%> <br>
|
Options Reconfigured : <%=t["Options Reconfigured"]%> <br>
|
||||||
performance.readdir-ahead : <%=t["performance.readdir-ahead"]%>
|
performance.readdir-ahead : <%=t["performance.readdir-ahead"]%> <br>
|
||||||
mount state: <%=t["Mount State"]%> <br>
|
mount state: <%=t["Mount State"]%> <br>
|
||||||
<br><br><br>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<% if t["Status"] == " Stopped" %>
|
<% if t["Status"] == " Stopped" %>
|
||||||
<a class="btn btn-app" href="/volume/start/<%=t['Volume Name']%>">
|
<a class="btn btn-app" href="/volume/start/<%=t['Volume Name']%>">
|
||||||
<i class="fa fa-play" style="color:#26B99A;"></i>
|
<i class="fa fa-play" style="color:#26B99A;"></i>
|
||||||
@ -178,7 +178,7 @@
|
|||||||
|
|
||||||
|
|
||||||
<!-- right content -->
|
<!-- right content -->
|
||||||
<div class="col-md-8 col-sm-8 col-xs-8">
|
<div class="col-md-6 col-sm-6 col-xs-12">
|
||||||
<p>Drag multiple files to the box below for multi upload or click to select files.</p>
|
<p>Drag multiple files to the box below for multi upload or click to select files.</p>
|
||||||
<form action="/file_upload" method="post" enctype="multipart/form-data" class="dropzone" style="border: 1px solid #e5e5e5; height: 300px; overflow:auto;">
|
<form action="/file_upload" method="post" enctype="multipart/form-data" class="dropzone" style="border: 1px solid #e5e5e5; height: 300px; overflow:auto;">
|
||||||
</form>
|
</form>
|
||||||
|
Loading…
Reference in New Issue
Block a user