Skip to content

Commit 5554cb1

Browse files
committed
fix linstorcowutil
1 parent 9165f76 commit 5554cb1

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

drivers/linstorcowutil.py

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ def get_block_bitmap(self, vdi_uuid, response):
288288
def get_drbd_size(self, vdi_uuid, response):
289289
return int(response)
290290

291-
def _get_drbd_size(self, cowutil_inst, path):
291+
def _get_drbd_size(self, path):
292292
(ret, stdout, stderr) = util.doexec(['blockdev', '--getsize64', path])
293293
if ret == 0:
294294
return int(stdout.strip())
@@ -414,7 +414,7 @@ def force_deflate(self, path, newSize, oldSize, zeroize):
414414
}
415415
return self._call_method('_force_deflate', 'deflate', path, use_parent=False, **kwargs)
416416

417-
def _force_deflate(self, cowutil_inst, path, newSize, oldSize, zeroize):
417+
def _force_deflate(self, path, newSize, oldSize, zeroize):
418418
self.deflate(path, newSize, oldSize, zeroize)
419419

420420
# --------------------------------------------------------------------------
@@ -479,9 +479,13 @@ def _raise_openers_exception(self, device_path, e):
479479
util.SMlog('raise opener exception: {}'.format(e_wrapper))
480480
raise e_wrapper # pylint: disable = E0702
481481

482-
def _call_local_method(self, local_method, device_path, *args, **kwargs):
482+
def _sanitize_local_method(self, local_method):
483483
if isinstance(local_method, str):
484-
local_method = getattr(self._cowutil, local_method)
484+
return getattr(self if local_method.startswith('_') else self._cowutil, local_method)
485+
return local_method
486+
487+
def _call_local_method(self, local_method, device_path, *args, **kwargs):
488+
local_method = self._sanitize_local_method(local_method)
485489

486490
try:
487491
def local_call():
@@ -512,8 +516,7 @@ def _call_method(self, local_method, remote_method, device_path, use_parent, *ar
512516
# another host using the DRBD opener list. In the other case, if the parent is required,
513517
# we must check where this last one is open instead of the child.
514518

515-
if isinstance(local_method, str):
516-
local_method = getattr(self._cowutil, local_method)
519+
local_method = self._sanitize_local_method(local_method)
517520

518521
# A. Try to write locally...
519522
try:
@@ -530,7 +533,8 @@ def _call_method(self, local_method, remote_method, device_path, use_parent, *ar
530533
# B.2. Prepare remote args.
531534
remote_args = {
532535
'devicePath': device_path,
533-
'groupName': self._linstor.group_name
536+
'groupName': self._linstor.group_name,
537+
'vdiType': self._vdi_type
534538
}
535539
remote_args.update(**kwargs)
536540
remote_args = {str(key): str(value) for key, value in remote_args.items()}

0 commit comments

Comments
 (0)