class OvirtSDK4::SnapshotsService

Constants

ADD
LIST

Public Instance Methods

add(snapshot, opts = {}) click to toggle source

Creates a virtual machine snapshot.

For example, to create a new snapshot for virtual machine `123` send a request like this:

source

POST /ovirt-engine/api/vms/123/snapshots


With a request body like this:

source,xml

<snapshot>

<description>My snapshot</description>

</snapshot>


IMPORTANT

When a snapshot is created the default value for the <<types/snapshot/attributes/persist_memorystate, persist_memorystate>> attribute is `true`. That means that the content of the memory of the virtual machine will be included in the snapshot, and it also means that the virtual machine will be paused for a longer time. That can negatively affect applications that are very sensitive to timing (NTP servers, for example). In those cases make sure that you set the attribute to `false`:

source,xml

<snapshot>

<description>My snapshot</description>
<persist_memorystate>false</persist_memorystate>

</snapshot>


@param snapshot [Snapshot] The `snapshot` to add.

@param opts [Hash] Additional options.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Snapshot]

# File lib/ovirtsdk4/services.rb, line 18223
def add(snapshot, opts = {})
  internal_add(snapshot, Snapshot, ADD, opts)
end
list(opts = {}) click to toggle source

Returns the representation of the object managed by this service.

@param opts [Hash] Additional options.

@option opts [Integer] :max Sets the maximum number of snapshots to return. If not specified all the snapshots are returned.

@option opts [Hash] :headers ({}) Additional HTTP headers.

@option opts [Hash] :query ({}) Additional URL query parameters.

@option opts [Integer] :timeout (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.

@option opts [Boolean] :wait (true) If `true` wait for the response.

@return [Array<Snapshot>]

# File lib/ovirtsdk4/services.rb, line 18251
def list(opts = {})
  internal_get(LIST, opts)
end
service(path) click to toggle source

Locates the service corresponding to the given path.

@param path [String] The path of the service.

@return [Service] A reference to the service.

# File lib/ovirtsdk4/services.rb, line 18273
def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return snapshot_service(path)
  end
  return snapshot_service(path[0..(index - 1)]).service(path[(index +1)..-1])
end
snapshot_service(id) click to toggle source

Locates the `snapshot` service.

@param id [String] The identifier of the `snapshot`.

@return [SnapshotService] A reference to the `snapshot` service.

# File lib/ovirtsdk4/services.rb, line 18262
def snapshot_service(id)
  SnapshotService.new(@connection, "#{@path}/#{id}")
end
to_s() click to toggle source

Returns an string representation of this service.

@return [String]

# File lib/ovirtsdk4/services.rb, line 18289
def to_s
  "#<#{SnapshotsService}:#{@path}>"
end