I am trying to create a VLAN on host from xenapi python library. VLAN is getting created by following way,
>>> network = session.xenapi.network.create({'name_label': 'VLAN1280', 'name_description': 'VLAN1280', 'other_config': {}, 'bridge': '', 'MTU': '1500'})
>>> pif = session.xenapi.PIF.get_by_uuid("a733dc21-4e9e-9a13-0ba6-8cf1db29a985")
>>> vlan = session.xenapi.VLAN.create(pif, "1280", network)
Session is only getting created for masternode as xenapi does not allow to connect to slave node.
By the above code snippet, VLAN is getting created only on Master Node.
However, this does not getting flown to slave node with VLAN tag and NIC information. only NETWORK name is getting reflected but not NIC and VLAN information.
I'd like to mention, when we try to create a VLAN network from xencenter application, it is getting created on master node as well on slave node with proper information.
Can someone please guide me/help me out for this issue?
答案 0 :(得分:0)
我已经找到了解决这个问题的方法。 只需替换
vlan = session.xenapi.VLAN.create(pif, "1280", network)
通过
vlan = session.xenapi.pool.create_VLAN_from_PIF(pif, network, "1280")
这将在群集中的所有节点上创建VLAN。