mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-12 09:17:41 +03:00
Merge branch 'master' of git.opennebula.org:one
This commit is contained in:
commit
fe9412e2ce
@ -1,10 +1,26 @@
|
|||||||
#!/usr/bin/env ruby
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require 'pp'
|
||||||
|
|
||||||
PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server
|
PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server
|
||||||
ozones_server_mysql ozones_server_sqlite}
|
ozones_server_mysql ozones_server_sqlite}
|
||||||
|
|
||||||
DEFAULT=%w{optional sunstone quota cloud ozones_server acct}
|
DEFAULT=%w{optional sunstone quota cloud ozones_server acct}
|
||||||
|
|
||||||
|
GROUPS={
|
||||||
|
:optional => %w{nokogiri libxml-ruby},
|
||||||
|
:quota => %w{sqlite3 sequel},
|
||||||
|
:sunstone => %w{json rack sinatra thin},
|
||||||
|
:cloud => %w{amazon-ec2 rack sinatra thin uuid curb},
|
||||||
|
:ozones_client => %w{json},
|
||||||
|
:ozones_server => %w{json datamapper dm-sqlite-adapter dm-mysql-adapter},
|
||||||
|
:ozones_server_sqlite => %w{json datamapper dm-sqlite-adapter},
|
||||||
|
:ozones_server_mysql => %w{json datamapper dm-mysql-adapter},
|
||||||
|
:acct => %w{sequel sqlite3 mysql},
|
||||||
|
:acct_sqlite => %w{sequel sqlite3 mysql},
|
||||||
|
:acct_mysql => %w{sequel sqlite3 mysql}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
class String
|
class String
|
||||||
def unindent(spaces=4)
|
def unindent(spaces=4)
|
||||||
@ -44,6 +60,12 @@ def help
|
|||||||
puts DEFAULT.join(' ')
|
puts DEFAULT.join(' ')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def get_gems(packages)
|
||||||
|
packages.map do |package|
|
||||||
|
GROUPS[package.to_sym]
|
||||||
|
end.flatten.uniq
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
try_library :rubygems, <<-EOT.unindent
|
try_library :rubygems, <<-EOT.unindent
|
||||||
rubygems required to use this tool
|
rubygems required to use this tool
|
||||||
@ -61,13 +83,6 @@ try_library :rubygems, <<-EOT.unindent
|
|||||||
* Follow the instructions from http://rubygems.org/pages/download
|
* Follow the instructions from http://rubygems.org/pages/download
|
||||||
EOT
|
EOT
|
||||||
|
|
||||||
try_library :bundler, <<-EOT.unindent
|
|
||||||
bundler needed to install gems
|
|
||||||
|
|
||||||
execute this to install it:
|
|
||||||
|
|
||||||
[sudo] gem install bundler
|
|
||||||
EOT
|
|
||||||
|
|
||||||
if ARGV.include?('-h')
|
if ARGV.include?('-h')
|
||||||
help
|
help
|
||||||
@ -80,12 +95,10 @@ else
|
|||||||
packages=DEFAULT
|
packages=DEFAULT
|
||||||
end
|
end
|
||||||
|
|
||||||
no_packages=PACKAGES-packages
|
|
||||||
no_packages<<'dummy'
|
|
||||||
|
|
||||||
without="--without #{no_packages.join(' ')}"
|
packages_string=get_gems(packages).join(' ')
|
||||||
|
|
||||||
command_string = "bundle install #{without}"
|
command_string = "gem install --no-ri --no-rdoc #{packages_string}"
|
||||||
|
|
||||||
install_warning(packages)
|
install_warning(packages)
|
||||||
|
|
||||||
|
@ -94,7 +94,7 @@ module OneWatchClient
|
|||||||
end
|
end
|
||||||
|
|
||||||
a = Array.new
|
a = Array.new
|
||||||
resources.group_and_count(:timestamp).collect { |row|
|
resources.group_and_count(:timestamp).all.each { |row|
|
||||||
a << [row[:timestamp], row[:count].to_i]
|
a << [row[:timestamp], row[:count].to_i]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,12 +341,14 @@ module WatchHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.flush
|
def self.flush
|
||||||
VmDelta.multi_insert(@@deltas_cache)
|
DB.transaction do
|
||||||
VmSample.multi_insert(@@samples_cache)
|
VmDelta.multi_insert(@@deltas_cache)
|
||||||
|
VmSample.multi_insert(@@samples_cache)
|
||||||
|
end
|
||||||
|
|
||||||
Vm.each { |vm|
|
Vm.each { |vm|
|
||||||
if vm.samples.count > @@vm_window_size
|
if vm.samples.count > @@vm_window_size
|
||||||
vm.samples.last.delete
|
vm.samples.first.destroy
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -395,11 +397,13 @@ module WatchHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.flush
|
def self.flush
|
||||||
HostSample.multi_insert(@@samples_cache)
|
DB.transaction do
|
||||||
|
HostSample.multi_insert(@@samples_cache)
|
||||||
|
end
|
||||||
|
|
||||||
Host.all.each { |host|
|
Host.all.each { |host|
|
||||||
if host.samples.count > @@host_window_size
|
if host.samples.count > @@host_window_size
|
||||||
host.samples.first.delete
|
host.samples.first.destroy
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user