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:



19641
19642
19643
# File 'lib/ovirtsdk4/services.rb', line 19641

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

#disks_serviceSnapshotDisksService

Locates the disks service.

Returns:



19650
19651
19652
# File 'lib/ovirtsdk4/services.rb', line 19650

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:



19526
19527
19528
# File 'lib/ovirtsdk4/services.rb', line 19526

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

#nics_serviceSnapshotNicsService

Locates the nics service.

Returns:



19659
19660
19661
# File 'lib/ovirtsdk4/services.rb', line 19659

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.



19562
19563
19564
# File 'lib/ovirtsdk4/services.rb', line 19562

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.



19632
19633
19634
# File 'lib/ovirtsdk4/services.rb', line 19632

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:



19670
19671
19672
19673
19674
19675
19676
19677
19678
19679
19680
19681
19682
19683
19684
19685
19686
19687
19688
19689
19690
19691
19692
19693
# File 'lib/ovirtsdk4/services.rb', line 19670

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