Class: Ovirt::Snapshot

Inherits:
Base
  • Object
show all
Defined in:
lib/ovirt/snapshot.rb

Instance Attribute Summary

Attributes inherited from Base

#attributes, #operations, #relationships, #service

Instance Method Summary collapse

Methods inherited from Base

#[], all, all_xml_objects, api_endpoint, #api_endpoint, #class_suffix, create_from_xml, #destroy, element_name, element_names, find_by_href, find_by_id, find_by_name, has_first_node?, hash_from_id_and_href, href_from_creation_status_link, #keys, #method_missing, object_to_id, #operation, parse_attribute, parse_boolean, parse_first_node, parse_first_node_with_hash, parse_first_text, parse_xml, #relationship, #reload, #replace, set_value, #update, #update!, xml_to_actions, xml_to_hash, xml_to_nokogiri, xml_to_relationships

Methods included from Logging

#logger

Constructor Details

#initialize(service, options = {}) ⇒ Snapshot

Returns a new instance of Snapshot.



7
8
9
10
# File 'lib/ovirt/snapshot.rb', line 7

def initialize(service, options = {})
  super
  @relationships[:disks] = self[:href] + "/disks"
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Ovirt::Base

Instance Method Details

#deleteObject



12
13
14
15
16
17
18
19
# File 'lib/ovirt/snapshot.rb', line 12

def delete
  destroy
  while self[:snapshot_status] == "locked" || self[:snapshot_status] == "ok"
    sleep 2
    break if (obj = self.class.find_by_href(@service, self[:href])).nil?
    replace(obj)
  end
end