Opennebula in-depth analysis

Source: Internet
Author: User

-------------------
Opennebula in-depth analysis
-------------------

# Capacity list

Attribute description
If the name is empty, the default name is one-<vid>.
Memory is measured in MB and is the memory size allocated to the VM Ram.
CPU percentage of CPU divided by 100 required for the Virtual Machine. Half a processor is written 0.5.
Vcpu Number of virtual CPUs. This value is optional, the default hypervisor behavior is used, usually one virtual CPU

# Image type
Opennebula has three types of images. You can use oneimage chtype to change the image type.
OS: this image contains a complete OS. Each virtual template must contain an OS-type image as the root disk.
CDROM: this image contains read-only data.
Datablock: this image is used as the storage of data and can be accessed and modified by different VMS.

When the image is in the error status, enable the image again to the ready status.


# An error is returned when a VM is created after the image is added to the context file.
========================================================== ========================================================== ========
Thu Aug 7 22:17:06 2014 [dim] [I]: New VM state is active.
Thu Aug 7 22:17:06 2014 [LCM] [I]: New VM state is Prolog.
Thu Aug 7 22:17:07 2014 [LCM] [I]: New VM state is boot
Thu Aug 7 22:17:07 2014 [vmm] [I]: generating deployment file:/var/lib/One/opennebula/var/VMS/213/deployment.0
Thu Aug 7 22:17:07 2014 [vmm] [I]: exitcode: 0
Thu Aug 7 22:17:07 2014 [vmm] [I]: successfully execute Network Driver Operation: pre.
Thu Aug 7 22:17:09 2014 [vmm] [I]: Command Execution fail: cat <EOT |/var/tmp/One/vmm/xen4/deploy '/var/lib/One/opennebula/var/datastores/0/213/deployment.0 ''' 192. 168.70.70 '213 192.168.70.70
Thu Aug 7 22:17:09 2014 [vmm] [I]: Error: block device type "Raw" is invalid.
Thu Aug 7 22:17:09 2014 [vmm] [e]: unable
Thu Aug 7 22:17:09 2014 [vmm] [I]: exitcode: 1
Thu Aug 7 22:17:09 2014 [vmm] [I]: failed to execute virtualization driver operation: deploy.
Thu Aug 7 22:17:09 2014 [vmm] [e]: Error deploying Virtual Machine: unable
Thu Aug 7 22:17:09 2014 [dim] [I]: New VM state is failed
========================================================== ========================================================== ==========

