高危操作 :
以fsp用户登录控制节点
su - root 切换到root用户后导入环境变量
1:云平台上查看业务虚拟机的ID
2:nova interface-list fbbff44d-a3e8-4575-8f67-1246307026b6
39372A03-8688-72A7-E911-805486341B42:~ # nova interface-list fbbff44d-a3e8-4575-8f67-1246307026b6
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
| ACTIVE | 97b426b7-732a-4665-b5ad-c3f140ff4b19 | 4aaabf56-f34d-495b-8b5d-0e7f1fe0fb1b | 10.182.211.243 | fa:16:3e:ed:5e:9c |
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
39372A03-8688-72A7-E911-805486341B42:~ #
39372A03-8688-72A7-E911-805486341B42:~ #
39372A03-8688-72A7-E911-805486341B42:~ #
3:找到对应的要删除的PortID后,执行网卡与虚拟机解绑操作;
执行命令: nova interface-detach **虚拟机ID PortID**
nova interface-detach fbbff44d-a3e8-4575-8f67-1246307026b6 97b426b7-732a-4665-b5ad-c3f140ff4b19
再次检查
nova interface-list fbbff44d-a3e8-4575-8f67-1246307026b6
39372A03-8688-72A7-E911-805486341B42:~ # nova interface-detach fbbff44d-a3e8-4575-8f67-1246307026b6 97b426b7-732a-4665-b5ad-c3f140ff4b19
39372A03-8688-72A7-E911-805486341B42:~ # nova interface-list fbbff44d-a3e8-4575-8f67-1246307026b6
+------------+---------+--------+--------------+----------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+---------+--------+--------------+----------+
+------------+---------+--------+--------------+----------+
39372A03-8688-72A7-E911-805486341B42:~ #
39372A03-8688-72A7-E911-805486341B42:~ #
4:添加新网卡
解绑后,在SC上查看虚拟机信息为虚拟机重新添加新网卡,然后返回在后面级联层控制节点主机上,查看当前添加的新网卡是否为主网卡
5:检查新网卡信息
查看网卡是否为主网卡命令:neutron port-show PortID
39372A03-8688-72A7-E911-805486341B42:~ # nova interface-list fbbff44d-a3e8-4575-8f67-1246307026b6
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
| Port State | Port ID | Net ID | IP addresses | MAC Addr |
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
| ACTIVE | 0f067519-6e9a-4178-a7cc-2b614d837d6a | ab44a2db-9d7a-42fe-9f49-9d1e966987b7 | 10.182.212.157 | fa:16:3e:d9:d0:bc |
+------------+--------------------------------------+--------------------------------------+----------------+-------------------+
39372A03-8688-72A7-E911-805486341B42:~ # neutron port-show 0f067519-6e9a-4178-a7cc-2b614d837d6a
+-----------------------+------------------------------------------------------------------------------------------------------------------------+
| Field | Value |
+-----------------------+------------------------------------------------------------------------------------------------------------------------+
| admin_state_up | True |
| allowed_address_pairs | |
| binding:host_id | 44454C4C-3000-105A-8044-B1C04F345932 |
| binding:profile | {"availability_zone": "az2.dc0"} |
| binding:vif_details | {"ovs_hybrid_plug": true, "primary_interface": true, "port_filter": true, "mtu_request": false} |
| binding:vif_type | ovs |
| binding:vnic_type | normal |
| binding_levels | {"driver": "huawei_ac_ml2", "level": 0, "physical_network": "", "network_type": "vxlan", "segmentation_id": 99382} |
| | {"driver": "openvswitch", "level": 1, "physical_network": "physnet2", "network_type": "vlan", "segmentation_id": 1011} |
| created_at | 2020-11-06T08:48:53 |
| description | |
| device_id | fbbff44d-a3e8-4575-8f67-1246307026b6 |
| device_owner | compute:az2.dc0 |
| extra_dhcp_opts | |
| fixed_ips | {"subnet_id": "ee245829-b9b0-4c00-a882-b9f88397f7eb", "ip_address": "10.182.212.157"} |
| id | 0f067519-6e9a-4178-a7cc-2b614d837d6a |
| mac_address | fa:16:3e:d9:d0:bc |
| name | |
| network_id | ab44a2db-9d7a-42fe-9f49-9d1e966987b7 |
| port_security_enabled | True |
| project_id | 314fe0973e804ceaaa8ca7879fcc3857 |
| qos_policy_id | |
| security_groups | 50c386be-3290-4c9d-b7fe-70faf5841b59 |
| status | ACTIVE |
| tags | |
| tenant_id | 314fe0973e804ceaaa8ca7879fcc3857 |
| updated_at | 2020-11-06T08:49:07 |
+-----------------------+------------------------------------------------------------------------------------------------------------------------+
39372A03-8688-72A7-E911-805486341B42:~ #
6:检查新网卡信息
查看回显信息,admin_state_up字段是否为true,true为主网卡,反之不是
如新加网卡不是主网卡,则需要为当前网卡添加主网卡属性
命令:neutron port-update PortID admin_state_up True