mirror of
https://github.com/OpenNebula/one.git
synced 2025-01-11 05: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
|
||||
|
||||
require 'pp'
|
||||
|
||||
PACKAGES=%w{optional sunstone quota cloud ozones_client ozones_server
|
||||
ozones_server_mysql ozones_server_sqlite}
|
||||
|
||||
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
|
||||
def unindent(spaces=4)
|
||||
@ -44,6 +60,12 @@ def help
|
||||
puts DEFAULT.join(' ')
|
||||
end
|
||||
|
||||
def get_gems(packages)
|
||||
packages.map do |package|
|
||||
GROUPS[package.to_sym]
|
||||
end.flatten.uniq
|
||||
end
|
||||
|
||||
|
||||
try_library :rubygems, <<-EOT.unindent
|
||||
rubygems required to use this tool
|
||||
@ -61,13 +83,6 @@ try_library :rubygems, <<-EOT.unindent
|
||||
* Follow the instructions from http://rubygems.org/pages/download
|
||||
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')
|
||||
help
|
||||
@ -80,12 +95,10 @@ else
|
||||
packages=DEFAULT
|
||||
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)
|
||||
|
||||
|
@ -94,7 +94,7 @@ module OneWatchClient
|
||||
end
|
||||
|
||||
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]
|
||||
}
|
||||
|
||||
|
@ -341,12 +341,14 @@ module WatchHelper
|
||||
end
|
||||
|
||||
def self.flush
|
||||
VmDelta.multi_insert(@@deltas_cache)
|
||||
VmSample.multi_insert(@@samples_cache)
|
||||
DB.transaction do
|
||||
VmDelta.multi_insert(@@deltas_cache)
|
||||
VmSample.multi_insert(@@samples_cache)
|
||||
end
|
||||
|
||||
Vm.each { |vm|
|
||||
if vm.samples.count > @@vm_window_size
|
||||
vm.samples.last.delete
|
||||
vm.samples.first.destroy
|
||||
end
|
||||
}
|
||||
|
||||
@ -395,11 +397,13 @@ module WatchHelper
|
||||
end
|
||||
|
||||
def self.flush
|
||||
HostSample.multi_insert(@@samples_cache)
|
||||
DB.transaction do
|
||||
HostSample.multi_insert(@@samples_cache)
|
||||
end
|
||||
|
||||
Host.all.each { |host|
|
||||
if host.samples.count > @@host_window_size
|
||||
host.samples.first.delete
|
||||
host.samples.first.destroy
|
||||
end
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user