ovirt_metrics 1.2.0 → 1.3.0

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: d77fbff78ca341555af7b4aedeacfb4cdc993b19
4
- data.tar.gz: 0abdcd35775f8553286f60341eb9790f18ec646e
3
+ metadata.gz: 5a37ae7cb321c5386026f470810ae932e5811b67
4
+ data.tar.gz: 558a4614ef65c48a5aa6568f38eea11a2f284abb
5
5
  SHA512:
6
- metadata.gz: 50ddf0f9c933aefe585b85431e7b85c1a5064f8dc06137548500805512f18a65a2f9e27ae67e1d6035043401443fce3a2c8165df76f4a3a858733620cc86f369
7
- data.tar.gz: aa04cc6baec4d034ae7a4ead3db42c6e965990163574b762d7fef83e19ca1bcf8cf2833617908b66d8c09f521469bd14ee6e47e0d710eda1ab382ca88b4cece2
6
+ metadata.gz: 1b45a7e80fbd847de34defbbd1c712a0dd956e1ecfaed42acce1827596d098d098cebc350f733b3b5833a4b7860017dff268873421bb23198f7f49670b46c9b1
7
+ data.tar.gz: 04d92708791794f33d225d293e79c38e59d411b06a86f9c05c255f1a31c5bc25c06096db56cc93189215b9c2dc135823b04b7070b3d98001fa383dd6d7890333
@@ -1,3 +1,3 @@
1
1
  module OvirtMetrics
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
data/lib/ovirt_metrics.rb CHANGED
@@ -107,6 +107,10 @@ module OvirtMetrics
107
107
  "/api/hosts/#{metric.host_id}"
108
108
  end
109
109
 
110
+ def self.record_duplication_required?(metric)
111
+ metric.try(:seconds_in_status) != 20
112
+ end
113
+
110
114
  def self.metrics_to_hashes(metrics, related_metrics, column_definitions, href_method)
111
115
  counters_by_id = {}
112
116
  counter_values_by_id_and_ts = {}
@@ -127,13 +131,13 @@ module OvirtMetrics
127
131
  values[info[:ovirt_key]] = info[:ovirt_method].call(options)
128
132
  end
129
133
 
130
- # For (temporary) symmetry with VIM API having 20-second intervals
131
134
  counter_values_by_id_and_ts[href] ||= {}
132
- [0, 20, 40].each do |t|
135
+ counter_values_by_id_and_ts[href][(metric.history_datetime).utc.iso8601] = values
136
+ offsets = record_duplication_required?(metric) ? [0, 20, 40] : [0]
137
+ offsets.each do |t|
133
138
  counter_values_by_id_and_ts[href][(metric.history_datetime + t).utc.iso8601] = values
134
139
  end
135
140
  end
136
-
137
141
  return counters_by_id, counter_values_by_id_and_ts
138
142
  end
139
143
  end
@@ -1,5 +1,6 @@
1
1
  describe OvirtMetrics do
2
- shared_examples_for "OvirtMetrics" do
2
+ shared_examples_for "OvirtMetrics" do |multiplication_required|
3
+ let(:multiplication_required) { multiplication_required }
3
4
  context ".vm_realtime" do
4
5
  it "when vm_id finds no matches" do
5
6
  expect(described_class.vm_realtime(42)).to eq([{}, {}])
@@ -33,7 +34,6 @@ describe OvirtMetrics do
33
34
  :history_datetime => history_datetime,
34
35
  }
35
36
  record = klass.create!(record_attrs)
36
-
37
37
  href = "/api/#{type.pluralize}/#{id}"
38
38
  constant = "OvirtMetrics::#{type.upcase}_COLUMN_DEFINITIONS".constantize
39
39
  column_definitions = constant.each_with_object({}) do |(_name, defn), hash|
@@ -43,13 +43,14 @@ describe OvirtMetrics do
43
43
  end
44
44
  columns = { href => column_definitions }
45
45
 
46
- rows_hash = [0, 20, 40].each_with_object({}) do |offset, hash|
46
+ offsets = multiplication_required ? [0, 20, 40] : [0]
47
+
48
+ rows_hash = offsets.each_with_object({}) do |offset, hash|
47
49
  value = column_definitions.keys.each_with_object({}) { |key, col_hash| col_hash[key] = 0.0 }
48
50
  key = (record.history_datetime + offset).utc.iso8601.to_s
49
51
  hash[key] = value
50
52
  end
51
53
  rows = { href => rows_hash }
52
-
53
54
  method = "#{type}_realtime"
54
55
  expect(described_class.send(method, id)).to eq([columns, rows])
55
56
  end
@@ -58,12 +59,17 @@ describe OvirtMetrics do
58
59
 
59
60
  context "RHEV 3.0" do
60
61
  before(:each) { load_rhev_30 }
61
- it_should_behave_like "OvirtMetrics"
62
+ it_should_behave_like "OvirtMetrics", true
62
63
  end
63
64
 
64
65
  context "RHEV 3.1" do
65
66
  before(:each) { load_rhev_31 }
66
- it_should_behave_like "OvirtMetrics"
67
+ it_should_behave_like "OvirtMetrics", true
68
+ end
69
+
70
+ context "RHEV 4" do
71
+ before(:each) { load_rhev_40 }
72
+ it_should_behave_like "OvirtMetrics", false
67
73
  end
68
74
 
69
75
  end
