本文整理汇总了Python中cfgm_common.vnc_cassandra.VncCassandraClient.object_delete方法的典型用法代码示例。如果您正苦于以下问题:Python VncCassandraClient.object_delete方法的具体用法?Python VncCassandraClient.object_delete怎么用?Python VncCassandraClient.object_delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cfgm_common.vnc_cassandra.VncCassandraClient
的用法示例。
在下文中一共展示了VncCassandraClient.object_delete方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _issu_basic_function
# 需要导入模块: from cfgm_common.vnc_cassandra import VncCassandraClient [as 别名]
# 或者: from cfgm_common.vnc_cassandra.VncCassandraClient import object_delete [as 别名]
#.........这里部分代码省略.........
nks = {ks: cflist}
oks = {ks: cflist}
self._nkeyspaces.update(nks)
self._okeyspaces.update(oks)
self._ks_issu_func_info.update(ks_issu_func_info)
self._oldversion_handle = VncCassandraClient(
self._oldversion_server_list, self._odb_prefix, None, self._okeyspaces, self._logger
)
self._newversion_handle = VncCassandraClient(
self._newversion_server_list, self._ndb_prefix, self._nkeyspaces, None, self._logger
)
# end
def _fetch_issu_func(self, ks):
return self._ks_issu_func_info[ks]
# end
# Overwrite what is seen in the newer with the old version.
def _merge_overwrite(self, new, current):
updated = current
updated.update(new)
return updated
# end
# For now this function should be called for only config_db_uuid.
# If we separate out config_db_uuid keyspace from VncCassandraClient,
# then we don't need to pass keyspaces here.
def issu_merge_copy(self, keyspaces):
for ks, cflist in keyspaces.items():
self._logger("Issu contrail cassandra merge copy, keyspace: " + str(ks), level=SandeshLevel.SYS_INFO)
issu_funct = self._fetch_issu_func(ks)
for cf in cflist:
newList = []
newversion_result = self._newversion_handle.get_range(cf)
self._logger("Building New DB memory for columnfamily: " + str(cf), level=SandeshLevel.SYS_INFO)
new_db = dict(newversion_result)
oldversion_result = self._oldversion_handle.get_range(cf)
self._logger("Doing ISSU copy for columnfamily: " + str(cf), level=SandeshLevel.SYS_INFO)
for rows, columns in oldversion_result:
out = issu_funct(ks, cf, columns)
current = new_db.pop(rows, None)
if current is not None:
updated = self._merge_overwrite(out, dict(current))
x = self._newversion_handle.add(cf, rows, updated)
else:
updated = []
x = self._newversion_handle.add(cf, rows, out)
diff = set(updated) - set(out)
y = self._newversion_handle.get_cf(cf).remove(rows, diff)
self._logger(
"Pruning New DB if entires don't exist in old DB column " "family: " + str(cf),
level=SandeshLevel.SYS_INFO,
)
for item in new_db:
# TBD should be catch exception and fail ISSU
self._newversion_handle.delete(cf, item)
# end
# This is issu_copy function.
def issu_copy(self, keyspaces):
for ks, cflist in keyspaces.items():
issu_funct = self._fetch_issu_func(ks)
for cf in cflist:
self._logger(
"Issu Copy KeySpace: " + str(ks) + " Column Family: " + str(cf), level=SandeshLevel.SYS_INFO
)
oldversion_result = self._oldversion_handle.get_range(cf)
for rows, columns in oldversion_result:
out = issu_funct(ks, cf, columns)
x = self._newversion_handle.add(cf, rows, out)
# TBD If failure to add, fail ISSU
# end
def issu_sync_row(self, msg, cf):
if msg["oper"] == "CREATE":
self._logger(msg, level=SandeshLevel.SYS_INFO)
self._newversion_handle.object_create(msg["type"].replace("-", "_"), msg["uuid"], msg["obj_dict"])
elif msg["oper"] == "UPDATE":
self._logger(msg, level=SandeshLevel.SYS_INFO)
uuid_list = []
uuid_list.append(msg["uuid"])
bool1, current = self._newversion_handle.object_read(msg["type"].replace("-", "_"), uuid_list)
bool2, new = self._oldversion_handle.object_read(msg["type"].replace("-", "_"), uuid_list)
updated = self._merge_overwrite(dict(new.pop()), dict(current.pop()))
# New object dictionary should be created, for now passing as is
self._newversion_handle.object_update(msg["type"].replace("-", "_"), msg["uuid"], updated)
elif msg["oper"] == "DELETE":
self._logger(msg, level=SandeshLevel.SYS_INFO)
self._newversion_handle.object_delete(msg["type"].replace("-", "_"), msg["uuid"])
return