首页 > 代码库 > 在openstack宿主机里删除一个虚拟机关联的网卡、端口及桥

在openstack宿主机里删除一个虚拟机关联的网卡、端口及桥

在宿主机里删除一个虚拟机关联的网卡、端口及桥

1)、用ovs-vsctl命令查看宿主机的所有的桥信息

[root@os-node4 ~]#ovs-vsctl show

169dc0d6-0c44-42df-9bd5-5e1f380a8704

    Bridge br-int

        Port int-br-int

            Interface int-br-int

        Port phy-br-int

            Interface phy-br-int

        Port "em2"

            Interface "em2"

        Port br-int

            Interface br-int

                type: internal

        Port "qvo2bb4fd90-f1"

            tag: 1

            Interface"qvo2bb4fd90-f1"

    ovs_version: "1.11.0"

2)、删除br-int桥下的qvo2bb4fd90-f1端口

[root@os-node4 ~]#ovs-vsctl del-port br-int qvo2bb4fd90-f1

3)、再次查看桥信息刚才的那个端口已经删除

[root@os-node4 ~]#ovs-vsctl show

169dc0d6-0c44-42df-9bd5-5e1f380a8704

    Bridge br-int

        Port int-br-int

            Interface int-br-int

        Port phy-br-int

            Interface phy-br-int

        Port "em2"

            Interface "em2"

        Port br-int

            Interface br-int

                type: internal

    ovs_version: "1.11.0"

 

3)、用ifconfig查看全局接口信息

[root@os-node4 ~]#ifconfig | grep  HWaddr

br-int    Link encap:Ethernet  HWaddr 74:86:7A:D9:05:19 

em1       Link encap:Ethernet  HWaddr 74:86:7A:D9:05:18 

em2       Link encap:Ethernet  HWaddr 74:86:7A:D9:05:19 

int-br-int Linkencap:Ethernet  HWaddr 42:D4:65:7C:EE:5E 

phy-br-int Linkencap:Ethernet  HWaddrAE:70:7F:C8:4E:53 

qbr2bb4fd90-f1Link encap:Ethernet  HWaddrF2:6E:69:E9:7B:62 

qvb2bb4fd90-f1Link encap:Ethernet  HWaddrF2:6E:69:E9:7B:62 

qvo2bb4fd90-f1Link encap:Ethernet  HWaddr F2:12:9A:D9:85:58 

tap2bb4fd90-f1Link encap:Ethernet  HWaddrFE:16:3E:0F:72:20 

virbr0    Link encap:Ethernet  HWaddr 52:54:00:07:56:A2 

4)、把虚拟机关联的4个端口qbr2bb4fd90-f1qvb2bb4fd90-f1 qvo2bb4fd90-f1 tap2bb4fd90-f1down

[root@os-node4 ~]#ifconfig qbr2bb4fd90-f1 down

[root@os-node4 ~]#ifconfig qvb2bb4fd90-f1 down

[root@os-node4 ~]#ifconfig qvo2bb4fd90-f1 down

[root@os-node4 ~]#ifconfig tap2bb4fd90-f1 down

5)、再次在全局下查看端口信息

[root@os-node4 ~]#ifconfig | grep  HWaddr

br-int    Link encap:Ethernet  HWaddr 74:86:7A:D9:05:19 

em1       Link encap:Ethernet  HWaddr 74:86:7A:D9:05:18 

em2       Link encap:Ethernet  HWaddr 74:86:7A:D9:05:19 

int-br-int Linkencap:Ethernet  HWaddr42:D4:65:7C:EE:5E 

phy-br-int Linkencap:Ethernet  HWaddrAE:70:7F:C8:4E:53 

virbr0    Link encap:Ethernet  HWaddr 52:54:00:07:56:A2

6)、用brctl命令查看所有的桥信息

[root@os-node4~]#  brctl show

bridge name     bridge id               STP enabled     interfaces

qbr2bb4fd90-f1          8000.f26e69e97b62       no              qvb2bb4fd90-f1

                                                       tap2bb4fd90-f1

virbr0          8000.5254000756a2       yes             virbr0-nic

[root@os-node4 ~]#

7)、删除虚拟机的桥qbr2bb4fd90-f1

[root@os-node4 ~]#brctl delbr qbr2bb4fd90-f1

[root@os-node4~]#  brctl show

bridge name     bridge id               STP enabled     interfaces

virbr0          8000.5254000756a2       yes             virbr0-nic

[root@os-node4 ~]#

8)、如果可以的话重启下服务器网卡

[root@os-node4 ~]#service network restart


本文出自 “zhanguo1110” 博客,请务必保留此出处http://zhanguo1110.blog.51cto.com/5750817/1543027