oneacct-export 0.4.3 → 0.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
 - data/lib/one_data_accessor.rb +4 -13
 - data/lib/one_worker.rb +1 -21
 - data/lib/oneacct_exporter/version.rb +1 -1
 - data/lib/oneacct_opts.rb +25 -0
 - data/mock/one_data_accessor_cluster_01.xml +1 -1
 - data/mock/one_data_accessor_host_01.xml +1 -1
 - data/spec/one_data_accessor_spec.rb +7 -15
 - data/spec/one_worker_spec.rb +1 -46
 - metadata +3 -4
 - data/mock/one_data_accessor_host_02.xml +0 -65
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 7c97727a09636b7edebe37a73fd01907ecf90dba
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 6611ef8ab87262b8fc76117eacf42278bf422aef
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: a2ba6173efd943e3bbd01850a089b5135f7ce94fccbb2f7ecc75b67cfda1b0d76d18a88ad29ab8c361c159943ab4cae9f16acaa064b6a4c881aaa87b3fc81e26
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 3db730a269e531b8a48667275479e26d587cb12f98ae3a1055461304451458f753316dac4b8bd76cf881a4cdd5a3ea6d7d04a7a60c7dd1030fde38c01b18c7ae
         
     | 
    
        data/lib/one_data_accessor.rb
    CHANGED
    
    | 
         @@ -17,7 +17,7 @@ class OneDataAccessor 
     | 
|
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
              STATE_DONE = '6'
         
     | 
| 
       19 
19 
     | 
    
         
             
              BENCHMARK_TYPE_XPATH = 'TEMPLATE/BENCHMARK_TYPE'
         
     | 
| 
       20 
     | 
    
         
            -
               
     | 
| 
      
 20 
     | 
    
         
            +
              BENCHMARK_VALUE_XPATH = 'TEMPLATE/BENCHMARK_VALUE'
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
              attr_reader :log, :batch_size, :client, :compatibility
         
     | 
| 
       23 
23 
     | 
    
         
             
              attr_accessor :start_vm_id
         
     | 
| 
         @@ -199,14 +199,14 @@ class OneDataAccessor 
     | 
|
| 
       199 
199 
     | 
    
         
             
              #
         
     | 
| 
       200 
200 
     | 
    
         
             
              # @return [Hash] hosts' IDs and hash with benchmark name and value
         
     | 
| 
       201 
201 
     | 
    
         
             
              def benchmark_map
         
     | 
| 
       202 
     | 
    
         
            -
                map = {}
         
     | 
| 
      
 202 
     | 
    
         
            +
                map = Hash.new({})
         
     | 
| 
       203 
203 
     | 
    
         
             
                host_pool = OpenNebula::HostPool.new(@client)
         
     | 
| 
       204 
204 
     | 
    
         
             
                rc = host_pool.info
         
     | 
| 
       205 
205 
     | 
    
         
             
                check_retval(rc, Errors::ResourceRetrievalError)
         
     | 
| 
       206 
206 
     | 
    
         | 
| 
       207 
207 
     | 
    
         
             
                host_pool.each do |host|
         
     | 
| 
       208 
208 
     | 
    
         
             
                  benchmark = benchmark_values(host)
         
     | 
| 
       209 
     | 
    
         
            -
                   
     | 
| 
      
 209 
     | 
    
         
            +
                  unless benchmark[:benchmark_type]
         
     | 
| 
       210 
210 
     | 
    
         
             
                    cluster = cluster_for_host(host)
         
     | 
| 
       211 
211 
     | 
    
         
             
                    benchmark = benchmark_values(cluster) if cluster
         
     | 
| 
       212 
212 
     | 
    
         
             
                  end
         
     | 
| 
         @@ -222,16 +222,7 @@ class OneDataAccessor 
     | 
|
| 
       222 
222 
     | 
    
         
             
              # @param [OpenNebula::PoolElement] entity
         
     | 
| 
       223 
223 
     | 
    
         
             
              # @return [Hash] benchmark type and values in form of hash
         
     | 
| 
       224 
224 
     | 
    
         
             
              def benchmark_values(entity)
         
     | 
| 
       225 
     | 
    
         
            -
                benchmark_type  
     | 
| 
       226 
     | 
    
         
            -
                return {} unless benchmark_type
         
     | 
| 
       227 
     | 
    
         
            -
             
     | 
| 
       228 
     | 
    
         
            -
                mixins = {}
         
     | 
