Module: Fog::Compute::Ovirt::Shared

Included in:
Mock, Mock, Real, Real
Defined in:
lib/fog/ovirt/compute.rb,
lib/fog/ovirt/requests/compute/update_volume.rb,
lib/fog/ovirt/requests/compute/update_interface.rb

Instance Method Summary collapse

Instance Method Details

#check_arguments(id, options) ⇒ Object

Raises:

  • (ArgumentError)


6
7
8
9
# File 'lib/fog/ovirt/requests/compute/update_volume.rb', line 6

def check_arguments(id, options)
  raise ArgumentError, "instance id is a required parameter" unless id
  raise ArgumentError, "disk id is a required parameter for update-volume" unless options.has_key? :id
end

#ovirt_attrs(obj) ⇒ Object

converts an OVIRT object into an hash for fog to consume.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# File 'lib/fog/ovirt/compute.rb', line 70

def ovirt_attrs obj
  opts = {:raw => obj}
  obj.instance_variables.each do |v|
    key = v.to_s.gsub("@","").to_sym
    value = obj.instance_variable_get(v)
    #ignore nil values
    next if value.nil?

    opts[key] = case value
                when OVIRT::Link
                  value.id
                when OVIRT::TemplateVersion
                  value
                when Array
                  value
                when Hash
                  value
                else
                  value.to_s.strip
                end
  end
  opts
end