lib/fog/ovirt/compute/v4.rb in fog-ovirt-1.1.1 vs lib/fog/ovirt/compute/v4.rb in fog-ovirt-1.1.2
- old
+ new
@@ -54,11 +54,11 @@
opts[key] = client.follow_link(obj.vnic_profile).network.id
next
end
if key == :provisioned_size
- opts[:size] = value
+ opts[:size] = value.to_s
next
end
# ignore nil values
next if value.nil?
@@ -146,11 +146,10 @@
connection_opts = {
:url => url,
:username => username,
:password => password
}
-
@datacenter = options[:ovirt_datacenter]
connection_opts[:ca_file] = options[:ca_file]
connection_opts[:ca_certs] = [OpenSSL::X509::Certificate.new(options[:public_key])] if options[:public_key].present?
@client = ExceptionWrapper.new(OvirtSDK4::Connection.new(connection_opts))
@@ -165,14 +164,22 @@
def datacenter
@datacenter ||= datacenter_hash[:id]
end
def datacenter_hash
+ @datacenter_hash ||= datacenters.find { |x| x[:id] == @datacenter } if @datacenter
@datacenter_hash ||= datacenters.first
end
def blank_template
@blank_template ||= client.system_service.get.special_objects.blank_template
+ end
+
+ def create_search_by_datacenter(search:, datacenter:, page: nil)
+ search ||= ""
+ search += " datacenter=#{datacenter}" if datacenter
+ search += " page #{page}" if page
+ search
end
private
attr_reader :client