From: Perry Gagne <pgagne(a)redhat.com>
Was able to figure out the issues with exporting Devices, so we don't need to exclude
them anymore.
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 4b9afcb..5920d69 100644
--- a/lnst/Controller/Machine.py
+++ b/lnst/Controller/Machine.py
@@ -589,3 +589,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
Show replies by date