From edd0ff7f460776eb7be22f5d693597f03b01c39e Mon Sep 17 00:00:00 2001 From: Nguyen Van Trung Date: Wed, 25 Jul 2018 10:22:28 +0700 Subject: [PATCH] Update docs to portgroup with creating windows images This change will add how to create windows images article in portgroup docs. these images will support to create port bounding through ironic services. This feature has tested on Fujitsu servers successfully. Change-Id: I1ce941a16f080fce1699d8629a7e12a2c2d83ade --- doc/source/admin/building-windows-images.rst | 91 ++++++++++++++++++++ doc/source/admin/index.rst | 1 + doc/source/admin/portgroups.rst | 15 ++++ tools/link_aggregation_on_windows.ps1 | 40 +++++++++ 4 files changed, 147 insertions(+) create mode 100644 doc/source/admin/building-windows-images.rst create mode 100644 tools/link_aggregation_on_windows.ps1 diff --git a/doc/source/admin/building-windows-images.rst b/doc/source/admin/building-windows-images.rst new file mode 100644 index 0000000000..2e68afd945 --- /dev/null +++ b/doc/source/admin/building-windows-images.rst @@ -0,0 +1,91 @@ +.. _building_image_windows: + +Building images for Windows +--------------------------- +We can use ``New-WindowsOnlineImage`` in `windows-openstack-imaging-tools`_ +tool as an option to create Windows images (whole disk images) corresponding +boot modes which will support for Windows NIC Teaming. And allow the +utilization of link aggregation when the instance is spawned on hardware +servers (Bare metals). + +Requirements: +~~~~~~~~~~~~~ + +* A Microsoft Windows Server Operating System along with + ``Hyper-V virtualization`` enabled, + ``PowerShell`` version >=4 supported, + ``Windows Assessment and Deployment Kit``, + in short ``Windows ADK``. +* The windows Server compatible drivers. +* Working git environment. + +Preparation: +~~~~~~~~~~~~ + +* Download a Windows Server 2012R2/ 2016 installation ISO. +* Install Windows Server 2012R2/ 2016 OS on workstation PC along with + following feature: + + - Enable Hyper-V virtualization. + - Install PowerShell 4.0. + - Install Git environment & import git proxy (if have). + - Create new ``Path`` in Microsoft Windows Server Operating System which + support for submodule update via ``git submodule update –init`` command:: + + - Variable name: Path + - Variable value: C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\bin + + - Rename virtual switch name in Windows Server 2012R2/ 2016 in + ``Virtual Switch Manager`` into `external`. + +Implementation: +~~~~~~~~~~~~~~~ + +* ``Step 1``: Create folders: ``C:\`` where output images will + be located, ``C:\`` where you need to place the necessary + hardware drivers. + +* ``Step 2``: Copy and extract necessary hardware drivers in + ``C:\``. + +* ``Step 3``: Insert or burn Windows Server 2016 ISO to ``D:\``. + +* ``Step 4``: Download ``windows-openstack-imaging-tools`` tools. + + .. code-block:: console + + git clone https://github.com/cloudbase/windows-openstack-imaging-tools.git + +* ``Step 5``: Create & running script `create-windows-cloud-image.ps1`: + + .. code-block:: console + + git submodule update --init + Import-Module WinImageBuilder.psm1 + $windowsImagePath = "C:\\.qcow2" + $VirtIOISOPath = "C:\\virtio.iso" + $virtIODownloadLink = "https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/archive-virtio/virtio-win-0.1.133-2/virtio-win.iso" + (New-Object System.Net.WebClient).DownloadFile($virtIODownloadLink, $VirtIOISOPath) + $wimFilePath = "D:\sources\install.wim" + $extraDriversPath = "C:\\" + $image = (Get-WimFileImagesInfo -WimFilePath $wimFilePath)[1] + $switchName = 'external' + New-WindowsOnlineImage -WimFilePath $wimFilePath + -ImageName $image.ImageName ` -WindowsImagePath $windowsImagePath -Type 'KVM' -ExtraFeatures @() ` + -SizeBytes 20GB -CpuCores 2 -Memory 2GB -SwitchName $switchName ` -ProductKey $productKey -DiskLayout 'BIOS' ` + -ExtraDriversPath $extraDriversPath ` -InstallUpdates:$false -AdministratorPassword 'Pa$$w0rd' ` + -PurgeUpdates:$true -DisableSwap:$true + + After executing this command you will get two output files, first one being + "C:\\.qcow2", which is the resulting windows + whole disk image and "C:\\virtio.iso", which is virtio iso + contains all the synthetic drivers for the KVM hypervisor. + + See `example_windows_images`_ for more details and examples. + + .. note:: + + We can change ``SizeBytes``, ``CpuCores`` and ``Memory`` depending on requirements. + +.. _`example_windows_images`: https://github.com/cloudbase/windows-openstack-imaging-tools/blob/master/Examples +.. _`windows-openstack-imaging-tools`: https://github.com/cloudbase/windows-openstack-imaging-tools diff --git a/doc/source/admin/index.rst b/doc/source/admin/index.rst index 8bb4720c86..c26a05d2a2 100644 --- a/doc/source/admin/index.rst +++ b/doc/source/admin/index.rst @@ -28,6 +28,7 @@ the services. Conductor Groups Upgrade Guide Security + Windows Images Troubleshooting FAQ Dashboard Integration diff --git a/doc/source/admin/portgroups.rst b/doc/source/admin/portgroups.rst index e2a4f02cbe..dc35f7dee7 100644 --- a/doc/source/admin/portgroups.rst +++ b/doc/source/admin/portgroups.rst @@ -117,3 +117,18 @@ group, in no particular order. It starts with 0 and increments by 1 for every configured port group. .. _`kernel documentation on bonding`: https://www.kernel.org/doc/Documentation/networking/bonding.txt + +Link aggregation/teaming on windows +----------------------------------- + +Portgroups are supported for Windows Server images, which can created by +:ref:`building_image_windows` instruction. + +You can customise an instance after it is launched along with +`script file <../../../../tools/link_aggregation_on_windows.ps1>`_ in +``Configuration`` of ``Instance`` and selected ``Configuration Drive`` option. +Then ironic virt driver will generate network metadata and add all the +additional information, such as bond mode, transmit hash policy, +MII link monitoring interval, and of which links the bond consists. +The information in InstanceMetadata will be used afterwards to generate +the config drive. diff --git a/tools/link_aggregation_on_windows.ps1 b/tools/link_aggregation_on_windows.ps1 new file mode 100644 index 0000000000..346493d8d6 --- /dev/null +++ b/tools/link_aggregation_on_windows.ps1 @@ -0,0 +1,40 @@ +#ps1_sysnative + +# Copyright 2018 FUJITSU LIMITED +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +# Load network_data.json +$dir_data_config_file = (Get-ChildItem -Path ($PSCommandPath | Split-Path -Parent) -Filter 'network_data.json' -File -Recurse).fullname +$network_data = Get-Content -Raw -Path $dir_data_config_file | ConvertFrom-Json + +# Create NIC Teaming base on netwok_data.json +$MAC_MASTER='' +foreach ($nic in $network_data.links) +{ + if ($nic.type -like 'bond') + { + $nic_master=Get-NetAdapter | where MacAddress -eq $nic.ethernet_mac_address.Replace(':','-').ToUpper() + $MAC_MASTER = $nic.ethernet_mac_address.Replace(':','-').ToUpper() + New-NetLbfoTeam -Name 'openstack' -TeamMembers $nic_master.Name -TeamingMode SwitchIndependent -LoadBalancingAlgorithm MacAddresses -Confirm:$false + } + if ($nic.type -like 'phy') + { + $MAC_MEMBER = $nic.ethernet_mac_address.Replace(':','-').ToUpper() + if($MAC_MEMBER -notlike $MAC_MASTER) + { + $nic_member=Get-NetAdapter | where MacAddress -eq $MAC_MEMBER + Add-NetLbfoTeamMember -Name $nic_member.Name -Team 'openstack' -Confirm:$false + } + } +}