1、重置虚拟机状态 source keystonerc nova list --all-tenant +--------------------------------------+----------+---------+------------+-------------+-----------------------+ | ID | Name | Status | Task State | Power State | Networks | +--------------------------------------+----------+---------+------------+-------------+-----------------------+ | 05cb1d54-5e42-4097-a9c5-018d5d595aea | win7-02 | SHUTOFF | - | Shutdown | public=192.168.121.70 | | 27a99710-27d0-43f8-8f8f-92b6bfd6654e | win7-A | SHUTOFF | - | Shutdown | public=192.168.121.72 | | a8f47e98-2050-4789-81dc-4a80d58f5de7 | win7-VDI | ACTIVE | - | Running | public=192.168.121.74 | | 172de985-476a-483d-a9da-71aab3ab1538 | xp-02 | SHUTOFF | - | Shutdown | public=192.168.121.69 | | 567d7f57-0cf4-4d77-a2f9-72fba1b796b4 | xp-A | ACTIVE | - | Running | public=192.168.121.71 | +--------------------------------------+----------+---------+------------+-------------+-----------------------+ nova reset-state --active 567d7f57-0cf4-4d77-a2f9-72fba1b796b4 172de985-476a-483d-a9da-71aab3ab1538 nova stop 567d7f57-0cf4-4d77-a2f9-72fba1b796b4 nova start 567d7f57-0cf4-4d77-a2f9-72fba1b796b4 2、命令创建虚拟机 admin创建网络 neutron net-create public --shared \ --provider:physical_network public \ --provider:network_type flat neutron subnet-create public 192.168.11.0/24 \ --name public --allocation-pool start=192.168.11.50,end=192.168.11.99 \ --dns-nameserver 114.114.114.114 \ --gateway 192.168.11.1 demo 创建虚拟机 source demo-openrc.sh nova secgroup-add-rule default tcp 22 22 0.0.0.0/0 nova secgroup-add-rule default icmp -1 -1 0.0.0.0/0 nova flavor-list neutron net-list nova boot --flavor m1.tiny --image cirros \ --nic net-id=3a277edd-c088-4550-87d1-f1dc5cccdeac \ --security-group default test1 nova list 查看kvm虚拟机的xml配置 virsh list Id Name State ---------------------------------------------------- 8 instance-00000005 running virsh dumpxml 8 查看kvm虚拟机的vnc或者spice远程端口 ps -ef | grep instance-00000005 (责任编辑:IT) |