From bb76c59a0c8187cd8a5965f1b422eb9a3211e6d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miha=20Ple=C5=A1ko?= Date: Mon, 19 Nov 2018 13:11:55 +0100 Subject: [PATCH] Forcibly mark vCloud VMs as not disconnected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Like other cloud providers we have to override functions ``` def disconnected def disconnected? ``` to always return false for vCloud cloud provider or else UI displays all its VMs as 'disconnected' regardless the actual power state. Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1649403 Fixes ManageIQ/manageiq-ui-classic#4909 Signed-off-by: Miha Pleško --- app/models/manageiq/providers/vmware/cloud_manager/vm.rb | 8 ++++++++ .../manageiq/providers/vmware/cloud_manager/vm_spec.rb | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/app/models/manageiq/providers/vmware/cloud_manager/vm.rb b/app/models/manageiq/providers/vmware/cloud_manager/vm.rb index 813b45caa..314764434 100644 --- a/app/models/manageiq/providers/vmware/cloud_manager/vm.rb +++ b/app/models/manageiq/providers/vmware/cloud_manager/vm.rb @@ -27,6 +27,14 @@ def provider_object(connection = nil) "suspended" => "suspended" }.freeze + def disconnected + false + end + + def disconnected? + false + end + def self.calculate_power_state(raw_power_state) # https://github.com/xlab-si/fog-vcloud-director/blob/master/lib/fog/vcloud_director/parsers/compute/vm.rb#L70 POWER_STATES[raw_power_state.to_s] || "terminated" diff --git a/spec/models/manageiq/providers/vmware/cloud_manager/vm_spec.rb b/spec/models/manageiq/providers/vmware/cloud_manager/vm_spec.rb index 5fbc1150e..603adede0 100644 --- a/spec/models/manageiq/providers/vmware/cloud_manager/vm_spec.rb +++ b/spec/models/manageiq/providers/vmware/cloud_manager/vm_spec.rb @@ -83,5 +83,13 @@ vm.raw_suspend end end + + it '.disconnected' do + expect(subject.disconnected).to be_falsey + end + + it '.disconnected?' do + expect(subject.disconnected).to be_falsey + end end end