Search code examples
pythonvirtualizationcitrixxenhypervisor

XENAPI VLAN not getting flown to slave node if created on master node


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. Image of vlan created on master node with VLAN and NIC attached.

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. Image of VLAN created with improper information of NIC and VLAN tag.

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?


Solution

  • I have got the solution for this problem. Just replace

    vlan = session.xenapi.VLAN.create(pif, "1280", network)
    

    by

     vlan = session.xenapi.pool.create_VLAN_from_PIF(pif, network, "1280")
    

    This will create VLAN on all nodes in the cluster.