From 44d86acabe29e62db639308f11792d4d93f9ff08 Mon Sep 17 00:00:00 2001 From: Adam Grare Date: Thu, 28 May 2020 16:16:53 -0400 Subject: [PATCH] Add supports terminate feature --- .../providers/kubevirt/infra_manager/vm/operations.rb | 6 ++++++ .../providers/kubevirt/infra_manager/vm/operations_spec.rb | 4 ++++ 2 files changed, 10 insertions(+) diff --git a/app/models/manageiq/providers/kubevirt/infra_manager/vm/operations.rb b/app/models/manageiq/providers/kubevirt/infra_manager/vm/operations.rb index ab52bb3..0fa1c87 100644 --- a/app/models/manageiq/providers/kubevirt/infra_manager/vm/operations.rb +++ b/app/models/manageiq/providers/kubevirt/infra_manager/vm/operations.rb @@ -18,6 +18,12 @@ module ManageIQ::Providers::Kubevirt::InfraManager::Vm::Operations include_concern 'Power' + included do + supports :terminate do + unsupported_reason_add(:terminate, unsupported_reason(:control)) unless supports_control? + end + end + def raw_destroy require 'fog/kubevirt' ext_management_system.with_provider_connection do |connection| diff --git a/spec/models/manageiq/providers/kubevirt/infra_manager/vm/operations_spec.rb b/spec/models/manageiq/providers/kubevirt/infra_manager/vm/operations_spec.rb index 1195da7..23d9b38 100644 --- a/spec/models/manageiq/providers/kubevirt/infra_manager/vm/operations_spec.rb +++ b/spec/models/manageiq/providers/kubevirt/infra_manager/vm/operations_spec.rb @@ -51,6 +51,10 @@ let(:vm_metadata) { double("vm_metadata", :namespace => "default") } let(:provider_vm) { double("provider_vm", :metadata => vm_metadata) } + it "supports_terminate?" do + expect(vm.supports_terminate?).to be_truthy + end + context 'running vm' do it 'removes an running vm from kubevirt provider' do allow(connection).to receive(:vm_instance).and_return(vm_instance)