Skip to content

Commit

Permalink
Fix: Large hostname issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
Andres D. Molins committed Sep 21, 2023
1 parent 2176191 commit 7464eb9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion vm_supervisor/vm/firecracker/instance.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import base64
import json
import logging
from pathlib import Path
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 7464eb9

Please sign in to comment.