[libvirt] Quorum block driver libvirt support proposal

Benoît Canet benoit.canet at irqsave.net
Fri May 16 10:33:04 UTC 2014


Hello list,                                                                     
                                                                                
I want to implement libvirt Quorum support.                                     
(https://github.com/qemu/qemu/commit/c88a1de51ab2f26a9a37ffc317249736de8c015c)  
Quorum is a QEMU RAID like block storage driver.                                
Data are written on n replicas and when a read is done a comparison between the 
replica read is done. If more than threshold reads are identical the read succeed
else it's and error.

For example a Quorum with n = 3 and threshold = 2 would be made of three QCOW2
backing chains used as identicals replicas. threshold = 2 means that at least
2 replica must be identical when doing a read.                                                            
                                                                                
I want to make use of the new backingStore xml element to implement quorum.     
                                                                                
Proposed Quorum libvirt format:                                                 
-------------------------------                                                 
                                                                                
<disk type='quorum' device='disk'>                                              
  <driver name='qemu' type='quorum'/>                                           
  <threshold value=2/>                                                          
  <backingStore type='file'>                                                    
    <format type='qcow2'/>                                                      
    <source file='/var/lib/libvirt/images/file1.qcow2'/>                        
  </backingStore>                                                               
  <backingStore type='file'>                                                    
    <format type='qcow2'/>                                                      
    <source file='/var/lib/libvirt/images/file2.qcow2'/>                        
  </backingStore>                                                               
  <backingStore type='file'>                                                    
    <format type='qcow2'/>                                                      
    <source file='/var/lib/libvirt/images/file3.qcow2'/>                        
  </backingStore>                                                               
  <target dev='vda' bus='virtio'/>                                              
</disk>

Implementation plan:                                                            
--------------------                                                            
                                                                                
* Add VIR_STORAGE_TYPE_QUORUM                                                     
                                                                                
* In src/util/virstoragefile.h change _virStorageSource to contain a              
virStorageSourcePtrPtr backingStores.                                           
I think doing it at this level allow to keep a 1-1 mapping with the qemu        
BlockDriverState hiearchy                                                       
                                                                                
* Add a int quorum_threshold field to the same structure                          
                                                                                
* Add support for parsing treshold in virDomainDiskDefParseXML                    
                                                                                
* Change virDomainDiskBackingStoreParse to virDomainDiskBackingStoresParse to parse
all the backingStore at once an use realloc to grow the backingStores field.    
                                                                                
* Modify virDomainDiskDefFormat to call virDomainDiskBackingStoreFormat in a loop
  for saving
                                                                                
* hook into qemuBuildDriveStr around line 3442 to create the quorum parameters    

Do you feel that I am missing something ?

Best regards

Benoît                                                                              




More information about the libvir-list mailing list