Use of Xen virtual machines: Start, close, pause, reply, reboot, enter terminal, etc.

Source: Internet
Author: User
Tags centos in domain

Use of Xen virtual machines

(i) using virtual machine profiles and disk files to manually start the virtual machine system

After the virtual machine system is created, the virtual system will start up and use the XM List command to see all the virtual machines that are started , but the next time we restart the system, we will not see the virtual machines created with the XM list . the network device for the virtual machine is not visible in the network device . At this point we need to manually start the virtual machine system based on the configuration files and disk files that were generated when the virtual machines were created.

[Root@gmnode14 software]# XM list
Name ID Mem (MiB) Vcpus state time (s)
Domain-0 0 4936 8 R-----173.4

[Root@gmnode14 xen_zkl]# Ifconfig View network devices
eth1 Link encap:ethernet hwaddr 00:e0:81:c0:52:85
inet addr:10.10.113.14 bcast:10.10.255.255 mask:255.255.0.0
Inet6 ADDR:FE80::2E0:81FF:FEC0:5285/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:13405 errors:0 dropped:0 overruns:0 frame:0
TX packets:3144 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1701456 (1.6 mib) TX bytes:7347870 (7.0 MiB)
interrupt:251 Base address:0x2000

Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up loopback RUNNING mtu:16436 metric:1
RX packets:334 errors:0 dropped:0 overruns:0 frame:0
TX packets:334 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23680 (23.1 KiB) TX bytes:23680 (23.1 KiB)

virbr0Link encap:ethernet hwaddr 00:00:00:00:00:00
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Inet6 ADDR:FE80::200:FF:FE00:0/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15472 (15.1 KiB) TX bytes:16625 (16.2 KiB)

Each of our virtual machine systems creates two files: one is a virtual machine disk file vm01-centos-5.5-pv.img and a virtual machine configuration file /etc/xen/vm01-centos-5.5, The contents of the configuration file are as follows:

------------------------------------------------------------------------------------------------
Name = "vm01-centos-5.5" Virtual machine names
UUID = "0283f36d-c95a-521b-737d-e400ca657029"
MAXMEM = 1024 Maximum memory
Memory = 1024 Virtual machine memory
Vcpus = 4 CPU Count
bootloader = "/usr/bin/pygrub"
On_poweroff = "Destroy"
On_reboot = "Restart"
On_crash = "Restart"
disk = ["tap:aio:/local/xen_zkl/vm01-centos-5.5/vm01-centos-5.5.img,xvda,w"] Diskette file
Vif = ["Mac=00:16:36:40:43:85,bridge=virbr0,script=vif-bridge"] network device

-----------------------------------------------------------------------------------------------

[Root@gmnode14 software]# XM create/etc/xen/vm01-centos-5.5 Create a domain using a configuration file
Using config file "/etc/xen/vm01-centos-5.5".
Started domain vm01-centos-5.5

If an error occurs at startup, refer to the error summary that is common when installing Xen, creating Xen virtual machines, and using Xen virtual machines


[Root@gmnode14 software]# XM List
Name ID Mem (MiB) Vcpus state time (s)
Domain-0 0 6984 8 R-----167.7
vm01-centos-5.5 1 1024 4-b----0.6 domain created with ID 1


[Root@gmnode14 software]# XM create/etc/xen/vm02-centos-5.5-full
Using config file "/etc/xen/vm02-centos-5.5-full".
Started domain Vm02-centos-5.5-full


[Root@gmnode14 software]#XM List
Name ID Mem (MiB) Vcpus state time (s)
Domain-0 0 4936 8 R-----173.4
vm01-centos-5.5 1 1023 4 R-----11.4
Vm02-centos-5.5-full 2 2048 4-b----0.8
The domain created has an ID of 2
[Root@gmnode14 software]# XM List
Name ID Mem (MiB) Vcpus state time (s)
Domain-0 0 4936 8 R-----182.8
vm01-centos-5.5 3 10234-b----19.6
Vm02-centos-5.5-full 4 20474-b----34.4
You have new mail in/var/spool/mail/root

After the virtual machine is started, the corresponding network device is also added.


[Root@gmnode14 xen_zkl]# ifconfig View network devices
eth1 Link encap:ethernet hwaddr 00:e0:81:c0:52:85
inet addr:10.10.113.14 bcast:10.10.255.255 mask:255.255.0.0
Inet6 ADDR:FE80::2E0:81FF:FEC0:5285/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:13758 errors:0 dropped:0 overruns:0 frame:0
TX packets:3307 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1741480 (1.6 mib) TX bytes:7373148 (7.0 MiB)
interrupt:251 Base address:0x2000

Lo Link encap:local Loopback
inet addr:127.0.0.1 mask:255.0.0.0
Inet6 addr::: 1/128 scope:host
Up loopback RUNNING mtu:16436 metric:1
RX packets:334 errors:0 dropped:0 overruns:0 frame:0
TX packets:334 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:23680 (23.1 KiB) TX bytes:23680 (23.1 KiB)

vif1.0Link encap:ethernet hwaddr FE:FF:FF:FF:FF:FFnetwork devices in domain 1
Inet6 ADDR:FE80::FCFF:FFFF:FEFF:FFFF/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:0  (0.0 b) TX bytes:4628 (4.5 KiB)

vif2.0Link encap:ethernet hwaddr FE:FF:FF:FF:FF:FFnetwork devices in domain 2
Up broadcast multicast mtu:1500 metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:32
RX bytes:0  (0.0 b) TX bytes:0 (0.0 b)

virbr0Link encap:ethernet hwaddr FE:FF:FF:FF:FF:FF
inet addr:192.168.122.1 bcast:192.168.122.255 mask:255.255.255.0
Inet6 ADDR:FE80::200:FF:FE00:0/64 Scope:link
Up broadcast RUNNING multicast mtu:1500 metric:1
RX packets:142 errors:0 dropped:0 overruns:0 frame:0
TX packets:122 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:15472 (15.1 KiB) TX bytes:16625 (16.2 KiB)

(ii) a detailed explanation of the XM order

Normal 0 7.8 lb 0 2 false false

XM Console < domain id> # Enter the terminal of the virtual machine from the host, press CTRL + when exiting

XM reboot < domain id> # restart virtual machines

XM Pause < domain id> #暂停虚拟机

XM Resume < domain id> # Restore paused virtual machines

XM shutdown < domain id> # shut down domain

(ii) related tools


Virt-manager Create, delete, and modify virtual machines


Virt-viewer displays the interface of the virtual machine with the graphical interface installed, such as Virt-viewer <domain-id>

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.