Wed, Oct 14, 2020 at 04:17:16PM CEST, pgagne(a)redhat.com wrote:
From: Perry Gagne <pgagne(a)redhat.com>
Previously we were excluding RemoteDevice from export due to a number of its attributes
containing references to low level PYCapsule and socket stuff.
I took another look at this to be more precise about what is excluded.
Also, with Ondrej help I was able to find the cause of an issue I a ran into previously
where an infinite loop of calls to RemoteDevice.__setattr__ would occur when trying to
unpickle a exported run.
Could you please wrap these long lines? Applies to rest of the patches
as well.
Secondly, all patches contain "From: Perry Gagne <pgagne(a)redhat.com>" in
the
patch description. Please fix this.
Signed-off-by: Perry Gagne <pgagne(a)redhat.com>
---
lnst/Common/ConnectionHandler.py | 7 +++++++
lnst/Controller/Machine.py | 8 ++++++++
lnst/Controller/RecipeResults.py | 5 -----
lnst/Devices/RemoteDevice.py | 2 ++
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/lnst/Common/ConnectionHandler.py b/lnst/Common/ConnectionHandler.py
index a74d4a8..04bf7be 100644
--- a/lnst/Common/ConnectionHandler.py
+++ b/lnst/Common/ConnectionHandler.py
@@ -133,3 +133,10 @@ class ConnectionHandler(object):
def clear_connections(self):
self._connections = []
self._connection_mapping = {}
+
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ # Remove things that can't be pickled
+ state['_connections'] = []
+ state['_connection_mapping'] = {}
+ return state
\ No newline at end of file
diff --git a/lnst/Controller/Machine.py b/lnst/Controller/Machine.py
index f63fd6f..7ef3204 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -591,3 +591,11 @@ class Machine(object):
def get_security(self):
return self._security
+
+ def __getstate__(self):
+ state = self.__dict__.copy()
+ # Remove things that can't be pickled
+ state['_msg_dispatcher'] = None
+ if self.get_libvirt_domain():
+ state['_domain_ctl'] = None
+ return state
\ No newline at end of file
diff --git a/lnst/Controller/RecipeResults.py b/lnst/Controller/RecipeResults.py
index 941ea8d..38a4170 100644
--- a/lnst/Controller/RecipeResults.py
+++ b/lnst/Controller/RecipeResults.py
@@ -118,11 +118,6 @@ class DeviceConfigResult(BaseResult):
def device(self):
return self._device
- def __getstate__(self):
- state = self.__dict__.copy()
- # Remove things that can't be pickled
- state['_device'] = None
- return state
class DeviceCreateResult(DeviceConfigResult):
@property
diff --git a/lnst/Devices/RemoteDevice.py b/lnst/Devices/RemoteDevice.py
index f11fa65..7891514 100644
--- a/lnst/Devices/RemoteDevice.py
+++ b/lnst/Devices/RemoteDevice.py
@@ -108,6 +108,8 @@ class RemoteDevice(object):
def __getattr__(self, name):
if name == "_inited":
return False
+ if not self._inited:
+ return super(RemoteDevice, self).__getattr__(name)
attr = getattr(self._dev_cls, name)
--
2.26.2
_______________________________________________
LNST-developers mailing list -- lnst-developers(a)lists.fedorahosted.org
To unsubscribe send an email to lnst-developers-leave(a)lists.fedorahosted.org
Fedora Code of Conduct:
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines:
https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives:
https://lists.fedorahosted.org/archives/list/lnst-developers@lists.fedora...