Skip to content

Commit bc80916

Browse files
committed
Global renaming from APISession to ApiSession.
Signed-off-by: Arnaud Garcia-Fernandez <arnaud.garcia-fernandez@vates.tech>
1 parent c4d891b commit bc80916

15 files changed

Lines changed: 29 additions & 29 deletions

drivers/LinstorSR.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,7 +2585,7 @@ def _start_persistent_http_server(volume_name):
25852585
# Use a timeout call because XAPI may be unusable on startup
25862586
# or if the host has been ejected. So in this case the call can
25872587
# block indefinitely.
2588-
api_session = util.timeout(5, util.APISession, "SM-ha-linstor-http-server")
2588+
api_session = util.timeout(5, util.ApiSession, "SM-ha-linstor-http-server")
25892589
session = api_session.session
25902590
host_ip = util.get_this_host_address(session)
25912591
except:
@@ -2672,7 +2672,7 @@ def _start_persistent_nbd_server(self, volume_name):
26722672
device_size = 256 * 1024 * 1024
26732673

26742674
try:
2675-
api_session = util.timeout(5, util.APISession, "SM-ha-linstor-nbd-server")
2675+
api_session = util.timeout(5, util.ApiSession, "SM-ha-linstor-nbd-server")
26762676
session = api_session.session
26772677
ips = util.get_host_addresses(session)
26782678
except Exception as e:

drivers/XE_SR_ERRORCODES.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -521,7 +521,7 @@
521521

522522
<!-- Agent database query errors 150+ -->
523523
<code>
524-
<name>APISession</name>
524+
<name>ApiSession</name>
525525
<description>Failed to initialize XMLRPC connection</description>
526526
<value>150</value>
527527
</code>

drivers/blktap2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -882,7 +882,7 @@ def abort_linstor_gc(drbd_path: str) -> bool:
882882

883883
openers = get_all_volume_openers(volume_name, "0")
884884

