If trying to access the serial console of a VM in CloudVPS one must perform the following steps:
- investigate in which hypervisor is the VM running
- investigate the libvirt ID of the VM (something like i-000045b2)
- jump by ssh to the hypervisor and run the command sudo virsh console --devname serial1 $ID
This is documented here: https://wikitech.wikimedia.org/wiki/Portal:Cloud_VPS/Admin/Troubleshooting#Root_console_access
The procedure is very time-consuming and can easily be automated (all the information is in keystone)
When developing new services or projects (example: T228500: Toolforge: evaluate ingress mechanism) this is a very common operation, so having a wmcs-root-console script that does all the above would save us a lot of time.
First step would be to develop some helper library to help us translate between the main identifiers for a given VM:
- short name (like tools-worker-1003)
- full hostname (like tools-worker-1003.tools.eqiad.wmflabs)
- nova ID (like d268926f-32a4-4201-ad70-b6956a66d929)
- libvirt ID (like i-000045b2)
(BTW this small helper library should be really helpful in a lot of other small scripts we have.)
Ideally, the script would be able run from anywhere with enough credentials to do all the steps (keystone creds + ssh creds for the cloudvirt).
$ wmcs-root-console tools-worker-1003