filecluster 0.4.15 → 0.4.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b860fb1f75b6844222f4335a3e7f3088518fa4d2
4
- data.tar.gz: feefd623d4cf79f93672c5fbde5208704466767a
3
+ metadata.gz: 8a77a589e905d57361c53d461dac5bbdffcf5b15
4
+ data.tar.gz: de91ef4e8a99f6124a24b72d0f4b63c428cd2286
5
5
  SHA512:
6
- metadata.gz: 321930084012bda837973fc91a217e37648e0d97a909627a03288933f0c81ffde1349959e9ce3ecebee9df9542596e5ad13bbc625037012288bb5b92124ae39b
7
- data.tar.gz: 4a1e444e9e8de32df3355c135378659ebfed7c4fd2365790032866b6c723b932bb4c3e4e289c53f746d42faa081a27db83ade49ad7f7f38f1d7cf74de003e89e
6
+ metadata.gz: 1e5e4519345081eca7d9b6fd704d65f185fb01e95bdf5d9a381430ffc8cf44afb5f6e96165cf3cb27543b1450b8d79e320e0d11f2ab0d40df4b61ad69c92eaf9
7
+ data.tar.gz: 36940d94c87ddf6c69b5875df1d5d12d66c5ce02f502f1aea8c9a43f068ff0f3ad6167f53be9d6ec765175edc91b73830b880d2bff226eb5707358db3c7e2366
@@ -11,7 +11,7 @@ class UpdateTasksThread < BaseThread
11
11
  tasks = (type == :copy ? $tasks_copy : $tasks_delete)
12
12
  $storages.each do |storage|
13
13
  tasks[storage.name] = [] unless tasks[storage.name]
14
- ids = tasks[storage.name].map(&:id) + $curr_tasks.map(&:id)
14
+ ids = tasks[storage.name].map(&:id) + $curr_tasks.compact.map(&:id)
15
15
  if ids.length > limit*2
16
16
  $log.debug("Too many (#{ids.length}) #{type} tasks")
17
17
  next
@@ -275,5 +275,9 @@ module FC
275
275
  FC::DB.query("ALTER TABLE #{@prefix}storages ADD COLUMN write_weight int NOT NULL DEFAULT 0")
276
276
  FC::DB.query("INSERT INTO #{@prefix}vars SET name='daemon_copy_speed_per_host_limit', val='', descr='copy tasks speed limit for hosts, change via fc-manage copy_speed'")
277
277
  end
278
+
279
+ def self.migrate_2
280
+ FC::DB.query("ALTER TABLE #{@prefix}storages ADD COLUMN dc varchar(255) DEFAULT ''")
281
+ end
278
282
  end
279
283
  end
@@ -4,7 +4,7 @@ require 'fileutils'
4
4
 
5
5
  module FC
6
6
  class Storage < DbBase
7
- set_table :storages, 'name, host, path, url, size, size_limit, check_time, copy_storages, url_weight, write_weight'
7
+ set_table :storages, 'name, host, dc, path, url, size, size_limit, check_time, copy_storages, url_weight, write_weight'
8
8
 
9
9
  class << self
10
10
  attr_accessor :check_time_limit, :storages_cache_time, :get_copy_storages_mutex
@@ -1,3 +1,3 @@
1
1
  module FC
2
- VERSION = "0.4.15"
2
+ VERSION = "0.4.16"
3
3
  end
@@ -7,7 +7,7 @@ def storages_list
7
7
  puts "No storages."
8
8
  else
9
9
  storages.each do |storage|
10
- str = "#{colorize_string(storage.host, :yellow)} #{storage.name} #{size_to_human(storage.size)}/#{size_to_human(storage.size_limit)} "
10
+ str = " #{colorize_string(storage.dc, :blue)}\t#{colorize_string(storage.host, :yellow)} #{storage.name} #{size_to_human(storage.size)}/#{size_to_human(storage.size_limit)} "
11
11
  str += "#{(storage.free_rate*100).to_i}% free "