| 
       229 
     | 
    
         
            -
                benchmark_values = entity[BENCHMARK_VALUES_XPATH]
         
     | 
| 
       230 
     | 
    
         
            -
                if benchmark_values
         
     | 
| 
       231 
     | 
    
         
            -
                  mixins = JSON.parse(benchmark_values, :max_nesting => 1)
         
     | 
| 
       232 
     | 
    
         
            -
                end
         
     | 
| 
       233 
     | 
    
         
            -
             
     | 
| 
       234 
     | 
    
         
            -
                { :benchmark_type => benchmark_type, :mixins => mixins }
         
     | 
| 
      
 225 
     | 
    
         
            +
                { benchmark_type: entity[BENCHMARK_TYPE_XPATH], benchmark_value: entity[BENCHMARK_VALUE_XPATH] }
         
     | 
| 
       235 
226 
     | 
    
         
             
              end
         
     | 
| 
       236 
227 
     | 
    
         | 
| 
       237 
228 
     | 
    
         
             
              # Returns object representing a cluster for specified host
         
     | 
    
        data/lib/one_worker.rb
    CHANGED
    
    | 
         @@ -131,7 +131,7 @@ class OneWorker 
     | 
|
| 
       131 
131 
     | 
    
         
             
                data['disks'] = disk_records(vm)
         
     | 
| 
       132 
132 
     | 
    
         
             
                data['number_of_public_ips'] = number_of_public_ips(vm)
         
     | 
| 
       133 
133 
     | 
    
         | 
| 
       134 
     | 
    
         
            -
                benchmark =  
     | 
| 
      
 134 
     | 
    
         
            +
                benchmark = benchmark_map[vm['HISTORY_RECORDS/HISTORY[last()]/HID']]
         
     | 
| 
       135 
135 
     | 
    
         
             
                data['benchmark_type'] = benchmark[:benchmark_type]
         
     | 
| 
       136 
136 
     | 
    
         
             
                data['benchmark_value'] = benchmark[:benchmark_value]
         
     | 
| 
       137 
137 
     | 
    
         | 
| 
         @@ -272,26 +272,6 @@ class OneWorker 
     | 
|
| 
       272 
272 
     | 
    
         
             
                raise msg
         
     | 
| 
       273 
273 
     | 
    
         
             
              end
         
     | 
| 
       274 
274 
     | 
    
         | 
| 
       275 
     | 
    
         
            -
              # Search benchmark type and value virtual machine.
         
     | 
| 
       276 
     | 
    
         
            -
              #
         
     | 
| 
       277 
     | 
    
         
            -
              # @param [OpenNebula::VirtualMachine] vm virtual machine
         
     | 
| 
       278 
     | 
    
         
            -
              # @param [Hash] benchmark_map map of all hosts' benchmarks
         
     | 
| 
       279 
     | 
    
         
            -
              #
         
     | 
| 
       280 
     | 
    
         
            -
              # @return [Hash] benchmark type and value or both can be nil
         
     | 
| 
       281 
     | 
    
         
            -
              def search_benchmark(vm, benchmark_map)
         
     | 
| 
       282 
     | 
    
         
            -
                map = benchmark_map[vm['HISTORY_RECORDS/HISTORY[last()]/HID']]
         
     | 
| 
       283 
     | 
    
         
            -
             
     | 
| 
       284 
     | 
    
         
            -
                return {} unless vm['USER_TEMPLATE/OCCI_COMPUTE_MIXINS']
         
     | 
| 
       285 
     | 
    
         
            -
                return {} if map.nil? || map.empty?
         
     | 
| 
       286 
     | 
    
         
            -
             
     | 
| 
       287 
     | 
    
         
            -
                occi_compute_mixins = vm['USER_TEMPLATE/OCCI_COMPUTE_MIXINS'].split(/\s+/)
         
     | 
| 
       288 
     | 
    
         
            -
                occi_compute_mixins.each do |mixin|
         
     | 
| 
       289 
     | 
    
         
            -
                  return { :benchmark_type => map[:benchmark_type], :benchmark_value => map[:mixins][mixin] } if map[:mixins].has_key?(mixin)
         
     | 
| 
       290 
     | 
    
         
            -
                end
         
     | 
| 
       291 
     | 
    
         
            -
             
     | 
| 
       292 
     | 
    
         
            -
                {}
         
     | 
| 
       293 
     | 
    
         
            -
              end
         
     | 
| 
       294 
     | 
    
         
            -
             
     | 
