Class: Nifty::Events::Opennebula::RegistrationEvent
- Includes:
- Utils::EventsCommon
- Defined in:
- lib/nifty/events/opennebula/registration_event.rb
Overview
OpenNebula registration event
Instance Attribute Summary collapse
-
#group_handler ⇒ Object
Returns the value of attribute group_handler.
-
#image_handler ⇒ Object
Returns the value of attribute image_handler.
-
#original_disks ⇒ Object
Returns the value of attribute original_disks.
-
#template_handler ⇒ Object
Returns the value of attribute template_handler.
Attributes inherited from Event
#client, #datastores, #parameters
Attributes inherited from Event
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(appliance, transfer_method, client, datastores, parameters) ⇒ RegistrationEvent
constructor
A new instance of RegistrationEvent.
- #run ⇒ Object
Methods included from Utils::EventsCommon
Constructor Details
#initialize(appliance, transfer_method, client, datastores, parameters) ⇒ RegistrationEvent
Returns a new instance of RegistrationEvent.
21 22 23 24 25 26 27 28 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 21 def initialize(appliance, transfer_method, client, datastores, parameters) super(appliance, transfer_method, client, datastores, parameters) @image_handler = Nifty::Backends::Utils::Opennebula::ImageHandler.new(client) @template_handler = Nifty::Backends::Utils::Opennebula::TemplateHandler.new(client) @group_handler = Nifty::Backends::Utils::Opennebula::GroupHandler.new(client) @original_disks = [] end |
Instance Attribute Details
#group_handler ⇒ Object
Returns the value of attribute group_handler.
14 15 16 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 14 def group_handler @group_handler end |
#image_handler ⇒ Object
Returns the value of attribute image_handler.
14 15 16 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 14 def image_handler @image_handler end |
#original_disks ⇒ Object
Returns the value of attribute original_disks.
14 15 16 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 14 def original_disks @original_disks end |
#template_handler ⇒ Object
Returns the value of attribute template_handler.
14 15 16 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 14 def template_handler @template_handler end |
Class Method Details
.event? ⇒ Boolean
10 11 12 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 10 def self.event? true end |
Instance Method Details
#run ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/nifty/events/opennebula/registration_event.rb', line 31 def run logger.debug("Runnig event #{self.inspect}") transfer_disks expire_appliance(template_handler, image_handler, appliance, parameters) groups = groups(group_handler, appliance, parameters[:groups]) # due to OpenNebula restrictions appliances have to be registered separately for each datastore and each group datastores.each do |datastore| groups.each do |group| image_data = register_disks(group, datastore) register_appliance(image_data, group, datastore) end end clean_original_disks rescue Nifty::Errors::Backends::OpennebulaError, Nifty::Errors::TransferMethodError, Nifty::Errors::ApiCallTimeoutError => ex fail Nifty::Errors::Events::EventError, ex ensure clean_copied_disks end |