from keystoneauth1.adapter import Adapter

adapter = Adapter(conn.session, service_type="block-storage")

 

Adding this and passing adapter instead of conn.session to the commit call seems to work.

 

---

John Ratliff

Systems Automation Engineer

GlobalNOC @ Indiana University

 

From: jdratlif@globalnoc.iu.edu <jdratlif@globalnoc.iu.edu>
Sent: Friday, June 24, 2022 11:44 AM
To: openstack-discuss@lists.openstack.org
Cc: Ratliff, John <jdratlif@iu.edu>
Subject: [sdk] renaming a volume with the SDK

 

I’m trying to set a property on a volume, specifically the name. But when I try to do this, it tells me the Session object has no default_microversion. I have all my auth in environment variables. Using TOKEN authentication.

 

What am I doing wrong here?

 

import openstack

from openstack.block_storage.v3._proxy import Proxy as BlockStorageService

from openstack.block_storage.v3.volume import Volume

 

# enable openstack debug logging

openstack.enable_logging(debug=True)

 

conn = openstack.connect()

 

cinder: BlockStorageService = conn.block_storage

volume: Volume = cinder.get_volume("b3a70014-1cf0-4fd1-bdc4-183dbfd33e79")

volume.name = "test_rename"

volume.commit(conn.session)

 

 

Thanks,

 

---

John Ratliff

Systems Automation Engineer

GlobalNOC @ Indiana University