12
12
  str += "#{storage.up? ? colorize_string('UP', :green) : colorize_string('DOWN', :red)}"
13
13
  str += " #{storage.check_time_delay} seconds ago" if storage.check_time
@@ -22,6 +22,7 @@ def storages_show
22
22
  puts %Q{Storage
23
23
  Name: #{storage.name}
24
24
  Host: #{storage.host}
25
+ DC: #{storage.dc}
25
26
  Path: #{storage.path}
26
27
  Url: #{storage.url}
27
28
  Url weight: #{storage.url_weight}
@@ -40,6 +41,7 @@ def storages_add
40
41
  host = FC::Storage.curr_host
41
42
  puts "Add storage to host #{host}"
42
43
  name = stdin_read_val('Name')
44
+ dc = stdin_read_val('DC')
43
45
  path = stdin_read_val('Path')
44
46
  url = stdin_read_val('Url')
45
47
  url_weight = stdin_read_val('URL weight', true).to_i
@@ -51,7 +53,7 @@ def storages_add
51
53
  begin
52
54
  path = path +'/' unless path[-1] == '/'
53
55
  path = '/' + path unless path[0] == '/'
54
- storage = FC::Storage.new(:name => name, :host => host, :path => path, :url => url, :size_limit => size_limit, :copy_storages => copy_storages, :url_weight => url_weight, :write_weight => write_weight)
56
+ storage = FC::Storage.new(:name => name, :dc => dc, :host => host, :path => path, :url => url, :size_limit => size_limit, :copy_storages => copy_storages, :url_weight => url_weight, :write_weight => write_weight)
55
57
  print "Calc current size.. "
56
58
  size = storage.file_size('', true)
57
59
  puts "ok"
@@ -62,6 +64,7 @@ def storages_add
62
64
  free = size_limit - size
63
65
  puts %Q{\nStorage
64
66
  Name: #{name}
67
+ DC: #{dc}
65
68
  Host: #{host}
66
69
  Path: #{path}
67
70
  Url: #{url}
@@ -120,6 +123,7 @@ end
120
123
  def storages_change
121
124
  if storage = find_storage
122
125
  puts "Change storage #{storage.name}"
126
+ dc = stdin_read_val("DC (now #{storage.dc})", true)
123
127
  host = stdin_read_val("Host (now #{storage.host})", true)
124
128
  path = stdin_read_val("Path (now #{storage.path})", true)
125
129
  url = stdin_read_val("Url (now #{storage.url})", true)
@@ -128,6 +132,7 @@ def storages_change
128
132
  size_limit = stdin_read_val("Size (now #{size_to_human(storage.size_limit)})", true) {|val| "Size limit not is valid size." if !val.empty? && !human_to_size(val)}
129
133
  copy_storages = stdin_read_val("Copy storages (now #{storage.copy_storages})", true)
130
134
 
135
+ storage.dc = dc unless dc.empty?
131
136
  storage.host = host unless host.empty?
132
137
  if !path.empty? && path != storage.path
133
138
  path = path +'/' unless path[-1] == '/'
@@ -146,6 +151,7 @@ def storages_change
146
151
 
147
152
  puts %Q{\nStorage
148
153
  Name: #{storage.name}
154
+ DC: #{storage.dc}
149
155
  Host: #{storage.host}
150
156
  Path: #{storage.path}
151
157
  Url: #{storage.url}
@@ -74,6 +74,8 @@ def colorize_string(str, color)
74
74
  color_code = 32
75
75
  when 'yellow'
76
76
  color_code = 33
77
+ when 'blue'
78
+ color_code = 34
77
79
  when 'pink'
78
80
  color_code = 35
79
81
  else
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: filecluster
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.15
4
+ version: 0.4.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - sh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-08-25 00:00:00.000000000 Z
11
+ date: 2015-12-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mysql2