Class: OvirtSDK4::SnapshotsService
- Defined in:
- lib/ovirtsdk4/services.rb,
lib/ovirtsdk4/services.rb
Instance Method Summary collapse
-
#add(snapshot, opts = {}) ⇒ Snapshot
Creates a virtual machine snapshot.
-
#list(opts = {}) ⇒ Array<Snapshot>
Returns the list of snapshots of the storage domain or virtual machine.
-
#service(path) ⇒ Service
Locates the service corresponding to the given path.
-
#snapshot_service(id) ⇒ SnapshotService
Locates the
snapshot
service.
Methods inherited from Service
Instance Method Details
#add(snapshot, opts = {}) ⇒ Snapshot
Creates a virtual machine snapshot.
For example, to create a new snapshot for virtual machine 123
send a request like this:
POST /ovirt-engine/api/vms/123/snapshots
With a request body like this:
<snapshot>
<description>My snapshot</description>
</snapshot>
For including only a sub-set of disks in the snapshots, add disk_attachments
element to the
request body. Note that disks which are not specified in disk_attachments
element will not be a
part of the snapshot. If an empty disk_attachments
element is passed, the snapshot will include
only the virtual machine configuration. If no disk_attachments
element is passed, then all
the disks will be included in the snapshot.
For each disk, image_id
element can be specified for setting the new active image id.
This is used in order to restore a chain of images from backup. I.e. when restoring
a disk with snapshots, the relevant image_id
should be specified for each snapshot
(so the identifiers of the disk snapshots are identical to the backup).
<snapshot>
<description>My snapshot</description>
<disk_attachments>
<disk_attachment>
<disk id="123">
<image_id>456</image_id>
</disk>
</disk_attachment>
</disk_attachments>
</snapshot>
Important
|
When a snapshot is created the default value for the persist_memorystate attribute is
|
21292 21293 21294 |
# File 'lib/ovirtsdk4/services.rb', line 21292 def add(snapshot, opts = {}) internal_add(snapshot, Snapshot, ADD, opts) end |
#list(opts = {}) ⇒ Array<Snapshot>
Returns the list of snapshots of the storage domain or virtual machine.
The order of the returned list of snapshots isn’t guaranteed.
21338 21339 21340 |
# File 'lib/ovirtsdk4/services.rb', line 21338 def list(opts = {}) internal_get(LIST, opts) end |
#service(path) ⇒ Service
Locates the service corresponding to the given path.
21360 21361 21362 21363 21364 21365 21366 21367 21368 21369 |
# File 'lib/ovirtsdk4/services.rb', line 21360 def service(path) if path.nil? || path == '' return self end index = path.index('/') if index.nil? return snapshot_service(path) end return snapshot_service(path[0..(index - 1)]).service(path[(index + 1)..-1]) end |
#snapshot_service(id) ⇒ SnapshotService
Locates the snapshot
service.
21349 21350 21351 |
# File 'lib/ovirtsdk4/services.rb', line 21349 def snapshot_service(id) SnapshotService.new(self, id) end |