Skip to content

Commit 66cecbc

Browse files
committed
refactor(LVHDSR): rename to "LVMSR"
1 parent d2845fa commit 66cecbc

File tree

13 files changed

+103
-103
lines changed

13 files changed

+103
-103
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ install: build
203203
ln -sf $$i"SR.py" $$i"SR"; \
204204
done
205205
rm $(SM_STAGING)$(SM_DEST)/SHMSR
206-
cd $(SM_STAGING)$(SM_DEST) && rm -f LVHDSR && ln -sf LVHDSR.py LVMSR
206+
cd $(SM_STAGING)$(SM_DEST) && rm -f LVMSR && ln -sf LVMSR.py LVHDSR
207207
cd $(SM_STAGING)$(SM_DEST) && rm -f RawISCSISR && ln -sf RawISCSISR.py ISCSISR
208208
cd $(SM_STAGING)$(SM_DEST) && rm -f LVHDoISCSISR && ln -sf LVHDoISCSISR.py LVMoISCSISR
209209
cd $(SM_STAGING)$(SM_DEST) && rm -f LVHDoHBASR && ln -sf LVHDoHBASR.py LVMoHBASR

drivers/LVHDSR.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
# along with this program; if not, write to the Free Software Foundation, Inc.,
1616
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
1717
#
18-
# LVHDSR: VHD on LVM storage repository
18+
# LVMSR: VHD on LVM storage repository
1919
#
2020

2121
from sm_typing import Dict, List, override
@@ -89,7 +89,7 @@
8989
# Log if snapshot pauses VM for more than this many seconds
9090
LONG_SNAPTIME = 60
9191

92-
class LVHDSR(SR.SR):
92+
class LVMSR(SR.SR):
9393
DRIVER_TYPE = 'lvhd'
9494

9595
PROVISIONING_TYPES = ["thin", "thick"]
@@ -149,7 +149,7 @@ def handles(type) -> bool:
149149
return type == "lvm"
150150
elif name.endswith("EXTSR"):
151151
return type == "ext"
152-
return type == LVHDSR.DRIVER_TYPE
152+
return type == LVMSR.DRIVER_TYPE
153153

