Class: OvirtSDK4::VmBackupsService

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

#add(backup, opts = {}) ⇒ Backup

Adds a new backup entity to a virtual machine.

For example, to start a new incremental backup of a virtual machine since checkpoint id previous-checkpoint-uuid, send a request like this:

POST /ovirt-engine/api/vms/123/backups HTTP/1.1

With a request body like this:

<backup>
  <from_checkpoint_id>previous-checkpoint-uuid</from_checkpoint_id>
  <disks>
      <disk id="disk-uuid" />
      ...
  </disks>
</backup>

The response body:

<backup id="backup-uuid">
    <from_checkpoint_id>previous-checkpoint-uuid</from_checkpoint_id>
    <to_checkpoint_id>new-checkpoint-uuid</to_checkpoint_id>
    <disks>
        <disk id="disk-uuid" />
        ...
        ...
    </disks>
    <status>initializing</status>
    <creation_date>
</backup>

To provide the ID of the created backup, send a request like this:

POST /ovirt-engine/api/vms/123/backups HTTP/1.1

With a request body like this:

<backup id="backup-uuid">
  <from_checkpoint_id>previous-checkpoint-uuid</from_checkpoint_id>
  <disks>
      <disk id="disk-uuid" />
      ...
  </disks>
</backup>

Options Hash (opts):

  • :require_consistency (Boolean)

    Indicates if the backup will fail if VM failed to freeze or not.

    If requireConsistency=True VM backup will fail in case of a failure to freeze the VM.

    The REST API call should look like this:

    POST /ovirt-engine/api/vms/123/backups?require_consistency=true HTTP/1.1

    The default value of the requireConsistency flag is false.

  • :use_active (Boolean)

    Indicate whether to use the active volume for performing the backup.

    If useActive=False a snapshot will be created for the backup operation.

    The REST API call should look like this:

    POST /ovirt-engine/api/vms/123/backups?use_active=false HTTP/1.1

    The default value of the useActive flag is false.

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



31823
31824
31825
# File 'lib/ovirtsdk4/services.rb', line 31823

def add(backup, opts = {})
  internal_add(backup, Backup, ADD, opts)
end

#backup_service(id) ⇒ VmBackupService

Returns a reference to the service that manages a specific VM backup.



31866
31867
31868
# File 'lib/ovirtsdk4/services.rb', line 31866

def backup_service(id)
  VmBackupService.new(self, id)
end

#list(opts = {}) ⇒ Array<Backup>

The list of virtual machine backups.

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.

  • :max (Integer)

    Sets the maximum number of virtual machine backups to return. If not specified, all the virtual machine backups are returned.

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



31855
31856
31857
# File 'lib/ovirtsdk4/services.rb', line 31855

def list(opts = {})
  internal_get(LIST, opts)
end

#service(path) ⇒ Service

Locates the service corresponding to the given path.



31877
31878
31879
31880
31881
31882
31883
31884
31885
31886
# File 'lib/ovirtsdk4/services.rb', line 31877

def service(path)
  if path.nil? || path == ''
    return self
  end
  index = path.index('/')
  if index.nil?
    return backup_service(path)
  end
  return backup_service(path[0..(index - 1)]).service(path[(index + 1)..-1])
end