| 
       295 
275 
     | 
    
         
             
              private
         
     | 
| 
       296 
276 
     | 
    
         | 
| 
       297 
277 
     | 
    
         
             
              # Check if IP is public
         
     | 
    
        data/lib/oneacct_opts.rb
    CHANGED
    
    | 
         @@ -69,6 +69,24 @@ class OneacctOpts 
     | 
|
| 
       69 
69 
     | 
    
         
             
                    options.compatibility = compatibility
         
     | 
| 
       70 
70 
     | 
    
         
             
                  end
         
     | 
| 
       71 
71 
     | 
    
         | 
| 
      
 72 
     | 
    
         
            +
                  opts.on('--harden-ssl-security', 'Sets basic SSL options for better security.') do
         
     | 
| 
      
 73 
     | 
    
         
            +
                      OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv2
         
     | 
| 
      
 74 
     | 
    
         
            +
                      OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_SSLv3
         
     | 
| 
      
 75 
     | 
    
         
            +
                      OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:options] |= OpenSSL::SSL::OP_NO_COMPRESSION
         
     | 
| 
      
 76 
     | 
    
         
            +
                  end
         
     | 
| 
      
 77 
     | 
    
         
            +
             
     | 
| 
      
 78 
     | 
    
         
            +
                  opts.on('--ssl-cipher-suite CIPHER_SUITE', 'Sets SSL cipher suite.') do |suite|
         
     | 
| 
      
 79 
     | 
    
         
            +
                    OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ciphers] = suite
         
     | 
| 
      
 80 
     | 
    
         
            +
                  end
         
     | 
| 
      
 81 
     | 
    
         
            +
             
     | 
| 
      
 82 
     | 
    
         
            +
                  opts.on('--ssl-version VERSION', 'Sets SSL version') do |version|
         
     | 
| 
      
 83 
     | 
    
         
            +
                    OpenSSL::SSL::SSLContext::DEFAULT_PARAMS[:ssl_version] = version
         
     | 
| 
      
 84 
     | 
    
         
            +
                  end
         
     | 
| 
      
 85 
     | 
    
         
            +
             
     | 
| 
      
 86 
     | 
    
         
            +
                  opts.on("--skip-ca-check", "Skip server certificate verification [NOT recommended]") do
         
     | 
| 
      
 87 
     | 
    
         
            +
                      silence_warnings { OpenSSL::SSL.const_set(:VERIFY_PEER, OpenSSL::SSL::VERIFY_NONE) }
         
     | 
| 
      
 88 
     | 
    
         
            +
                  end
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
       72 
90 
     | 
    
         
             
                  opts.on_tail('-h', '--help', 'Shows this message') do
         
     | 
| 
       73 
91 
     | 
    
         
             
                    puts opts
         
     | 
| 
       74 
92 
     | 
    
         
             
                    exit
         
     | 
| 
         @@ -173,4 +191,11 @@ class OneacctOpts 
     | 
|
| 
       173 
191 
     | 
    
         
             
                  end
         
     | 
| 
       174 
192 
     | 
    
         
             
                end
         
     | 
| 
       175 
193 
     | 
    
         
             
              end
         
     | 
| 
      
 194 
     | 
    
         
            +
             
     | 
| 
      
 195 
     | 
    
         
            +
              def self.silence_warnings
         
     | 
| 
      
 196 
     | 
    
         
            +
                old_verbose, $VERBOSE = $VERBOSE, nil
         
     | 
| 
      
 197 
     | 
    
         
            +
                yield
         
     | 
| 
      
 198 
     | 
    
         
            +
              ensure
         
     | 
| 
      
 199 
     | 
    
         
            +
                $VERBOSE = old_verbose
         
     | 
| 
      
 200 
     | 
    
         
            +
              end
         
     | 
| 
       176 
201 
     | 
    
         
             
            end
         
     | 
| 
         @@ -20,7 +20,7 @@ 
     | 
|
| 
       20 
20 
     | 
    
         
             
              </VNETS>
         
     | 
| 
       21 
21 
     | 
    
         
             
              <TEMPLATE>
         
     | 
| 
       22 
22 
     | 
    
         
             
                <BENCHMARK_TYPE>bench_type_cluster_1</BENCHMARK_TYPE>
         
     | 
| 
       23 
     | 
    
         
            -
                < 
     | 
| 
      
 23 
     | 
    
         
            +
                <BENCHMARK_VALUE>21.7</BENCHMARK_VALUE>
         
     | 
