Is this required if you're removing the message dispatcher from the
Machine object anyway?
 
Good point. I must have added it when debugging, and forgot to remove it.  

On Tue, Sep 29, 2020 at 4:23 AM Ondrej Lichtner <olichtne@redhat.com> wrote:
On Mon, Sep 28, 2020 at 10:45:31AM -0400, pgagne@redhat.com wrote:
> From: Perry Gagne <pgagne@redhat.com>
>
> Was able to figure out the issues with exporting Devices, so we don't need to exclude them anymore.

Please write an actual commit description of what/why this commit/patch
does.

Saying "i figured it out" is not helpful when looking into git log
history a couple of months later trying to debug something...

>
> Signed-off-by: Perry Gagne <pgagne@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

Is this required if you're removing the message dispatcher from the
Machine object anyway?

> \ 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
> _______________________________________________
> LNST-developers mailing list -- lnst-developers@lists.fedorahosted.org
> To unsubscribe send an email to lnst-developers-leave@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.fedorahosted.org