Sha256: 1a9398e97fbb00fbf24aaae0bc6c3abc576c48c5da11bd121ffb8bcad8190226

Contents?: true

Size: 1.9 KB

Versions: 7

Compression:

Stored size: 1.9 KB

Contents

module Fog
  module Compute
    class XenServer
      module Models
        class Vif < Model
          # API Reference here:
          # http://docs.vmd.citrix.com/XenServer/6.2.0/1.0/en_gb/api/?c=VIF

          provider_class :VIF
          collection_name :vifs

          identity :reference

          attribute :allowed_operations
          attribute :current_operations
          attribute :currently_attached
          attribute :device
          attribute :ipv4_allowed
          attribute :ipv6_allowed
          attribute :locking_mode
          attribute :mac,                :aliases => :MAC,                  :default => "",         :as => :MAC
          attribute :mac_autogenerated,  :aliases => :MAC_autogenerated,    :default => "True",     :as => :MAC_autogenerated
          attribute :mtu,                :aliases => :MTU,                  :default => "0",        :as => :MTU
          attribute :other_config,                                          :default => {}
          attribute :qos_algorithm_params,                                  :default => {}
          attribute :qos_algorithm_type,                                    :default => "ratelimit"
          attribute :qos_supported_algorithms
          attribute :runtime_properties
          attribute :status_code
          attribute :status_detail
          attribute :uuid

          has_one_identity   :metrics,   :vifs_metrics
          has_one_identity   :network,   :networks
          has_one_identity   :vm,        :servers,          :aliases => :VM,  :as => :VM

          require_before_save :vm, :network, :device

          alias_method :server, :vm

          def set_device_number
            raise ArgumentError, "vm is required for this operation" if vm.nil?
            device_number = vm.vifs.empty? ? 0 : vm.vifs.map(&:device).max.to_i + 1
            self.device = device_number.to_s
          end
        end
      end
    end
  end
end

Version data entries

7 entries across 5 versions & 2 rubygems

Version Path
vagrant-packet-0.1.1 vendor/bundle/ruby/2.3.0/gems/fog-xenserver-0.3.0/lib/fog/compute/xen_server/models/vif.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.5.0/gems/fog-xenserver-0.3.0/lib/fog/compute/xen_server/models/vif.rb
vagrant-packet-0.1.1 vendor/bundle/ruby/2.4.0/gems/fog-xenserver-0.3.0/lib/fog/compute/xen_server/models/vif.rb
fog-xenserver-0.3.0 lib/fog/compute/xen_server/models/vif.rb
fog-xenserver-0.2.3 lib/fog/compute/xen_server/models/vif.rb
fog-xenserver-0.2.2 lib/fog/compute/xen_server/models/vif.rb
fog-xenserver-0.2.1 lib/fog/compute/xen_server/models/vif.rb