Class: OvirtSDK4::SnapshotService

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

#cdroms_serviceSnapshotCdromsService

Locates the cdroms service.

Returns:



19735
19736
19737
# File 'lib/ovirtsdk4/services.rb', line 19735

def cdroms_service
  @cdroms_service ||= SnapshotCdromsService.new(self, 'cdroms')
end

#disks_serviceSnapshotDisksService

Locates the disks service.

Returns:



19744
19745
19746
# File 'lib/ovirtsdk4/services.rb', line 19744

def disks_service
  @disks_service ||= SnapshotDisksService.new(self, 'disks')
end

#get(opts = {}) ⇒ Snapshot

Returns the representation of the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :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.

  • :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:



19620
19621
19622
# File 'lib/ovirtsdk4/services.rb', line 19620

def get(opts = {})
  internal_get(GET, opts)
end

#nics_serviceSnapshotNicsService

Locates the nics service.

Returns:



19753
19754
19755
# File 'lib/ovirtsdk4/services.rb', line 19753

def nics_service
  @nics_service ||= SnapshotNicsService.new(self, 'nics')
end

#remove(opts = {}) ⇒ Object

Deletes the object managed by this service.

Parameters:

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

    Additional options.

Options Hash (opts):

  • :all_content (Boolean)

    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
  • :async (Boolean)

    Indicates if the remove should be performed asynchronously.

  • :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.



19656
19657
19658
# File 'lib/ovirtsdk4/services.rb', line 19656

def remove(opts = {})
  internal_remove(REMOVE, opts)
end

#restore(opts = {}) ⇒ Object

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:

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

With an empty action in the body:

<action/>

Parameters:

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

    Additional options.

Options Hash (opts):

  • :async (Boolean)

    Indicates if the restore should be performed asynchronously.

  • :disks (Array<Disk>)

    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:

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

    Request body:

    <action>
      <disks>
        <disk id="111">
          <image_id>222</image_id>
        </disk>
      </disks>
    </action>
  • :restore_memory (Boolean)
  • :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.



19726
19727
19728
# File 'lib/ovirtsdk4/services.rb', line 19726

def restore(opts = {})
  internal_action(:restore, nil, RESTORE, 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.

Raises:



19764
19765
19766
19767
19768
19769
19770
19771
19772
19773
19774
19775
19776
19777
19778
19779
19780
19781
19782
19783
19784
19785
19786
19787
# File 'lib/ovirtsdk4/services.rb', line 19764

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