Hi Cu, When you try to set/reset the SSH key for a VM, it goes into the VR as a databag, i.e., a vm_metadata.json.<uuid>.gz file gets created in the /var/cache/cloud/processed/ path in the VR. This databag is then read by the merge.py script, which in turn creates the final metadata file at /etc/cloudstack/ - here, /etc/cloudstack/vm_metadata.json. The management server then internally calls the vr_cfg.sh script in the virtual router which in turn calls configure.py script that takes the vm_metadata.json file as an input. It is this script - 'configure.py' that creates the files in /var/www/html/metadata/ path. Now wrt how the public key is actually sent from the management server to the VR - it is at this point in the management server code: https://github.com/apache/cloudstack/blob/master/server/src/main/java/com/cloud/network/NetworkModelImpl.java#L2451 where the public key is set to the vmdata which further goes on to become the databag in the VR.
Thanks Pearl ________________________________ From: m...@swen.io <m...@swen.io> Sent: Wednesday, October 14, 2020 5:26 PM To: users@cloudstack.apache.org <users@cloudstack.apache.org> Subject: AW: metadata on VR Hi David, thx for getting back so fast. That is what I thought too. Now the problem is that in the file public-keys is a key that is not in the database. It should be in the table ssh_keypairs, correct? When I do a ssh-keygen -lf public-keys on the file in the VR the fingerprint did not match any fingerprint in the ssh_keypairs table. I am wondering where the key in the public-keys file comes from. Cu Swen pearl.dsi...@shapeblue.com www.shapeblue.com 3 London Bridge Street, 3rd floor, News Building, London SE1 9SGUK @shapeblue -----Ursprüngliche Nachricht----- Von: David Jumani <david.jum...@shapeblue.com> Gesendet: Mittwoch, 14. Oktober 2020 12:19 An: users@cloudstack.apache.org Betreff: Re: metadata on VR Hi, The file contents are written by vmdata.py itself. The public keys are sent to the router by the management server when the ssh key is reset. The vmdata.py file receives this and a method 'createFile' is internally called which writes the relevant data in the respective file in the folder. Thanks, David ________________________________ From: m...@swen.io <m...@swen.io> Sent: Wednesday, October 14, 2020 3:34 PM To: users@cloudstack.apache.org <users@cloudstack.apache.org> Subject: metadata on VR Hi all, I have a question regarding the metadata on virtual routers. We are running an older version, so I am not sure if path or script are being renamed or changed. I see that CS is creating /var/www/html/metadata/<ip>/ on the VR for all VMs in the network. As far as I understand this script is creating the folders: /opt/cloud/bin/vmdata.py But I am unable to find which script is creating the files with content inside this folder. In particular I need to know what is creating the file public-keys where the content of this file is from. Thank you for any help! Cu Swen david.jum...@shapeblue.com www.shapeblue.com<http://www.shapeblue.com> 3 London Bridge Street, 3rd floor, News Building, London SE1 9SGUK @shapeblue