First, hardware and software preparation
1, the physical machine one: requires support for hardware virtualization, the CENTOS7 installed on the physical machine
2, Windows7 ISO, can use any official image, here take windows7-x86 as an example.
3. Download Virtio Driver
Because win does not support Virtio drivers by default, managing virtual machines via OpenStack requires virtio drivers. Need two Virtio drive, one is the hard disk, one is the network card.
Note: The virtual machine is required for memory monitoring, so in the template production process need to install Virtio-balloon driver
One:
Https://fedoraproject.org/wiki/Windows_Virtio_Drivers#Direct_download
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/9E/63/wKioL1mRWQrynoI6AAEjo7bohOY477.png "title=" 106124905030.png "alt=" Wkiol1mrwqrynoi6aaejo7bohoy477.png "/>
Two:
http://pan.baidu.com/share/link?shareid=3434663063&uk=3372669665&fid=835080568834768
The ISO file is downloaded and the VfD file can be obtained after decompression
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9E/63/wKioL1mRWSnBqcwKAAAkrvoC6iQ040.png "title=" Clipboard.png "alt=" Wkiol1mrwsnbqcwkaaakrvoc6iq040.png "/>
VfD files that can respond to the selection of Windows systems
Second, the Environment preparation
1. Check if the system supports KVM
# egrep "(VMX|SVM)"/proc/cpuinfo
Supports normal echo:
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/63/wKioL1mRWT2wKQ9sAACRxbpHdfU137.png "title=" 106125104124.png "alt=" Wkiol1mrwt2wkq9saacrxbphdfu137.png "/>
2. Install the Package
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9E/63/wKioL1mRWXewmfTOAACHZlietqQ593.png "title=". png " alt= "Wkiol1mrwxewmftoaachzlietqq593.png"/>
# yum Clean All
installing the underlying dependency package
# yum Install QEMU-KVM qemu-img–y
1. Copy the image file to local, mount the local ISO file
# mount-o Loop-t iso9660/root/centos-7.1-x86_64-dvd-1503-01.iso/media
2. Modify Yum file to build local Yum source
# cd/etc/yum.repos.d/
# VI Os.repo
Write
[OS]
Name=os
Baseurl=file:///media
enabled=1
gpgcheck=0
Note: The name of the repo file must be the same as the session in the content
3. Install the underlying dependency package
# Yum Clean All
# yum Install QEMU-KVM qemu-img–y
3. Create a link
# ln-s/usr/libexec/qemu-kvm/usr/bin/kvm# ln-s/usr/bin/qemu-img/usr/bin/kvm-img
Third, image production
1. Create the Mirror directory, only the Windows ISO and Virito files are copied to the directory
# mkdir Image
# CD image/
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9E/63/wKioL1mRWbqiJW6-AAAeJZQhFig385.png "title=" 1.png "alt=" Wkiol1mrwbqijw6-aaaejzqhfig385.png "/>
2, make Disk file (. qcow2), disk size according to system requirements set
# qemu-img create-f qcow2 win7.qcow2 20G
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9E/63/wKioL1mRWcSjgs_ZAAARphkoEwk270.png "title=" 2.png "alt=" Wkiol1mrwcsjgs_zaaarphkoewk270.png "/>
3, to the storage image and disk files directory to empower, or create the cloud host when the disk file cannot be opened
# Chown-r qemu:qemu/root/image/
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9E/75/wKiom1mRWdCyBoflAAAe83Svxqo809.png "title=" 3.png "alt=" Wkiom1mrwdcyboflaaae83svxqo809.png "/>
4. Start the Windows7-based KVM virtual machine and map the drive to the VfD floppy disk
# kvm -name win-lh -m 2048 - cdrom /root/image/cn_windows_7_ultimate_with_sp1_x86_dvd_u_677486.iso -drive file=/root/image/virtio-win-0.1.102.iso,media= cdrom,index=1 -drive file=win7.qcow2,media=disk,index=1,if=virtio,format=qcow2 -fda /root/image/virtio-win-0.1.102_x86.vfd -boot order=dc,once=d -net nic,model=virtio -net user -boot c -balloon virtio -display vnc=:3
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9E/64/wKioL1mRWeuxH_3EAAA0GjFsIJ8714.png "title=" 4.png "alt=" Wkiol1mrweuxh_3eaaa0gjfsij8714.png "/>
Option Explanation:
-FDA File use file as the floppy image. We can also use the host floppy by using/DEV/FD0 as the file name.
-cdrom File using a file as a CD-ROM image (IDE disc mirroring)
-boot [A|c|d] by floppy disk (a), hard drive (c) or CD-ROM (d). By default, the hard drive starts
-net Nic[,vlan=n][,macaddr=addr] create a new NIC and with VLAN n
-net User[,vlan=n] Use the user-mode network stack so that no administrator privileges are required to run. If the-net option is not specified, this will be the default condition
-balloon Virtio using Virtio balloon
5. Install with VNC client
Enter 10.10.199.11:3 address and port to see the boot interface
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M01/9E/64/wKioL1mRWjbj9XLKAABjHXHLhuw765.png "title=" 5.png "alt=" Wkiol1mrwjbj9xlkaabjhxhlhuw765.png "/>
6. Install the Windows system and install the relevant drivers
Choosing a Custom Installation
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9E/75/wKiom1mRWk7zrb8uAAnqrlj4HsI569.png "title=" 6.png "alt=" Wkiom1mrwk7zrb8uaanqrlj4hsi569.png "/>650) this.width=650; src=" https://s1.51cto.com/wyfs02/M02/9E/64/ Wkiol1mrwnlyt1veaad82-c2-xi821.png "title=" 7.png "alt=" Wkiol1mrwnlyt1veaad82-c2-xi821.png "/>
Hardware is not recognized by default, click Load Driver
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9E/64/wKioL1mRWo_hL1G3AAVFVAlIwEY925.png "title=" 8.png "alt=" Wkiol1mrwo_hl1g3aavfvaliwey925.png "/>
Click to browse
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/9E/75/wKiom1mRWp6BghnlAACInAjNMJE608.png "title=" 9.png "alt=" Wkiom1mrwp6bghnlaacinajnmje608.png "/>
Select disk drive from floppy disk
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9E/75/wKiom1mRWrmQmneBAAU__05INk8066.png "title=" 10. PNG "alt=" Wkiom1mrwrmqmnebaau__05ink8066.png "/>
Select the appropriate version of Windows
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9E/64/wKioL1mRWtCwPCgQAAWZZj-GgFk540.png "title=" 11. PNG "alt=" Wkiol1mrwtcwpcgqaawzzj-ggfk540.png "/>
Select disk drive for installation, the NIC driver needs to be updated after installation is complete
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9E/75/wKiom1mRWvXxm2r6AAVJqC-_v-k657.png "title=" 12. PNG "alt=" Wkiom1mrwvxxm2r6aavjqc-_v-k657.png "/>
Select disk drive to install properly
Setup is complete, log in with the user name password set
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M00/9E/75/wKiom1mRWw6TBX2kAAeGk60LrNc850.png "title=" 13. PNG "alt=" Wkiom1mrww6tbx2kaaegk60lrnc850.png "/>
Open Device Manager to see the disk drive is correct
Two drivers in other devices require an update installation
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9E/64/wKioL1mRXNTxZhArAAFGae4fqn8366.png "title=" 1.png "alt=" Wkiol1mrxntxzharaafgae4fqn8366.png "/>
go to Device Manager-system devices, install Ethernet controller, select a device on your computer, select the appropriate version of Windows on the CD
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/9E/75/wKiom1mRXOPwl8mfAADvXgEHOzU371.png "title=" 2.png "alt=" Wkiom1mrxopwl8mfaadvxgehozu371.png "/>
Go to "Device Manager"-"System device", install "PCI device" as "Virtio Balloon Driver"
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M02/9E/75/wKiom1mRXPniovPGAADuEtzfRJI945.png "title=" 3.png "alt=" Wkiom1mrxpniovpgaaduetzfrji945.png "/>
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M00/9E/64/wKioL1mRXQqh29PvAAEdXTW05H4285.png "title=" 4.png "alt=" Wkiol1mrxqqh29pvaaedxtw05h4285.png "/>
Virtio-balloon driver after installation Balloon service is not installed and requires manual installation:
Copy blnsvr.exe files from the Win7/x86 directory in the Virtio-win CD-ROM drive to "c:/" (any directory on the system disk)
Use the cmd command line as an administrator to enter the above directory
Perform "blnsvr.exe-i" to install the BLNSVR service
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M02/9E/75/wKiom1mRXUOR2j3kAADAHpJPeDw611.png "title=" 5.png "alt=" Wkiom1mrxuor2j3kaadahpjpedw611.png "/>
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M00/9E/64/wKioL1mRXVyyAiGvAAD5uYgJG44770.png "title=" 6.png "alt=" Wkiol1mrxvyyaigvaad5uygjg44770.png "/>
At this point, the balloon service is up and running and self-booting
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M00/9E/75/wKiom1mRXWuyD-v9AAEXpLVV6XM454.png "title=" 7.png "alt=" Wkiom1mrxwuyd-v9aaexplvv6xm454.png "/>
Shutting down the firewall
650) this.width=650; "src=" Https://s2.51cto.com/wyfs02/M01/9E/64/wKioL1mRXYbBzb_eAADEFL_yvHU318.png "style=" float : none; "title=" 8.png "alt=" Wkiol1mrxybbzb_eaadefl_yvhu318.png "/>
Turn on remote connections
650) this.width=650; "src=" Https://s5.51cto.com/wyfs02/M02/9E/64/wKioL1mRXYeDOl4CAADu3TeQTAM835.png "title=" 9.png "Style=" Float:none; "alt=" Wkiol1mrxyedol4caadu3teqtam835.png "/>
Normal shutdown Save Settings
7. View the disk file format and convert it to format
# qemu-img Info Win7.qcow2
# qemu-img convert-f qcow2-o qcow2 win7.qcow2 window7.qcow2
8.glance Uploading OpenStack and verifying
This article from "Royals-blog" blog, declined reprint!
Make an OpenStack Windows Mirroring template (official image)