Manage a VM from the CLI
List and inspect
openstack server list
openstack server show vm1
openstack server show vm1 -f json
openstack server list --long adds the flavor, image and network columns, which is useful when several VMs share a name prefix.
Start, stop, reboot
openstack server stop vm1
openstack server start vm1
openstack server reboot --soft vm1
openstack server reboot --hard vm1
--soft asks the guest to shut down cleanly. --hard is a power cycle and can lose writes. Use --hard only when the guest is unresponsive.
Resize
The VM must be stopped first. The resize is not applied until you confirm it.
openstack server stop vm1
openstack server resize --flavor <new-flavor-id> vm1
openstack server show vm1 -c status
When the status is VERIFY_RESIZE, boot the guest and check that it sees the new CPU and RAM. Then either keep or revert:
openstack server resize confirm vm1
openstack server resize revert vm1
revert goes back to the previous flavor. Both actions are final; another resize is the only way back after confirming.
Console
When SSH is broken, get a browser console URL:
openstack console url show vm1
The URL contains a temporary token. Do not paste it into tickets or chat.
Volumes
openstack volume list
openstack server add volume vm1 <volume-id>
openstack server remove volume vm1 <volume-id>
Unmount the filesystem inside the guest before removing the volume. Removing a volume does not delete it.
Delete
openstack server delete vm1
Deleting a VM does not delete volumes that were attached to it. Check openstack volume list afterwards.