Skip to content

Commit 80c20a3

Browse files
committed
repair pipeline
Signed-off-by: Ronan Abhamon <[email protected]>
1 parent 38ea04f commit 80c20a3

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

drivers/LinstorSR.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
import xmlrpc.client
5757
import xs_errors
5858

59-
from cowutil import getVdiTypeFromImageFormat
59+
from cowutil import CowUtil, getVdiTypeFromImageFormat
6060
from srmetadata import \
6161
NAME_LABEL_TAG, NAME_DESCRIPTION_TAG, IS_A_SNAPSHOT_TAG, SNAPSHOT_OF_TAG, \
6262
TYPE_TAG, VDI_TYPE_TAG, READ_ONLY_TAG, SNAPSHOT_TIME_TAG, \
@@ -1297,7 +1297,7 @@ def _get_vdi_path_and_parent(self, vdi_uuid, volume_name):
12971297

12981298
# Otherwise it's a COW and a parent can exist.
12991299
linstorcowutil = LinstorCowUtil(self.session, self._linstor, vdi_type)
1300-
if linstorcowutil.check(vdi_uuid) != cowutil.CheckResult.Success:
1300+
if linstorcowutil.check(vdi_uuid) != CowUtil.CheckResult.Success:
13011301
return (None, None)
13021302

13031303
image_info = linstorcowutil.get_info(vdi_uuid)
@@ -1348,7 +1348,7 @@ def _handle_interrupted_inflate(self, vdi_uuid, old_size):
13481348

13491349
current_size = volume_info.virtual_size
13501350
assert current_size > 0
1351-
linstorcowutil.force_deflate(vdi.path, old_size, current_size, zeroize=True)
1351+
vdi.linstorcowutil.force_deflate(vdi.path, old_size, current_size, zeroize=True)
13521352

13531353
def _handle_interrupted_clone(
13541354
self, vdi_uuid, clone_info, force_undo=False
@@ -2290,7 +2290,7 @@ def _create_snapshot(self, snap_vdi_type, snap_uuid, snap_of_uuid=None):
22902290
# 2. Write the snapshot content.
22912291
is_raw = (self.vdi_type == VdiType.RAW)
22922292
self.linstorcowutil.snapshot(
2293-
snap_path, self.path, is_raw, max(self.size, cowutil.getDefaultPreallocationSizeVirt())
2293+
snap_path, self.path, is_raw, max(self.size, self.linstorcowutil.cowutil.getDefaultPreallocationSizeVirt())
22942294
)
22952295

22962296
# 3. Get snapshot parent.

drivers/cleanup.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# Script to coalesce and garbage collect COW-based SR's in the background
1919
#
2020

21-
from sm_typing import Any, Optional, override
21+
from sm_typing import Any, Optional, List, override
2222

2323
import os
2424
import os.path
@@ -1524,7 +1524,7 @@ def load(self, info=None) -> None:
15241524

15251525
self.fileName = self.sr._linstor.get_volume_name(self.uuid)
15261526
self.path = self.sr._linstor.build_device_path(self.fileName)
1527-
self.linstorcowutil = LinstorCowUtil(self.sr.xapi.session, self.sr._linstor, self.cowutil)
1527+
self.linstorcowutil = LinstorCowUtil(self.sr.xapi.session, self.sr._linstor, info.vdiType)
15281528

15291529
if not info:
15301530
try:
@@ -2700,7 +2700,7 @@ def scan(self, force=False) -> None:
27002700
if not util.pathexists(self.path):
27012701
raise util.SMException("directory %s not found!" % self.uuid)
27022702

2703-
uuidsPresent: list[str] = []
2703+
uuidsPresent: List[str] = []
27042704

27052705
for vdi_type in VDI_COW_TYPES:
27062706
scan_result = self._scan(vdi_type, force)
@@ -3399,17 +3399,18 @@ def _load_vdi_info(self):
33993399
# Always RAW!
34003400
info = None
34013401
elif VdiType.isCowImage(vdi_type):
3402-
info = self.linstorcowutil.get_info(vdi_uuid)
3402+
info = LinstorCowUtil(self.xapi.session, self._linstor, vdi_type).get_info(vdi_uuid)
34033403
else:
3404-
# Ensure it's not a VHD...
3404+
# Ensure it's not a COW image...
3405+
linstorcowutil = LinstorCowUtil(self.xapi.session, self._linstor, vdi_type)
34053406
try:
3406-
info = self.linstorcowutil.get_info(vdi_uuid)
3407+
info = linstorcowutil.get_info(vdi_uuid)
34073408
except:
34083409
try:
3409-
self._vhdutil.force_repair(
3410+
linstorcowutil.force_repair(
34103411
self._linstor.get_device_path(vdi_uuid)
34113412
)
3412-
info = self.linstorcowutil.get_info(vdi_uuid)
3413+
info = linstorcowutil.get_info(vdi_uuid)
34133414
except:
34143415
info = None
34153416

@@ -3418,7 +3419,7 @@ def _load_vdi_info(self):
34183419
' [VDI {}: failed to load VDI info]: {}'
34193420
.format(vdi_uuid, e)
34203421
)
3421-
info = vhdutil.VHDInfo(vdi_uuid)
3422+
info = cowutil.CowImageInfo(vdi_uuid)
34223423
info.error = 1
34233424

34243425
all_vdi_info[vdi_uuid] = info

drivers/verifyVHDsOnSR.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
import VDI
2929

3030
from constants import NS_PREFIX_LVM, VG_LOCATION, VG_PREFIX
31+
from cowutil import getCowUtil
3132
from lock import Lock
3233
from lvmcowutil import LV_PREFIX, LvmCowUtil
3334
from refcounter import RefCounter

0 commit comments

Comments
 (0)