webee 0.3.6 → 0.3.7

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -23,6 +23,7 @@ Jeweler::Tasks.new do |gem|
23
23
  gem.add_runtime_dependency 'i18n'
24
24
  gem.add_runtime_dependency 'alchemist'
25
25
  gem.add_runtime_dependency 'activesupport'
26
+ gem.add_runtime_dependency 'json'
26
27
  # gem.add_development_dependency 'rspec', '> 1.2.3'
27
28
  end
28
29
  Jeweler::RubygemsDotOrgTasks.new
@@ -0,0 +1,33 @@
1
+ $: << '../lib'
2
+ require 'rubygems'
3
+ require 'webee'
4
+ require 'md5'
5
+
6
+ CIAB_IP = ENV['host'] || '127.0.0.1'
7
+
8
+ WeBee::Api.user = ENV['user'] || 'admin'
9
+ WeBee::Api.password = ENV['pass'] || 'xabiquo'
10
+ WeBee::Api.url = "http://#{ENV['host'] || 'abiquo'}/api"
11
+
12
+ #
13
+ # Add a license
14
+ #
15
+ license_file = ARGV[0]
16
+ if license_file.nil? or (not File.exist?(license_file))
17
+ $stderr.puts "Invalid license file"
18
+ exit 1
19
+ end
20
+ WeBee::Config.add_license File.read(license_file).strip.chomp
21
+
22
+ dc = WeBee::Datacenter.create :name => 'BCN'
23
+ rack = dc.add_rack :name => 'rack_1',
24
+ :ha_enabled => false,
25
+ :vlan_min_id => 100,
26
+ :vlan_max_id => 2048,
27
+ :vlan_per_vdc_expected => 6,
28
+ :nrsq => 80
29
+
30
+ machine = dc.discover_machine :ip => CIAB_IP, :hypervisortype => 'kvm'
31
+ machine.virtual_switch = machine.virtual_switches.first
32
+ machine.datastores.first.enabled = true
33
+ rack.add_machine(machine)
@@ -6,70 +6,8 @@ require 'colorize'
6
6
  include WeBee
7
7
  Alchemist::use_si = true
8
8
 
9
- WeBee::Api.user = ENV['user'] || 'admin'
10
- WeBee::Api.password = ENV['pass'] || 'xabiquo'
9
+ WeBee::Api.user = ENV['user'] || 'xfernandez'
10
+ WeBee::Api.password = ENV['pass'] || 'xfernandez'
11
11
  WeBee::Api.url = 'http://mothership/api'
12
12
 
