fix bug in zone-policy

change action.node to action.entity.

Change-Id: Ie5bd34fdd25764f4d8cf91b0e98503777a9c60a3
This commit is contained in:
RUIJIE YUAN 2017-07-17 11:44:07 +08:00
parent 36f49fbf4d
commit 0bd8ba93f1
2 changed files with 3 additions and 3 deletions

View File

@ -176,7 +176,7 @@ class ZonePlacementPolicy(base.Policy):
"""
if action.action == consts.NODE_CREATE:
# skip the policy if availability zone is specified in profile
profile = action.node.rt['profile']
profile = action.entity.rt['profile']
if profile.properties[profile.AVAILABILITY_ZONE]:
return 0
return 1

View File

@ -133,7 +133,7 @@ class TestZonePlacementPolicy(base.SenlinTestCase):
x_profile = mock.Mock(AVAILABILITY_ZONE='availability_zone',
properties={'availability_zone': 'zone1'})
x_node = mock.Mock(rt={'profile': x_profile})
action = mock.Mock(action=consts.NODE_CREATE, node=x_node)
action = mock.Mock(action=consts.NODE_CREATE, entity=x_node)
policy = zp.ZonePlacementPolicy('p1', self.spec)
@ -144,7 +144,7 @@ class TestZonePlacementPolicy(base.SenlinTestCase):
x_profile = mock.Mock(AVAILABILITY_ZONE='availability_zone',
properties={'availability_zone': None})
x_node = mock.Mock(rt={'profile': x_profile})
action = mock.Mock(action=consts.NODE_CREATE, node=x_node)
action = mock.Mock(action=consts.NODE_CREATE, entity=x_node)
policy = zp.ZonePlacementPolicy('p1', self.spec)