diff --git a/cmdb-api/api/lib/cmdb/ipam/address.py b/cmdb-api/api/lib/cmdb/ipam/address.py index b9bcfe5f..a29ee99f 100644 --- a/cmdb-api/api/lib/cmdb/ipam/address.py +++ b/cmdb-api/api/lib/cmdb/ipam/address.py @@ -31,10 +31,11 @@ def list_ip_address(parent_id): return numfound, result - def _get_cis(self, ips): - response, _, _, _, _, _ = SearchFromDB( - "_type:{},{}:({})".format(self.type_id, IPAddressBuiltinAttributes.IP, ";".join(ips or [])), - count=10000000, parent_node_perm_passed=True).search() + def _get_cis(self, subnet_id, ips): + + q = "_type:{},{}:({})".format(self.type_id, IPAddressBuiltinAttributes.IP, ";".join(ips or [])) + + response, _, _, _, _, _ = RelationSearch([subnet_id], level=[1], query=q, count=1000000).search() return response @@ -92,7 +93,7 @@ def assign_ips(self, ips, subnet_id, cidr, **kwargs): return abort(400, ErrFormat.ipam_address_model_not_found) with (redis_lock.Lock(rd.r, "IPAM_ASSIGN_ADDRESS_{}".format(subnet_id))): - cis = self._get_cis(ips) + cis = self._get_cis(subnet_id, ips) ip2ci = {ci[IPAddressBuiltinAttributes.IP]: ci for ci in cis} ci_ids = [] diff --git a/docker-compose.yml b/docker-compose.yml index 45d1a3ab..07cad7ce 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,7 +41,7 @@ services: - redis cmdb-api: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.15 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-api:2.4.16 container_name: cmdb-api env_file: - .env @@ -64,14 +64,14 @@ services: gunicorn --workers=4 autoapp:app -b 0.0.0.0:5000 -D celery -A celery_worker.celery worker -E -Q one_cmdb_async --autoscale=4,1 --logfile=one_cmdb_async.log -D - celery -A celery_worker.celery worker -E -Q acl_async --logfile=one_acl_async.log --autoscale=2,1 -D + celery -A celery_worker.celery worker -E -Q acl_async --logfile=one_acl_async.log --autoscale=4,1 -D nohup flask cmdb-trigger > trigger.log 2>&1 & flask cmdb-init-cache flask cmdb-init-acl flask init-import-user-from-acl flask init-department - nohup flask cmdb-patch -v 2.4.15 & + nohup flask cmdb-patch -v 2.4.16 & flask cmdb-counter > counter.log 2>&1 networks: new: @@ -84,7 +84,7 @@ services: test: "ps aux|grep -v grep|grep -v '1 root'|grep gunicorn || exit 1" cmdb-ui: - image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.15 + image: registry.cn-hangzhou.aliyuncs.com/veops/cmdb-ui:2.4.16 container_name: cmdb-ui depends_on: cmdb-api: