Skip to content

Commit

Permalink
Write guest properties from KVM environment into agent
Browse files Browse the repository at this point in the history
Allow the guest to detect whether the KVM environment has changed at
runtime in combination with the boot-time seed data.
  • Loading branch information
sysvinit committed Oct 16, 2024
1 parent 6c48f04 commit ef278b0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/fc/qemu/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,7 @@ def ensure_online_local(self):
# reduce the time we're unnecessarily waiting for timeouts.
self.ensure_thawed()
self.mark_qemu_binary_generation()
self.mark_qemu_guest_properties()

def cleanup(self):
"""Removes various run and tmp files."""
Expand All @@ -1102,6 +1103,23 @@ def ensure_thawed(self):
except Exception as e:
self.log.error("ensure-thawed-failed", reason=str(e))

def mark_qemu_guest_properties(self):
props = {
"binary_generation": self.binary_generation,
"cpu_model": self.cfg["cpu_model"],
"rbd_pool": self.cfg["rbd_pool"],
}
self.log.info(
"mark-qemu-guest-properties", properties=props,
)
try:
self.qemu.write_file(
"/run/qemu-guest-properties-current",
(json.dumps(props)).encode("ascii"),
)
except Exception as e:
self.log.error("mark-qemu-guest-properties", reason=str(e))

def mark_qemu_binary_generation(self):
self.log.info(
"mark-qemu-binary-generation", generation=self.binary_generation
Expand Down

0 comments on commit ef278b0

Please sign in to comment.