Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement :reboot_guest for VM #52

Merged
merged 1 commit into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,11 @@ def shutdown_guest(operation)
rescue Ovirt::VmIsNotRunning
end

def reboot_guest(operation)
operation.with_provider_object(&:reboot)
rescue Ovirt::VmIsNotRunning
end

def start_clone(source, clone_options, phase_context)
source.with_provider_object do |rhevm_template|
vm = rhevm_template.create_vm(clone_options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ def shutdown_guest(operation)
rescue OvirtSDK4::Error
end

def reboot_guest(operation)
operation.with_provider_object(VERSION_HASH, &:reboot)
rescue OvirtSDK4::Error
end

def start_clone(source, clone_options, phase_context)
source.with_provider_object(VERSION_HASH) do |rhevm_template|
vm = rhevm_template.create_vm(clone_options)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,18 @@ module ManageIQ::Providers::Redhat::InfraManager::Vm::Operations::Guest
unsupported_reason_add(:shutdown_guest, unsupported_reason(:control)) unless supports_control?
unsupported_reason_add(:shutdown_guest, _("The VM is not powered on")) unless current_state == "on"
end

supports :reboot_guest do
unsupported_reason_add(:reboot_guest, unsupported_reason(:control)) unless supports_control?
unsupported_reason_add(:reboot_guest, _("The VM is not powered on")) unless current_state == "on"
end
end

def raw_shutdown_guest
ext_management_system.ovirt_services.shutdown_guest(self)
end

def raw_reboot_guest
ext_management_system.ovirt_services.reboot_guest(self)
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

context("with :reboot_guest") do
let(:state) { :reboot_guest }
include_examples "Vm operation is not available"
include_examples 'Vm operation is available when powered on'
end

context("with :reset") do
Expand Down