154154
@override
155155
def load(self, sr_uuid) -> None:
@@ -452,7 +452,7 @@ def _refresh_size(self):
452452
# LVHDoHBASR, LVHDoISCSISR
453453
return scsiutil.refresh_lun_size_by_SCSIid(getattr(self, 'SCSIid'))
454454
else:
455-
# LVHDSR
455+
# LVMSR
456456
devices = self.dconf['device'].split(',')
457457
scsiutil.refreshdev(devices)
458458
return True
@@ -476,18 +476,18 @@ def _expand_size(self):
476476
# LVHDoHBASR, LVHDoISCSISR might have slaves
477477
scsiutil.refresh_lun_size_by_SCSIid_on_slaves(self.session,
478478
getattr(self, 'SCSIid'))
479-
util.SMlog("LVHDSR._expand_size for %s will resize the pv." %
479+
util.SMlog("LVMSR._expand_size for %s will resize the pv." %
480480
self.uuid)
481481
for pv in lvutil.get_pv_for_vg(self.vgname):
482482
lvutil.resizePV(pv)
483483
except:
484-
util.logException("LVHDSR._expand_size for %s failed to resize"
484+
util.logException("LVMSR._expand_size for %s failed to resize"
485485
" the PV" % self.uuid)
486486

487487
@override
488488
@deviceCheck
489489
def create(self, uuid, size) -> None:
490-
util.SMlog("LVHDSR.create for %s" % self.uuid)
490+
util.SMlog("LVMSR.create for %s" % self.uuid)
491491
if not self.isMaster:
492492
util.SMlog('sr_create blocked for non-master')
493493
raise xs_errors.XenError('LVMMaster')
@@ -516,7 +516,7 @@ def create(self, uuid, size) -> None:
516516

517517
@override
518518
def delete(self, uuid) -> None:
519-
util.SMlog("LVHDSR.delete for %s" % self.uuid)
519+
util.SMlog("LVMSR.delete for %s" % self.uuid)
520520
if not self.isMaster:
521521
raise xs_errors.XenError('LVMMaster')
522522
cleanup.gc_force(self.session, self.uuid)
@@ -527,7 +527,7 @@ def delete(self, uuid) -> None:
527527
continue
528528

529529
if util.doesFileHaveOpenHandles(fileName):
530-
util.SMlog("LVHDSR.delete: The dev mapper entry %s has open " \
530+
util.SMlog("LVMSR.delete: The dev mapper entry %s has open " \
531531
"handles" % fileName)
532532
success = False
533533
continue
@@ -544,7 +544,7 @@ def delete(self, uuid) -> None:
544544
os.unlink(lpath)
545545
except OSError as e:
546546
if e.errno != errno.ENOENT:
547-
util.SMlog("LVHDSR.delete: failed to remove the symlink for " \
547+
util.SMlog("LVMSR.delete: failed to remove the symlink for " \
548548
"file %s. Error: %s" % (fileName, str(e)))
549549
success = False
550550

@@ -553,7 +553,7 @@ def delete(self, uuid) -> None:
553553
if util.pathexists(self.path):
554554
os.rmdir(self.path)
555555
except Exception as e:
556-
util.SMlog("LVHDSR.delete: failed to remove the symlink " \
556+
util.SMlog("LVMSR.delete: failed to remove the symlink " \
557557
"directory %s. Error: %s" % (self.path, str(e)))
558558
success = False
559559

@@ -563,15 +563,15 @@ def delete(self, uuid) -> None:
563563
raise xs_errors.XenError('SRNotEmpty')
564564

565565
if not success:
566-
raise Exception("LVHDSR delete failed, please refer to the log " \
566+
raise Exception("LVMSR delete failed, please refer to the log " \
567567
"for details.")
568568

569569
lvutil.removeVG(self.dconf['device'], self.vgname)
570570
self._cleanup()
571571

572572
@override
573573
def attach(self, uuid) -> None:
574-
util.SMlog("LVHDSR.attach for %s" % self.uuid)
574+
util.SMlog("LVMSR.attach for %s" % self.uuid)
575575

576576
self._cleanup(True) # in case of host crashes, if detach wasn't called
577577

@@ -610,7 +610,7 @@ def attach(self, uuid) -> None:
610610

611611
@override
612612
def detach(self, uuid) -> None:
613-
util.SMlog("LVHDSR.detach for %s" % self.uuid)
613+
util.SMlog("LVMSR.detach for %s" % self.uuid)
614614
cleanup.abort(self.uuid)
615615

616616
# Do a best effort cleanup of the dev mapper entries
@@ -625,7 +625,7 @@ def detach(self, uuid) -> None:
625625
if util.doesFileHaveOpenHandles(fileName):
626626
# if yes, log this and signal failure
627627
util.SMlog(
628-
f"LVHDSR.detach: The dev mapper entry {fileName} has "
628+
f"LVMSR.detach: The dev mapper entry {fileName} has "
629629
"open handles")
630630
success = False
631631
continue
@@ -642,7 +642,7 @@ def detach(self, uuid) -> None:
642642
lvname = os.path.join(self.path, lvname)
643643
util.force_unlink(lvname)
644644
except Exception as e:
645-
util.SMlog("LVHDSR.detach: failed to remove the symlink for " \
645+
util.SMlog("LVMSR.detach: failed to remove the symlink for " \
646646
"file %s. Error: %s" % (fileName, str(e)))
647647
success = False
648648

@@ -653,7 +653,7 @@ def detach(self, uuid) -> None:
653653
if util.pathexists(self.path):
654654
os.rmdir(self.path)
655655
except Exception as e:
656-
util.SMlog("LVHDSR.detach: failed to remove the symlink " \
656+
util.SMlog("LVMSR.detach: failed to remove the symlink " \
657657
"directory %s. Error: %s" % (self.path, str(e)))
658658
success = False
659659

@@ -671,14 +671,14 @@ def detach(self, uuid) -> None:
671671
def forget_vdi(self, uuid) -> None:
672672
if not self.legacyMode:
673673
LVMMetadataHandler(self.mdpath).deleteVdiFromMetadata(uuid)
674-
super(LVHDSR, self).forget_vdi(uuid)
674+
super(LVMSR, self).forget_vdi(uuid)
675675

676676
@override
677677
def scan(self, uuid) -> None:
678678
activated = True
679679
try:
680680
lvname = ''
681-
util.SMlog("LVHDSR.scan for %s" % self.uuid)
681+
util.SMlog("LVMSR.scan for %s" % self.uuid)
682682
if not self.isMaster:
683683
util.SMlog('sr_scan blocked for non-master')
684684
raise xs_errors.XenError('LVMMaster')
@@ -815,7 +815,7 @@ def scan(self, uuid) -> None:
815815
new_vdi.cbt_enabled = True
816816
self.vdis[cbt_uuid] = new_vdi
817817

818-
super(LVHDSR, self).scan(uuid)
818+
super(LVMSR, self).scan(uuid)
819819
self._kickGC()
820820

821821
finally:
@@ -1600,7 +1600,7 @@ def clone(self, sr_uuid, vdi_uuid) -> str:
16001600

16011601
@override
16021602
def compose(self, sr_uuid, vdi1, vdi2) -> None:
1603-
util.SMlog("LVHDSR.compose for %s -> %s" % (vdi2, vdi1))
1603+
util.SMlog("LVMSR.compose for %s -> %s" % (vdi2, vdi1))
16041604
if not VdiType.isCowImage(self.vdi_type):
16051605
raise xs_errors.XenError('Unimplemented')
16061606

@@ -1623,7 +1623,7 @@ def compose(self, sr_uuid, vdi1, vdi2) -> None:
16231623
util.SMlog("Compose done")
16241624

16251625
def reset_leaf(self, sr_uuid, vdi_uuid):
1626-
util.SMlog("LVHDSR.reset_leaf for %s" % vdi_uuid)
1626+
util.SMlog("LVMSR.reset_leaf for %s" % vdi_uuid)
16271627
if not VdiType.isCowImage(self.vdi_type):
16281628
raise xs_errors.XenError('Unimplemented')
16291629

@@ -2263,6 +2263,6 @@ def _cbt_log_exists(self, logpath) -> bool:
22632263
return lvutil.exists(logpath)
22642264

22652265
if __name__ == '__main__':
2266-
SRCommand.run(LVHDSR, DRIVER_INFO)
2266+
SRCommand.run(LVMSR, DRIVER_INFO)
22672267
else:
2268-
SR.registerSR(LVHDSR)
2268+
SR.registerSR(LVMSR)

drivers/LVHDoFCoESR.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import SR
2424
import VDI
2525
import LVHDoHBASR
26-
import LVHDSR
26+
import LVMSR
2727
import SRCommand
2828
import sys
2929
import xs_errors
@@ -89,7 +89,7 @@ def load(self, sr_uuid) -> None:
8989
raise xs_errors.XenError('ConfigSCSIid')
9090

9191
self.SCSIid = self.dconf['SCSIid']
92-
LVHDSR.LVHDSR.load(self, sr_uuid)
92+
LVMSR.LVMSR.load(self, sr_uuid)
9393

9494
@override
9595
def vdi(self, uuid) -> VDI.VDI:

drivers/LVHDoHBASR.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
from sm_typing import override
2323

2424
import SR
25-
import LVHDSR
25+
import LVMSR
2626
import SRCommand
2727
import VDI
2828
import lvutil
@@ -58,7 +58,7 @@
5858
}
5959

6060

61-
class LVHDoHBASR(LVHDSR.LVHDSR):
61+
class LVHDoHBASR(LVMSR.LVMSR):
6262
"""LVHD over HBA storage repository"""
6363

6464
@override
@@ -120,7 +120,7 @@ def create(self, sr_uuid, size) -> None:
120120
self.mpathmodule.refresh(self.SCSIid, 0)
121121
self._pathrefresh(LVHDoHBASR)
122122
try:
123-
LVHDSR.LVHDSR.create(self, sr_uuid, size)
123+
LVMSR.LVMSR.create(self, sr_uuid, size)
124124
finally:
125125
if self.mpath == "true":
126126
self.mpathmodule.reset(self.SCSIid, explicit_unmap=True)
@@ -144,7 +144,7 @@ def attach(self, sr_uuid) -> None:
144144
# Must re-initialise the multipath node
145145
if self.mpath == "true":
146146
self.mpathmodule.refresh(self.SCSIid, 0)
147-
LVHDSR.LVHDSR.attach(self, sr_uuid)
147+
LVMSR.LVMSR.attach(self, sr_uuid)
148148
self._setMultipathableFlag(SCSIid=self.SCSIid)
149149

150150
@override
@@ -160,7 +160,7 @@ def scan(self, sr_uuid) -> None:
160160
self._setMultipathableFlag(SCSIid=self.SCSIid)
161161
else:
162162
self._pathrefresh(LVHDoHBASR)
163-
LVHDSR.LVHDSR.scan(self, sr_uuid)
163+
LVMSR.LVMSR.scan(self, sr_uuid)
164164

165165
@override
166166
def probe(self) -> str:
@@ -181,7 +181,7 @@ def probe(self) -> str:
181181

182182
try:
183183
self._pathrefresh(LVHDoHBASR)
184-
result = LVHDSR.LVHDSR.probe(self)
184+
result = LVMSR.LVMSR.probe(self)
185185
if self.mpath == "true":
186186
self.mpathmodule.reset(self.SCSIid, explicit_unmap=True)
187187
return result
@@ -192,7 +192,7 @@ def probe(self) -> str:
192192

193193
@override
194194
def detach(self, sr_uuid) -> None:
195-
LVHDSR.LVHDSR.detach(self, sr_uuid)
195+
LVMSR.LVMSR.detach(self, sr_uuid)
196196
self.mpathmodule.reset(self.SCSIid, explicit_unmap=True)
197197
try:
198198
pbdref = util.find_my_pbd(self.session, self.host_ref, self.sr_ref)
@@ -219,7 +219,7 @@ def _remove_device_nodes(self):
219219
def delete(self, sr_uuid) -> None:
220220
self._pathrefresh(LVHDoHBASR)
221221
try:
222-
LVHDSR.LVHDSR.delete(self, sr_uuid)
222+
LVMSR.LVMSR.delete(self, sr_uuid)
223223
finally:
224224
if self.mpath == "true":
225225
self.mpathmodule.reset(self.SCSIid, explicit_unmap=True)
@@ -230,7 +230,7 @@ def vdi(self, uuid) -> VDI.VDI:
230230
return LVHDoHBAVDI(self, uuid)
231231

232232

233-
class LVHDoHBAVDI(LVHDSR.LVHDVDI):
233+
class LVHDoHBAVDI(LVMSR.LVHDVDI):
234234
@override
235235
def generate_config(self, sr_uuid, vdi_uuid) -> str:
236236
util.SMlog("LVHDoHBAVDI.generate_config")

0 commit comments

Comments
 (0)