| Design document | |
|---|---|
| Revision | v3 |
| Status | proposed |
| Review | create new issue |
| Revision history | |
| v1 | Initial version |
| v2 | Addition of `networkd_db` update for Upgrade |
| v3 | More info on `networkd_db` and API Errors |
This document describes design details for the REQ-42: Support Use of VLAN on XAPI Management Interface.
Creating a VLAN is already there, Lisiting the steps to create a VLAN which is used later in the document. Steps:
eth0, eth1.
xe pif-list params=uuid physical=true host-uuid=UUID this will list pif-UUIDxe network-create name-label=VLAN1
It returns a new network-UUIDxe vlan-create pif-uuid=pif-UUID network-uuid=network-UUID vlan=VLAN-ID
It returns a new VLAN PIF new-pif-UUIDxe pif-plug uuid=new-pif-UUIDxe pif-reconfigure-ip uuid=new-pif-UUID mode= IP= netmask= gateway= DNS=
This will configure IP on the PIF, here mode is must and other parametrs are needed on selecting mode=staticSimilarly, creating a vlan pif can be achieved by corresponding XenAPI calls.
For a newly installed host, If host installer was asked to put the management interface on given VLAN.
We will expect a new entry VLAN=ID under /etc/firstboot.d/data/management.conf.
Listing current contents of management.conf which will be used later in the document.
LABEL=eth0 -> Represents Pyhsical device on which Management Interface must reside.
MODE=dhcp||static -> Represents IP configuration mode for the Management Interface. There can be other parameters like IP, NETMASK, GATEWAY and DNS when we have static mode.
VLAN=ID -> New entry for specifying VLAN TAG going to be configured on device LABEL.
Management interface going to be configured on this VLAN ID with specified mode.
Firstboot script /etc/firstboot.d/30-prepare-networking need to be updated for configuring
management interface to be on provided VLAN ID.
Steps to be followed:
PIF.scan performed in the script must have created the PIFs for the underlying pyhsical devices.LABEL.Creating a VLAN, i.e. network-create, vlan-create and pif-plug. Now we have a new PIF for the VLAN.pif-reconfigure-ip for the new VLAN PIF.host-management-reconfigure using new VLAN PIF.XCP-Networkd during first boot and boot after pool eject gets the initial network setup from the management.conf and xensource-inventory file to update the network.db for management interface info.
XCP-Networkd must honour the new VLAN config.
Steps to be followed:
read_config step tries to read the /var/lib/xcp/networkd.db file which is not yet created just after host installation.networkd.db read throws Read_Error, it tries to read network.dbcache which is also not available hence it goes to read read_management_conf file.static or dhcp taken from management.conf.bridge_name is taken as MANAGEMENT_INTERFACE from xensource-inventory, further bridge_config and interface_config are build based on MODE.Bridge.make_config() and Interface.make_config() are performed with respective bridge_config and interface_config.networkd_db provides the management interface info to the host installer during upgrade.
It reads /var/lib/xcp/networkd.db file to output the Management Interface information. Here we need to update the networkd_db to output the VLAN information when vlan bridge is a input.
Steps to be followed:
networkd_db -iface xapi0 this will list mode as dhcp or static, if mode=static then it will provide ipaddr and netmask too.networkd_db -bridge xapi0 It should output the VLAN info like:
interfaces=
vlan=vlanID
parent=xenbr0 using the parent bridge user can identify the physical interfaces.
Here we will extract VLAN and parent bridge from bridge_config under networkd.db.Detail design is mentioned on http://xapi-project.github.io/xapi/design/emergency-network-reset.html
For using xe-reset-networking utility to configure management interface on VLAN, We need to add one more parameter --vlan=vlanID to the utility.
There are certain parameters need to be passed to this utility: –master, –device, –mode, –ip, –netmask, –gateway, –dns and new one –vlan.
Steps to be followed:
VLANID is passed then let bridge=xapi0.bridge=xapi0 into xensource-inventory file, This should work as Xapi check avialable bridges while creating networks.VLAN=vlanID into management.conf and /tmp/network-reset.check_network_reset under xapi.ml to perform steps Creating a VLAN and perform management_reconfigure on vlan pif.
Step Creating a VLAN must have created the VLAN record in Xapi DB similar to firstboot script.networkd_db program and handle the VLAN config.Under Emergency Network Reset option under the Network and Management Interface menu.
Selecting this option will show some explanation in the pane on the right-hand side.
Pressing
Currently pool-join fails if VLANs are present on the host joining a pool.
We need to allow pool-join only if Pool and host joining a pool both has management interface on same VLAN.
Steps to be followed:
pre_join_checks update function assert_only_physical_pifs to check Pool master management_interface is on same VLAN.Host.get_management_interface on Pool master and get the vlanID, match it with localhost management_interface VLAN ID.
If it matches then allow pool-join.Currently managament interface VLAN config on host is not been retained in xensource-inventory or management.conf file.
We need to retain the vlanID under config files.
Steps to be followed:
Pool.eject we need to update write_first_boot_management_interface_configuration_file function.managament.conf file and the bridge into xensource-inventory file.
In order to be retained by XCP-Networkd on startup after the host is ejected.Currently there is no Pool Level API to reconfigure management_interface for all of the Hosts in a Pool at once.
API Pool.management_reconfigure will be needed in order to reconfigure manamegemnt_interface on all hosts in a Pool to the same Network either VLAN or Physical.
Currently call Host.management_reconfigure with VLAN pif-uuid can change the management_interface to specified VLAN.
Listing the steps to understand the workflow of management_interface reconfigure. We will be using Host.management_reconfigure call inside the new API.
Steps performed during management_reconfigure:
bring_pif_up get called for the pif.xensource-inventory get updated with the latest info of interface.
3 update-mh-info updates the management_mac into xenstore._the_ management interface is used by slaves to connect to pool master.on_dom0_networking_change refreshes console URIs for the new IP address.Listing steps to be performed manually on each Host or Pool as a prerequisite to use the New API. We need to make sure that new network which is going to be a management interface has PIFs configured on each Host. In case of pyhsical network we will assume pifs are configured on each host, In case of vlan network we need to create vlan pifs on each Host. We would assume that VLAN is available on the switch/network.
Manual steps to be performed before calling new API:
network.create, In case of pyhsical NICs network must be present.VLAN.create using above network ref, physical PIF ref and vlanID, Not needed in case of pyhsical network.
Or An Alternate call pool.create_VLAN providing device and above network will create vlan PIFs for all hosts in a pool.PIF.reconfigure_ip for each new Network PIF on each Host.If User wishes to change the management interface manually on each Host in a Pool, We should allow it, There will be a guideline for that:
User can individually change management interface on each host calling Host.management_reconfigure using pifs on physical devices or vlan pifs.
This must be perfomed on slaves first and lastly on Master, As changing management_interface on master will disconnect slaves from master then further calls Host.management_reconfigure cannot be performed till master recover slaves via call pool.recover_slaves.
Pool.management_reconfigure
network.management_interface on each host of a pool.network provided it will check pifs are present on each Host,
In case of VLAN network it will check vlan pifs on provided network are present on each Host of Pool.Host.management_reconfigure on each slave then lastly on master.pool.recover_slaves on master inorder to recover slaves which might have lost the connection to master.Possible API errors that may be raised by pool.management_reconfigure:
INTERFACE_HAS_NO_IP : the specified PIF (pif parameter) has no IP configuration. The new API checks for all PIFs on the new Network has IP configured. There might be a case when user has forgotten to configure IP on PIF on one or many of the Hosts in a Pool.New API ERROR:
REQUIRED_PIF_NOT_PRESENT : the specified Network (network parameter) has no PIF present on the host in pool. There might be a case when user has forgotten to create vlan pif on one or many of the Hosts in a Pool.