Class: VagrantPlugins::ProviderLibvirt::Action::ResumeDomain
- Inherits:
-
Object
- Object
- VagrantPlugins::ProviderLibvirt::Action::ResumeDomain
- Defined in:
- lib/vagrant-libvirt/action/resume_domain.rb
Overview
Resume suspended domain.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, _env) ⇒ ResumeDomain
constructor
A new instance of ResumeDomain.
Constructor Details
#initialize(app, _env) ⇒ ResumeDomain
Returns a new instance of ResumeDomain.
10 11 12 13 |
# File 'lib/vagrant-libvirt/action/resume_domain.rb', line 10 def initialize(app, _env) @logger = Log4r::Logger.new('vagrant_libvirt::action::resume_domain') @app = app end |
Instance Method Details
#call(env) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/vagrant-libvirt/action/resume_domain.rb', line 15 def call(env) env[:ui].info(I18n.t('vagrant_libvirt.resuming_domain')) domain = env[:machine].provider.driver.connection.servers.get(env[:machine].id.to_s) raise Errors::NoDomainError if domain.nil? libvirt_domain = env[:machine].provider.driver.connection.client.lookup_domain_by_uuid(env[:machine].id) config = env[:machine].provider_config if env[:machine].state.id == :pmsuspended libvirt_domain.pmwakeup elsif config.suspend_mode == 'managedsave' domain.start else domain.resume end @logger.info("Machine #{env[:machine].id} is resumed.") @app.call(env) end |