From f89ef9a9ee968c778af3444c7f9d2a39489fcf2b Mon Sep 17 00:00:00 2001 From: Harry Huang Date: Thu, 11 Oct 2018 11:05:02 +0800 Subject: Manage host power from cobbler JIRA: COMPASS-616 1. Use fence_ipmilan to control power of baremetal servers. Add fence_libvirt to control power of virtual servers. 2. Use power_manage field instead of ipmi field 3. Add power_type to specify machine's power manage tool 4. Store power manage information in db and update to cobbler 5. Manage power from cobbler for both virtual and baremetal machines Change-Id: Ic36ae640dc0aa1703566b5b0b549880a71be36e4 Signed-off-by: Harry Huang --- compass-tasks-base/db/api/machine.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'compass-tasks-base/db/api/machine.py') diff --git a/compass-tasks-base/db/api/machine.py b/compass-tasks-base/db/api/machine.py index 7991ada..11d19e6 100644 --- a/compass-tasks-base/db/api/machine.py +++ b/compass-tasks-base/db/api/machine.py @@ -29,20 +29,20 @@ from compass.utils import util MACHINE_PRIMARY_FILEDS = ['mac', 'owner_id'] SUPPORTED_FIELDS = [ - 'mac', 'tag', 'location', 'ipmi_credentials', - 'machine_attributes', 'owner_id'] + 'mac', 'tag', 'location', 'power_manage', + 'machine_attributes', 'owner_id', 'power_type'] IGNORE_FIELDS = ['id', 'created_at', 'updated_at'] UPDATED_FIELDS = [ - 'ipmi_credentials', 'machine_attributes', - 'tag', 'location'] + 'mac', 'tag', 'location', 'power_manage', + 'machine_attributes', 'power_type'] PATCHED_FIELDS = [ - 'patched_ipmi_credentials', 'patched_tag', + 'patched_power_manage', 'patched_tag', 'patched_location' ] RESP_FIELDS = [ - 'id', 'mac', 'ipmi_credentials', 'switches', 'switch_ip', + 'id', 'mac', 'power_manage', 'switches', 'switch_ip', 'port', 'vlans', 'machine_attributes', 'owner_id', - 'tag', 'location', 'created_at', 'updated_at' + 'tag', 'location', 'power_type', 'created_at', 'updated_at' ] RESP_DEPLOY_FIELDS = [ 'status', 'machine' @@ -149,7 +149,7 @@ def _update_machine(machine_id, session=None, **kwargs): optional_support_keys=UPDATED_FIELDS, ignore_support_keys=IGNORE_FIELDS ) -@utils.input_validates(ipmi_credentials=utils.check_ipmi_credentials) +@utils.input_validates(power_manage=utils.check_power_manage) @database.run_in_session() @user_api.check_user_permission( permission.PERMISSION_ADD_MACHINE @@ -161,11 +161,11 @@ def update_machine(machine_id, user=None, session=None, **kwargs): ) -# replace [ipmi_credentials, tag, location] to -# [patched_ipmi_credentials, patched_tag, patched_location] +# replace [power_manage, tag, location] to +# [patched_power_manage, patched_tag, patched_location] # in kwargs. It tells db these fields will be patched. @utils.replace_filters( - ipmi_credentials='patched_ipmi_credentials', + power_manage='patched_power_manage', tag='patched_tag', location='patched_location' ) @@ -174,7 +174,7 @@ def update_machine(machine_id, user=None, session=None, **kwargs): ignore_support_keys=IGNORE_FIELDS ) @database.run_in_session() -@utils.output_validates(ipmi_credentials=utils.check_ipmi_credentials) +@utils.output_validates(power_manage=utils.check_power_manage) @user_api.check_user_permission( permission.PERMISSION_ADD_MACHINE ) -- cgit 1.2.3-korg