Virtualized KVM "virsh command"

1. View running virtual machines

[root@room9pc01 ~]# virsh list
 Id    名称                         状态
----------------------------------------------------
 3     rh7_node06                     running
 4     rh7_node22                     running
 5     rh7_node02                     running

 6     rh7_node04                     running

2. View all virtual machines (including the shutdown and running virtual machines of the current computer)

[root@room9pc01 ~]# virsh list --all

 Id Name Status
----------------------------------------------- -----
 3 rh7_node06 running
 4 rh7_node22 running
 5 rh7_node02 running
 6 rh7_node04 running
 - classroom off
 - desktop off
 - rh7_node08 off
 - rh7_node09 off
 - server off
 - win2008 off

3. Start the virtual machine

[root@room9pc01 ~]# virsh start classroom

Domain classroom started

4.virsh console + (the name of the virtual machine)

[root@room9pc01 ~]# virsh console desktop
connects to domain desktop with
escape character ^]


Red Hat Enterprise Linux Server 7.0 (Maipo)
Kernel 3.10.0-123.el7.x86_64 on an x86_64

desktop0 login: root
Password:

Last login: Sun May  6 19:36:22 from 172.25.0.250

5. Shut down the virtual machine

ctrl+]

6. Delete the virtual machine name in virsh

virsh destroy + (the name of the virtual machine)

7. Suspend the virtual machine

virsh suspend + domain name

[root@room9pc01 ~]# virsh suspend desktop

Domain desktop is suspended






Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325358268&siteId=291194637