nova event机制分析

本文主要分析Nova的一个event机制,目前主要用于VIF plugin时的notification,可以实现Nova 和 Neutron之间VIF 状态信息的交互。

1. nova部分

vif_plugging_timeout配置参数的解释,用于定义创建VM时等待VIF准备好的时间
    cfg.BoolOpt('vif_plugging_is_fatal',
                default=True,
                help="Fail instance boot if vif plugging fails"),
    cfg.IntOpt('vif_plugging_timeout',
               default=300,
               help='Number of seconds to wait for neutron vif plugging '
                    'events to arrive before continuing or failing (see '
                    'vif_plugging_is_fatal). If this is set to zero and '
                    'vif_plugging_is_fatal is False, events should not '
                    'be expected to arrive at all.'),

_create_domain_and_network():

        timeout = CONF.vif_plugging_timeout
        if (self._conn_supports_start_paused and #判断是不是支持开机是暂停,主要是virt_type是否是kvm or qemu, 此处进行判断的原因是vm需要暂停一下等待linux bridge创建好并把vm连接到br-int上去
            utils.is_neutron() and not
            vifs_already_plugged and power_on and timeout):
            events = self._get_neutron_events(network_info)#返回所有vif的active属性为False的项
        else:
            events = []

        launch_flags = events and libvirt.VIR_DOMAIN_START_PAUSED or 0
        domain = None
        try:
            with self.virtapi.wait_for_instance_event(#上下文管理
                    instance, events, deadline=timeout,
                    error_callback
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值