Sha256: bd915ffc1e94abfbc7c15e7f3469ef124241bad7cff121c831086eb098665547

Contents?: true

Size: 495 Bytes

Versions: 2

Compression:

Stored size: 495 Bytes

Contents

module FogExtensions
  module Xenserver
    module Host
      extend ActiveSupport::Concern

      included do
        attribute :display_name
        prepend FogExtensions::Xenserver::Host
      end

      def initialize(new_attributes = {})
        super(new_attributes)
        attributes[:display_name] = "#{name} - #{mem_free_gb} GB free memory"
      end

      def mem_free_gb
        return metrics.memory_free.to_i / 1024 / 1024 / 1024 if metrics

        0
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
foreman_xen-1.0.1 app/models/concerns/fog_extensions/xenserver/host.rb
foreman_xen-1.0.0 app/models/concerns/fog_extensions/xenserver/host.rb