DC fix audit sync failure
During the sync Security Group needs to be compared with the tenant names and not tenant ids. The tenant id which is the uuid are different between regions. The compare does not match and an attempt to create the Security Group fails since it already exists. This commit changes the compare to use tenant names. Closes-Bug: 1802397 Change-Id: I9363945868b857802e137dcf05757ec3691230c1 Signed-off-by: Kristine Bujold <kristine.bujold@windriver.com>
This commit is contained in:
parent
e815932fdb
commit
7c1c082be0
|
@ -22,6 +22,7 @@ from oslo_serialization import jsonutils
|
||||||
|
|
||||||
from dcorch.common import consts
|
from dcorch.common import consts
|
||||||
from dcorch.common import exceptions
|
from dcorch.common import exceptions
|
||||||
|
from dcorch.drivers.openstack import sdk
|
||||||
from dcorch.engine import quota_manager
|
from dcorch.engine import quota_manager
|
||||||
from dcorch.engine.sync_thread import SyncThread
|
from dcorch.engine.sync_thread import SyncThread
|
||||||
from dcorch.objects import resource
|
from dcorch.objects import resource
|
||||||
|
@ -417,14 +418,31 @@ class NetworkSyncThread(SyncThread):
|
||||||
self.post_security_group_rule(request, rsrc)
|
self.post_security_group_rule(request, rsrc)
|
||||||
|
|
||||||
def same_security_group(self, qc1, qc2):
|
def same_security_group(self, qc1, qc2):
|
||||||
|
# Fetch the tenant name from the project. Tenant ids are different
|
||||||
|
# between regions.
|
||||||
|
qc1_tenant_name = sdk.OpenStackDriver().get_project_by_id(
|
||||||
|
qc1['tenant_id']).name
|
||||||
|
qc2_tenant_name = sdk.OpenStackDriver(
|
||||||
|
self.subcloud_engine.subcloud.region_name).get_project_by_id(
|
||||||
|
qc2['tenant_id']).name
|
||||||
|
|
||||||
return (qc1['description'] == qc2['description'] and
|
return (qc1['description'] == qc2['description'] and
|
||||||
qc1['tenant_id'] == qc2['tenant_id'] and
|
qc1_tenant_name == qc2_tenant_name and
|
||||||
qc1['name'] == qc2['name'])
|
qc1['name'] == qc2['name'])
|
||||||
|
|
||||||
def same_security_group_rule(self, qc1, qc2):
|
def same_security_group_rule(self, qc1, qc2):
|
||||||
# Ignore id, created_at, updated_at, and revision_number
|
# Ignore id, created_at, updated_at, and revision_number
|
||||||
|
|
||||||
|
# Fetch the tenant name from the project. Tenant id are different
|
||||||
|
# between regions.
|
||||||
|
qc1_tenant_name = sdk.OpenStackDriver().get_project_by_id(
|
||||||
|
qc1['tenant_id']).name
|
||||||
|
qc2_tenant_name = sdk.OpenStackDriver(
|
||||||
|
self.subcloud_engine.subcloud.region_name).get_project_by_id(
|
||||||
|
qc2['tenant_id']).name
|
||||||
|
|
||||||
return (qc1['description'] == qc2['description'] and
|
return (qc1['description'] == qc2['description'] and
|
||||||
qc1['tenant_id'] == qc2['tenant_id'] and
|
qc1_tenant_name == qc2_tenant_name and
|
||||||
qc1['project_id'] == qc2['project_id'] and
|
qc1['project_id'] == qc2['project_id'] and
|
||||||
qc1['direction'] == qc2['direction'] and
|
qc1['direction'] == qc2['direction'] and
|
||||||
qc1['protocol'] == qc2['protocol'] and
|
qc1['protocol'] == qc2['protocol'] and
|
||||||
|
|
Loading…
Reference in New Issue