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:


20676
20677
20678
# File 'lib/ovirtsdk4/services.rb', line 20676

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

#disks_serviceSnapshotDisksService

Locates the disks service.

Returns:


20685
20686
20687
# File 'lib/ovirtsdk4/services.rb', line 20685

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:


20561
20562
20563
# File 'lib/ovirtsdk4/services.rb', line 20561

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

#nics_serviceSnapshotNicsService

Locates the nics service.

Returns:


20694
20695
20696
# File 'lib/ovirtsdk4/services.rb', line 20694

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.


20597
20598
20599
# File 'lib/ovirtsdk4/services.rb', line 20597

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.


20667
20668
20669
# File 'lib/ovirtsdk4/services.rb', line 20667

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:


20705
20706
20707
20708
20709
20710
20711
20712
20713
20714
20715
20716
20717
20718
20719
20720
20721
20722
20723
20724
20725
20726
20727
20728
# File 'lib/ovirtsdk4/services.rb', line 20705

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