Sha256: 027c4d935ec9d0cf735a8412f636f78aa8b4fe882915c77331cee4d3f80c12ea
Contents?: true
Size: 1.15 KB
Versions: 2
Compression:
Stored size: 1.15 KB
Contents
module FogExtensions module Xenserver module StorageRepository extend ActiveSupport::Concern included do attribute :display_name prepend FogExtensions::Xenserver::StorageRepository end def initialize(new_attributes = {}) super(new_attributes) attributes[:display_name] = init_display_name end def free_space physical_size.to_i - physical_utilisation.to_i end def free_space_gb free_space.to_i / 1024 / 1024 / 1024 end def physical_size_gb physical_size.to_i / 1024 / 1024 / 1024 end def physical_utilisation_gb physical_utilisation.to_i / 1024 / 1024 / 1024 end def init_display_name srname = name unless shared pbd = pbds.first srname = "#{name} - #{pbd.host.name}" unless pbd.nil? end format('%{n} (%{f}: %{f_gb} GB - %{u}: %{u_gb} GB - %{t}: %{t_gb} GB)', n: srname, f: _('free'), f_gb: free_space_gb, u: _('used'), u_gb: physical_utilisation_gb, t: _('total'), t_gb: physical_size_gb) 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/storage_repository.rb |
foreman_xen-1.0.0 | app/models/concerns/fog_extensions/xenserver/storage_repository.rb |