Pickling Server object fails with attribute error

Bug #2046838 reported by Alice Seaborn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
openstacksdk
New
Undecided
Unassigned

Bug Description

Greetings,

I am using the OpenStackSDK with Python 3.9.16, here is the output of `pip freeze | grep openstack` for identifying package versions which might be relevant to my issue.

openstackclient==4.0.0
openstacksdk==2.0.0
python-openstackclient==6.4.0

When creating new compute server instances, the `conn.create_server(...)` method returns an instance of the openstack.compute.v2.server.Server object. This object is extremely useful since it contains instance specific information that will come in handy later. I would very much like to pickle these objects and load them back into Server instances later on. To accomplish this task, I am using the following process:

import pickle
instance = conn.create_server(...)
with open('instance.pkl', 'wb') as f:
    pickle.dump(instance, f, pickle.HIGHEST_PROTOCOL)

However, I end up getting an attribute error from the Resource object as pickle attempts to iterate through the object's items.

File /opt/environments/cdp-python/lib64/python3.9/site-packages/openstack/resource.py:199, in _BaseComponent.__get__(self, instance, owner)
    197 setattr(instance, seen_flag, True)
    198 value = getattr(instance, self.alias)
--> 199 delattr(instance, seen_flag)
    200 self.warn_if_deprecated_property(value)
    201 return value

AttributeError: owner_seen

I suspect this issue is a user-error and I am doing something incorrectly. However, I could not find a user forum to post this issue and I have exhausted paths forward for debugging on my own since I am new to using OpenStack to say nothing of the SDK. Please let me know if there is a place where I should redirect my debugging attention and I will get right on it.

Thanks! Alice

Revision history for this message
Alice Seaborn (atseabo) wrote :
description: updated
information type: Public → Public Security
Revision history for this message
Alice Seaborn (atseabo) wrote :

Trying to lower the priority as much as possible since this issue isn't critical.

information type: Public Security → Public
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.