コード例 #1
0
    def post_start_actions(self, instance, vif_ref):
        """Do needed actions post vif start:
        plug the interim ovs bridge to the integration bridge;
        set external_ids to the int-br port which will service
        for this vif.
        """
        vif_rec = self._session.VIF.get_record(vif_ref)
        network_ref = vif_rec['network']
        bridge_name = self._session.network.get_bridge(network_ref)
        network_uuid = self._session.network.get_uuid(network_ref)
        iface_id = vif_rec['other_config']['neutron-port-id']
        patch_port1, tap_name = self._get_patch_port_pair_names(iface_id)
        LOG.debug('plug_ovs_bridge: port1=%(port1)s, port2=%(port2)s,'
                  'network_uuid=%(uuid)s, bridge_name=%(bridge_name)s',
                  {'port1': patch_port1, 'port2': tap_name,
                   'uuid': network_uuid, 'bridge_name': bridge_name})
        if bridge_name is None:
            raise exception.VirtualInterfacePlugException(
                      _("Failed to find bridge for vif"))

        # Create Linux bridge qbrXXX
        linux_br_name = self._create_linux_bridge(vif_rec)
        if not self._device_exists(tap_name):
            LOG.debug("create veth pair for interim bridge %(interim_bridge)s "
                      "and linux bridge %(linux_bridge)s",
                      {'interim_bridge': bridge_name,
                       'linux_bridge': linux_br_name})
            self._create_veth_pair(tap_name, patch_port1)
            host_network.brctl_add_if(self._session, linux_br_name, tap_name)
            # Add port to interim bridge
            host_network.ovs_add_port(self._session, bridge_name, patch_port1)
コード例 #2
0
ファイル: vif.py プロジェクト: arbrandes/nova
    def post_start_actions(self, instance, vif_ref):
        """Do needed actions post vif start:
        plug the interim ovs bridge to the integration bridge;
        set external_ids to the int-br port which will service
        for this vif.
        """
        vif_rec = self._session.VIF.get_record(vif_ref)
        network_ref = vif_rec['network']
        bridge_name = self._session.network.get_bridge(network_ref)
        network_uuid = self._session.network.get_uuid(network_ref)
        iface_id = vif_rec['other_config']['neutron-port-id']
        patch_port1, tap_name = self._get_patch_port_pair_names(iface_id)
        LOG.debug('plug_ovs_bridge: port1=%(port1)s, port2=%(port2)s,'
                  'network_uuid=%(uuid)s, bridge_name=%(bridge_name)s',
                  {'port1': patch_port1, 'port2': tap_name,
                   'uuid': network_uuid, 'bridge_name': bridge_name})
        if bridge_name is None:
            raise exception.VirtualInterfacePlugException(
                      _("Failed to find bridge for vif"))

        # Create Linux bridge qbrXXX
        linux_br_name = self._create_linux_bridge(vif_rec)
        if not self._device_exists(tap_name):
            LOG.debug("create veth pair for interim bridge %(interim_bridge)s "
                      "and linux bridge %(linux_bridge)s",
                      {'interim_bridge': bridge_name,
                       'linux_bridge': linux_br_name})
            self._create_veth_pair(tap_name, patch_port1)
            host_network.brctl_add_if(self._session, linux_br_name, tap_name)
            # Add port to interim bridge
            host_network.ovs_add_port(self._session, bridge_name, patch_port1)
コード例 #3
0
    def _create_linux_bridge(self, vif_rec):
        """create a qbr linux bridge for neutron security group
        """
        iface_id = vif_rec['other_config']['neutron-port-id']
        linux_br_name = self._get_qbr_name(iface_id)
        if not self._device_exists(linux_br_name):
            LOG.debug("Create linux bridge %s", linux_br_name)
            host_network.brctl_add_br(self._session, linux_br_name)
            host_network.brctl_set_fd(self._session, linux_br_name, '0')
            host_network.brctl_set_stp(self._session, linux_br_name, 'off')
            host_network.ip_link_set_dev(self._session, linux_br_name, 'up')

        qvb_name, qvo_name = self._get_veth_pair_names(iface_id)
        if not self._device_exists(qvo_name):
            self._create_veth_pair(qvb_name, qvo_name)
            host_network.brctl_add_if(self._session, linux_br_name, qvb_name)
            host_network.ovs_create_port(
                self._session, CONF.xenserver.ovs_integration_bridge,
                qvo_name, iface_id, vif_rec['MAC'], 'active')
        return linux_br_name
コード例 #4
0
ファイル: vif.py プロジェクト: arbrandes/nova
    def _create_linux_bridge(self, vif_rec):
        """create a qbr linux bridge for neutron security group
        """
        iface_id = vif_rec['other_config']['neutron-port-id']
        linux_br_name = self._get_qbr_name(iface_id)
        if not self._device_exists(linux_br_name):
            LOG.debug("Create linux bridge %s", linux_br_name)
            host_network.brctl_add_br(self._session, linux_br_name)
            host_network.brctl_set_fd(self._session, linux_br_name, '0')
            host_network.brctl_set_stp(self._session, linux_br_name, 'off')
            host_network.ip_link_set_dev(self._session, linux_br_name, 'up')

        qvb_name, qvo_name = self._get_veth_pair_names(iface_id)
        if not self._device_exists(qvo_name):
            self._create_veth_pair(qvb_name, qvo_name)
            host_network.brctl_add_if(self._session, linux_br_name, qvb_name)
            host_network.ovs_create_port(
                self._session, CONF.xenserver.ovs_integration_bridge,
                qvo_name, iface_id, vif_rec['MAC'], 'active')
        return linux_br_name