13
- stats = {
14
- :free_hd => 0,
15
- :real_hd => 0,
16
- :used_hd => 0,
17
- :hypervisors => 0,
18
- :free_ram => 0,
19
- :real_ram => 0,
20
- :used_ram => 0,
21
- :available_cpus => 0
22
- }
23
-
24
- Datacenter.all.each do |dc|
25
- banner = "\n***** Datacenter (#{dc.name}) ******\n\n"
26
- puts "*" * banner.size
27
- puts banner
28
- puts "*" * banner.size
29
- dc.racks.each do |rack|
30
- puts "Rack: #{rack.name}"
31
- rack.machines.each do |m|
32
- stats[:hypervisors] += 1
33
- stats[:used_ram] += m.ram_used.to_i
34
- stats[:real_ram] += m.real_ram.to_i
35
- stats[:available_cpus] += m.real_cpu.to_i
36
- stats[:used_hd] += m.hd_used.to_i.bytes.to.gigabytes.to_f.round
37
- stats[:real_hd] += m.real_hd.to_i.bytes.to.gigabytes.to_f.round
38
- puts " #{m.name.green}"
39
- puts " IP: #{m.ip}"
40
- puts " CPUs: #{m.real_cpu}"
41
- puts " State: #{m.state}"
42
- puts " Type: #{m.hypervisortype}"
43
- puts " RAM: #{m.real_ram.to_i} MB"
44
- puts " RAM Used: #{m.ram_used.to_i} MB"
45
- puts " RAM Free: #{m.real_ram.to_i - m.ram_used.to_i} MB"
46
- puts " HD Size: #{m.real_hd.to_i.bytes.to.gigabytes.to_i} GB"
47
- puts " HD Used: #{m.hd_used.to_i.bytes.to.gigabytes.to_i} GB"
48
- puts " HD Free: #{(m.real_hd.to_i - m.hd_used.to_i).bytes.to.gigabytes.to_i} GB"
49
- puts " CPU Used: #{m.cpu_used.to_i}"
50
- puts " Datastores:"
51
- m.datastores.each do |ds|
52
- puts " Name: #{ds.name}"
53
- puts " Enabled: #{ds.enabled}"
54
- puts " Size: #{ds.size.to_i.bytes.to.gigabytes.to_i} GB"
55
- puts " Used Size: #{ds.used_size.to_i.bytes.to.gigabytes.to_i} GB"
56
- end
57
- end
58
- end
59
- end
60
-
61
- stats[:free_ram] = stats[:real_ram] - stats[:used_ram]
62
- stats[:free_hd] = stats[:real_hd] - stats[:used_hd]
63
-
64
- puts "\n\n------------------------------------"
65
- puts " Cloud Statistics"
66
- puts "------------------------------------"
67
- puts "Hypevisors: #{stats[:hypervisors]}"
68
- puts "Available CPUs: #{stats[:available_cpus]}"
69
- puts "Total RAM: #{stats[:real_ram].megabytes.to.gigabytes} GB"
70
- puts "Free RAM: #{stats[:free_ram].megabytes.to.gigabytes} GB"
71
- puts "Used RAM: #{stats[:used_ram].megabytes.to.gigabytes} GB"
72
- puts "Total HD: #{stats[:real_hd]} GB"
73
- puts "Free HD: #{stats[:free_hd]} GB"
74
- puts "Used HD: #{stats[:used_hd]} GB"
75
-
13
+ puts User.all
@@ -29,7 +29,7 @@ end
29
29
 
30
30
  module WeBee
31
31
 
32
- VERSION = '0.3.6'
32
+ VERSION = '0.3.7'
33
33
 
34
34
  module RestResource
35
35
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: webee
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 3
9
- - 6
10
- version: 0.3.6
9
+ - 7
10
+ version: 0.3.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Sergio Rubio
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-09-16 00:00:00 Z
18
+ date: 2011-09-27 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: sax-machine
@@ -115,6 +115,20 @@ dependencies:
115
115
  version: "0"
116
116
  type: :runtime
117
117
  version_requirements: *id007
118
+ - !ruby/object:Gem::Dependency
119
+ name: json
120
+ prerelease: false
121
+ requirement: &id008 !ruby/object:Gem::Requirement
122
+ none: false
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ hash: 3
127
+ segments:
128
+ - 0
129
+ version: "0"
130
+ type: :runtime
131
+ version_requirements: *id008
118
132
  description: Abiquo API Ruby Implementation
119
133
  email: sergio@rubio.name
120
134
  executables:
@@ -142,6 +156,7 @@ files:
142
156
  - lib/webee/commands/user.rb
143
157
  - test/helper.rb
144
158
  - test/test_webee.rb
159
+ - examples/bootstrap2.rb
145
160
  - examples/test.rb
146
161
  - examples/test2.rb
147
162
  - test/test_appliance_manager.rb
@@ -182,6 +197,7 @@ test_files:
182
197
  - examples/all_vms.rb
183
198
  - examples/basics.rb
184
199
  - examples/bootstrap.rb
200
+ - examples/bootstrap2.rb
185
201
  - examples/list_hypervisors.rb
186
202
  - examples/test.rb
187
203
  - examples/test2.rb