From 316002fb2e9c10b5d4ea36e017b51999822e4f10 Mon Sep 17 00:00:00 2001 From: Scott Seago Date: Wed, 25 Jan 2017 23:35:09 -0500 Subject: [PATCH] Use task queue for set/unset node maintenance Uses task queue instead of making direct provider API calls from the UI. This PR contains the necessary model changes. --- .../infra_manager/host/operations.rb | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb b/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb index d07adca9053..91ac35fc6d5 100644 --- a/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb +++ b/app/models/manageiq/providers/openstack/infra_manager/host/operations.rb @@ -8,10 +8,42 @@ def ironic_fog_node end end + def set_node_maintenance_queue(userid) + task_opts = { + :action => "setting node maintenance on Host for user #{userid}", + :userid => userid + } + queue_opts = { + :class_name => self.class.name, + :method_name => 'set_node_maintenance', + :instance_id => id, + :role => 'ems_operations', + :zone => ext_management_system.my_zone, + :args => [] + } + MiqTask.generic_action_with_callback(task_opts, queue_opts) + end + def set_node_maintenance ironic_fog_node.set_node_maintenance(:reason=>"CFscaledown") end + def unset_node_maintenance_queue(userid) + task_opts = { + :action => "unsetting node maintenance on Host for user #{userid}", + :userid => userid + } + queue_opts = { + :class_name => self.class.name, + :method_name => 'unset_node_maintenance', + :instance_id => id, + :role => 'ems_operations', + :zone => ext_management_system.my_zone, + :args => [] + } + MiqTask.generic_action_with_callback(task_opts, queue_opts) + end + def unset_node_maintenance ironic_fog_node.unset_node_maintenance end