When we want to rebuild an instance and change the keypair we can specified it with :
openstack --os-compute-api-version 2.54 server rebuild --image "Debian 10" --key-name key1 instance1
And this meta_data.json uses the keys from instance_extra tables
But the keypair will be updated in the 'instances' table but not in the 'instance_extra' table.
- Deploy a DevStack
- Boot an instance with keypair key1
- Rebuild it with key2
- A nova show will show the key_name key2, keypairs object in table instance_extra is not updated and you cannot connect with key2 to the instance
Expected result
===============
Connecte to the Vm with the new keypair added during the rebuild call
Actual result
=============
The keypair added during the rebuild call is not set in the VM
Environment
===========
I tested it on a Devstack from master and we have the behaviour.
NOVA : commit 5fa49cd0b8b6015aa61b4312b2ce1ae780c42c64
Description
===========
When we want to rebuild an instance and change the keypair we can specified it with : api-version 2.54 server rebuild --image "Debian 10" --key-name key1 instance1
openstack --os-compute-
This comes from this implementation : /review. opendev. org/#/c/ 379128/ /specs. openstack. org/openstack/ nova-specs/ specs/queens/ implemented/ rebuild- keypair- reset.html
https:/
https:/
But when rebuilding the instance, Cloud-Init will set the key in authorized_keys from 169.254. 169.254/ openstack/ latest/ meta_data. json
http://
And this meta_data.json uses the keys from instance_extra tables
But the keypair will be updated in the 'instances' table but not in the 'instance_extra' table.
So the keypair is not updated inside the VM
May be this is the function for saving the keypair, but the save() do nothing : /opendev. org/openstack/ nova/src/ branch/ master/ nova/objects/ instance. py#L714
https:/
Steps to reproduce
==================
- Deploy a DevStack
- Boot an instance with keypair key1
- Rebuild it with key2
- A nova show will show the key_name key2, keypairs object in table instance_extra is not updated and you cannot connect with key2 to the instance
Expected result
===============
Connecte to the Vm with the new keypair added during the rebuild call
Actual result
=============
The keypair added during the rebuild call is not set in the VM
Environment aa61b4312b2ce1a e780c42c64
===========
I tested it on a Devstack from master and we have the behaviour.
NOVA : commit 5fa49cd0b8b6015