步骤:
1、创建一个Network
2、创建VLAN
创建VLAN的时候内部包含几个工作
2.1、创建一个Vlan对象(图中的①)
2.2、创建一个PIF(图中的②)连接之前新建的VLAN和新建的Network
2.3、Vlan(图中的①)和PIF(图中的③)连接起来
code:
Network.Record networkRecord = new Network.Record(); networkRecord.nameLabel = "for_vlan_test_1"; networkRecord.nameDescription = "for_vlan_test_1"; networkRecord.MTU = 1500L;//最大传输单元,取配置文件常量,1500L networkRecord.otherConfig = null; Network network = Network.create(connection, networkRecord); Long tag = 801L; PIF taggedPIF = PIF.getByUuid(connection, "8a6dfb4d-187f-a5d0-7e35-bd8d81a301a7");//PIF为图中的③ //create vlan VLAN vlan = VLAN.create(connection, taggedPIF, tag, network);
XEN创建内网(VLAN)
时间: 2024-10-29 02:36:24