mirror of
https://github.com/cubefs/cubefs.git
synced 2026-08-02 02:00:56 +00:00
Enhancment: add console for operation
Signed-off-by: ansjsun <ansj-sun@163.com>
This commit is contained in:
parent
f0c164523e
commit
b87a53234d
@ -181,7 +181,7 @@ func main() {
|
||||
module = ModuleObject
|
||||
case RoleConsole:
|
||||
server = console.NewServer()
|
||||
module = ModuleObject
|
||||
module = ModuleConsole
|
||||
default:
|
||||
daemonize.SignalOutcome(fmt.Errorf("Fatal: role mismatch: %v", role))
|
||||
os.Exit(1)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>ChubaoFS</title><link rel=icon href=/static/favicon.ico><link href=/static/css/app.34d117afcd65e67772d068564e0d22b3.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.a5b4c77806b4b123a7a1.js></script><script type=text/javascript src=/static/js/vendor.8b1697221f35295d801a.js></script><script type=text/javascript src=/static/js/app.2c8318e5db0ab0d23919.js></script></body></html>
|
||||
<!DOCTYPE html><html><head><meta charset=utf-8><meta name=viewport content="width=device-width,initial-scale=1"><title>ChubaoFS</title><link rel=icon href=/static/favicon.ico><link href=/static/css/app.b90f5f893a324ec8ce0527f90f74f730.css rel=stylesheet></head><body><div id=app></div><script type=text/javascript src=/static/js/manifest.2ab2b9fccfd387c10baa.js></script><script type=text/javascript src=/static/js/vendor.8b1697221f35295d801a.js></script><script type=text/javascript src=/static/js/app.261c91dc5b1de6f2b8f4.js></script></body></html>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
console/html/static/js/1.acabd7c050f76b6fd632.js
Normal file
2
console/html/static/js/1.acabd7c050f76b6fd632.js
Normal file
File diff suppressed because one or more lines are too long
1
console/html/static/js/1.acabd7c050f76b6fd632.js.map
Normal file
1
console/html/static/js/1.acabd7c050f76b6fd632.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
2
console/html/static/js/5.f9c439c0fc5da9b8d400.js
Normal file
2
console/html/static/js/5.f9c439c0fc5da9b8d400.js
Normal file
File diff suppressed because one or more lines are too long
1
console/html/static/js/5.f9c439c0fc5da9b8d400.js.map
Normal file
1
console/html/static/js/5.f9c439c0fc5da9b8d400.js.map
Normal file
File diff suppressed because one or more lines are too long
2
console/html/static/js/7.4d7dbe5d69058ebe51d8.js
Normal file
2
console/html/static/js/7.4d7dbe5d69058ebe51d8.js
Normal file
File diff suppressed because one or more lines are too long
1
console/html/static/js/7.4d7dbe5d69058ebe51d8.js.map
Normal file
1
console/html/static/js/7.4d7dbe5d69058ebe51d8.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +0,0 @@
|
||||
webpackJsonp([9],{PJZA:function(t,e){},Quw4:function(t,e,s){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var n=s("KrWI"),o={name:"login",data:function(){return{name:"root",password:"ChubaoFSRoot"}},methods:{login:function(){var t=this,e={userID:this.name,password:this.sha1(this.password)};this.apollo.query(this.url.login,n.a.login,e).then(function(e){e.code||e.message?t.$message.error(e.message):(sessionStorage.setItem("access_token",e.data.login.token),sessionStorage.setItem("access_userID",e.data.login.userID),sessionStorage.getItem("returnUrl")?window.location.href=sessionStorage.getItem("returnUrl"):t.$router.push({path:"/"}))}).catch(function(t){console.log(t)})}}},a={render:function(){var t=this,e=t.$createElement,s=t._self._c||e;return s("div",{staticClass:"login login-bg"},[s("h1",{staticClass:"login-logo"},[t._v("ChubaoFS")]),t._v(" "),s("div",{staticClass:"login-con clearfix"},[t._m(0),t._v(" "),s("div",{staticClass:"login-block"},[s("h3",{staticClass:"mb10"},[t._v("SEE MORE")]),t._v(" "),s("p",{staticClass:"h3-subtit"},[t._v("Complete the form below to log in")]),t._v(" "),s("div",{staticClass:"mt60"},[s("p",{staticClass:"login-form-tit mb5"},[t._v("NAME")]),t._v(" "),s("el-input",{staticClass:"login-form-txt",attrs:{placeholder:"Please enter name"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.login(e)}},model:{value:t.name,callback:function(e){t.name=e},expression:"name"}}),t._v(" "),s("p",{staticClass:"login-form-tit mt40 mb5"},[t._v("PASSWORD")]),t._v(" "),s("el-input",{staticClass:"login-form-txt",attrs:{"show-password":"",placeholder:"Please enter password"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.login(e)}},model:{value:t.password,callback:function(e){t.password=e},expression:"password"}}),t._v(" "),s("el-button",{staticClass:"login-form-submit mt60",attrs:{type:"primary"},on:{click:t.login}},[t._v("LOG IN")])],1)])]),t._v(" "),s("div",{staticClass:"copy-right"},[t._v("\n © 2020 The ChubaoFS Authors\n ")])])},staticRenderFns:[function(){var t=this.$createElement,e=this._self._c||t;return e("div",{staticClass:"login-show-text"},[e("h3",{staticClass:"login-welcom"},[this._v("Welcome!")]),this._v(" "),e("div",{staticClass:"underline mt10"}),this._v(" "),e("p",{staticClass:"login-welcom-subtit"},[this._v("Sign in to access your account.")])])}]};var i=s("C7Lr")(o,a,!1,function(t){s("PJZA"),s("hQe8")},"data-v-05e68e67",null);e.default=i.exports},hQe8:function(t,e){}});
|
||||
//# sourceMappingURL=9.94dfa4295dfc819f8beb.js.map
|
||||
File diff suppressed because one or more lines are too long
2
console/html/static/js/9.b85dfda776888a30886f.js
Normal file
2
console/html/static/js/9.b85dfda776888a30886f.js
Normal file
@ -0,0 +1,2 @@
|
||||
webpackJsonp([9],{Quw4:function(t,s,e){"use strict";Object.defineProperty(s,"__esModule",{value:!0});var n=e("KrWI"),o={name:"login",data:function(){return{name:"",password:""}},methods:{login:function(){var t=this,s={userID:this.name,password:this.sha1(this.password)};this.apollo.query(this.url.login,n.a.login,s).then(function(s){s.code||s.message?t.$message.error(s.message):(sessionStorage.setItem("access_token",s.data.login.token),sessionStorage.setItem("access_userID",s.data.login.userID),sessionStorage.getItem("returnUrl")?window.location.href=sessionStorage.getItem("returnUrl"):t.$router.push({path:"/"}))}).catch(function(t){console.log(t)})}}},a={render:function(){var t=this,s=t.$createElement,e=t._self._c||s;return e("div",{staticClass:"login login-bg"},[e("h1",{staticClass:"login-logo"},[t._v("ChubaoFS")]),t._v(" "),e("div",{staticClass:"login-con clearfix"},[t._m(0),t._v(" "),e("div",{staticClass:"login-block"},[e("h3",{staticClass:"mb10"},[t._v("SEE MORE")]),t._v(" "),e("p",{staticClass:"h3-subtit"},[t._v("Complete the form below to log in")]),t._v(" "),e("div",{staticClass:"mt60"},[e("p",{staticClass:"login-form-tit mb5"},[t._v("NAME")]),t._v(" "),e("el-input",{staticClass:"login-form-txt",attrs:{placeholder:"Please enter name"},nativeOn:{keyup:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:t.login(s)}},model:{value:t.name,callback:function(s){t.name=s},expression:"name"}}),t._v(" "),e("p",{staticClass:"login-form-tit mt40 mb5"},[t._v("PASSWORD")]),t._v(" "),e("el-input",{staticClass:"login-form-txt",attrs:{"show-password":"",placeholder:"Please enter password"},nativeOn:{keyup:function(s){return!s.type.indexOf("key")&&t._k(s.keyCode,"enter",13,s.key,"Enter")?null:t.login(s)}},model:{value:t.password,callback:function(s){t.password=s},expression:"password"}}),t._v(" "),e("el-button",{staticClass:"login-form-submit mt60",attrs:{type:"primary"},on:{click:t.login}},[t._v("LOG IN")])],1)])]),t._v(" "),e("div",{staticClass:"copy-right"},[t._v("\n © 2020 The ChubaoFS Authors\n ")])])},staticRenderFns:[function(){var t=this.$createElement,s=this._self._c||t;return s("div",{staticClass:"login-show-text"},[s("h3",{staticClass:"login-welcom"},[this._v("Welcome!")]),this._v(" "),s("div",{staticClass:"underline mt10"}),this._v(" "),s("p",{staticClass:"login-welcom-subtit"},[this._v("Sign in to access your account.")])])}]};var i=e("C7Lr")(o,a,!1,function(t){e("Z/l9"),e("S3Y+")},"data-v-3fdf28f8",null);s.default=i.exports},"S3Y+":function(t,s){},"Z/l9":function(t,s){}});
|
||||
//# sourceMappingURL=9.b85dfda776888a30886f.js.map
|
||||
1
console/html/static/js/9.b85dfda776888a30886f.js.map
Normal file
1
console/html/static/js/9.b85dfda776888a30886f.js.map
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1,2 +1,2 @@
|
||||
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var f,d,i,u=0,s=[];u<r.length;u++)d=r[u],t[d]&&s.push(t[d][0]),t[d]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(r,c,a);s.length;)s.shift()();if(a)for(u=0;u<a.length;u++)i=o(o.s=a[u]);return i};var r={},t={16:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"14c165eafe7b12388a58",1:"6ff77b465826846fc47b",2:"98a9a770f49da267c6e5",3:"39d22bf59d9ee4e42c4b",4:"72413eb69d424012d1d7",5:"721c3380bec4458add21",6:"6780e808a9c5d7e826e7",7:"c4fdbc37cbc3c4d513ae",8:"c237132ffce2f70edfb3",9:"94dfa4295dfc819f8beb",10:"5046ef9db7e9cb219cf8",11:"0d156d6ecd557516c64f",12:"831c0dba28444e5d6610",13:"12589b49735141713d8b"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,c.appendChild(a),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="/",o.oe=function(e){throw console.error(e),e}}([]);
|
||||
//# sourceMappingURL=manifest.a5b4c77806b4b123a7a1.js.map
|
||||
!function(e){var n=window.webpackJsonp;window.webpackJsonp=function(r,c,a){for(var f,d,i,u=0,s=[];u<r.length;u++)d=r[u],t[d]&&s.push(t[d][0]),t[d]=0;for(f in c)Object.prototype.hasOwnProperty.call(c,f)&&(e[f]=c[f]);for(n&&n(r,c,a);s.length;)s.shift()();if(a)for(u=0;u<a.length;u++)i=o(o.s=a[u]);return i};var r={},t={16:0};function o(n){if(r[n])return r[n].exports;var t=r[n]={i:n,l:!1,exports:{}};return e[n].call(t.exports,t,t.exports,o),t.l=!0,t.exports}o.e=function(e){var n=t[e];if(0===n)return new Promise(function(e){e()});if(n)return n[2];var r=new Promise(function(r,o){n=t[e]=[r,o]});n[2]=r;var c=document.getElementsByTagName("head")[0],a=document.createElement("script");a.type="text/javascript",a.charset="utf-8",a.async=!0,a.timeout=12e4,o.nc&&a.setAttribute("nonce",o.nc),a.src=o.p+"static/js/"+e+"."+{0:"14c165eafe7b12388a58",1:"acabd7c050f76b6fd632",2:"98a9a770f49da267c6e5",3:"1cf7e00ef00e46f87804",4:"cfdd75ad506c129ca348",5:"f9c439c0fc5da9b8d400",6:"6780e808a9c5d7e826e7",7:"4d7dbe5d69058ebe51d8",8:"c237132ffce2f70edfb3",9:"b85dfda776888a30886f",10:"5046ef9db7e9cb219cf8",11:"0d156d6ecd557516c64f",12:"831c0dba28444e5d6610",13:"12589b49735141713d8b"}[e]+".js";var f=setTimeout(d,12e4);function d(){a.onerror=a.onload=null,clearTimeout(f);var n=t[e];0!==n&&(n&&n[1](new Error("Loading chunk "+e+" failed.")),t[e]=void 0)}return a.onerror=a.onload=d,c.appendChild(a),r},o.m=e,o.c=r,o.d=function(e,n,r){o.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="/",o.oe=function(e){throw console.error(e),e}}([]);
|
||||
//# sourceMappingURL=manifest.2ab2b9fccfd387c10baa.js.map
|
||||
File diff suppressed because one or more lines are too long
@ -128,7 +128,7 @@ func (c *ConsoleNode) loadConfig(cfg *config.Config) (err error) {
|
||||
}
|
||||
log.LogInfof("loadConfig: setup config: %v(%v)", proto.MasterAddr, strings.Join(c.masters, ","))
|
||||
|
||||
c.objectNodeDomain = cfg.GetString(proto.ConsoleNodeDomain)
|
||||
c.objectNodeDomain = cfg.GetString(proto.ObjectNodeDomain)
|
||||
|
||||
c.server = mux.NewRouter()
|
||||
|
||||
|
||||
@ -62,6 +62,26 @@ http {
|
||||
}
|
||||
}
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name console.chubao.io ~^(?<bucket>.+)\.console\.chubao\.io$;
|
||||
charset utf-8;
|
||||
|
||||
location / {
|
||||
proxy_pass http://192.168.0.50:80;
|
||||
|
||||
proxy_http_version 1.1;
|
||||
proxy_set_header Host $http_host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
|
||||
access_log /tmp/console_access.log main;
|
||||
error_log /tmp/console_error.log warn;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
server {
|
||||
listen 80;
|
||||
server_name master.chubao.io;
|
||||
@ -79,4 +99,4 @@ http {
|
||||
error_log /tmp/master_error.log warn;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -7,9 +7,9 @@ import (
|
||||
"fmt"
|
||||
"github.com/chubaofs/chubaofs/proto"
|
||||
"github.com/chubaofs/chubaofs/util/log"
|
||||
"github.com/chubaofs/chubaofs/util/ump"
|
||||
"github.com/samsarahq/thunder/graphql"
|
||||
"github.com/samsarahq/thunder/graphql/schemabuilder"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
@ -513,40 +513,37 @@ func (m *ClusterService) alarmList(ctx context.Context, args struct {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
size := int64(args.Size * 5000)
|
||||
size := int64(args.Size * 1000)
|
||||
|
||||
list := make([]*WarnMessage, 0, 100)
|
||||
|
||||
path := filepath.Join(ump.UmpDataDir, "ump_master_business.log")
|
||||
path := filepath.Join(log.LogDir, "master"+log.CriticalLogFileName)
|
||||
|
||||
stat, err := os.Stat(path)
|
||||
if err != nil {
|
||||
if os.IsNotExist(err) {
|
||||
list = append(list, &WarnMessage{
|
||||
Time: time.Now().Format("2006-01-02 15:04:05"),
|
||||
Key: "not found",
|
||||
Hostname: m.leaderInfo.addr,
|
||||
Type: "not found",
|
||||
Value: "not found",
|
||||
Detail: path + " not exist",
|
||||
})
|
||||
return list, nil
|
||||
} else {
|
||||
return nil, err
|
||||
}
|
||||
list = append(list, &WarnMessage{
|
||||
Time: time.Now().Format("2006-01-02 15:04:05"),
|
||||
Key: "not found",
|
||||
Hostname: m.leaderInfo.addr,
|
||||
Type: "not found",
|
||||
Value: "not found",
|
||||
Detail: path + " read has err:" + err.Error(),
|
||||
})
|
||||
return list, nil
|
||||
}
|
||||
|
||||
f, err := os.Open(path)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("open file has err:[%s]", err.Error())
|
||||
}
|
||||
|
||||
if stat.Size() > size {
|
||||
if _, err := f.Seek(stat.Size()-size, 0); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("seek file has err:[%s]", err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
if err := f.Close(); err != nil {
|
||||
log.LogErrorf("close alarm file has err:[%s]", err.Error())
|
||||
@ -555,27 +552,50 @@ func (m *ClusterService) alarmList(ctx context.Context, args struct {
|
||||
|
||||
buf := bufio.NewReader(f)
|
||||
|
||||
for {
|
||||
line, _, err := buf.ReadLine()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
msg := &WarnMessage{}
|
||||
if err := json.Unmarshal(line, msg); err != nil {
|
||||
log.LogWarnf("unmarshal line has err:[%s]", err.Error())
|
||||
continue
|
||||
}
|
||||
if line == nil || len(line) == 0 {
|
||||
all, err := ioutil.ReadAll(buf)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("read file:[%s] size:[%d] has err:[%s]", path, stat.Size(), err.Error())
|
||||
}
|
||||
|
||||
for _, line := range strings.Split(string(all), "\n") {
|
||||
|
||||
if len(line) == 0 {
|
||||
break
|
||||
}
|
||||
|
||||
split := strings.Split(string(line), " ")
|
||||
|
||||
var msg *WarnMessage
|
||||
|
||||
if len(split) < 7 {
|
||||
value := string(line)
|
||||
msg = &WarnMessage{
|
||||
Time: "unknow",
|
||||
Key: "parse msg has err",
|
||||
Hostname: "parse msg has err",
|
||||
Type: "parse msg has err",
|
||||
Value: value,
|
||||
Detail: value,
|
||||
}
|
||||
} else {
|
||||
value := strings.Join(split[6:], " ")
|
||||
msg = &WarnMessage{
|
||||
Time: split[0] + " " + split[1],
|
||||
Key: split[4],
|
||||
Hostname: split[5],
|
||||
Type: split[2],
|
||||
Value: value,
|
||||
Detail: value,
|
||||
}
|
||||
}
|
||||
|
||||
list = append(list, msg)
|
||||
}
|
||||
|
||||
//reverse slice
|
||||
l := len(list)
|
||||
for i := 0; i < l/2; i++ {
|
||||
list[i], list[l-i] = list[l-i], list[i]
|
||||
list[i], list[l-i-1] = list[l-i-1], list[i]
|
||||
}
|
||||
|
||||
if len(list) > int(args.Size) {
|
||||
|
||||
@ -885,6 +885,7 @@ func (v *Volume) WritePart(path string, multipartId string, partId uint16, reade
|
||||
Size: int64(size),
|
||||
Mode: os.FileMode(DefaultFileMode),
|
||||
ModifyTime: time.Now(),
|
||||
CreateTime: tempInodeInfo.CreateTime,
|
||||
ETag: etag,
|
||||
Inode: tempInodeInfo.Inode,
|
||||
}
|
||||
@ -1382,7 +1383,7 @@ func (v *Volume) ObjectMeta(path string) (info *FSFileInfo, err error) {
|
||||
Path: path,
|
||||
Size: int64(inoInfo.Size),
|
||||
Mode: os.FileMode(inoInfo.Mode),
|
||||
CreateTime: inoInfo.CreateTime,
|
||||
CreateTime: inoInfo.CreateTime,
|
||||
ModifyTime: inoInfo.ModifyTime,
|
||||
ETag: etagValue.ETag(),
|
||||
Inode: inoInfo.Inode,
|
||||
@ -1783,6 +1784,7 @@ func (v *Volume) supplyListFileInfo(fileInfos []*FSFileInfo) (err error) {
|
||||
if i >= 0 && i < len(inodeInfos) && inodeInfos[i].Inode == fileInfo.Inode {
|
||||
fileInfo.Size = int64(inodeInfos[i].Size)
|
||||
fileInfo.ModifyTime = inodeInfos[i].ModifyTime
|
||||
fileInfo.CreateTime = inodeInfos[i].CreateTime
|
||||
fileInfo.Mode = os.FileMode(inodeInfos[i].Mode)
|
||||
}
|
||||
}
|
||||
@ -2071,6 +2073,7 @@ func (v *Volume) CopyFile(sv *Volume, sourcePath, targetPath, metaDirective stri
|
||||
Size: 0,
|
||||
Mode: DefaultDirMode,
|
||||
ModifyTime: tInodeInfo.ModifyTime,
|
||||
CreateTime: tInodeInfo.CreateTime,
|
||||
ETag: EmptyContentMD5String,
|
||||
Inode: tInodeInfo.Inode,
|
||||
MIMEType: HeaderValueContentTypeDirectory,
|
||||
@ -2267,6 +2270,7 @@ func (v *Volume) CopyFile(sv *Volume, sourcePath, targetPath, metaDirective stri
|
||||
Size: int64(fileSize),
|
||||
Mode: sMode,
|
||||
ModifyTime: tInodeInfo.ModifyTime,
|
||||
CreateTime: tInodeInfo.CreateTime,
|
||||
ETag: md5Value,
|
||||
Inode: tInodeInfo.Inode,
|
||||
}
|
||||
|
||||
@ -51,9 +51,9 @@ const (
|
||||
|
||||
// For server
|
||||
const (
|
||||
MasterAddr = "masterAddr"
|
||||
ListenPort = "listen"
|
||||
ConsoleNodeDomain = "consoleNodeDomain"
|
||||
MasterAddr = "masterAddr"
|
||||
ListenPort = "listen"
|
||||
ObjectNodeDomain = "objectNodeDomain"
|
||||
)
|
||||
|
||||
type MountOption struct {
|
||||
|
||||
@ -254,11 +254,14 @@ var (
|
||||
|
||||
var gLog *Log = nil
|
||||
|
||||
var LogDir string
|
||||
|
||||
// InitLog initializes the log.
|
||||
func InitLog(dir, module string, level Level, rotate *LogRotate) (*Log, error) {
|
||||
l := new(Log)
|
||||
dir = path.Join(dir, module)
|
||||
l.dir = dir
|
||||
LogDir = dir
|
||||
fi, err := os.Stat(dir)
|
||||
if err != nil {
|
||||
os.MkdirAll(dir, 0755)
|
||||
@ -274,7 +277,7 @@ func InitLog(dir, module string, level Level, rotate *LogRotate) (*Log, error) {
|
||||
return nil, fmt.Errorf("[InitLog] stats disk space: %s",
|
||||
err.Error())
|
||||
}
|
||||
minRatio := float64(fs.Blocks * uint64(fs.
|
||||
minRatio := float64(fs.Blocks*uint64(fs.
|
||||
Bsize)) * DefaultHeadRatio / 1024 / 1024
|
||||
rotate.SetHeadRoomMb(int64(math.Min(minRatio, DefaultHeadRoom)))
|
||||
minRollingSize := int64(fs.Bavail * uint64(fs.Bsize) / uint64(len(levelPrefixes)))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user