解决了

PrismCentral 2020.9.0.1不能删除项目

  • 2020年12月9日
  • 1回复
  • 191的浏览量

Userlevel 1
徽章 +2

这就跟你问声好!

棱镜中心有个奇怪的项目。

当我尝试更新项目槽GUI时,我得到这个错误消息:

编辑冲突:请重试更改。
通知{"api_version": "3.1", "code": " 409, "kind": "project_internal", "message_list": [{"message": "Edit conflict: please retry change.", "reason": "CONCURRENT_REQUESTS_NOT_ALLOWED"}], "state": "ERROR"}

所以我用SSH连接到PC CVM,并试图删除项目槽核,

< nucleus > Project .delete Project \Name confirm=true
确认删除项目?(yes / no)是的

{“消息”:
{“类型”:“项目”,
“代码”:409年,

“message_list”:
[{"message": "Edit conflict: please retry change.", "reason": "CONCURRENT_REQUESTS_NOT_ALLOWED"}],

"state": "ERROR", "api_version": "3.1"}}

只有特定的项目才有这个问题,其他的项目都很好。我搜索了KBs,但没有找到任何内容。ncc health_checks run_all没有显示任何可疑的内容。

我也开了一个关于这个错误的案例!

图标

最佳答案jonas.hogman2020年12月9日

Ok!
So i just got this solved by support.\u00a0

There was a category for this project witch was stale.\u00a0
So support used a script called remove_stale_entries.py.\u00a0<\/p>

CAUTION!
Use this only after verifying with support that it\u2019s safe. But for CE users, it might help :)<\/p>

import env
import argparse
from insights_interface.insights_interface_pb2 import *
from insights_interface.insights_interface import *
interface = InsightsInterface('127.0.0.1', 2027)

parser = argparse.ArgumentParser()
parser.add_argument(\"--uuid\", nargs=\"*\", required=True, help=\"Enter stale entity's UUID as a list separated by space\", default=[])
parser.add_argument(\"--entity_type\", required=True, help=\"Enter the type of entity. Example : task,vm etc. \")
parser.add_argument(\"--cas\", help=\"Use this flag for deleting CAS entities, else deletion will fail\", action=\"store_true\", required=False)

if len(sys.argv)==1:
parser.print_help()
sys.exit(1)

args = parser.parse_args()
entity_list = args.uuid
entity_type = args.entity_type
cas = args.cas
g = GetEntitiesArg()
for entity_id in entity_list:
e = EntityGuid()
e.entity_type_name = entity_type
e.entity_id = entity_id
g.entity_guid_list.extend([e])

res = interface.GetEntities(g)

if len(res.entity) == 0:
print \"No entities found matching the input UUID(s).\"

for entity in res.entity:
d = DeleteEntityArg()
d.entity_guid.CopyFrom(entity.entity_guid)
if(cas):
d.cas_value = entity.cas_value + 1
print 'deleting entity %s with CAS %s' \\
% (str(entity.entity_guid.entity_id), entity.cas_value)
else:
print 'deleting entity %s' % (str(entity.entity_guid.entity_id))
interface.DeleteEntity(d)
<\/code><\/pre>

put the script i \/home\/nutanix\/bin<\/p>

chmod 777 on the script.\u00a0<\/p>

Then used nuclei project.list to get the UUID from the undeletable project.\u00a0<\/p>

Then ran the python script:

python remove_stale_entries.py --uuid 857fbbf0-3ecc-5d9e-b4b4-f9b4b54d8192 --entity_type=abac_category --cas
tada, the project is gone :)<\/p>","className":"post__content__best_answer"}">

查看原始

1回复

Userlevel 1
徽章 +2

好的!
所以我通过支持解决了这个问题。

这个项目有一个类别是陈旧的。
因此,支持使用了一个名为remove_stale_entries.py的脚本。

谨慎!
只有在与支持验证它是安全的之后才使用它。但对于CE用户来说,它可能会有帮助:)

进口env
进口argparse
从insights_interface。insights_interface_pb2进口*
从insights_interface。insights_interface进口*
接口= InsightsInterface('127.0.0.1', 2027)

解析器= argparse.ArgumentParser ()
解析器。add_argument("——uuid", nargs="*", required=True, help="以空格分隔的列表形式输入过时实体的uuid", default=[])
解析器。add_argument("——entity_type", required=True, help="输入实体的类型。例如:task、vm等。”)
解析器。add_argument("——cas", help="使用此标志删除cas实体,否则删除将失败",action="store_true", required=False)

如果len (sys.argv) = = 1:
parser.print_help ()
sys.exit (1)

args = parser.parse_args ()
entity_list = args.uuid
entity_type = args.entity_type
中科院= args.cas
g = GetEntitiesArg ()
对于entity_list中的entity_id:
e = EntityGuid ()
e.entity_type_name = entity_type
e.entity_id = entity_id
g.entity_guid_list.extend ([e])

res = interface.GetEntities (g)

If len(res.entity) == 0:
print“没有找到匹配输入UUID的实体。”

对于res.entity中的实体:
d = DeleteEntityArg ()
d.entity_guid.CopyFrom (entity.entity_guid)
如果(cas):
d.cas_value =实体。cas_value + 1
打印“正在删除带有CAS的实体%s”\
% (str (entity.entity_guid.entity_id)、entity.cas_value)
其他:
打印“删除实体%s”% (str(entity. entity_guide .entity_id))
interface.DeleteEntity (d)

放置脚本I /home/nutanix/bin

Chmod 777脚本。

然后用核工程。list从不可删除的项目中获取UUID。

然后运行python脚本:

Python remove_stale_ents .py——uuid 857fbbf0-3ec -5d9e-b4b4-f9b4b54d8192——entity_type=abac_category——cas
好了,项目结束了:)

回复


Baidu