记录常用的 Nova client 命令。
openstack
# 获取所有的 server
openstack server list --all --limit -1
# 根据VM 名称获取 server
openstack server list --all --limit -1 --name <vm-name>
# 查看 server
openstack server show <vm-id>
openstack port list --server <vm-id>
openstack port show <port-id>
openstack port set --disable <port-id>
openstack hypervisor show <hostname>
nova
nova interface-list <vm-id>
nova list --all --name VM-1
nova list --all --host <compute-hostname>
nova service-list
nova aggregate-list
nova stop <vm-id>
nova start <vm-id>
nova show <vm-id>
nova reset-state --active <vm-id>
nova get-vnc-console <vm-id> novnc
nova live-migration <vm-id>
nova flavor-list
nova flavor-show <flavor-name>
virsh
virsh qemu-monitor-command <vm-id> --hmp "info block"
# device list
virsh qemu-monitor-command <vm-id> --hmp "info block"| grep 'drive-scsi'|grep -v group|awk '{print $'1'}'
# set bytes/iops
virsh qemu-monitor-command <vm-id> --hmp "block_set_io_throttle <device> 0 <read-bytes-sec> <write-bytes-sec> 0 <read-iops-sec> <write-iops-sec>
virsh qemu-monitor-command <vm-id> --hmp "info block"