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:



20947
20948
20949
# File 'lib/ovirtsdk4/services.rb', line 20947

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

#disks_serviceSnapshotDisksService

Locates the disks service.

Returns:



20956
20957
20958
# File 'lib/ovirtsdk4/services.rb', line 20956

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:



20831
20832
20833
# File 'lib/ovirtsdk4/services.rb', line 20831

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

#nics_serviceSnapshotNicsService

Locates the nics service.

Returns:



20965
20966
20967
# File 'lib/ovirtsdk4/services.rb', line 20965

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.



20867
20868
20869
# File 'lib/ovirtsdk4/services.rb', line 20867

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/>
Note
Confirm that the commit operation is finished and the virtual machine is down before running the virtual machine.

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.



20938
20939
20940
# File 'lib/ovirtsdk4/services.rb', line 20938

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:



20976
20977
20978
20979
20980
20981
20982
20983
20984
20985
20986
20987
20988
20989
20990
20991
20992
20993
20994
20995
20996
20997
20998
20999
# 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