Class: Fog::XenServer::Compute::Models::Vif

Inherits:
Model
  • Object
show all
Defined in:
lib/fog/xenserver/compute/models/vif.rb

Instance Method Summary collapse

Methods included from ClassMethods

#collection_name, #provider_class, #require_before_save

Methods included from InstanceMethods

#collection, #destroy, #method_missing, #provider_class, #require_creation_attributes, #respond_to?, #save, #set_attribute

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Fog::XenServer::Compute::Models::InstanceMethods

Instance Method Details

#set_device_numberObject

Raises:

  • (ArgumentError)


41
42
43
44
45
# File 'lib/fog/xenserver/compute/models/vif.rb', line 41

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