Skip to content

Commit

Permalink
No need to reload http service when shutting down middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Qubad786 committed Aug 7, 2024
1 parent 0548b16 commit 61fa0b7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/middlewared/middlewared/plugins/vm/lifecycle.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,14 @@ async def start_on_boot(self):
@accepts(
Dict(
'deinitialize_vms_options',
Bool('reload_ui', default=True),
Bool('stop_libvirt', default=True),
)
)
async def deinitialize_vms(self, options):
await self.middleware.call('vm.close_libvirt_connection')
await self.middleware.call('service.reload', 'http')
if options['reload_ui']:
await self.middleware.call('service.reload', 'http')
if options['stop_libvirt']:
await self.middleware.call('service.stop', 'libvirtd')

Expand All @@ -101,7 +103,7 @@ def setup_details(self):
@private
async def terminate(self):
async with SHUTDOWN_LOCK:
await self.middleware.call('vm.deinitialize_vms', {'stop_libvirt': False})
await self.middleware.call('vm.close_libvirt_connection')

@private
async def terminate_timeout(self):
Expand Down Expand Up @@ -145,7 +147,7 @@ async def poweroff_stop_vm(vm):
# We do this in vm.terminate as well, reasoning for repeating this here is that we don't want to
# stop libvirt on middlewared restarts, we only want that to happen if a shutdown has been initiated
# and we have cleanly exited
await middleware.call('vm.deinitialize_vms')
await middleware.call('vm.deinitialize_vms', {'reload_ui': False})


async def setup(middleware):
Expand Down

0 comments on commit 61fa0b7

Please sign in to comment.