Class: OvirtSDK4::FilesService

Inherits:
Service
  • Object
show all
Defined in:
lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb

Instance Method Summary collapse

Methods inherited from Service

#inspect, #to_s

Instance Method Details

#file_service(id) ⇒ FileService

Locates the file service.

Parameters:

  • id (String)

    The identifier of the file.

Returns:


10749
10750
10751
# File 'lib/ovirtsdk4/services.rb', line 10749

def file_service(id)
  FileService.new(self, id)
end

#list(opts = {}) ⇒ Array<File>

Returns the list of ISO images and virtual floppy disks available in the storage domain. The order of the returned list is not guaranteed.

If the refresh parameter is false, the returned list may not reflect recent changes to the storage domain; for example, it may not contain a new ISO file that was recently added. This is because the server caches the list of files to improve performance. To get the very latest results, set the refresh parameter to true.

The default value of the refresh parameter is true, but it can be changed using the configuration value ForceRefreshDomainFilesByDefault:

# engine-config -s ForceRefreshDomainFilesByDefault=false
Important
Setting the value of the refresh parameter to true has an impact on the performance of the server. Use it only if necessary.

Parameters:

  • opts (Hash) (defaults to: {})

    Additional options.

Options Hash (opts):

  • :case_sensitive (Boolean)

    Indicates if the search performed using the search parameter should take case into account. The default value is true.

  • :follow (String)

    Indicates which inner links should be followed. The objects referenced by these links will be fetched as part of the current request. See here for details.

  • :max (Integer)

    Sets the maximum number of files to return. If not specified, all the files are returned.

  • :refresh (Boolean)

    Indicates whether the list of files should be refreshed from the storage domain, rather than showing cached results that are updated at certain intervals.

  • :search (String)

    A query string used to restrict the returned files.

  • :headers (Hash) — default: {}

    Additional HTTP headers.

  • :query (Hash) — default: {}

    Additional URL query parameters.

  • :timeout (Integer) — default: nil

    The timeout for this request, in seconds. If no value is explicitly given then the timeout set globally for the connection will be used.

  • :wait (Boolean) — default: true

    If true wait for the response.

Returns:


10738
10739
10740
# File 'lib/ovirtsdk4/services.rb', line 10738

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.

Parameters:

  • path (String)

    The path of the service.

Returns:

  • (Service)

    A reference to the service.


10760
10761
10762
10763
10764
10765
10766
10767
10768
10769
# File 'lib/ovirtsdk4/services.rb', line 10760

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return file_service(path)
  end
  return file_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end