Quantum 数据库增加新表

本文介绍了如何在Quantum的OpenvSwitch插件中创建和引入ovs_qos_db.py模块,用于处理QoS相关数据。首先,创建这个模块,然后在ovs_db_v2.py中导入,接着通过软链接将模块添加到指定路径,最后重启quantum-server以应用更改。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

本文地址:http://blog.youkuaiyun.com/spch2008/article/details/9011321


1. 创建代码ovs_qos_db.py

'''
Created on 2013-6-3

@author: spch2008
'''

from sqlalchemy import Column, Integer, String
from sqlalchemy.orm import exc
from quantum.db.models_v2 import model_base

class QoSPortBinding(model_base.BASEV2):
    __tablename__ = 'ovs_qos_port_binding'

    port_id = Column(String(20), primary_key=True)
    
    qos_id  = Column(String(20), primary_key=True)

    def __init__(self, port_id, qos_id):
        self.port_id = port_id
        self.qos_id  = qos_id

    def __repr__(self):
        return "<QoSPortBinding(%s, %s, %s)>" % (self.port_id, self.qos_id)

将代码置于/usr/share/pyshared/quantum/plugins/openvswitch# 中


2. 引入该模块

    在/usr/share/pyshared/quantum/plugins/openvswitch#下的ovs_db_v2.py中,导入上述模块 

from quantum.plugins.openvswitch import ovs_qos_db

3. 创建软连接


/usr/lib/python2.7/dist-packages/quantum/plugins/openvswitch#   ln -s ../../../../../../share/pyshared/quantum/plugins/openvswitch/ovs_qos_db.py  ovs_qos_db.py


4. 重启quantum-server

    service quantum-server restart



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值