This is the 2nd chapter in the OpenStack implementation experience sharing series.
OpenStack deploys instance through Glance mirroring, the previous section introduces the Linux image authoring method, Windows mirroring is very different from Linux, and today we take windows2008 as an example to discuss it in detail.
The image production steps are as follows:
1. Create and run the windows2008 KVM virtual machine
2. Installing the Virtio Drive
3. Installing Cloudbase-init
4. Other Custom work
5. Create a Glance image
6. Deploying new instance through mirroring
1. Create and run the Windows2008 KVM virtual machine
If there is a virt-manager, this step can be done in the graphical interface. Considering that not all cases have virt-manager, we are here to operate directly on the KVM host. The following steps are used to create a windows2008 virtual machine.
First create a 20G virtual disk as the Startup disk for the virtual machine:
Qemu-img create-f Qcow2/var/lib/libvirt/images/win2008r2sp1.qcow2 20G
Copy Virtual machine template
CP Template.xml Win2008r2sp1.xml
Template.xml How does this template come from? In fact, it is simple to dump the XML definition of an existing KVM virtual machine directly. Like what:
Virsh dumpxml [Vm-id] > Template.xml
Modify the following items in the Win2008r2sp1.xml:
Virtual machine Name
Virtual disks (previously created via QEMU-IMG) and boot ISO
Create a virtual machine
Virsh Define Win2008r2sp1.xml
Start a virtual machine
Virsh Start WIN2008R2SP1
Connecting virtual machines via VNC
Here 172.17.12.11 is the host IP, the port number is 2 (can be queried through Virsh vncdisplay). After the connection is successful, the virtual machine installation interface is displayed
The process of installing the operating system through the wizard is no longer mentioned. If the virtual machine does not restart automatically during the installation process, you can start the virtual machine with the following command
Virsh Start WIN2008R2SP1
After the installation is successful, set the IP address
2. Installing the Virtio drive
OpenStack uses Virtio disks and network cards by default, and Virtio performs well. Because Windows does not have its own Virtio driver, manual installation is required, as follows:
Add a virtio type of disk.
Virsh Edit Win2008r2sp1
Modify the current NIC device to Virtio.
Restart the operating system and install the Virtio driver.
Virtio driver for Https://fedorapeople.org/groups/virt/virtio-win/direct-downloads/stable-virtio/virtio-win.iso.
3. Installing Cloudbase-init
Cloudbase-init enables the instance of a Windows mirroring deployment to automatically configure personalization information such as IP addresses. As with the Linux Cloud-init, the following illustrates the Cloudbase-init configuration method.
Download Cloudbase-init
https://cloudbase.it/cloudbase-init/#download
Installing Cloudbase-init in a virtual machine
Cloudbase-init Installer can be uploaded via Remote Desktop and installed
The system will shut down automatically.
4. Other Custom work
Restart the virtual machine to complete other customizations, such as installing some common software as needed. Now that the Windows image file is ready, the file path is
/var/lib/libvirt/images/win2008r2sp1.qcow2
5. Create a Glance image
The image creation method is the same as the previous Linux image
glance image-create--name "Windows R2 SP1"--file/var/lib/libvirt/images/win2008r2sp1.qcow2--disk-format Qcow2--container-format bare--is-public true--progress
6. Deploying new instance through mirroring
Click the "Start Cloud Host" button on the back of the image.
Give instance a name and click "Run", instance create successfully and assign to IP.
Click Instance Name.
Open the console.
In the VNC console you can see that the instance starts normally.
Click Administrator User
The first login requires a password change.
The above is the operation of customizing OpenStack Windows mirroring, and the next section discusses some of the experience and techniques used in mirroring.
Make OpenStack Windows mirroring-5 minutes a day to play with OpenStack (152)