Fix create_server_group in compute noop

When using Noop+ACTIVE_STANDBY+anti_affinity, create_server_group
doesn't return a value but the caller (NovaServerGroupCreate.execute)
accesses to the id attribute of the returned value, it triggers an
AttributeError:

File "../worker/v2/tasks/compute_tasks.py", line 319, in execute
        "%s", server_group.id, loadbalancer_id)
AttributeError: 'NoneType' object has no attribute 'id'

This commit adds a fake object that is returned by the noop driver.

Change-Id: I579c1e7bd364b3c34e9a813f99c77d30753d288b
This commit is contained in:
Gregory Thiemonge
2023-03-17 09:56:07 -04:00
parent 764cbf014f
commit 5fff5676d7
@@ -12,6 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
from collections import namedtuple
from oslo_log import log as logging
from oslo_utils import uuidutils
@@ -23,6 +25,9 @@ from octavia.network import data_models as network_models
LOG = logging.getLogger(__name__)
NoopServerGroup = namedtuple('ServerGroup', ['id'])
class NoopManager(object):
def __init__(self):
super().__init__()
@@ -76,6 +81,7 @@ class NoopManager(object):
LOG.debug("Create Server Group %s no-op, name %s, policy %s ",
self.__class__.__name__, name, policy)
self.computeconfig[(name, policy)] = (name, policy, 'create')
return NoopServerGroup(id=uuidutils.generate_uuid())
def delete_server_group(self, server_group_id):
LOG.debug("Delete Server Group %s no-op, id %s ",