diff --git a/vm_supervisor/vm/firecracker/instance.py b/vm_supervisor/vm/firecracker/instance.py index dbe9fd32a..be4f886ba 100644 --- a/vm_supervisor/vm/firecracker/instance.py +++ b/vm_supervisor/vm/firecracker/instance.py @@ -1,4 +1,5 @@ import asyncio +import base64 import json import logging from pathlib import Path @@ -236,9 +237,11 @@ def _create_network_file(self) -> bytes: def _create_metadata_file(self) -> bytes: """Creates metadata configuration file for cloud-init tool""" + hostname = base64.b32encode(self.vm_hash).decode().strip("=").lower() + metadata = { "instance-id": f"iid-instance-{self.vm_id}", - "local-hostname": str(self.vm_hash), + "local-hostname": hostname, } return json.dumps(metadata).encode()