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
2121from sm_typing import Dict , List , override
8989# Log if snapshot pauses VM for more than this many seconds
9090LONG_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
22652265if __name__ == '__main__' :
2266- SRCommand .run (LVHDSR , DRIVER_INFO )
2266+ SRCommand .run (LVMSR , DRIVER_INFO )
22672267else :
2268- SR .registerSR (LVHDSR )
2268+ SR .registerSR (LVMSR )
0 commit comments