KVM (ii) Managing operating virtual machines

Source: Internet
Author: User

Cont.: KVM (i) Installation configuration

Client Host Name: VM1

[[Email protected] ~]# hostnamevm1[[email protected] ~]# ifconfig eth0eth0       Link encap:Ethernet  HWaddr 52:54:00:44:70:00           inet addr:192.168.100.134  bcast :192.168.100.255  mask:255.255.255.0           inet6 addr: fe80::5054:ff:fe44:7000/64 scope:link           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1           RX packets:268 errors:0 dropped:0  overruns:0 frame:0          tx packets:66  errors:0 dropped:0 overruns:0 carrier:0           collisions:0 txqueuelen:1000          RX bytes:21071  (20.5 kib)    TX bytes:7997  (7.8 kib) [[email protected] ~]# cat /etc/sysconfig/ Network-scripts/ifcfg-eth0device=eth0ipaddr=192.168.100.134netmask=255.255.255.0gateway=192.168.100.2hwaddr= 52:54:00:44:70:00type=ethernetuuid=ef9bdb2d-b13a-453a-81ee-03c7e2b93883onboot=yesnm_controlled=nobootproto= Static

1. Install power Management Services to clients

[[email protected] ~]# yum install acpid-y[[email protected] ~]#/etc/init.d/acpid start[[email protected] ~]# chkconfig Acpid on

2. Managing VMS


List all the VMS now

[Email protected] ~]# Virsh list--all

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/5E/wKiom1WaLKHydRu2AACCG6CRXys581.jpg "title=" 1.jpg " alt= "Wkiom1walkhydru2aaccg6crxys581.jpg"/>

Shutdown operation on the VM

[Email protected] ~]# Virsh shutdown VM1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/5E/wKiom1WaLOaS2Q-lAABUSjZb98o529.jpg "title=" 1.jpg " alt= "Wkiom1waloas2q-laabusjzb98o529.jpg"/>

Restart operation on this VM

[Email protected] ~]# Virsh start VM1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/5E/wKiom1WaLSWjAKmAAABf8u4EYQM668.jpg "title=" 1.jpg " alt= "Wkiom1walswjakmaaabf8u4eyqm668.jpg"/>

Power down the VM (this operation must be active in the VM running state)

[Email protected] ~]# Virsh destroy VM1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/5E/wKiom1WaLXaT6toKAABX_YYBNVg103.jpg "title=" 1.jpg " alt= "Wkiom1walxat6tokaabx_yybnvg103.jpg"/>

A start operation can also be performed on the host after a power outage

Set the VM as a host to boot up

[Email protected] ~]# Virsh autostart vm1

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M00/6F/5B/wKioL1WaL7SQdbYpAABbwIIWYuI856.jpg "title=" 1.jpg " alt= "Wkiol1wal7sqdbypaabbwiiwyui856.jpg"/>

Start the VM as a configuration file

[Email protected] qemu]# Virsh create/etc/libvirt/qemu/vm1.xml

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/5E/wKiom1WaLkyDVr3vAADyZbqPErc691.jpg "title=" 1.jpg " alt= "Wkiom1walkydvr3vaadyzbqperc691.jpg"/>

Manage the configuration files for exporting VMS,

Virsh dumpxml vm2 >/etc/libvirt/qemu/vm2bak.xml

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/74/wKiom1Wcy_uSNmsMAAGe5d7kV1c623.jpg "title=" 1.jpg " alt= "Wkiom1wcy_usnmsmaage5d7kv1c623.jpg"/>

Delete VMS (you need to shut down the VM beforehand, the operation will only delete the VM's profile and not delete the disk file)

Virsh undefine vm2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/74/wKiom1Wc0IazFIHaAAE8KnQIt3k408.jpg "title=" 1.jpg " alt= "Wkiom1wc0iazfihaaae8knqit3k408.jpg"/>

Use a backup VM configuration file to redefine

Virsh Define Vm2.xml

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/71/wKioL1Wc2-iAsHvKAAGRCjtP-hs407.jpg "title=" 1.jpg " alt= "Wkiol1wc2-iashvkaagrcjtp-hs407.jpg"/>

Temporarily Hang VM

Virsh Suspend VM2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/74/wKiom1Wc2r2THem-AADsAFzT2wI534.jpg "title=" 1.jpg " alt= "Wkiom1wc2r2them-aadsafzt2wi534.jpg"/>

To re-enable a suspended VM

Virsh Resume VM2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/6F/71/wKioL1Wc3L2xJZImAADhwzC68xY809.jpg "title=" 1.jpg " alt= "Wkiol1wc3l2xjzimaadhwzc68xy809.jpg"/>

Get CPU information for a VM

Virsh Vcpuinfo vm2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/75/wKiom1Wc35_zceedAABscAU3sMQ060.jpg "title=" 1.jpg " alt= "Wkiom1wc35_zceedaabscau3smq060.jpg"/>

Get the status of a VM

Virsh domstate vm2

650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M01/6F/72/wKioL1Wc4gGA6FmzAAEIwXRI02A665.jpg "title=" 1.jpg " alt= "Wkiol1wc4gga6fmzaaeiwxri02a665.jpg"/>




This article is from the "Big Wind" blog, please be sure to keep this source http://lansgg.blog.51cto.com/5675165/1672077

KVM (ii) Managing operating virtual machines

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.