@@ -0,0 +1,679 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended to check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(:version => 20130115171747) do
15
+
16
+ create_table "calendar", :id => false, :force => true do |t|
17
+ t.datetime "the_datetime", :null => false
18
+ t.date "the_date", :null => false
19
+ t.integer "the_year", :limit => 2, :null => false
20
+ t.integer "the_month", :limit => 2, :null => false
21
+ t.string "month_name", :limit => 9, :null => false
22
+ t.integer "the_day", :limit => 2, :null => false
23
+ t.string "day_name", :limit => 9, :null => false
24
+ t.time "the_hour", :null => false
25
+ end
26
+
27
+ add_index "calendar", ["the_date"], :name => "calendar_table_index"
28
+
29
+ create_table "cluster_configuration", :primary_key => "history_id", :force => true do |t|
30
+ t.string "cluster_id", :limit => nil, :null => false
31
+ t.string "cluster_name", :limit => 40, :null => false
32
+ t.string "cluster_description", :limit => 4000
33
+ t.string "datacenter_id", :limit => nil
34
+ t.string "cpu_name"
35
+ t.string "compatibility_version", :limit => 40, :default => "2.2", :null => false
36
+ t.integer "datacenter_configuration_version"
37
+ t.datetime "create_date"
38
+ t.datetime "update_date"
39
+ t.datetime "delete_date"
40
+ end
41
+
42
+ add_index "cluster_configuration", ["cluster_id"], :name => "cluster_configuration_cluster_id_idx"
43
+ add_index "cluster_configuration", ["datacenter_id"], :name => "cluster_configuration_datacenter_id_idx"
44
+
45
+ create_table "datacenter_configuration", :primary_key => "history_id", :force => true do |t|
46
+ t.string "datacenter_id", :limit => nil, :null => false
47
+ t.string "datacenter_name", :limit => 40, :null => false
48
+ t.string "datacenter_description", :limit => 4000, :null => false
49
+ t.integer "storage_type", :limit => 2, :null => false
50
+ t.datetime "create_date"
51
+ t.datetime "update_date"
52
+ t.datetime "delete_date"
53
+ end
54
+
55
+ add_index "datacenter_configuration", ["datacenter_id"], :name => "datacenter_configuration_datacenter_id_idx"
56
+
57
+ create_table "datacenter_daily_history", :primary_key => "history_id", :force => true do |t|
58
+ t.date "history_datetime", :null => false
59
+ t.string "datacenter_id", :limit => nil, :null => false
60
+ t.integer "datacenter_status", :limit => 2, :null => false
61
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
62
+ t.integer "datacenter_configuration_version", :null => false
63
+ end
64
+
65
+ add_index "datacenter_daily_history", ["datacenter_configuration_version"], :name => "idx_datacenter_configuration_version_daily"
66
+ add_index "datacenter_daily_history", ["datacenter_id"], :name => "datacenter_daily_history_datacenter_id_idx"
67
+ add_index "datacenter_daily_history", ["history_datetime"], :name => "idx_datacenter_history_datetime_daily"
68
+
69
+ create_table "datacenter_hourly_history", :primary_key => "history_id", :force => true do |t|
70
+ t.datetime "history_datetime", :null => false
71
+ t.string "datacenter_id", :limit => nil, :null => false
72
+ t.integer "datacenter_status", :limit => 2, :null => false
73
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
74
+ t.integer "datacenter_configuration_version", :null => false
75
+ end
76
+
77
+ add_index "datacenter_hourly_history", ["datacenter_configuration_version"], :name => "idx_datacenter_configuration_version_hourly"
78
+ add_index "datacenter_hourly_history", ["datacenter_id"], :name => "datacenter_hourly_history_datacenter_id_idx"
79
+ add_index "datacenter_hourly_history", ["history_datetime"], :name => "idx_datacenter_history_datetime_hourly"
80
+
81
+ create_table "datacenter_samples_history", :primary_key => "history_id", :force => true do |t|
82
+ t.datetime "history_datetime", :null => false
83
+ t.string "datacenter_id", :limit => nil, :null => false
84
+ t.integer "datacenter_status", :limit => 2, :null => false
85
+ t.integer "seconds_in_status", :default => 20, :null => false
86
+ t.integer "datacenter_configuration_version", :null => false
87
+ end
88
+
89
+ add_index "datacenter_samples_history", ["datacenter_configuration_version"], :name => "idx_datacenter_configuration_version_samples"
90
+ add_index "datacenter_samples_history", ["datacenter_id"], :name => "datacenter_samples_history_datacenter_id_idx"
91
+ add_index "datacenter_samples_history", ["history_datetime"], :name => "idx_datacenter_history_datetime_samples"
92
+
93
+ create_table "datacenter_storage_domain_map", :primary_key => "history_id", :force => true do |t|
94
+ t.string "storage_domain_id", :limit => nil, :null => false
95
+ t.string "datacenter_id", :limit => nil, :null => false
96
+ t.datetime "attach_date", :null => false
97
+ t.datetime "detach_date"
98
+ end
99
+
100
+ add_index "datacenter_storage_domain_map", ["datacenter_id"], :name => "datacenter_storage_domain_map_datacenter_id_idx"
101
+ add_index "datacenter_storage_domain_map", ["storage_domain_id"], :name => "datacenter_storage_domain_map_storage_domain_id_idx"
102
+
103
+ create_table "disks_vm_map", :primary_key => "history_id", :force => true do |t|
104
+ t.string "vm_disk_id", :limit => nil, :null => false
105
+ t.string "vm_id", :limit => nil, :null => false
106
+ t.datetime "attach_date", :null => false
107
+ t.datetime "detach_date"
108
+ end
109
+
110
+ add_index "disks_vm_map", ["vm_disk_id"], :name => "disks_vm_map_vm_disk_id_idx"
111
+ add_index "disks_vm_map", ["vm_id"], :name => "disks_vm_map_vm_id_idx"
112
+
113
+ create_table "enum_translator", :id => false, :force => true do |t|
114
+ t.string "enum_type", :limit => 40, :null => false
115
+ t.integer "enum_key", :limit => 2, :null => false
116
+ t.string "language_code", :limit => 40, :null => false
117
+ t.text "value", :null => false
118
+ end
119
+
120
+ create_table "history_configuration", :id => false, :force => true do |t|
121
+ t.string "var_name", :limit => 50, :null => false
122
+ t.string "var_value"
123
+ t.datetime "var_datetime"
124
+ end
125
+
126
+ create_table "host_configuration", :primary_key => "history_id", :force => true do |t|
127
+ t.string "host_id", :limit => nil, :null => false
128
+ t.string "host_unique_id", :limit => 128
129
+ t.string "host_name", :null => false
130
+ t.string "cluster_id", :limit => nil, :null => false
131
+ t.integer "host_type", :limit => 2, :default => 0, :null => false
132
+ t.string "fqdn_or_ip", :null => false
133
+ t.integer "memory_size_mb"
134
+ t.integer "swap_size_mb"
135
+ t.string "cpu_model"
136
+ t.integer "number_of_cores", :limit => 2
137
+ t.string "host_os"
138
+ t.string "pm_ip_address"
139
+ t.string "kernel_version"
140
+ t.string "kvm_version"
141
+ t.string "vdsm_version", :limit => 40
142
+ t.integer "vdsm_port", :null => false
143
+ t.integer "cluster_configuration_version"
144
+ t.datetime "create_date"
145
+ t.datetime "update_date"
146
+ t.datetime "delete_date"
147
+ t.integer "number_of_sockets", :limit => 2
148
+ t.decimal "cpu_speed_mh", :precision => 18, :scale => 0
149
+ end
150
+
151
+ add_index "host_configuration", ["cluster_id"], :name => "host_configuration_cluster_id_idx"
152
+ add_index "host_configuration", ["host_id"], :name => "host_configuration_host_id_idx"
153
+
154
+ create_table "host_daily_history", :primary_key => "history_id", :force => true do |t|
155
+ t.date "history_datetime", :null => false
156
+ t.string "host_id", :limit => nil, :null => false
157
+ t.integer "host_status", :limit => 2, :null => false
158
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
159
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
160
+ t.integer "max_memory_usage", :limit => 2
161
+ t.integer "cpu_usage_percent", :limit => 2
162
+ t.integer "max_cpu_usage", :limit => 2
163
+ t.integer "ksm_cpu_percent", :limit => 2, :default => 0
164
+ t.integer "max_ksm_cpu_percent", :limit => 2, :default => 0
165
+ t.integer "active_vms", :limit => 2, :default => 0
166
+ t.integer "max_active_vms", :limit => 2, :default => 0
167
+ t.integer "total_vms", :limit => 2, :default => 0
168
+ t.integer "max_total_vms", :limit => 2, :default => 0
169
+ t.integer "total_vms_vcpus", :default => 0
170
+ t.integer "max_total_vms_vcpus", :default => 0
171
+ t.integer "cpu_load", :default => 0
172
+ t.integer "max_cpu_load", :default => 0
173
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
174
+ t.integer "max_system_cpu_usage_percent", :limit => 2, :default => 0
175
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
176
+ t.integer "max_user_cpu_usage_percent", :limit => 2, :default => 0
177
+ t.integer "swap_used_mb"
178
+ t.integer "max_swap_used_mb"
179
+ t.integer "host_configuration_version"
180
+ end
181
+
182
+ add_index "host_daily_history", ["history_datetime"], :name => "idx_host_history_datetime_daily"
183
+ add_index "host_daily_history", ["host_configuration_version"], :name => "idx_host_configuration_version_daily"
184
+ add_index "host_daily_history", ["host_id"], :name => "host_daily_history_host_id_idx"
185
+
186
+ create_table "host_hourly_history", :primary_key => "history_id", :force => true do |t|
187
+ t.datetime "history_datetime", :null => false
188
+ t.string "host_id", :limit => nil, :null => false
189
+ t.integer "host_status", :limit => 2, :null => false
190
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
191
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
192
+ t.integer "max_memory_usage", :limit => 2
193
+ t.integer "cpu_usage_percent", :limit => 2
194
+ t.integer "max_cpu_usage", :limit => 2
195
+ t.integer "ksm_cpu_percent", :limit => 2, :default => 0
196
+ t.integer "max_ksm_cpu_percent", :limit => 2, :default => 0
197
+ t.integer "active_vms", :limit => 2, :default => 0
198
+ t.integer "max_active_vms", :limit => 2, :default => 0
199
+ t.integer "total_vms", :limit => 2, :default => 0
200
+ t.integer "max_total_vms", :limit => 2, :default => 0
201
+ t.integer "total_vms_vcpus", :default => 0
202
+ t.integer "max_total_vms_vcpus", :default => 0
203
+ t.integer "cpu_load", :default => 0
204
+ t.integer "max_cpu_load", :default => 0
205
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
206
+ t.integer "max_system_cpu_usage_percent", :limit => 2, :default => 0
207
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
208
+ t.integer "max_user_cpu_usage_percent", :limit => 2, :default => 0
209
+ t.integer "swap_used_mb"
210
+ t.integer "max_swap_used_mb"
211
+ t.integer "host_configuration_version"
212
+ end
213
+
214
+ add_index "host_hourly_history", ["history_datetime"], :name => "idx_host_history_datetime_hourly"
215
+ add_index "host_hourly_history", ["host_configuration_version"], :name => "idx_host_configuration_version_hourly"
216
+ add_index "host_hourly_history", ["host_id"], :name => "host_hourly_history_host_id_idx"
217
+
218
+ create_table "host_interface_configuration", :primary_key => "history_id", :force => true do |t|
219
+ t.string "host_interface_id", :limit => nil, :null => false
220
+ t.string "host_interface_name", :limit => 50, :null => false
221
+ t.string "host_id", :limit => nil, :null => false
222
+ t.integer "host_interface_type", :limit => 2
223
+ t.integer "host_interface_speed_bps"
224
+ t.string "mac_address", :limit => 59
225
+ t.string "network_name", :limit => 50
226
+ t.string "ip_address", :limit => 20
227
+ t.string "gateway", :limit => 20
228
+ t.boolean "bond"
229
+ t.string "bond_name", :limit => 50
230
+ t.integer "vlan_id"
231
+ t.integer "host_configuration_version"
232
+ t.datetime "create_date"
233
+ t.datetime "update_date"
234
+ t.datetime "delete_date"
235
+ end
236
+
237
+ add_index "host_interface_configuration", ["host_id"], :name => "host_interface_configuration_host_id_idx"
238
+ add_index "host_interface_configuration", ["host_interface_id"], :name => "host_interface_configuration_host_interface_id_idx"
239
+
240
+ create_table "host_interface_daily_history", :primary_key => "history_id", :force => true do |t|
241
+ t.date "history_datetime", :null => false
242
+ t.string "host_interface_id", :limit => nil, :null => false
243
+ t.integer "receive_rate_percent", :limit => 2
244
+ t.integer "max_receive_rate_percent", :limit => 2
245
+ t.integer "transmit_rate_percent", :limit => 2
246
+ t.integer "max_transmit_rate_percent", :limit => 2
247
+ t.integer "host_interface_configuration_version"
248
+ end
249
+
250
+ add_index "host_interface_daily_history", ["history_datetime"], :name => "idx_host_interface_history_datetime_daily"
251
+ add_index "host_interface_daily_history", ["host_interface_configuration_version"], :name => "idx_host_interface_configuration_version_daily"
252
+ add_index "host_interface_daily_history", ["host_interface_id"], :name => "host_interface_daily_history_host_interface_id_idx"
253
+
254
+ create_table "host_interface_hourly_history", :primary_key => "history_id", :force => true do |t|
255
+ t.datetime "history_datetime", :null => false
256
+ t.string "host_interface_id", :limit => nil, :null => false
257
+ t.integer "receive_rate_percent", :limit => 2
258
+ t.integer "max_receive_rate_percent", :limit => 2
259
+ t.integer "transmit_rate_percent", :limit => 2
260
+ t.integer "max_transmit_rate_percent", :limit => 2
261
+ t.integer "host_interface_configuration_version"
262
+ end
263
+
264
+ add_index "host_interface_hourly_history", ["history_datetime"], :name => "idx_host_interface_history_datetime_hourly"
265
+ add_index "host_interface_hourly_history", ["host_interface_configuration_version"], :name => "idx_host_interface_configuration_version_hourly"
266
+ add_index "host_interface_hourly_history", ["host_interface_id"], :name => "host_interface_hourly_history_host_interface_id_idx"
267
+
268
+ create_table "host_interface_samples_history", :primary_key => "history_id", :force => true do |t|
269
+ t.datetime "history_datetime", :null => false
270
+ t.string "host_interface_id", :limit => nil, :null => false
271
+ t.integer "receive_rate_percent", :limit => 2
272
+ t.integer "transmit_rate_percent", :limit => 2
273
+ t.integer "host_interface_configuration_version"
274
+ end
275
+
276
+ add_index "host_interface_samples_history", ["history_datetime"], :name => "idx_host_interface_history_datetime_samples"
277
+ add_index "host_interface_samples_history", ["host_interface_configuration_version"], :name => "idx_host_interface_configuration_version_samples"
278
+ add_index "host_interface_samples_history", ["host_interface_id"], :name => "host_interface_samples_history_host_interface_id_idx"
279
+
280
+ create_table "host_samples_history", :primary_key => "history_id", :force => true do |t|
281
+ t.datetime "history_datetime", :null => false
282
+ t.string "host_id", :limit => nil, :null => false
283
+ t.integer "host_status", :limit => 2, :null => false
284
+ t.integer "seconds_in_status", :default => 20, :null => false
285
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
286
+ t.integer "cpu_usage_percent", :limit => 2
287
+ t.integer "ksm_cpu_percent", :limit => 2, :default => 0
288
+ t.integer "active_vms", :limit => 2, :default => 0
289
+ t.integer "total_vms", :limit => 2, :default => 0
290
+ t.integer "total_vms_vcpus", :default => 0
291
+ t.integer "cpu_load", :default => 0
292
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
293
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
294
+ t.integer "swap_used_mb"
295
+ t.integer "host_configuration_version"
296
+ end
297
+
298
+ add_index "host_samples_history", ["history_datetime"], :name => "idx_host_history_datetime_samples"
299
+ add_index "host_samples_history", ["host_configuration_version"], :name => "idx_host_configuration_version_samples"
300
+ add_index "host_samples_history", ["host_id"], :name => "host_samples_history_host_id_idx"
301
+
302
+ create_table "schema_version", :force => true do |t|
303
+ t.string "version", :limit => 10, :null => false
304
+ t.string "script", :null => false
305
+ t.string "checksum", :limit => 128
306
+ t.string "installed_by", :limit => 30, :null => false
307
+ t.datetime "started_at"
308
+ t.datetime "ended_at"
309
+ t.string "state", :limit => 15, :null => false
310
+ t.boolean "current", :null => false
311
+ t.text "comment", :default => ""
312
+ end
313
+
314
+ create_table "storage_domain_configuration", :primary_key => "history_id", :force => true do |t|
315
+ t.string "storage_domain_id", :limit => nil, :null => false
316
+ t.string "storage_domain_name", :limit => 250, :null => false
317
+ t.integer "storage_domain_type", :limit => 2, :null => false
318
+ t.integer "storage_type", :limit => 2, :null => false
319
+ t.datetime "create_date"
320
+ t.datetime "update_date"
321
+ t.datetime "delete_date"
322
+ end
323
+
324
+ add_index "storage_domain_configuration", ["storage_domain_id"], :name => "storage_domain_configuration_storage_domain_id_idx"
325
+
326
+ create_table "storage_domain_daily_history", :primary_key => "history_id", :force => true do |t|
327
+ t.date "history_datetime", :null => false
328
+ t.string "storage_domain_id", :limit => nil, :null => false
329
+ t.integer "available_disk_size_gb"
330
+ t.integer "used_disk_size_gb"
331
+ t.integer "storage_configuration_version"
332
+ end
333
+
334
+ add_index "storage_domain_daily_history", ["history_datetime"], :name => "idx_storage_domain_history_datetime_daily"
335
+ add_index "storage_domain_daily_history", ["storage_configuration_version"], :name => "idx_storage_configuration_version_daily"
336
+ add_index "storage_domain_daily_history", ["storage_domain_id"], :name => "storage_domain_daily_history_storage_domain_id_idx"
337
+
338
+ create_table "storage_domain_hourly_history", :primary_key => "history_id", :force => true do |t|
339
+ t.datetime "history_datetime", :null => false
340
+ t.string "storage_domain_id", :limit => nil, :null => false
341
+ t.integer "available_disk_size_gb"
342
+ t.integer "used_disk_size_gb"
343
+ t.integer "storage_configuration_version"
344
+ end
345
+
346
+ add_index "storage_domain_hourly_history", ["history_datetime"], :name => "idx_storage_history_datetime_hourly"
347
+ add_index "storage_domain_hourly_history", ["storage_configuration_version"], :name => "idx_storage_configuration_version_hourly"
348
+ add_index "storage_domain_hourly_history", ["storage_domain_id"], :name => "storage_domain_hourly_history_storage_domain_id_idx"
349
+
350
+ create_table "storage_domain_samples_history", :primary_key => "history_id", :force => true do |t|
351
+ t.datetime "history_datetime", :null => false
352
+ t.string "storage_domain_id", :limit => nil, :null => false
353
+ t.integer "available_disk_size_gb"
354
+ t.integer "used_disk_size_gb"
355
+ t.integer "storage_configuration_version"
356
+ end
357
+
358
+ add_index "storage_domain_samples_history", ["history_datetime"], :name => "idx_storage_history_datetime_samples"
359
+ add_index "storage_domain_samples_history", ["storage_configuration_version"], :name => "idx_storage_configuration_version_samples"
360
+ add_index "storage_domain_samples_history", ["storage_domain_id"], :name => "storage_domain_samples_history_storage_domain_id_idx"
361
+
362
+ create_table "tag_details", :primary_key => "history_id", :force => true do |t|
363
+ t.string "tag_id", :limit => nil, :null => false
364
+ t.string "tag_name", :limit => 50, :null => false
365
+ t.string "tag_description", :limit => 4000
366
+ t.string "tag_path", :limit => 4000, :null => false
367
+ t.integer "tag_level", :limit => 2, :null => false
368
+ t.datetime "create_date", :null => false
369
+ t.datetime "update_date"
370
+ t.datetime "delete_date"
371
+ end
372
+
373
+ add_index "tag_details", ["tag_id"], :name => "tag_details_tag_id_idx"
374
+ add_index "tag_details", ["tag_level"], :name => "tag_details_tag_level_idx"
375
+ add_index "tag_details", ["tag_path"], :name => "tag_details_tag_path_idx"
376
+
377
+ create_table "tag_relations_history", :primary_key => "history_id", :force => true do |t|
378
+ t.string "entity_id", :limit => nil, :null => false
379
+ t.integer "entity_type", :limit => 2, :null => false
380
+ t.string "parent_id", :limit => nil
381
+ t.datetime "attach_date", :null => false
382
+ t.datetime "detach_date"
383
+ end
384
+
385
+ add_index "tag_relations_history", ["entity_id", "attach_date"], :name => "ix_tag_relations_history"
386
+ add_index "tag_relations_history", ["entity_type"], :name => "ix_tag_relations_history_1"
387
+ add_index "tag_relations_history", ["parent_id"], :name => "tag_relations_history_parent_id_idx"
388
+
389
+ create_table "vm_configuration", :primary_key => "history_id", :force => true do |t|
390
+ t.string "vm_id", :limit => nil, :null => false
391
+ t.string "vm_name", :null => false
392
+ t.string "vm_description", :limit => 4000
393
+ t.integer "vm_type", :limit => 2
394
+ t.string "cluster_id", :limit => nil, :null => false
395
+ t.string "template_id", :limit => nil, :null => false
396
+ t.string "template_name", :limit => 40
397
+ t.integer "cpu_per_socket", :limit => 2
398
+ t.integer "number_of_sockets", :limit => 2
399
+ t.integer "memory_size_mb"
400
+ t.integer "operating_system", :limit => 2, :default => 0, :null => false
401
+ t.string "ad_domain", :limit => 40
402
+ t.string "default_host", :limit => nil
403
+ t.boolean "high_availability"
404
+ t.boolean "initialized"
405
+ t.boolean "stateless"
406
+ t.boolean "fail_back"
407
+ t.boolean "auto_suspend", :default => false
408
+ t.integer "usb_policy", :limit => 2
409
+ t.string "time_zone", :limit => 40
410
+ t.integer "cluster_configuration_version"
411
+ t.integer "default_host_configuration_version"
412
+ t.datetime "create_date"
413
+ t.datetime "update_date"
414
+ t.datetime "delete_date"
415
+ end
416
+
417
+ add_index "vm_configuration", ["cluster_id"], :name => "vm_configuration_cluster_id_idx"
418
+ add_index "vm_configuration", ["vm_id"], :name => "vm_configuration_vm_id_idx"
419
+
420
+ create_table "vm_daily_history", :primary_key => "history_id", :force => true do |t|
421
+ t.date "history_datetime", :null => false
422
+ t.string "vm_id", :limit => nil, :null => false
423
+ t.integer "vm_status", :limit => 2, :null => false
424
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
425
+ t.integer "cpu_usage_percent", :limit => 2, :default => 0
426
+ t.integer "max_cpu_usage", :limit => 2
427
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
428
+ t.integer "max_memory_usage", :limit => 2
429
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
430
+ t.integer "max_user_cpu_usage_percent", :limit => 2, :default => 0
431
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
432
+ t.integer "max_system_cpu_usage_percent", :limit => 2, :default => 0
433
+ t.string "vm_ip"
434
+ t.string "current_user_name"
435
+ t.string "currently_running_on_host", :limit => nil
436
+ t.integer "vm_configuration_version"
437
+ t.integer "current_host_configuration_version"
438
+ end
439
+
440
+ add_index "vm_daily_history", ["current_host_configuration_version"], :name => "idx_vm_current_host_configuration_daily"
441
+ add_index "vm_daily_history", ["history_datetime"], :name => "idx_vm_history_datetime_daily"
442
+ add_index "vm_daily_history", ["vm_configuration_version"], :name => "idx_vm_configuration_version_daily"
443
+ add_index "vm_daily_history", ["vm_id"], :name => "vm_daily_history_vm_id_idx"
444
+
445
+ create_table "vm_device_history", :primary_key => "history_id", :force => true do |t|
446
+ t.string "vm_id", :limit => nil, :null => false
447
+ t.string "device_id", :limit => nil, :null => false
448
+ t.string "type", :limit => 30, :null => false
449
+ t.string "address", :null => false
450
+ t.boolean "is_managed", :default => false, :null => false
451
+ t.boolean "is_plugged"
452
+ t.boolean "is_readonly", :default => false, :null => false
453
+ t.integer "vm_configuration_version"
454
+ t.integer "device_configuration_version"
455
+ t.datetime "create_date", :null => false
456
+ t.datetime "update_date"
457
+ t.datetime "delete_date"
458
+ end
459
+
460
+ add_index "vm_device_history", ["vm_id", "type"], :name => "idx_vm_device_history_vm_id_type"
461
+
462
+ create_table "vm_disk_configuration", :primary_key => "history_id", :force => true do |t|
463
+ t.string "image_id", :limit => nil, :null => false
464
+ t.string "storage_domain_id", :limit => nil
465
+ t.integer "vm_internal_drive_mapping", :limit => 2
466
+ t.string "vm_disk_description", :limit => 4000
467
+ t.integer "vm_disk_size_mb"
468
+ t.integer "vm_disk_type", :limit => 2
469
+ t.integer "vm_disk_format", :limit => 2
470
+ t.integer "vm_disk_interface", :limit => 2
471
+ t.datetime "create_date"
472
+ t.datetime "update_date"
473
+ t.datetime "delete_date"
474
+ t.string "vm_disk_id", :limit => nil
475
+ t.string "vm_disk_name"
476
+ t.boolean "is_shared"
477
+ end
478
+
479
+ add_index "vm_disk_configuration", ["image_id"], :name => "vm_disk_configuration_vm_disk_id_idx"
480
+ add_index "vm_disk_configuration", ["storage_domain_id"], :name => "vm_disk_configuration_storage_domain_id_idx"
481
+
482
+ create_table "vm_disk_daily_history", :primary_key => "history_id", :force => true do |t|
483
+ t.date "history_datetime", :null => false
484
+ t.string "image_id", :limit => nil, :null => false
485
+ t.integer "vm_disk_status", :limit => 2
486
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
487
+ t.integer "vm_disk_actual_size_mb", :null => false
488
+ t.integer "read_rate_bytes_per_second"
489
+ t.integer "max_read_rate_bytes_per_second"
490
+ t.decimal "read_latency_seconds", :precision => 18, :scale => 9
491
+ t.decimal "max_read_latency_seconds", :precision => 18, :scale => 9
492
+ t.integer "write_rate_bytes_per_second"
493
+ t.integer "max_write_rate_bytes_per_second"
494
+ t.decimal "write_latency_seconds", :precision => 18, :scale => 9
495
+ t.decimal "max_write_latency_seconds", :precision => 18, :scale => 9
496
+ t.decimal "flush_latency_seconds", :precision => 18, :scale => 9
497
+ t.decimal "max_flush_latency_seconds", :precision => 18, :scale => 9
498
+ t.integer "vm_disk_configuration_version"
499
+ t.string "vm_disk_id", :limit => nil
500
+ end
501
+
502
+ add_index "vm_disk_daily_history", ["history_datetime"], :name => "idx_vm_disk_history_datetime_daily"
503
+ add_index "vm_disk_daily_history", ["image_id"], :name => "vm_disk_daily_history_vm_disk_id_idx"
504
+ add_index "vm_disk_daily_history", ["vm_disk_configuration_version"], :name => "idx_vm_disk_configuration_version_daily"
505
+
506
+ create_table "vm_disk_hourly_history", :primary_key => "history_id", :force => true do |t|
507
+ t.datetime "history_datetime", :null => false
508
+ t.string "image_id", :limit => nil, :null => false
509
+ t.integer "vm_disk_status", :limit => 2
510
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
511
+ t.integer "vm_disk_actual_size_mb", :null => false
512
+ t.integer "read_rate_bytes_per_second"
513
+ t.integer "max_read_rate_bytes_per_second"
514
+ t.decimal "read_latency_seconds", :precision => 18, :scale => 9
515
+ t.decimal "max_read_latency_seconds", :precision => 18, :scale => 9
516
+ t.integer "write_rate_bytes_per_second"
517
+ t.integer "max_write_rate_bytes_per_second"
518
+ t.decimal "write_latency_seconds", :precision => 18, :scale => 9
519
+ t.decimal "max_write_latency_seconds", :precision => 18, :scale => 9
520
+ t.decimal "flush_latency_seconds", :precision => 18, :scale => 9
521
+ t.decimal "max_flush_latency_seconds", :precision => 18, :scale => 9
522
+ t.integer "vm_disk_configuration_version"
523
+ t.string "vm_disk_id", :limit => nil
524
+ end
525
+
526
+ add_index "vm_disk_hourly_history", ["history_datetime"], :name => "idx_vm_disk_history_datetime_hourly"
527
+ add_index "vm_disk_hourly_history", ["image_id"], :name => "vm_disk_hourly_history_vm_disk_id_idx"
528
+ add_index "vm_disk_hourly_history", ["vm_disk_configuration_version"], :name => "idx_vm_disk_configuration_version_hourly"
529
+
530
+ create_table "vm_disk_samples_history", :primary_key => "history_id", :force => true do |t|
531
+ t.datetime "history_datetime", :null => false
532
+ t.string "image_id", :limit => nil, :null => false
533
+ t.integer "vm_disk_status", :limit => 2
534
+ t.integer "seconds_in_status", :default => 20, :null => false
535
+ t.integer "vm_disk_actual_size_mb", :null => false
536
+ t.integer "read_rate_bytes_per_second"
537
+ t.decimal "read_latency_seconds", :precision => 18, :scale => 9
538
+ t.integer "write_rate_bytes_per_second"
539
+ t.decimal "write_latency_seconds", :precision => 18, :scale => 9
540
+ t.decimal "flush_latency_seconds", :precision => 18, :scale => 9
541
+ t.integer "vm_disk_configuration_version"
542
+ t.string "vm_disk_id", :limit => nil
543
+ end
544
+
545
+ add_index "vm_disk_samples_history", ["history_datetime"], :name => "idx_vm_disk_history_datetime_samples"
546
+ add_index "vm_disk_samples_history", ["image_id"], :name => "vm_disk_samples_history_vm_disk_id_idx"
547
+ add_index "vm_disk_samples_history", ["vm_disk_configuration_version"], :name => "idx_vm_disk_configuration_version_samples"
548
+
549
+ create_table "vm_disks_usage_daily_history", :primary_key => "history_id", :force => true do |t|
550
+ t.datetime "history_datetime", :null => false
551
+ t.string "vm_id", :limit => nil, :null => false
552
+ t.text "disks_usage"
553
+ end
554
+
555
+ add_index "vm_disks_usage_daily_history", ["history_datetime"], :name => "idx_disks_usage_history_datetime_daily"
556
+ add_index "vm_disks_usage_daily_history", ["vm_id"], :name => "idx_disks_usage_vm_id_daily"
557
+
558
+ create_table "vm_disks_usage_hourly_history", :primary_key => "history_id", :force => true do |t|
559
+ t.datetime "history_datetime", :null => false
560
+ t.string "vm_id", :limit => nil, :null => false
561
+ t.text "disks_usage"
562
+ end
563
+
564
+ add_index "vm_disks_usage_hourly_history", ["history_datetime"], :name => "idx_disks_usage_history_datetime_hourly"
565
+ add_index "vm_disks_usage_hourly_history", ["vm_id"], :name => "idx_disks_usage_vm_id_hourly"
566
+
567
+ create_table "vm_disks_usage_samples_history", :primary_key => "history_id", :force => true do |t|
568
+ t.datetime "history_datetime", :null => false
569
+ t.string "vm_id", :limit => nil, :null => false
570
+ t.text "disks_usage"
571
+ end
572
+
573
+ add_index "vm_disks_usage_samples_history", ["history_datetime"], :name => "idx_disks_usage_history_datetime_samples"
574
+ add_index "vm_disks_usage_samples_history", ["vm_id"], :name => "idx_disks_usage_vm_id_samples"
575
+
576
+ create_table "vm_hourly_history", :primary_key => "history_id", :force => true do |t|
577
+ t.datetime "history_datetime", :null => false
578
+ t.string "vm_id", :limit => nil, :null => false
579
+ t.integer "vm_status", :limit => 2, :null => false
580
+ t.decimal "minutes_in_status", :precision => 7, :scale => 2, :default => 1.0, :null => false
581
+ t.integer "cpu_usage_percent", :limit => 2, :default => 0
582
+ t.integer "max_cpu_usage", :limit => 2
583
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
584
+ t.integer "max_memory_usage", :limit => 2
585
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
586
+ t.integer "max_user_cpu_usage_percent", :limit => 2, :default => 0
587
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
588
+ t.integer "max_system_cpu_usage_percent", :limit => 2, :default => 0
589
+ t.string "vm_ip"
590
+ t.string "current_user_name"
591
+ t.string "currently_running_on_host", :limit => nil
592
+ t.integer "vm_configuration_version"
593
+ t.integer "current_host_configuration_version"
594
+ end
595
+
596
+ add_index "vm_hourly_history", ["current_host_configuration_version"], :name => "idx_vm_current_host_configuration_hourly"
597
+ add_index "vm_hourly_history", ["history_datetime"], :name => "idx_vm_history_datetime_hourly"
598
+ add_index "vm_hourly_history", ["vm_configuration_version"], :name => "idx_vm_configuration_version_hourly"
599
+ add_index "vm_hourly_history", ["vm_id"], :name => "vm_hourly_history_vm_id_idx"
600
+
601
+ create_table "vm_interface_configuration", :primary_key => "history_id", :force => true do |t|
602
+ t.string "vm_interface_id", :limit => nil, :null => false
603
+ t.string "vm_interface_name", :limit => 50, :null => false
604
+ t.string "vm_id", :limit => nil
605
+ t.integer "vm_interface_type", :limit => 2
606
+ t.integer "vm_interface_speed_bps"
607
+ t.string "mac_address", :limit => 20
608
+ t.string "network_name", :limit => 50
609
+ t.integer "vm_configuration_version"
610
+ t.datetime "create_date"
611
+ t.datetime "update_date"
612
+ t.datetime "delete_date"
613
+ end
614
+
615
+ add_index "vm_interface_configuration", ["vm_id"], :name => "vm_interface_configuration_vm_id_idx"
616
+ add_index "vm_interface_configuration", ["vm_interface_id"], :name => "vm_interface_configuration_vm_interface_id_idx"
617
+
618
+ create_table "vm_interface_daily_history", :primary_key => "history_id", :force => true do |t|
619
+ t.date "history_datetime", :null => false
620
+ t.string "vm_interface_id", :limit => nil, :null => false
621
+ t.integer "receive_rate_percent", :limit => 2
622
+ t.integer "max_receive_rate_percent", :limit => 2
623
+ t.integer "transmit_rate_percent", :limit => 2
624
+ t.integer "max_transmit_rate_percent", :limit => 2
625
+ t.integer "vm_interface_configuration_version"
626
+ end
627
+
628
+ add_index "vm_interface_daily_history", ["history_datetime"], :name => "idx_vm_interface_history_datetime_daily"
629
+ add_index "vm_interface_daily_history", ["vm_interface_configuration_version"], :name => "idx_vm_interface_configuration_version_daily"
630
+ add_index "vm_interface_daily_history", ["vm_interface_id"], :name => "vm_interface_daily_history_vm_interface_id_idx"
631
+
632
+ create_table "vm_interface_hourly_history", :primary_key => "history_id", :force => true do |t|
633
+ t.datetime "history_datetime", :null => false
634
+ t.string "vm_interface_id", :limit => nil, :null => false
635
+ t.integer "receive_rate_percent", :limit => 2
636
+ t.integer "max_receive_rate_percent", :limit => 2
637
+ t.integer "transmit_rate_percent", :limit => 2
638
+ t.integer "max_transmit_rate_percent", :limit => 2
639
+ t.integer "vm_interface_configuration_version"
640
+ end
641
+
642
+ add_index "vm_interface_hourly_history", ["history_datetime"], :name => "idx_vm_interface_history_datetime_hourly"
643
+ add_index "vm_interface_hourly_history", ["vm_interface_configuration_version"], :name => "idx_vm_interface_configuration_version_hourly"
644
+ add_index "vm_interface_hourly_history", ["vm_interface_id"], :name => "vm_interface_hourly_history_vm_interface_id_idx"
645
+
646
+ create_table "vm_interface_samples_history", :primary_key => "history_id", :force => true do |t|
647
+ t.datetime "history_datetime", :null => false
648
+ t.string "vm_interface_id", :limit => nil, :null => false
649
+ t.integer "receive_rate_percent", :limit => 2
650
+ t.integer "transmit_rate_percent", :limit => 2
651
+ t.integer "vm_interface_configuration_version"
652
+ end
653
+
654
+ add_index "vm_interface_samples_history", ["history_datetime"], :name => "idx_vm_interface_history_datetime_samples"
655
+ add_index "vm_interface_samples_history", ["vm_interface_configuration_version"], :name => "idx_vm_interface_configuration_version_samples"
656
+ add_index "vm_interface_samples_history", ["vm_interface_id"], :name => "vm_interface_samples_history_vm_interface_id_idx"
657
+
658
+ create_table "vm_samples_history", :primary_key => "history_id", :force => true do |t|
659
+ t.datetime "history_datetime", :null => false
660
+ t.string "vm_id", :limit => nil, :null => false
661
+ t.integer "vm_status", :limit => 2, :null => false
662
+ t.integer "seconds_in_status", :default => 20, :null => false
663
+ t.integer "cpu_usage_percent", :limit => 2, :default => 0
664
+ t.integer "memory_usage_percent", :limit => 2, :default => 0
665
+ t.integer "user_cpu_usage_percent", :limit => 2, :default => 0
666
+ t.integer "system_cpu_usage_percent", :limit => 2, :default => 0
667
+ t.string "vm_ip"
668
+ t.string "current_user_name"
669
+ t.string "currently_running_on_host", :limit => nil
670
+ t.integer "vm_configuration_version"
671
+ t.integer "current_host_configuration_version"
672
+ end
673
+
674
+ add_index "vm_samples_history", ["current_host_configuration_version"], :name => "idx_vm_current_host_configuration_samples"
675
+ add_index "vm_samples_history", ["history_datetime"], :name => "idx_vm_history_datetime_samples"
676
+ add_index "vm_samples_history", ["vm_configuration_version"], :name => "idx_vm_configuration_version_samples"
677
+ add_index "vm_samples_history", ["vm_id"], :name => "vm_samples_history_vm_id_idx"
678
+
679
+ end
@@ -43,6 +43,12 @@ def load_rhev_31
43
43
  reset_models
