2
0
mirror of https://opendev.org/x/pyghmi synced 2025-02-10 07:44:02 +00:00

Only use one extra keep alive session.

Use only one extra keep alive session for keeping the media
mounted. Do a weblogout on that session when the media is
detached.

Change-Id: I3012d263510ba97477542e1325876000f2a52356
This commit is contained in:
Vlad Spoiala 2022-08-30 16:38:37 +03:00
parent 44d2ccd440
commit cef0cdc5fa

View File

@ -1680,8 +1680,10 @@ class XCCClient(IMMClient):
'Given location was unreachable by the XCC')
raise Exception('Unhandled return: ' + repr(rt))
if not self._keepalivesession:
# keep at least one session alive so that the
# XCC doesn't unmount the media
self._keepalivesession = self._wc
self._wc = None
self._wc = None
def keepalive(self):
if self.fwo and util._monotonic_time() - self.fwovintage > 15:
@ -1803,7 +1805,13 @@ class XCCClient(IMMClient):
yield firm
def detach_remote_media(self):
self._keepalivesession = None
if self._keepalivesession:
# log out from the extra session
try:
self._keepalivesession.grab_json_response(self.logouturl)
except Exception:
pass
self._keepalivesession = None
rt = self.wc.grab_json_response('/api/providers/rp_vm_remote_getdisk')
if 'items' in rt:
slots = []