| 
       24 
24 
     | 
    
         
             
                <RESERVED_CPU><![CDATA[]]></RESERVED_CPU>
         
     | 
| 
       25 
25 
     | 
    
         
             
                <RESERVED_MEM><![CDATA[8388608]]></RESERVED_MEM>
         
     | 
| 
       26 
26 
     | 
    
         
             
              </TEMPLATE>
         
     | 
| 
         @@ -49,7 +49,7 @@ 
     | 
|
| 
       49 
49 
     | 
    
         
             
              <TEMPLATE>
         
     | 
| 
       50 
50 
     | 
    
         
             
                <ARCH><![CDATA[x86_64]]></ARCH>
         
     | 
| 
       51 
51 
     | 
    
         
             
                <BENCHMARK_TYPE>bench_type_1</BENCHMARK_TYPE>
         
     | 
| 
       52 
     | 
    
         
            -
                < 
     | 
| 
      
 52 
     | 
    
         
            +
                <BENCHMARK_VALUE>36.9</BENCHMARK_VALUE>
         
     | 
| 
       53 
53 
     | 
    
         
             
                <CPUSPEED><![CDATA[1200]]></CPUSPEED>
         
     | 
| 
       54 
54 
     | 
    
         
             
                <ERROR><![CDATA[Thu Nov 19 11:56:06 2015 : Error monitoring Host whatever.in.czech.republic.cz (21): -]]></ERROR>
         
     | 
| 
       55 
55 
     | 
    
         
             
                <HOSTNAME><![CDATA[whatever.in.czech.republic.cz]]></HOSTNAME>
         
     | 
| 
         @@ -450,20 +450,10 @@ describe OneDataAccessor do 
     | 
|
| 
       450 
450 
     | 
    
         
             
                  OpenNebula::XMLElement.new(OpenNebula::XMLElement.build_xml(file, 'CLUSTER'))
         
     | 
| 
       451 
451 
     | 
    
         
             
                }
         
     | 
| 
       452 
452 
     | 
    
         | 
| 
       453 
     | 
    
         
            -
                context 'with correct data on a host 
     | 
| 
      
 453 
     | 
    
         
            +
                context 'with correct data on a host' do
         
     | 
| 
       454 
454 
     | 
    
         
             
                  let(:host_filename) { 'one_data_accessor_host_01.xml' }
         
     | 
| 
       455 
455 
     | 
    
         
             
                  let(:expected) { { '1' => { :benchmark_type => 'bench_type_1',
         
     | 
| 
       456 
     | 
    
         
            -
                                              : 
     | 
| 
       457 
     | 
    
         
            -
             
     | 
| 
       458 
     | 
    
         
            -
                  it 'creates correct benchmark_map' do
         
     | 
| 
       459 
     | 
    
         
            -
                    expect(subject.benchmark_map).to eq(expected)
         
     | 
| 
       460 
     | 
    
         
            -
                  end
         
     | 
| 
       461 
     | 
    
         
            -
                end
         
     | 
| 
       462 
     | 
    
         
            -
             
     | 
| 
       463 
     | 
    
         
            -
                context 'with correct data on a host with two benchmark values' do
         
     | 
| 
       464 
     | 
    
         
            -
                  let(:host_filename) { 'one_data_accessor_host_02.xml' }
         
     | 
| 
       465 
     | 
    
         
            -
                  let(:expected) { { '2' => { :benchmark_type => 'bench_type_2',
         
     | 
| 
       466 
     | 
    
         
            -
                                              :mixins => { 'mixin1' => 788.6, 'mixin2' => 123.123 } } } }
         
     | 
| 
      
 456 
     | 
    
         
            +
                                              :benchmark_value => '36.9' } } }
         
     | 
| 
       467 
457 
     | 
    
         | 
| 
       468 
458 
     | 
    
         
             
                  it 'creates correct benchmark_map' do
         
     | 
| 
       469 
459 
     | 
    
         
             
                    expect(subject.benchmark_map).to eq(expected)
         
     | 
| 
         @@ -478,7 +468,7 @@ describe OneDataAccessor do 
     | 
|
| 
       478 
468 
     | 
    
         
             
                  let(:host_filename) { 'one_data_accessor_host_03.xml' }
         
     | 
| 
       479 
469 
     | 
    
         
             
                  let(:cluster_filename) { 'one_data_accessor_cluster_01.xml' }
         
     | 
