mirror of
				https://git.proxmox.com/git/proxmox
				synced 2025-10-31 07:34:02 +00:00 
			
		
		
		
	datastore: remove datastore from internal cache based on maintenance mode
We keep a DataStore cache, so ChunkStore's and lock files are kept by the proxy process and don't have to be reopened every time. However, for specific maintenance modes, e.g. 'offline', our process should not keep file in that datastore open. This clears the cache entry of a datastore if it is in a specific maintanance mode and the last task finished, which also drops any files still open by the process. Signed-off-by: Hannes Laimer <h.laimer@proxmox.com> Reviewed-by: Gabriel Goller <g.goller@proxmox.com> Tested-by: Gabriel Goller <g.goller@proxmox.com>
This commit is contained in:
		
							parent
							
								
									158f98fe72
								
							
						
					
					
						commit
						71ff7c3344
					
				| @ -77,6 +77,12 @@ pub struct MaintenanceMode { | ||||
| } | ||||
| 
 | ||||
| impl MaintenanceMode { | ||||
|     /// Used for deciding whether the datastore is cleared from the internal cache after the last
 | ||||
|     /// task finishes, so all open files are closed.
 | ||||
|     pub fn is_offline(&self) -> bool { | ||||
|         self.ty == MaintenanceType::Offline | ||||
|     } | ||||
| 
 | ||||
|     pub fn check(&self, operation: Option<Operation>) -> Result<(), Error> { | ||||
|         if self.ty == MaintenanceType::Delete { | ||||
|             bail!("datastore is being deleted"); | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Hannes Laimer
						Hannes Laimer