# VNC logs
========================================================== ========================================================== ==========
378: 192.168.21.52: Plain non-SSL (WS: //) websocket connection
378: 192.168.21.52: Version hybi-13, base64: 'false'
378: 192.168.21.52: Path :'/? Token = 2cga46s9piy1cde4qggj'
378: connecting to: 192.168.70.70: 6105
385: Handler exception: (9, 'Bad file descriptor ')
379: 192.168.21.52: Plain non-SSL (WS: //) websocket connection
379: 192.168.21.52: Version hybi-13, base64: 'false'
379: 192.168.21.52: Path :'/? Token = gokz7mftkedb0x09l084'
379: connecting to: 192.168.70.70: 6104
373: 192.168.21.52: Plain non-SSL (WS: //) websocket connection
373: 192.168.21.52: Version hybi-13, base64: 'false'
373: 192.168.21.52: Path :'/? Token = 30qt4r6tmg0ldklbzslf'
373: connecting to: 192.168.70.70: 6105
========================================================== ========================================================== ============

# Opennebula Context
> On The IAAs platform, after a user creates a virtual machine, the user must initialize the virtual machine according to the user-defined information, such as the host name, user name/password, IP address, and MAC address, in addition, users may want to automatically configure some services after the virtual machine is started, such as SSH logon. All these virtual machine customization is completed in opennebula through a file called context ISO.

> 1. principles and functions of context ISO
Opennebula makes all user-defined virtual machine information into an ISO file, and then mounts the ISO file to the VM's optical drive when the virtual machine is started, then execute the corresponding scripts in the optical drive to complete VM customization. The whole process is very similar to VMware's vmware-tools.

> 2. Context ISO Generation Process
The context ISO generated by opennebula is implemented by the/opennebula-4.6.0/src/tm_mad/common/context script. The content of this script is analyzed in detail below.

# MD5 code
> The MD in MD5 indicates message digest, which means the information digest. However, this information digest is not the abbreviation of the information content, instead, a 128-bit signature is obtained after the original information is mathematical transformed based on the public MD5 algorithm.

# Alpine Linux
Http://alpinelinux.org/
# Radvd
Http://www.litech.org/radvd/

# How can I enable the opennebula Virtual Machine to automatically obtain network configuration information such as IP addresses?
> After creating an opennebula Ubuntu virtual machine image, you need to configure the image to adapt to the network running environment. Because our opennebula virtual machine uses a bridge, therefore, after the VM is started, it will use the existing network and attempt to obtain the IP address from the DHCP server, if the DHCP server is not bound, the obtained IP address does not meet the requirements defined in small_network.net (onevnet create small_network.net, we hope that the virtual machine can obtain the corresponding IP address from the network configuration file small_network.net after it is started. The contextualizing section in opennebula is used to deal with this situation. However, vpsee introduces a simpler method of laziness: simply use a STARTUP script. Opennebula has prepared similar scripts for us. You only need to adjust the scripts according to your requirements. Here we will introduce the scripts for Ubuntu and for centos, there are also for Debian and opensuse.

> Ubuntu Virtual Machine
Download the for Ubuntu context file and place it in the appropriate place. This script is a bit problematic and needs to be downloaded in the vmcontext. the sh file is appended with the restart Network (/etc/init. d/networking restart) This line:

$ Wget http://dev.opennebula.org/attachments/download/378/vmcontext.sh
$ Sudo-I
# Mv vmcontext. sh/etc/init. d/vmcontext
# Chmod + x/etc/init. d/vmcontext
# Ln-SF/etc/init. d/vmcontext/etc/rc2.d/s01vmcontext
# Echo "/etc/init. d/networking restart">/etc/init. d/vmcontext
Centos Virtual Machine
Download the context file for centos and place it in the appropriate place:
# Wget http://dev.opennebula.org/projects/opennebula/repository/revisions/master/raw/share/scripts/centos-5/net-vmcontext/vmcontext
# Mv vmcontext. sh/etc/init. d/vmcontext
# Chmod + x/etc/init. d/vmcontext
# Chkconfig -- add vmcontext
# Reboot
Do you still remember the question of adding swap partitions to the opennebula virtual machine last time? Simply put the swap activation part in vmcontext, you don't have to add more swap after creating the virtual machine every time.


# Configure driver error logs in template Context
========================================================== ========================================================== ==========
Fri Aug 8 01:39:46 2014 [dim] [I]: New VM state is active.
Fri Aug 8 01:39:46 2014 [LCM] [I]: New VM state is Prolog.
Fri Aug 8 01:39:47 2014 [LCM] [I]: New VM state is boot
Fri Aug 8 01:39:47 2014 [vmm] [I]: generating deployment file:/var/lib/One/opennebula/var/VMS/224/deployment.0
Fri Aug 8 01:39:47 2014 [vmm] [I]: exitcode: 0
Fri Aug 8 01:39:47 2014 [vmm] [I]: successfully execute Network Driver Operation: pre.
Fri Aug 8 01:39:49 2014 [vmm] [I]: Command Execution fail: cat <EOT |/var/tmp/One/vmm/xen4/deploy '/var/lib/One/opennebula/var // datastores/0/224/deployment.0 ''' 192. 168.70.70 '224 192.168.70.70
Fri Aug 8 01:39:49 2014 [vmm] [I]: Error: Device 51728 (vbd) cocould not be connected. /var/lib/One/opennebula/var // datastores/0/224/disk.2 is not a block device.
Fri Aug 8 01:39:49 2014 [vmm] [e]: unable
Fri Aug 8 01:39:49 2014 [vmm] [I]: exitcode: 1
Fri Aug 8 01:39:49 2014 [vmm] [I]: failed to execute virtualization driver operation: deploy.
Fri Aug 8 01:39:49 2014 [vmm] [e]: Error deploying Virtual Machine: unable
Fri Aug 8 01:39:49 2014 [dim] [I]: New VM state is failed
========================================================== ========================================================== ==========

### CDROM is a soft link of sr0

### Xen command
XM create deployment.0

Xedit xen-tmem-list-Parse xenlockprof xenstore-exists xentop
Xen-bugtool xen-vmresync xenmon. py xenstore-list xentrace
Xen-destroy xenalyze xenperf xenstore-ls xentrace_format
Xen-hptool xenalyze. Dump-raw xenpm xenstore-read xentrace_setmask
Xen-hvmcrash xenbaked xenpmd xenstore-RM xentrace_setsize
Xen-hvmctx xencons xenstore-watch xenwatchdogd
Xen-list xendeskled xenstore-chmod xenstore-write Xev
Xen-Python-path xend xenstore-control xenstored xeyes

#### Solution not a block device,
###### Set target: xvdc: CDROM
###### Set driver: File

Linux-xen01:/var/lib/One/opennebula/var/datastores/0/226 # Cat D
Deployment.0 disk.0 disk.1 disk.2 disk.2.iso
Linux-xen01:/var/lib/One/opennebula/var/datastores/0/226 # Cat deployment.0
Name = 'one-226'
# O cpu_credits = 256
Memory = '000000'
Builder = 'hvm'
Boot = 'C'
Disk = [
'File:/var/lib/One/opennebula/var // datastores/0/226/disk.0, xvdb, W ',
'File:/var/lib/One/opennebula/var // datastores/0/226/disk.1, xvda, W ',
'File:/var/lib/One/opennebula/var // datastores/0/226/disk.2, xvdc: CDROM, R ',
]
VIF = [
'Mac = 02: 00: C0: A8: 46: 96, IP = 192.168.70.150, bridge = br0 ',
]
VNC = '1'
Vnclisten = '0. 0.0.0'
Vncunused = '0'
Vncdisplay = '000000'

# Template Context
#! /Bin/sh-e
Mount-T iso9660/dev/SDC/mnt
If [-F/mnt/context. Sh]; then
./Mnt/init. Sh
Fi
Umount/mnt
Exit 0

# VM creation process
-Upload an image to storage

-Use an uploaded image to create a template that contains an ISO image. The template also includes a data disk (this data disk is used for the rootdisk after the system is installed)

-Use this template to create a virtual machine

-Delete the virtual machine installed at this time (because the previously configured datablock is set to persistent)

-Change the image type of the database lock installed on the system to the OS type, and change the persistence to non-persistent (for continuous use of the OS, but the non-persistent mode is much slower than the persistent creation of the VM)

 

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.