標籤:cinder volume glusterfs
glusterfs.py檔案
cinder/volume/drivers/glusterfs.py就是cinder調用glusterfs的驅動了
glusterfs.py只有一個GlusterfsDriver class,如所示
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/74/0F/wKiom1YRPUnRLaXiAAFusJ8X2_k557.jpg" title="C70E0FD5-B930-491C-BDC1-4A37DBA77ADF.png" alt="wKiom1YRPUnRLaXiAAFusJ8X2_k557.jpg" />
from os_brick.remotefs import remotefs as remotefs_brick # client端操作from oslo_concurrency import processutilsfrom oslo_config import cfgfrom oslo_log import log as loggingfrom oslo_utils import fileutilsfrom oslo_utils import unitsfrom cinder import exceptionfrom cinder.i18n import _, _LE, _LI, _LWfrom cinder.image import image_utilsfrom cinder import utilsfrom cinder.volume import driver # 很多定義的方法還沒具體實現from cinder.volume.drivers import remotefs as remotefs_drv # 基類class GlusterfsDriver(remotefs_drv.RemoteFSSnapDriver, driver.CloneableVD, driver.ExtendVD): """Gluster based cinder driver. Creates file on Gluster share for using it as block device on hypervisor. Operations such as create/delete/extend volume/snapshot use locking on a per-process basis to prevent multiple threads from modifying qcow2 chains or the snapshot .info file simultaneously. """
class GlusterfsDriver的父類remotefs_drv.RemoteFSSnapDriver(主要看這個)
cinder/volume/drivers/remotefs.py有兩個class,類RemoteFSSnapDriver從類RemoteFSDriver繼承
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/74/10/wKiom1YRSxLAGSJYAAAqbeKufEQ015.jpg" title="4D5BB04F-1165-4103-8DBE-1DE43A801D4F.png" alt="wKiom1YRSxLAGSJYAAAqbeKufEQ015.jpg" />
class RemoteFSSnapDriver(RemoteFSDriver, driver.SnapshotVD): """Base class for remotefs drivers implementing qcow2 snapshots. Driver must implement: _local_volume_dir(self, volume) """
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M01/74/0D/wKioL1YRTOvyPUPWAAHrZK3EBnI775.jpg" title="3BD087CC-1149-4520-B3BE-8E0427C6892B.png" alt="wKioL1YRTOvyPUPWAAHrZK3EBnI775.jpg" />
類RemoteFSSnapDriver主要是針對volume snapshot的一系列操作。
類RemoteFSDriver可以認為是一個base class,裡面定義了很多基本方法
上面提到的class都是關於server端的封裝。
client端的封裝已經獨立為一個項目:os-brick
os_brick/remotefs/remotefs.py,只有一個class RemoteFsClient,右邊是類中定義的方法。
650) this.width=650;" src="http://s3.51cto.com/wyfs02/M02/74/0D/wKioL1YRUqng5AXVAAC1aI0wvv0686.jpg" title="BF5ACB8B-02C5-4695-A1DA-43312185B25C.png" alt="wKioL1YRUqng5AXVAAC1aI0wvv0686.jpg" />
未完待續。。。。。。
本文出自 “the-way-to-cloud” 部落格,請務必保留此出處http://iceyao.blog.51cto.com/9426658/1700198
cinder glusterfs driver代碼結構