How to Set Passwords for OpenStack Instances with QEMU Guest Agent
When your OpenStack instances have the QEMU Guest Agent installed, you gain additional flexibility and control over your virtual machines. Here’s how you can set passwords for your OpenStack instances using this powerful tool.
OpenStack is a robust cloud computing platform that enables users to deploy and manage virtual machine instances with ease. One of the key concerns when managing these instances is setting and maintaining the root password while the instance is still running. If you are using QEMU/KVM as the hypervisor, the instance’s password can be easily changed if it has qemu-guest-agent installed.
What is the QEMU Guest Agent?
The QEMU Guest Agent is a daemon that runs on the guest operating system, facilitating communication between the host and the guest. It provides a way to execute commands inside the guest operating system without using the network, which can be particularly useful for tasks like setting passwords or retrieving system metrics.
Create an Image with qemu-guest-agent preinstalled
You must create an image that contains qemu-guest-agent. It is usually shipped with in every distribution as a package.
sudo apt update && sudo apt install qemu-guest-agent
sudo systemctl start qemu-guest-agent
sudo systemctl enable qemu-guest-agent
Configure Glance Image Property
You need to indicate that the image has qemu-guest-agent installed. You can do that by setting the hw_qemu_guest_agent property to the image.
openstack image set --property hw_qemu_guest_agent=yes IMAGE_ID
Set a New Password
nova set-password [YOUR_INSTANCE_NAME] [USERNAME]
OR
openstack server password set [YOUR_INSTANCE_ID] [USERNAME]
Security Considerations
When setting passwords, always choose strong, complex passwords. Avoid using the QEMU Guest Agent to set passwords over an unencrypted connection, as this could expose sensitive information.