OpenStack Virtualization Technology and image creation

Source: Internet
Author: User
Tags virtual environment

Introduction of Virtualization Technology


Application
function library
Operating system
Hardware

Hierarchical structure of computer systems


Now the computer system is a huge whole, the whole system is very complex, so the computer system is divided from bottom to layer, each level is like the previous level to render an abstraction, and each layer only need to know the underlying abstract interface, and do not need to understand its internal mechanism. Virtualization technology is the lower-level software module, according to the requirements of the upper software module, abstract a virtual software or hardware interface, so that the previous layer of software can be run in line with the desired operating environment exactly the same virtual environment.


Virtualization can occur at all levels of the table above, but for cloud services like OpenStack, it is more about virtualization on top of the hardware abstraction layer. Because only the physical computer system is virtualized into multiple virtual computer systems, through the network to connect these virtual computer systems, in order to form a modern sense of service cloud computing system. Virtualization above the hardware abstraction layer refers to virtual machines implemented through the virtual hardware abstraction layer, rendering the client operating system the same or similar hardware abstraction layer as the physical hardware. Because the client operating system Sony sees only the hardware abstraction layer, so the behavior of the customer operating system and its physical platform is no different.


Application Application Application
function library function library function library
Operating System 1 Operating System 2 Operating System 3
Virtualization Layer
Hardware

Join the virtualization layer


virtualization of the hardware abstraction layer, also known as System virtualization, refers to the virtualization of a physical computer system into one or more virtual computer systems, each of which has its own virtual hardware, such as CPUs, memory, and devices, and provides a separate virtual machine execution environment. By simulating the virtual monitor, also known as hypervisor, the operating system in the virtual machine thinks that it is still exclusive of a system running. The operating systems in each virtual machine running on a single physical machine can be completely different, and their execution environment is completely independent. KVM and Xen are two kinds of hypervisor. Since OpenStack uses KVM primarily as a virtualization technology, it only introduces KVM.


Kernel-based VMS (kernel-based virtual machine) require two conditions: hardware supports full virtualization and the operating system is Linux. KVM is a hardware virtualization technology based on Intel VT, which focuses on virtual machine scheduling, memory management, and uses QEMU to provide device virtualization.


In a data center, it is possible to use different hypervisor, it may not be easy to manage, Libvirt is a unified management tool to manage a variety of hypervisor, and to provide a unified API to support upper-level applications. Libvirt is a software collection that contains: 1. A library file to implement the management interface; 2. A daemon (LIBVIRTD); 3. A command-line tool (Virsh).



Second, image production, in order to create CENTOS7 image as an example

1. First, you need an image file to install the operating system, in the format ISO, followed by the creation of a virtual disk:

Qemu-img create-f qcow2-o size=5g centos7.qcow2


2. Writing XML file, vim Centos7.xml sample See attachment


3. Install the operating system

Virsh Define Centos7.xml

Virsh Start Centos7

Virsh Vncdisplay generates a port number, which is used by the physical machine to install the operating system using the graphical interface


6. After installation, you need to modify the startup mode

Virsh Destroy Centos7

Virsh undefine Centos7

Modify the XML file boot line, change from CDROM to HD

Virsh Define Centos7.xml

Virsh Start Centos7


Complete!




Examples of XML files:

<domain type= ' KVM ' >       

<name> CentOS 7 </name> image name, modifying

<memory unit= ' GiB ' >8</memory> memory capacity, modify as needed

<vcpu placement= ' static ' >4</vcpu> Number of CPUs, modify as needed

<os> Defining the system

<type arch= ' x86_64 ' machine= ' rhel6.5.0 ' >hvm</type> system architecture and type of machine used

<boot dev= ' CDROM '/> boot mode, set cdrom from ISO file

</os>

<features> Defining hardware feature information  

<acpi/> Advanced Configuration and Power Interface

<apic/> Advanced Programmable Interrupt Controller

<pae/> Physical Address Extension

</features>

<clock offset= ' UTC '/> clock, using UTC time

<on_poweroff>destroy</on_poweroff> define emergency handling and use destroy to shut down the machine

<on_reboot>restart</on_reboot>

<on_crash>restart</on_crash>

<devices> Defining Virtual Peripherals

<emulator>/usr/libexec/qemu-kvm</emulator> define Hypervisor, this is KVM

<disk type= ' file ' device= ' cdrom ' > Specify a virtual disc

<driver name= ' qemu ' type= ' raw '/> the ISO format belongs to a raw format

<source file= '/home/iso/ubuntu-14.04.3-server-amd64.iso '/>

<target dev= ' hdc ' bus= ' IDE '/>

<readonly/>

<address type= ' drive ' controller= ' 0 ' bus= ' 1 ' target= ' 0 ' unit= ' 0 '/>

</disk> Defining Disks

<disk type= ' file ' device= ' disk ' >

<driver name= ' qemu ' type= ' raw ' cache= ' None '/>

<source file= '/home/ CentOS . img '/> if the created disk is in qcow2 format, Change the type to qcow2

<target dev= ' Vda ' bus= ' Virtio '/>

</disk>

<controller type= ' usb ' index= ' 0 ' >

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x01 ' function= ' 0x2 '/>

</controller>

<controller type= ' IDE ' index= ' 0 ' >

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x01 ' function= ' 0x1 '/>

</controller>

<interface type= ' bridge ' > Configuring Bridging Networks

<mac address= ' 52:54:0 0 : c0:6f:ed '/>  

<source bridge= ' br0 '/>

<model type= ' Virtio '/>

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x03 ' function= ' 0x0 '/>

</interface>

<serial type= ' pty ' >

<target port= ' 0 '/>

</serial>

<console type= ' pty ' >

<target type= ' serial ' port= ' 0 '/>

</console>

<input type= ' mouse ' bus= ' ps2 '/>

<graphics type= ' vnc ' port= ' 5900 ' autoport= ' yes ' listen= ' 0.0.0.0 ' >

<listen type= ' address ' address= ' 0.0.0.0 '/>

</graphics>

<sound model= ' Ich6 ' >

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x04 ' function= ' 0x0 '/>

</sound>

<video>

<model type= ' Cirrus ' vram= ' 9216 ' heads= ' 1 '/>

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x02 ' function= ' 0x0 '/>

</video>

<memballoon model= ' Virtio ' >

<address type= ' PCI ' domain= ' 0x0000 ' bus= ' 0x00 ' slot= ' 0x06 ' function= ' 0x0 '/>

</memballoon>

</devices>

</domain>











This article is from the "11079353" blog, please be sure to keep this source http://11089353.blog.51cto.com/11079353/1751797

OpenStack Virtualization Technology and image creation

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.