Skip to content

Commit

Permalink
DEBUG: log list of VMs when startup failed
Browse files Browse the repository at this point in the history
And also basic xen info (including free memory)
  • Loading branch information
marmarek committed Oct 19, 2024
1 parent 334dbd6 commit 515c064
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qubes/vm/qubesvm.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,8 +1222,12 @@ async def start(self, start_guid=True, notify_function=None,

self._update_libvirt_domain()

free_mem = subprocess.check_output(["xl", "info", "free_memory"]).decode()
self.log.debug("free mem before start: %s", free_mem)
self.libvirt_domain.createWithFlags(
libvirt.VIR_DOMAIN_START_PAUSED)
free_mem = subprocess.check_output(["xl", "info", "free_memory"]).decode()
self.log.debug("free mem after start: %s", free_mem)

# the above allocates xid, lets announce that
self.fire_event('property-reset:xid', name='xid')
Expand All @@ -1239,6 +1243,10 @@ async def start(self, start_guid=True, notify_function=None,
exc = qubes.exc.QubesException(
'Failed to start an HVM qube with PCI devices assigned '
'- hardware does not support IOMMU/VT-d/AMD-Vi')
free_mem = subprocess.check_output(["xl", "info", "free_memory"]).decode()
self.log.debug("free mem after failed start: %s", free_mem)
subprocess.run(["xl", "list"])
subprocess.run(["xl", "info"])
self.log.error('Start failed: %s', str(exc))
await self.fire_event_async('domain-start-failed',
reason=str(exc))
Expand Down Expand Up @@ -1757,6 +1765,7 @@ def request_memory(self, mem_required=None):
initial_memory = self.memory
mem_required = int(initial_memory + stubdom_mem) * 1024 * 1024

self.log.debug(f"mem required: {mem_required}")
qmemman_client = qubes.qmemman.client.QMemmanClient()
try:
mem_required_with_overhead = mem_required + MEM_OVERHEAD_BASE \
Expand All @@ -1767,6 +1776,7 @@ def request_memory(self, mem_required=None):
mem_required_with_overhead += self.maxmem * 4096
got_memory = qmemman_client.request_memory(
mem_required_with_overhead)
self.log.debug(f"mem required with overhead: {mem_required_with_overhead}")

except IOError as e:
raise IOError('Failed to connect to qmemman: {!s}'.format(e))
Expand Down

0 comments on commit 515c064

Please sign in to comment.