From 714fc579f782c6383ea678c6aa327fe418837729 Mon Sep 17 00:00:00 2001 From: Damien Thenot Date: Mon, 18 Mar 2024 11:18:44 +0100 Subject: [PATCH] feat(LargeBlock): Rename the VG to use our prefix We override the variable used by EXTSR for creation/access to the VG. Signed-off-by: Damien Thenot --- drivers/LargeBlockSR.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/LargeBlockSR.py b/drivers/LargeBlockSR.py index 2bd96178..2dc0531c 100644 --- a/drivers/LargeBlockSR.py +++ b/drivers/LargeBlockSR.py @@ -22,6 +22,7 @@ import xs_errors import os import re +import lvutil CAPABILITIES = ["SR_PROBE", "SR_UPDATE", "SR_SUPPORTS_LOCAL_CACHING", "VDI_CREATE", "VDI_DELETE", "VDI_ATTACH", "VDI_DETACH", @@ -43,6 +44,8 @@ 'configuration': CONFIGURATION } +LARGEBLOCK_PREFIX = "XSLargeBlock-" + class LargeBlockSR(EXTSR.EXTSR): """Emulating 512b drives for EXT storage repository""" @@ -56,6 +59,8 @@ def handles(srtype): def load(self, sr_uuid): super(LargeBlockSR, self).load(sr_uuid=sr_uuid) self.is_deleting = False + self.vgname = LARGEBLOCK_PREFIX + sr_uuid + self.remotepath = os.path.join("/dev", self.vgname, sr_uuid) def attach(self, sr_uuid): if not self.is_deleting: @@ -91,6 +96,11 @@ def delete(self, sr_uuid): finally: self._destroy_emulated_device(old_devices) self.is_deleting = False + @deviceCheck + def probe(self): + # We override EXTSR.probe because it uses EXT_PREFIX in this call + return lvutil.srlist_toxml(lvutil.scan_srlist(LARGEBLOCK_PREFIX, self.dconf['device']), + LARGEBLOCK_PREFIX) def _create_loopdev(self, dev, new_path): cmd = ["losetup", "-f", "-v", "--show", "--sector-size", str(self.LOOP_SECTOR_SIZE), dev]