|
| 1 | +--- |
| 2 | +title: Management Interface on VLAN |
| 3 | +layout: default |
| 4 | +design_doc: true |
| 5 | +revision: 1 |
| 6 | +status: proposed |
| 7 | +revision_history: |
| 8 | +- revision_number: 1 |
| 9 | + description: Initial version |
| 10 | +--- |
| 11 | + |
| 12 | +This document describes design details for the |
| 13 | +REQ-42: Support Use of VLAN on XAPI Management Interface. |
| 14 | + |
| 15 | +XAPI and XCP-Networkd |
| 16 | +=============== |
| 17 | + |
| 18 | +### Creating a VLAN |
| 19 | + |
| 20 | +Steps for a user to create a VLAN via CLI. |
| 21 | + |
| 22 | +1. Check the PIFs created on a Host for physical devices `eth0`, `eth1`. |
| 23 | + `xe pif-list params=uuid physical=true host-uuid=UUID` this will list `pif-UUID` |
| 24 | +2. Create a new network for the VLAN interface. |
| 25 | + `xe network-create name-label=VLAN1` |
| 26 | + It returns a new `network-UUID` |
| 27 | +3. Create a VLAN PIF. |
| 28 | + `xe vlan-create pif-uuid=pif-UUID network-uuid=network-UUID vlan=VLAN-ID` |
| 29 | + It returns a new VLAN PIF `new-pif-UUID` |
| 30 | +4. Plug the VLAN PIF. |
| 31 | + `xe pif-plug uuid=new-pif-UUID` |
| 32 | +We can configure IP on this new PIF via `pif-reconfigure-ip` call with possible `DHCP` or `STATIC` mode. |
| 33 | +Similarly, creating a vlan pif can be achieved by corresponding XenAPI calls. |
| 34 | + |
| 35 | +Recognise VLAN config from management.conf |
| 36 | +---------------------------------------------- |
| 37 | + |
| 38 | +For a newly installed host, If host installer was asked to put the management interface on given VLAN. |
| 39 | +We will expect a new entry `VLAN=ID` under `/etc/firstboot.d/data/management.conf`. |
| 40 | +Current contents of management.conf: |
| 41 | +`LABEL`=`eth0` -> Represents Pyhsical device on which Management Interface must reside. |
| 42 | +`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. |
| 43 | +`VLAN`=`ID` -> New entry for specifying VLAN TAG going to be configured on device `LABEL`. |
| 44 | + Management interface going to be configured on this VLAN ID with specified mode. |
| 45 | + |
| 46 | +### Firstboot script need to recognise VLAN config |
| 47 | + |
| 48 | +Firstboot script `/etc/firstboot.d/30-prepare-networking` need to be updated for configuring |
| 49 | +management interface to be on provided VLAN ID. |
| 50 | + |
| 51 | +Steps to be followed: |
| 52 | + |
| 53 | +1. `PIF.scan` performed in the script must have created the PIFs for the underlying pyhsical devices. |
| 54 | +2. Get the PIF UUID for physical device `LABEL`. |
| 55 | +3. Repeat the steps mentioned in `Creating a VLAN`, i.e. network-create, vlan-create and pif-plug. Now we have a new PIF for the VLAN. |
| 56 | +4. Perform `pif-reconfigure-ip` for the new VLAN PIF. |
| 57 | +5. Perform `host-management-reconfigure` using new VLAN PIF. |
| 58 | + |
| 59 | +### XCP-Networkd need to recognise VLAN config during startup |
| 60 | + |
| 61 | +XCP-Networkd on startup get the initial network setup from the `management.conf` and `xensource-inventory` file to update the network.db for management interface info. |
| 62 | +XCP-Networkd must honour the new VLAN config. |
| 63 | + |
| 64 | +Steps to be followed: |
| 65 | + |
| 66 | +1. During startup `read_config` step tries to read the `/var/lib/xcp/networkd.db` file which is not yet created just after host installation. |
| 67 | +2. Since `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. |
| 68 | +3. There can be two possible MODE `static` or `dhcp` taken from management.conf. |
| 69 | +4. `bridge_name` is taken as `MANAGEMENT_INTERFACE` from xensource-inventory, further `bridge_config` and `interface_config` are build based on MODE. |
| 70 | +5. Call `Bridge.make_config()` and `Interface.make_config()` are performed with respective `bridge_config` and `interface_config`. |
| 71 | + |
| 72 | +Additional VLAN parameter for Emergency Network Reset |
| 73 | +----------------------------------------------------- |
| 74 | + |
| 75 | +Detail design is mentioned on http://xapi-project.github.io/xapi/design/emergency-network-reset.html |
| 76 | +For using `xe-reset-networking` utility to configure management interface on VLAN, We need to add one more parameter `--vlan=vlanID` to the utility. |
| 77 | +There are certain parameters need to be passed to this utility: --master, --device, --mode, --ip, --netmask, --gateway, --dns and new one --vlan. |
| 78 | + |
| 79 | +### VLAN parameter addition to xe-reset-networking |
| 80 | + |
| 81 | +Steps to be followed: |
| 82 | + |
| 83 | +1. Check if `VLANID` is passed then let bridge=`xapi0`. |
| 84 | +2. Write the `bridge=xapi0` into xensource-inventory file, This should work as Xapi check avialable bridges while creating networks. |
| 85 | +3. Write the `VLAN=vlanID` into `management.conf` and `/tmp/network-reset`. |
| 86 | +4. Modify `check_network_reset` under xapi.ml to perform steps `Creating a VLAN` and perform `management_reconfigure` on vlan pif. |
| 87 | + |
| 88 | +### VLAN parameter addition to xsconsole Emergency Network Reset |
| 89 | + |
| 90 | +Under `Emergency Network Reset` option under the `Network and Management Interface` menu. |
| 91 | +Selecting this option will show some explanation in the pane on the right-hand side. |
| 92 | +Pressing <Enter> will bring up a dialogue to select the interfaces to use as management interface after the reset. |
| 93 | +After choosing a device, the dialogue continues with configuration options like in the `Configure Management Interface` dialogue. |
| 94 | +There will be an additionall option for VLAN in the dialogue. |
| 95 | +After completing the dialogue, the same steps as listed for xe-reset-networking are executed. |
| 96 | + |
| 97 | +Updating Pool Join/Eject operations |
| 98 | +----------------------------------- |
| 99 | + |
| 100 | +### Pool Join while Pool having Management Interface on a VLAN |
| 101 | + |
| 102 | +Currently `pool-join` fails if VLANs are present on the host joining a pool. |
| 103 | +We need to allow pool-join only if Pool and host joining a pool both has management interface on same VLAN. |
| 104 | + |
| 105 | +Steps to be followed: |
| 106 | + |
| 107 | +1. Under `pre_join_checks` update function `assert_only_physical_pifs` to check Pool master management_interface is on same VLAN. |
| 108 | +2. Call `Host.get_management_interface` on Pool master and get the vlanID, match it with `localhost` management_interface VLAN ID. |
| 109 | + If it matches then allow pool-join. |
| 110 | +3. In case if there are multiple VLANs on host joining a pool, fail the pool-join gracefully. |
| 111 | +4. After the pool-join, Host xapi db will get sync from pool master xapi db, This will be fine to have management interface on VLAN. |
| 112 | + |
| 113 | +### Pool Eject while host ejected having Management Interface on a VLAN |
| 114 | + |
| 115 | +Currently managament interface VLAN config on host is not been retained in `xensource-inventory` or `management.conf` file. |
| 116 | +We need to retain the vlanID under config files. |
| 117 | + |
| 118 | +Steps to be followed: |
| 119 | + |
| 120 | +1. Under call `Pool.eject` we need to update `write_first_boot_management_interface_configuration_file` function. |
| 121 | +2. Check if management_interface is on VLAN then get the VLANID from the pif. |
| 122 | +3. Update the VLANID into the `managament.conf` file and the `bridge` into `xensource-inventory` file. |
| 123 | + In order to be retained by XCP-Networkd on startup after the host is ejected. |
| 124 | + |
| 125 | +New API for Pool Management Reconfigure |
| 126 | +--------------------------------------- |
| 127 | + |
| 128 | +### Current behaviour to change the Management Interface on Host |
| 129 | + |
| 130 | +Currently call `Host.management_reconfigure` with VLAN pif-uuid can change the management_interface on specified VLAN. |
| 131 | + |
| 132 | +Steps performed during management_reconfigure: |
| 133 | + |
| 134 | +1. `bring_pif_up` get called for the pif. |
| 135 | +2. `xensource-inventory` get updated with the latest info of interface. |
| 136 | +3 `update-mh-info` updates the management_mac into xenstore. |
| 137 | +4. Http server gets restarted, even though xapi listen on all IP addresses, This new interface as `_the_ management` interface is used by slaves to connect to pool master. |
| 138 | +5. `on_dom0_networking_change` refreshes console URIs for the new IP address. |
| 139 | +6. Xapi db is updated with new management interface info. |
| 140 | + |
| 141 | +### Management Reconfigure on Pool from Physical Network to VLAN Network or from VLAN Network to Other VLAN Network or from VLAN Network to Physical Network |
| 142 | + |
| 143 | +We need to make sure that new network which is going to be a management interface has PIFs configured on each Host. |
| 144 | +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. |
| 145 | +We would assume that VLAN is available on the switch/network. |
| 146 | + |
| 147 | +Steps to be performed before calling new API: |
| 148 | + |
| 149 | +1. Create a vlan network on pool via `network.create`, In case of pyhsical NICs network must be present. |
| 150 | +2. Create a vlan pif on each host via `VLAN.create` using above network ref, physical PIF ref and vlanID, Not needed in case of pyhsical network. |
| 151 | +3. Plug the vlan pif on each host via `PIF.plug` using above vlan pif. This might be needed in case pyhsical network. |
| 152 | +4. Perform `PIF.reconfigure_ip` for each new Network PIF on each Host. |
| 153 | + |
| 154 | +User can individually change management interface on each host calling `Host.management_reconfigure` using pifs on physical devices or vlan pifs. |
| 155 | +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`. |
| 156 | + |
| 157 | +### API Details |
| 158 | + |
| 159 | +- `Pool.management_reconfigure` |
| 160 | + - Parameter: network reference `network`. |
| 161 | + - Calling this function configures `management_interface` on each host of a pool. |
| 162 | + - For the `network` provided it will check pifs are attached on each Host, |
| 163 | + In case of VLAN network it will check vlan pifs on provided network are attached on each Host of Pool. |
| 164 | + - Check IP is configured on pif attached to each Host. |
| 165 | + - If PIFs are not attached or IP is not configured on PIFs this call must fail gracefully, Asking user to configure them. |
| 166 | + - Call `Host.management_reconfigure` on each slave then lastly on master. |
| 167 | + - Call `pool.recover_slaves` on master inorder to recover slaves which might have lost the connection to master. |
| 168 | + |
| 169 | +CP-Tickets |
| 170 | +---------- |
| 171 | + |
| 172 | +1. CP-14027 |
| 173 | +2. CP-14028 |
| 174 | +3. CP-14029 |
| 175 | +4. CP-14030 |
| 176 | +5. CP-14031 |
| 177 | +6. CP-14032 |
| 178 | +7. CP-14033 |
0 commit comments