从cinder 删除volume 分析cinder rpc
发布日期:2021-09-16 04:36:56
浏览次数:5
分类:技术文章
本文共 1775 字,大约阅读时间需要 5 分钟。
从volume_rpcapi delete_volume开始删除volume
self.volume_rpcapi.delete_volume(context, volume, unmanage_only, cascade)
def delete_volume(self, ctxt, volume, unmanage_only=False, cascade=False): volume.create_worker() cctxt = self._get_cctxt(volume.service_topic_queue) 这个cctxt是封闭context的地方,不过个 volume.service_topic_queue从字面上看是topic的名字, msg_args = { 'volume': volume, 'unmanage_only': unmanage_only, 'cascade': cascade, } cctxt.cast(ctxt, 'delete_volume', **msg_args)
volume.service_topic_queue 这里其实我还看了点时间, 从数据库里查找字段,发现根本没有,去objects里的volumes.py里找,也没看到,这就奇怪了,于是多调试了下,并看了下继承,发现原来是在base.py里的ClusteredObject
class ClusteredObject(object): @property def service_topic_queue(self): return self.cluster_name or self.host 原来是host字段
现在终于名字了,这个是取host字段值,名字写的这么高大上,有点名不副实的感觉。
def _get_cctxt(self, host=None, version=None, **kwargs): if host: server = utils.extract_host(host) # TODO(dulek): If we're pinned before 3.6, we should send stuff the # old way - addressing server=host@backend, topic=cinder-volume. # Otherwise we're addressing server=host, # topic=cinder-volume.host@backend. This conditional can go away # when we stop supporting 3.x. if self.client.can_send_version('3.6'): kwargs['topic'] = '%(topic)s.%(host)s' % {'topic': self.TOPIC, #这里到组装topic了,topic=self.TOPIC.host 这个host就是service_topic_queue 取出来的值 'host': server} server = utils.extract_host(server, 'host') kwargs['server'] = server return super(VolumeAPI, self)._get_cctxt(version=version, **kwargs)
分析完毕。
转载地址:https://blog.csdn.net/wllabs/article/details/77646376 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!
发表评论
最新留言
感谢大佬
[***.8.128.20]2024年04月07日 05时35分49秒
关于作者
喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
使用python登录和访问Confluence
2019-04-27
Unity2020中使用MemoryProfile卡死和报错的问题
2019-04-27
Unity中加载Texture2D不断消耗内存的问题
2019-04-27
手把手教你使用Unity制作一个飞机喷射火焰尾气的粒子效果
2019-04-27
gitee使用教程,创建项目仓库并上传代码
2019-04-27
Unity3D 上传日志
2019-04-27
Unity3D 序列帧
2019-04-27
Unity3D 动态创建图集并压入精灵(NGUI)
2019-04-27
C# 将Excel转xml
2019-04-27
Unity3D log写入文件
2019-04-27
Unity3D动态创建摄像机
2019-04-27
unity 根据纪元时间(1970/1/1)转换为DateTime
2019-04-27
C# 字符串md5加密
2019-04-27
unity3D 拖拽旋转3D物体
2019-04-27
unity3D LineRender的使用:插值移动终点
2019-04-27
unity3d 根据手指触摸的位置去放置UI
2019-04-27
加锁单例
2019-04-27
unity3D 让粒子在UI上播放
2019-04-27
C++的dll导出类
2019-04-27
Matlab与C++混合编程
2019-04-27