885-
api_session = util.timeout(5, util.APISession, "SM-blktap2-abort_linstor_gc")
885+
api_session = util.timeout(5, util.ApiSession, "SM-blktap2-abort_linstor_gc")
886886
try:
887887
srs = util.get_linstor_srs_uuid(api_session.session)
888888
pbd_ref = util.find_pbd_ref_from_dconf_value(
@@ -1154,7 +1154,7 @@ def get_o_direct_capability(self, options):
11541154

11551155
@classmethod
11561156
def from_cli(cls, uuid):
1157-
with util.APISession("SM-blktap2") as session:
1157+
with util.ApiSession("SM-blktap2") as session:
11581158
target = sm.VDI.from_uuid(session, uuid)
11591159
driver_info = target.sr.srcmd.driver_info
11601160
return cls(uuid, target, driver_info)

drivers/cleanup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ def __init__(self, session, srUuid):
303303
self.session = session
304304
self._api_session = None
305305
if self.session is None:
306-
self._api_session = util.APISession("SM-GC")
306+
self._api_session = util.ApiSession("SM-GC")
307307
self.session = self._api_session.session
308308
self._srRef = self.session.xenapi.SR.get_by_uuid(srUuid)
309309
self.srRecord = self.session.xenapi.SR.get_record(self._srRef)
@@ -2121,7 +2121,7 @@ def msg_cleared(self, xapi_session, msg_ref):
21212121
return msg is None
21222122

21232123
def check_no_space_candidates(self):
2124-
with util.APISession("SM-GC-check_no_space") as xapi_session:
2124+
with util.ApiSession("SM-GC-check_no_space") as xapi_session:
21252125
msg_id = self.xapi.srRecord["sm_config"].get(VDI.DB_GC_NO_SPACE)
21262126
if self.no_space_candidates:
21272127
if msg_id is None or self.msg_cleared(xapi_session, msg_id):
@@ -3928,7 +3928,7 @@ def _abort_gc_from_openers(uuid: str, is_vdi_uuid: bool, openers: "LinstorVolume
39283928
if node_name == hostname:
39293929
continue
39303930

3931-
with util.timeout(5), util.APISession("SM-GC-coalescing") as session:
3931+
with util.timeout(5), util.ApiSession("SM-GC-coalescing") as session:
39323932
sr_uuid = util.get_sr_uuid_from_vdi_uuid(session, uuid) if is_vdi_uuid else uuid
39333933
util.SMlog(f"LINSTOR volume is coalescing on `{sr_uuid}`. We're going to interrupt the GC...")
39343934
return util.strtobool(session.xenapi.host.call_plugin(

drivers/coalesce-leaf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def main():
229229
print(USAGE_STRING % sys.argv[0])
230230
sys.exit(-1)
231231

232-
with util.APISession("SM-coalesce-leaf") as session:
232+
with util.ApiSession("SM-coalesce-leaf") as session:
233233
ret, messages = vm_leaf_coalesce(session, uuid)
234234
if messages:
235235
print("\n".join(messages))

drivers/lcache.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ def from_session(cls, session):
221221

222222
@classmethod
223223
def from_cli(cls):
224-
with util.APISession("SM-local-cache") as session:
224+
with util.ApiSession("SM-local-cache") as session:
225225
return cls.from_session(session)
226226

227227
def statvfs(self):

drivers/linstorcowutil.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ def clear(self):
651651
def __init__(self, uri, group_name) -> None:
652652
self._uri = uri
653653
self._group_name = group_name
654-
self._loads: List[util.APISession] = []
654+
self._loads: List[util.ApiSession] = []
655655
self._executor_data = self.ExecutorData()
656656

657657
def __del__(self):
@@ -678,7 +678,7 @@ def get_local_cowutil(self, vdi_type):
678678
return instance
679679

680680
def _init_executor_thread(self):
681-
api_session = util.APISession("SM-linstorvhdutil")
681+
api_session = util.ApiSession("SM-linstorvhdutil")
682682
try:
683683
linstor = LinstorVolumeManager(
684684
self._uri,

drivers/linstorvolumemanager.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ def get_all_volume_openers(resource_name, volume) -> LinstorVolumeOpeners:
101101
volume = str(volume)
102102
openers = {}
103103

104-
with util.APISession("SM-get-linstor-volume-openers") as session:
104+
with util.ApiSession("SM-get-linstor-volume-openers") as session:
105105
hosts = session.xenapi.host.get_all_records()
106106
for host_ref, host_record in hosts.items():
107107
node_name = host_record['hostname']
@@ -190,7 +190,7 @@ def get_controller_node_name():
190190
if res:
191191
return res.groups()[0]
192192

193-
session = util.timeout(5, util.APISession, "SM-get-linstor-controller-node-name").session
193+
session = util.timeout(5, util.ApiSession, "SM-get-linstor-controller-node-name").session
194194

195195
for host_ref, host_record in session.xenapi.host.get_all_records().items():
196196
node_name = host_record['hostname']
@@ -213,7 +213,7 @@ def get_controller_node_name():
213213
def demote_drbd_resource(node_name, resource_name):
214214
PLUGIN_CMD = 'demoteDrbdResource'
215215

216-
session = util.timeout(5, util.APISession, "SM-demote-drbd-resource").session
216+
session = util.timeout(5, util.ApiSession, "SM-demote-drbd-resource").session
217217

218218
for host_ref, host_record in session.xenapi.host.get_all_records().items():
219219
if host_record['hostname'] != node_name:
@@ -1410,7 +1410,7 @@ def destroy(self):
14101410
# It needs to be done locally by each host so we go through the linstor-manager plugin.
14111411
# If we don't do this sometimes, the destroy will fail when trying to destroy the resource groups with:
14121412
# "linstor-manager:destroy error: Failed to destroy SP `xcp-sr-linstor_group_thin_device` on node `r620-s2`: The specified storage pool 'xcp-sr-linstor_group_thin_device' on node 'r620-s2' can not be deleted as volumes / snapshot-volumes are still using it."
1413-
session = util.timeout(5, util.APISession, "SM-linstor-destroy").session
1413+
session = util.timeout(5, util.ApiSession, "SM-linstor-destroy").session
14141414
for host_ref in session.xenapi.host.get_all():
14151415
try:
14161416
response = session.xenapi.host.call_plugin(

drivers/mpathcount.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def add(key, val):
280280

281281
if __name__ == '__main__':
282282
try:
283-
with util.APISession("SM-mpathcount") as api_session:
283+
with util.ApiSession("SM-mpathcount") as api_session:
284284
main(api_session)
285285
except xs_errors.XenError as e:
286286
util.SMlog(f"MPATH: Failure `{e}`")

drivers/plugins/keymanagerutil.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def load_key(key_hash, vdi_uuid):
3939

4040

4141
def _check_key(key_hash, vdi_uuid):
42-
with util.APISession(PROGRAM_NAME) as session:
42+
with util.ApiSession(PROGRAM_NAME) as session:
4343
vdi = session.xenapi.VDI.get_by_uuid(vdi_uuid)
4444
sm_config = session.xenapi.VDI.get_sm_config(vdi)
4545
if 'key_hash' in sm_config:

0 commit comments

Comments
 (0)