44
44
  end
45
45
 
46
+ def load_rhev_40
47
+ ActiveRecord::Schema.verbose = false
48
+ load File.join(File.dirname(__FILE__), %w{.. schemas schema_rhev40.rb})
49
+ reset_models
50
+ end
51
+
46
52
  def reset_models
47
53
  OvirtMetrics.constants.each do |c|
48
54
  o = OvirtMetrics.const_get(c)
@@ -50,4 +56,4 @@ def reset_models
50
56
  next unless o.respond_to?(:ancestors) && o.ancestors.include?(ActiveRecord::Base)
51
57
  o.reset_column_information
52
58
  end
53
- end
59
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ovirt_metrics
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oleg Barenboim
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-05-02 00:00:00.000000000 Z
12
+ date: 2016-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -227,6 +227,7 @@ files:
227
227
  - spec/ovirt_metrics_spec.rb
228
228
  - spec/schemas/schema_rhev30.rb
229
229
  - spec/schemas/schema_rhev31.rb
230
+ - spec/schemas/schema_rhev40.rb
230
231
  - spec/spec_helper.rb
231
232
  - spec/support/active_record.rb
232
233
  homepage: http://github.com/ManageIQ/ovirt_metrics
@@ -249,7 +250,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
249
250
  version: '0'
250
251
  requirements: []
251
252
  rubyforge_project:
252
- rubygems_version: 2.4.5.1
253
+ rubygems_version: 2.5.1
253
254
  signing_key:
254
255
  specification_version: 4
255
256
  summary: OvirtMetrics is an ActiveRecord-based gem for reading the oVirt History database.
@@ -262,6 +263,7 @@ test_files:
262
263
  - spec/ovirt_metrics_spec.rb
263
264
  - spec/schemas/schema_rhev30.rb
264
265
  - spec/schemas/schema_rhev31.rb
266
+ - spec/schemas/schema_rhev40.rb
265
267
  - spec/spec_helper.rb
266
268
  - spec/support/active_record.rb
267
269
  - ".rspec"