| 
       480 
470 
     | 
    
         
             
                  let(:expected) { { '3' => { :benchmark_type => 'bench_type_cluster_1',
         
     | 
| 
       481 
     | 
    
         
            -
                                              : 
     | 
| 
      
 471 
     | 
    
         
            +
                                              :benchmark_value => '21.7' } } }
         
     | 
| 
       482 
472 
     | 
    
         | 
| 
       483 
473 
     | 
    
         
             
                  it 'creates correct benchmark_map' do
         
     | 
| 
       484 
474 
     | 
    
         
             
                    expect(subject.benchmark_map).to eq(expected)
         
     | 
| 
         @@ -492,7 +482,8 @@ describe OneDataAccessor do 
     | 
|
| 
       492 
482 
     | 
    
         | 
| 
       493 
483 
     | 
    
         
             
                  let(:host_filename) { 'one_data_accessor_host_04.xml' }
         
     | 
| 
       494 
484 
     | 
    
         
             
                  let(:cluster_filename) { 'one_data_accessor_cluster_02.xml' }
         
     | 
| 
       495 
     | 
    
         
            -
                  let(:expected) { { '4' => { 
     | 
| 
      
 485 
     | 
    
         
            +
                  let(:expected) { { '4' => { :benchmark_type => nil,
         
     | 
| 
      
 486 
     | 
    
         
            +
                                              :benchmark_value => nil } } }
         
     | 
| 
       496 
487 
     | 
    
         | 
| 
       497 
488 
     | 
    
         
             
                  it 'creates correct benchmark_map' do
         
     | 
| 
       498 
489 
     | 
    
         
             
                    expect(subject.benchmark_map).to eq(expected)
         
     | 
| 
         @@ -501,7 +492,8 @@ describe OneDataAccessor do 
     | 
|
| 
       501 
492 
     | 
    
         | 
| 
       502 
493 
     | 
    
         
             
                context 'with no data on a host and without host\'s cluster' do
         
     | 
| 
       503 
494 
     | 
    
         
             
                  let(:host_filename) { 'one_data_accessor_host_05.xml' }
         
     | 
| 
       504 
     | 
    
         
            -
                  let(:expected) { { '5' => { 
     | 
| 
      
 495 
     | 
    
         
            +
                  let(:expected) { { '5' => { :benchmark_type => nil,
         
     | 
| 
      
 496 
     | 
    
         
            +
                                              :benchmark_value => nil } } }
         
     | 
| 
       505 
497 
     | 
    
         
             
                  let(:searched_cluster) { nil }
         
     | 
| 
       506 
498 
     | 
    
         | 
| 
       507 
499 
     | 
    
         
             
                  it 'creates correct benchmark_map' do
         
     | 
    
        data/spec/one_worker_spec.rb
    CHANGED
    
    | 
         @@ -213,7 +213,7 @@ describe OneWorker do 
     | 
|
| 
       213 
213 
     | 
    
         
             
                let(:user_map) { {'120' => '/Dn=FrOm/CN=DN/CN=MaP'} }
         
     | 
| 
       214 
214 
     | 
    
         
             
                let(:image_map) { {'31' => 'image_name_from_map'} }
         
     | 
| 
       215 
215 
     | 
    
         
             
                let(:cluster_map) { {'100' => 'site-name-from-cluster'}}
         
     | 
| 
       216 
     | 
    
         
            -
                let(:benchmark_map) { {' 
     | 
| 
      
 216 
     | 
    
         
            +
                let(:benchmark_map) { {'11' => {}}  }
         
     | 
| 
       217 
217 
     | 
    
         | 
| 
       218 
218 
     | 
    
         
             
                context 'with apel specific data' do
         
     | 
| 
       219 
219 
     | 
    
         
             
                  let(:filename) { 'one_worker_vm_dn01.xml' }
         
     | 
| 
         @@ -583,49 +583,4 @@ describe OneWorker do 
     | 
|
| 
       583 
583 
     | 
    
         
             
                  end
         
     | 
| 
       584 
584 
     | 
    
         
             
                end
         
     | 
| 
       585 
585 
     | 
    
         
             
              end
         
     | 
| 
       586 
     | 
    
         
            -
             
     | 
| 
       587 
     | 
    
         
            -
              describe '.search_benchmark' do
         
     | 
| 
       588 
     | 
    
         
            -
                let(:vm) do
         
     | 
| 
       589 
     | 
    
         
            -
                  xml = File.read("#{GEM_DIR}/mock/#{filename}")
         
     | 
| 
       590 
     | 
    
         
            -
                  OpenNebula::XMLElement.new(OpenNebula::XMLElement.build_xml(xml, 'VM'))
         
     | 
| 
       591 
     | 
    
         
            -
                end
         
     | 
| 
       592 
     | 
    
         
            -
             
     | 
| 
       593 
     | 
    
         
            -
                let(:benchmark_map) do
         
     | 
| 
       594 
     | 
    
         
            -
                  values1 = { :benchmark_type => 'bench_type_1', :mixins => { 'mixin1' => '34.12' } }
         
     | 
| 
       595 
     | 
    
         
            -
                  values2 = { :benchmark_type => 'bench_type_2', :mixins => { 'mixin2' => '123.2', 'mixin3' => '129.6' } }
         
     | 
| 
       596 
     | 
    
         
            -
                  values3 = { }
         
     | 
| 
       597 
     | 
    
         
            -
             
     | 
| 
       598 
     | 
    
         
            -
                  benchmark_map = { '19' => values1, '11' => values2, '23' => values3 }
         
     | 
| 
       599 
     | 
    
         
            -
                  benchmark_map
         
     | 
| 
       600 
     | 
    
         
            -
                end
         
     | 
| 
       601 
     | 
    
         
            -
             
     | 
| 
       602 
     | 
    
         
            -
                context 'with empty benchmark_map' do
         
     | 
| 
       603 
     | 
    
         
            -
                  let(:filename) { 'one_worker_vm_search_benchmark_01.xml' }
         
     | 
| 
       604 
     | 
    
         
            -
                  let(:benchmark_map) { {} }
         
     | 
| 
       605 
     | 
    
         
            -
                  let(:expected) { {} }
         
     | 
| 
       606 
     | 
    
         
            -
             
     | 
| 
       607 
     | 
    
         
            -
                  it 'returns array with two nil items' do
         
     | 
| 
       608 
     | 
    
         
            -
                    expect(subject.search_benchmark(vm, benchmark_map)).to eq(expected)
         
     | 
| 
       609 
     | 
    
         
            -
                  end
         
     | 
| 
       610 
     | 
    
         
            -
                end
         
     | 
| 
       611 
     | 
    
         
            -
             
     | 
| 
       612 
     | 
    
         
            -
                context 'with no data for the virtual machine in benchmark_map' do
         
     | 
| 
       613 
     | 
    
         
            -
                  let(:filename) { 'one_worker_vm_search_benchmark_02.xml' }
         
     | 
| 
       614 
     | 
    
         
            -
                  let(:expected) { {} }
         
     | 
| 
       615 
     | 
    
         
            -
             
     | 
| 
       616 
     | 
    
         
            -
                  it 'returns array with two nil items' do
         
     | 
| 
       617 
     | 
    
         
            -
                    expect(subject.search_benchmark(vm, benchmark_map)).to eq(expected)
         
     | 
| 
       618 
     | 
    
         
            -
                  end
         
     | 
| 
       619 
     | 
    
         
            -
                end
         
     | 
| 
       620 
     | 
    
         
            -
             
     | 
| 
       621 
     | 
    
         
            -
                context 'with correct data in vm and benchmark_map' do
         
     | 
| 
       622 
     | 
    
         
            -
                  let(:filename) { 'one_worker_vm_search_benchmark_01.xml' }
         
     | 
| 
       623 
     | 
    
         
            -
                  let(:expected) { { :benchmark_type => 'bench_type_2', :benchmark_value => '129.6' } }
         
     | 
| 
       624 
     | 
    
         
            -
             
     | 
| 
       625 
     | 
    
         
            -
                  it 'returns correct benchmark type and value' do
         
     | 
| 
       626 
     | 
    
         
            -
                    expect(subject.search_benchmark(vm, benchmark_map)).to eq(expected)
         
     | 
| 
       627 
     | 
    
         
            -
                  end
         
     | 
| 
       628 
     | 
    
         
            -
                end
         
     | 
| 
       629 
     | 
    
         
            -
              end
         
     | 
| 
       630 
     | 
    
         
            -
             
     | 
| 
       631 
586 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: oneacct-export
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.4. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 0.4.4
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Michal Kimle
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-12-25 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -220,7 +220,6 @@ files: 
     | 
|
| 
       220 
220 
     | 
    
         
             
            - mock/one_data_accessor_cluster_01.xml
         
     | 
| 
       221 
221 
     | 
    
         
             
            - mock/one_data_accessor_cluster_02.xml
         
     | 
| 
       222 
222 
     | 
    
         
             
            - mock/one_data_accessor_host_01.xml
         
     | 
| 
       223 
     | 
    
         
            -
            - mock/one_data_accessor_host_02.xml
         
     | 
| 
       224 
223 
     | 
    
         
             
            - mock/one_data_accessor_host_03.xml
         
     | 
| 
       225 
224 
     | 
    
         
             
            - mock/one_data_accessor_host_04.xml
         
     | 
| 
       226 
225 
     | 
    
         
             
            - mock/one_data_accessor_host_05.xml
         
     | 
| 
         @@ -274,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       274 
273 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       275 
274 
     | 
    
         
             
            requirements: []
         
     | 
| 
       276 
275 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       277 
     | 
    
         
            -
            rubygems_version: 2.4. 
     | 
| 
      
 276 
     | 
    
         
            +
            rubygems_version: 2.4.8
         
     | 
| 
       278 
277 
     | 
    
         
             
            signing_key: 
         
     | 
| 
       279 
278 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       280 
279 
     | 
    
         
             
            summary: Exporting OpenNebula accounting data.
         
     | 
| 
         @@ -1,65 +0,0 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
            <HOST>
         
     | 
| 
       2 
     | 
    
         
            -
              <ID>2</ID>
         
     | 
| 
       3 
     | 
    
         
            -
              <NAME>whatever.in.czech.republic.cz</NAME>
         
     | 
| 
       4 
     | 
    
         
            -
              <STATE>5</STATE>
         
     | 
| 
       5 
     | 
    
         
            -
              <IM_MAD><![CDATA[kvm]]></IM_MAD>
         
     | 
| 
       6 
     | 
    
         
            -
              <VM_MAD><![CDATA[kvm]]></VM_MAD>
         
     | 
| 
       7 
     | 
    
         
            -
              <VN_MAD><![CDATA[802.1Q]]></VN_MAD>
         
     | 
| 
       8 
     | 
    
         
            -
              <LAST_MON_TIME>1447930638</LAST_MON_TIME>
         
     | 
| 
       9 
     | 
    
         
            -
              <CLUSTER_ID>1</CLUSTER_ID>
         
     | 
| 
       10 
     | 
    
         
            -
              <CLUSTER>fedcloud-warg</CLUSTER>
         
     | 
| 
       11 
     | 
    
         
            -
              <HOST_SHARE>
         
     | 
| 
       12 
     | 
    
         
            -
                <DISK_USAGE>0</DISK_USAGE>
         
     | 
| 
       13 
     | 
    
         
            -
                <MEM_USAGE>50331648</MEM_USAGE>
         
     | 
| 
       14 
     | 
    
         
            -
                <CPU_USAGE>2000</CPU_USAGE>
         
     | 
| 
       15 
     | 
    
         
            -
                <MAX_DISK>19686</MAX_DISK>
         
     | 
| 
       16 
     | 
    
         
            -
                <MAX_MEM>57674040</MAX_MEM>
         
     | 
| 
       17 
     | 
    
         
            -
                <MAX_CPU>3200</MAX_CPU>
         
     | 
| 
       18 
     | 
    
         
            -
                <FREE_DISK>13945</FREE_DISK>
         
     | 
| 
       19 
     | 
    
         
            -
                <FREE_MEM>30670728</FREE_MEM>
         
     | 
| 
       20 
     | 
    
         
            -
                <FREE_CPU>3196</FREE_CPU>
         
     | 
| 
       21 
     | 
    
         
            -
                <USED_DISK>4742</USED_DISK>
         
     | 
| 
       22 
     | 
    
         
            -
                <USED_MEM>35391920</USED_MEM>
         
     | 
| 
       23 
     | 
    
         
            -
                <USED_CPU>3</USED_CPU>
         
     | 
| 
       24 
     | 
    
         
            -
                <RUNNING_VMS>11</RUNNING_VMS>
         
     | 
| 
       25 
     | 
    
         
            -
                <DATASTORES>
         
     | 
| 
       26 
     | 
    
         
            -
                  <DS>
         
     | 
| 
       27 
     | 
    
         
            -
                    <FREE_MB><![CDATA[3037509]]></FREE_MB>
         
     | 
| 
       28 
     | 
    
         
            -
                    <ID><![CDATA[101]]></ID>
         
     | 
| 
       29 
     | 
    
         
            -
                    <TOTAL_MB><![CDATA[3338205]]></TOTAL_MB>
         
     | 
| 
       30 
     | 
    
         
            -
                    <USED_MB><![CDATA[122933]]></USED_MB>
         
     | 
| 
       31 
     | 
    
         
            -
                    <VMS_ALLOCATED_MB><![CDATA[122733]]></VMS_ALLOCATED_MB>
         
     | 
| 
       32 
     | 
    
         
            -
                    <VMS_REQUIRED_MB><![CDATA[130925]]></VMS_REQUIRED_MB>
         
     | 
| 
       33 
     | 
    
         
            -
                  </DS>
         
     | 
| 
       34 
     | 
    
         
            -
                </DATASTORES>
         
     | 
| 
       35 
     | 
    
         
            -
              </HOST_SHARE>
         
     | 
| 
       36 
     | 
    
         
            -
              <VMS>
         
     | 
| 
       37 
     | 
    
         
            -
                <ID>51575</ID>
         
     | 
| 
       38 
     | 
    
         
            -
                <ID>53988</ID>
         
     | 
| 
       39 
     | 
    
         
            -
                <ID>54035</ID>
         
     | 
| 
       40 
     | 
    
         
            -
                <ID>54553</ID>
         
     | 
| 
       41 
     | 
    
         
            -
                <ID>55276</ID>
         
     | 
| 
       42 
     | 
    
         
            -
                <ID>56251</ID>
         
     | 
| 
       43 
     | 
    
         
            -
                <ID>56288</ID>
         
     | 
| 
       44 
     | 
    
         
            -
                <ID>56291</ID>
         
     | 
| 
       45 
     | 
    
         
            -
                <ID>59948</ID>
         
     | 
| 
       46 
     | 
    
         
            -
                <ID>60163</ID>
         
     | 
| 
       47 
     | 
    
         
            -
                <ID>60173</ID>
         
     | 
| 
       48 
     | 
    
         
            -
              </VMS>
         
     | 
| 
       49 
     | 
    
         
            -
              <TEMPLATE>
         
     | 
| 
       50 
     | 
    
         
            -
                <ARCH><![CDATA[x86_64]]></ARCH>
         
     | 
| 
       51 
     | 
    
         
            -
                <BENCHMARK_TYPE>bench_type_2</BENCHMARK_TYPE>
         
     | 
| 
       52 
     | 
    
         
            -
                <BENCHMARK_VALUES>{"mixin1": 788.6, "mixin2": 123.123}</BENCHMARK_VALUES>
         
     | 
| 
       53 
     | 
    
         
            -
                <CPUSPEED><![CDATA[1200]]></CPUSPEED>
         
     | 
| 
       54 
     | 
    
         
            -
                <ERROR><![CDATA[Thu Nov 19 11:56:06 2015 : Error monitoring Host whatever.in.czech.republic.cz (21): -]]></ERROR>
         
     | 
| 
       55 
     | 
    
         
            -
                <HOSTNAME><![CDATA[whatever.in.czech.republic.cz]]></HOSTNAME>
         
     | 
| 
       56 
     | 
    
         
            -
                <HYPERVISOR><![CDATA[kvm]]></HYPERVISOR>
         
     | 
| 
       57 
     | 
    
         
            -
                <MODELNAME><![CDATA[Intel(R) Xeon(R) CPU E5-2650 v2 @ 2.60GHz]]></MODELNAME>
         
     | 
| 
       58 
     | 
    
         
            -
                <NETRX><![CDATA[518778988428]]></NETRX>
         
     | 
| 
       59 
     | 
    
         
            -
                <NETTX><![CDATA[761175714938]]></NETTX>
         
     | 
| 
       60 
     | 
    
         
            -
                <PRIORITY><![CDATA[990]]></PRIORITY>
         
     | 
| 
       61 
     | 
    
         
            -
                <RESERVED_CPU><![CDATA[]]></RESERVED_CPU>
         
     | 
| 
       62 
     | 
    
         
            -
                <RESERVED_MEM><![CDATA[]]></RESERVED_MEM>
         
     | 
| 
       63 
     | 
    
         
            -
                <VERSION><![CDATA[4.10.1]]></VERSION>
         
     | 
| 
       64 
     | 
    
         
            -
              </TEMPLATE>
         
     | 
| 
       65 
     | 
    
         
            -
            </HOST>
         
     |