7de45afb19
Add full support for Active/Active redudancy model 1. services could have enable dependency to services in other service groups (standby group) 2. An active/active service failure will degraded the service group it is in 3. A failure of active/active service would not prevent a swact 4. Locking a controller that is sole active/active service provider will be rejected. But lock with force option will still proceed to lock the node. 5. sm-api bind to port 7777 on mgmt interface. (was localhost:7777) Change-Id: I6f0354e1e8fc606c6f3b8b33e3ab862b47824232 Signed-off-by: Jack Ding <jack.ding@windriver.com>
60 lines
1.7 KiB
Python
60 lines
1.7 KiB
Python
#
|
|
# Copyright (c) 2018 Wind River Systems, Inc.
|
|
#
|
|
# SPDX-License-Identifier: Apache-2.0
|
|
#
|
|
|
|
# vim: tabstop=4 shiftwidth=4 softtabstop=4
|
|
# coding=utf-8
|
|
#
|
|
|
|
from sm_api.db import api as db_api
|
|
from sm_api.objects import base
|
|
from sm_api.objects import utils
|
|
|
|
|
|
class service_group_member(base.Sm_apiObject):
|
|
|
|
dbapi = db_api.get_instance()
|
|
|
|
fields = {
|
|
'id': utils.int_or_none,
|
|
'name': utils.str_or_none,
|
|
'service_name': utils.str_or_none,
|
|
'service_failure_impact': utils.str_or_none
|
|
}
|
|
|
|
@staticmethod
|
|
def _from_db_object(server, db_server):
|
|
"""Converts a database entity to a formal object."""
|
|
for field in server.fields:
|
|
server[field] = db_server[field]
|
|
|
|
server.obj_reset_changes()
|
|
return server
|
|
|
|
@base.remotable_classmethod
|
|
def get_by_service_group(cls, context, service_group_name):
|
|
"""Find a server based on uuid and return a Node object.
|
|
|
|
:param uuid: the uuid of a server.
|
|
:returns: a :class:`Node` object.
|
|
"""
|
|
db_server = cls.dbapi.iservicegroup_member_get(service_group_name)
|
|
return service_group_member._from_db_object(cls(), db_server)
|
|
|
|
@base.remotable
|
|
def save(self, context):
|
|
"""Save service group member to this Node.
|
|
:param context: Security context
|
|
"""
|
|
raise NotImplemented("This method is intentially not implemented")
|
|
|
|
@base.remotable
|
|
def refresh(self, context):
|
|
current = self.__class__.get_by_uuid(context, uuid=self.uuid)
|
|
for field in self.fields:
|
|
if (hasattr(self, base.get_attrname(field)) and
|
|
self[field] != current[field]):
|
|
self[field] = current[field]
|