class OvirtSDK4::SnapshotService

Constants

GET
REMOVE
RESTORE

Public Instance Methods

cdroms_service() click to toggle source

Locates the `cdroms` service.

@return [SnapshotCdromsService] A reference to `cdroms` service.

# File lib/ovirtsdk4/services.rb, line 20947
def cdroms_service
  @cdroms_service ||= SnapshotCdromsService.new(self, 'cdroms')
end
disks_service() click to toggle source

Locates the `disks` service.

@return [SnapshotDisksService] A reference to `disks` service.

# File lib/ovirtsdk4/services.rb, line 20956
def disks_service
  @disks_service ||= SnapshotDisksService.new(self, 'disks')
end
get(opts = {}) click to toggle source

Returns the representation of the object managed by this service.

@param opts [Hash] Additional options.

@option opts [String] :follow Indicates which inner links should be followed. The objects referenced by these links will be fetched as part

of the current request. See <<documents/003_common_concepts/follow, here>> for details.

@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 20831
def get(opts = {})
  internal_get(GET, opts)
end
nics_service() click to toggle source

Locates the `nics` service.

@return [SnapshotNicsService] A reference to `nics` service.

# File lib/ovirtsdk4/services.rb, line 20965
def nics_service
  @nics_service ||= SnapshotNicsService.new(self, 'nics')
end
remove(opts = {}) click to toggle source

Deletes the object managed by this service.

@param opts [Hash] Additional options.

@option opts [Boolean] :all_content Indicates if all the attributes of the virtual machine snapshot should be included in the response.

By default the attribute `initialization.configuration.data` is excluded.

For example, to retrieve the complete representation of the snapshot with id `456` of the virtual machine
with id `123` send a request like this:

....
GET /ovirt-engine/api/vms/123/snapshots/456?all_content=true
....

@option opts [Boolean] :async Indicates if the remove should be performed asynchronously. @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.

# File lib/ovirtsdk4/services.rb, line 20867
def remove(opts = {})
  internal_remove(REMOVE, opts)
end
restore(opts = {}) click to toggle source

Restores a virtual machine snapshot.

For example, to restore the snapshot with identifier `456` of virtual machine with identifier `123` send a request like this:

source

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


With an empty `action` in the body:

source,xml

<action/>


NOTE: Confirm that the commit operation is finished and the virtual machine is down before running the virtual machine.

@param opts [Hash] Additional options.

@option opts [Boolean] :async Indicates if the restore should be performed asynchronously.

@option opts [Array<Disk>] :disks Specify the disks included in the snapshot's restore.

For each disk parameter, it is also required to specify its `image_id`.

For example, to restore a snapshot with an identifier `456` of a virtual machine with identifier `123`, including
a disk with identifier `111` and `image_id` of `222`, send a request like this:

[source]
----
POST /ovirt-engine/api/vms/123/snapshots/456/restore
----

Request body:

[source,xml]
----
<action>
  <disks>
    <disk id="111">
      <image_id>222</image_id>
    </disk>
  </disks>
</action>
----

@option opts [Boolean] :restore_memory

@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.

# File lib/ovirtsdk4/services.rb, line 20938
def restore(opts = {})
  internal_action(:restore, nil, RESTORE, 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 20976
def service(path)
  if path.nil? || path == ''
    return self
  end
  if path == 'cdroms'
    return cdroms_service
  end
  if path.start_with?('cdroms/')
    return cdroms_service.service(path[7..-1])
  end
  if path == 'disks'
    return disks_service
  end
  if path.start_with?('disks/')
    return disks_service.service(path[6..-1])
  end
  if path == 'nics'
    return nics_service
  end
  if path.start_with?('nics/')
    return nics_service.service(path[5..-1])
  end
  raise Error.new("The path \"#{path}\" doesn't correspond to any service")
end