@@ -1730,15 +1730,21 @@ def _check_journal_coalesce_chain(self, sr_uuid: str, vdi_uuid: str) -> bool:
17301730 for entry in journal .getAll ("coalesce" ).keys ():
17311731 if entry in vdi_chain :
17321732 vdi_to_cancel .append (entry )
1733- util .SMlog ("Coalescing VDI {} in chain" .format (entry ))
1733+ util .SMlog ("VDI {} in chain is coalescing" .format (entry ))
1734+
1735+ for entry in journal .getAll ("relink" ).keys ():
1736+ if entry in vdi_chain :
1737+ util .SMlog ("VDI {} is in relink" .format (entry ))
1738+ return False #TODO: need to do stop and retry the activating after the relink
17341739
17351740 # Get the host_ref from the host doing the GC work
17361741 host_ref = self ._get_sr_master_host_ref ()
17371742 for vdi in vdi_to_cancel :
17381743 args = {"sr_uuid" : sr_uuid , "vdi_uuid" : vdi }
17391744 util .SMlog ("Calling cancel_coalesce_master with args: {}" .format (args ))
17401745 self ._session .xenapi .host .call_plugin (\
1741- host_ref , PLUGIN_ON_SLAVE , "cancel_coalesce_master" , args )
1746+ host_ref , PLUGIN_ON_SLAVE , "cancel_coalesce_master" , args ) #TODO: This can potentially never return if we send it after the coalesce is done and the relink is in process
1747+ # We could run it abortable and check regularly that the journal isn't here?
17421748
17431749 return True
17441750
@@ -1806,6 +1812,8 @@ def _activate_locked(self, sr_uuid, vdi_uuid, options):
18061812 util .SMlog ('Using key with hash {} for VDI {}' .format (key_hash , vdi_uuid ))
18071813 # Activate the physical node
18081814 dev_path = self ._activate (sr_uuid , vdi_uuid , options )
1815+ # if not dev_path:
1816+ # return False
18091817
18101818 if hasattr (self .target .vdi .sr , 'DRIVER_TYPE' ) and \
18111819 self .target .vdi .sr .DRIVER_TYPE == 'lvhd' and \
@@ -1846,6 +1854,9 @@ def _activate_locked(self, sr_uuid, vdi_uuid, options):
18461854 def _activate (self , sr_uuid , vdi_uuid , options ):
18471855 vdi_options = self .target .activate (sr_uuid , vdi_uuid )
18481856
1857+ # if not self._check_journal_coalesce_chain(sr_uuid, vdi_uuid):
1858+ # return None
1859+
18491860 dev_path = self .setup_cache (sr_uuid , vdi_uuid , options )
18501861 if not dev_path :
18511862 phy_path = self .PhyLink .from_uuid (sr_uuid , vdi_uuid ).readlink ()
0 commit comments