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

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.



56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/fog/ovirt/compute.rb', line 56

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 Array
                  value
                when Hash
                  value
                else
                  value.to_s.strip
                end
  end
  opts
end