-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ab5ea45
commit 4c14cd2
Showing
38 changed files
with
1,175 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
dbm-ui/backend/db_meta/api/cluster/pulsar/clear_machine.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# -*- coding: utf-8 -*- | ||
""" | ||
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-DB管理系统(BlueKing-BK-DBM) available. | ||
Copyright (C) 2017-2023 THL A29 Limited, a Tencent company. All rights reserved. | ||
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at https://opensource.org/licenses/MIT | ||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations under the License. | ||
""" | ||
|
||
import logging | ||
from typing import List, Optional | ||
|
||
from django.core.exceptions import ObjectDoesNotExist | ||
from django.db import transaction | ||
|
||
from backend.db_meta.models.instance import ProxyInstance, StorageInstance | ||
from backend.db_meta.models.machine import Machine | ||
|
||
logger = logging.getLogger("root") | ||
|
||
|
||
@transaction.atomic | ||
def clear_machine(machines: Optional[List]): | ||
""" | ||
根据machine信息回收机器相关信息for大数据 | ||
""" | ||
for m in machines: | ||
try: | ||
machine = Machine.objects.get(ip=m["ip"], bk_cloud_id=m["bk_cloud_id"]) | ||
except ObjectDoesNotExist: | ||
logger.warning(f"the machine [{m['bk_cloud_id']}:{m['ip']}] not exist ") | ||
continue | ||
|
||
proxys = ProxyInstance.objects.filter(machine=machine) | ||
storages = StorageInstance.objects.filter(machine=machine) | ||
|
||
# 清理proxy相关信息 | ||
for p in proxys: | ||
p.delete(keep_parents=True) | ||
|
||
# 清理storage相关信息 | ||
for s in storages: | ||
s.delete(keep_parents=True) | ||
|
||
machine.delete(keep_parents=True) |
Oops, something went wrong.