Skip to content

Commit a93bc71

Browse files
committed
[vmware] VmdkDriverRemoteApi: RPC initialization improvements
Currently, creating the RPC client at the driver initialization might lead into an issue that, while upgrading to newer releases, the RPC client will limit the maximum RPC version to the older release's version, since that version is never refreshed while the volume backend is running. Initializing the RPC client every time it's needed will make sure it always refreshes the available RPC service versions. Also, inherit the RPC_DEFAULT_VERSION from the VolumeAPI, so that the smallest available major version is requested by default, instead of the biggest available version.
1 parent 893c218 commit a93bc71

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

cinder/volume/drivers/vmware/remote.py

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

2929
class VmdkDriverRemoteApi(rpc.RPCAPI):
3030
RPC_API_VERSION = VolumeAPI.RPC_API_VERSION
31-
RPC_DEFAULT_VERSION = RPC_API_VERSION
31+
RPC_DEFAULT_VERSION = VolumeAPI.RPC_DEFAULT_VERSION
3232
TOPIC = VolumeAPI.TOPIC
3333
BINARY = VolumeAPI.BINARY
3434

cinder/volume/drivers/vmware/vmdk.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,6 @@ def __init__(self, *args, **kwargs):
337337
self.additional_endpoints.extend([
338338
remote_api.VmdkDriverRemoteService(self)
339339
])
340-
self._remote_api = remote_api.VmdkDriverRemoteApi()
341340

342341
@staticmethod
343342
def get_driver_options():
@@ -2645,18 +2644,19 @@ def migrate_volume(self, context, volume, host):
26452644
{'volume_name': volume.name, 'dest_host': dest_host})
26462645
return (True, None)
26472646

2648-
service_locator = self._remote_api.get_service_locator_info(context,
2649-
dest_host)
2650-
ds_info = self._remote_api.select_ds_for_volume(context, dest_host,
2651-
volume)
2647+
dest_api = remote_api.VmdkDriverRemoteApi()
2648+
2649+
service_locator = dest_api.get_service_locator_info(context, dest_host)
2650+
ds_info = dest_api.select_ds_for_volume(context, dest_host, volume)
2651+
26522652
host_ref = vim_util.get_moref(ds_info['host'], 'HostSystem')
26532653
rp_ref = vim_util.get_moref(ds_info['resource_pool'], 'ResourcePool')
26542654
ds_ref = vim_util.get_moref(ds_info['datastore'], 'Datastore')
26552655

26562656
self.volumeops.relocate_backing(backing, ds_ref, rp_ref, host_ref,
26572657
service=service_locator)
26582658
try:
2659-
self._remote_api.move_volume_backing_to_folder(
2659+
dest_api.move_volume_backing_to_folder(
26602660
context, dest_host, volume, ds_info['folder'])
26612661
except Exception:
26622662
# At this point the backing has been migrated to the new host.

0 commit comments

Comments
 (0)