Skip to content

Commit

Permalink
fix(backend): 资源池扩展机型报错 #8780
Browse files Browse the repository at this point in the history
  • Loading branch information
peterxucai committed Dec 23, 2024
1 parent a29c1d3 commit d0ee701
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions dbm-ui/backend/db_services/dbresource/views/sepc.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,14 @@ def update(self, request, *args, **kwargs):
continue
else:
raise SpecOperateException(_("规格: {}已经被引用,只允许拓展机型").format(spec_id))
# 在机型更新的情况下 允许cpu/内存的更新
elif key in ["cpu", "mem"]:
if update_data["device_class"] == []:
continue
if set(update_data["device_class"]) > set(spec.device_class):
continue
else:
raise SpecOperateException(_("规格: {}已经被引用,只允许拓展机型").format(spec_id))
# 对正在被引用的规格的配置字段更改,抛出异常
elif update_data[key] != spec.__dict__[key]:
raise SpecOperateException(_("规格: {}已经被引用,无法修改配置!(只允许拓展机型和修改描述)").format(spec.spec_name))
Expand Down

0 comments on commit d0ee701

Please sign in to comment.