分享

OpenStack Cinder源码分析之六

shihailong123 发表于 2014-11-23 13:47:08 [显示全部楼层] 回帖奖励 阅读模式 关闭右栏 0 17814
阅读导读:
1.lvm.py主要作用?
2.glusterfs.py是什么?
3.SheepdogDriver的作用?





感谢朋友支持本博客,欢迎共同探讨交流,由于能力和时间有限,错误之处在所难免,欢迎指正!

我们继续来整理代码,继续来看cinder中volume部分的代码。
/cinder/volume/drivers/
/cinder/volume/drivers/emc----emc卷存储驱动;
/cinder/volume/drivers/hds----hus卷存储驱动;
/cinder/volume/drivers/huawei----huawei卷存储驱动;
/cinder/volume/drivers/netapp----NetApp卷存储驱动;
/cinder/volume/drivers/nexenta----Nexenta卷存储驱动;
/cinder/volume/drivers/san----San卷存储驱动;
/cinder/volume/drivers/vmware----VMware卷存储驱动;
/cinder/volume/drivers/windows----Windows卷存储驱动;
/cinder/volume/drivers/xenapi----XenApi卷存储驱动;
/cinder/volume/drivers/coraid.py----Coraid卷存储驱动;
/cinder/volume/drivers/eqlx.py----DELL卷存储驱动;
/cinder/volume/drivers/gpfs.py----GPFS卷存储驱动;
/cinder/volume/drivers/nfs.py----NFS卷存储驱动;
/cinder/volume/drivers/rbd.py----RADOS块设备驱动;
/cinder/volume/drivers/scality.py----ScalitySOFS卷驱动;
/cinder/volume/drivers/solidfire.py----SolidFire卷驱动;
/cinder/volume/drivers/storwize_svc.py----IBMStorwize和SVC卷驱动;
/cinder/volume/drivers/xiv_ds8k.py----IBMXIV和DS8K存储系统卷驱动;
/cinder/volume/drivers/zadara.py----VPSA卷驱动;
/cinder/volume/drivers/glusterfs.py----Glusterfs卷存储驱动;
  •     class GlusterfsDriver(nfs.RemoteFsDriver):Glusterfs文件系统驱动;
  • def do_setup(self, context):启动的时候进行卷驱动的初始化操作;
  • def _local_volume_dir(self, volume):根据卷的属性确定本地卷的直接路径;
  • def _local_path_volume(self, volume):根据卷的属性确定本地卷的全路径;
  • def _local_path_volume_info(self, volume):根据卷的属性确定本地卷的全路径信息;
  • def _qemu_img_info(self, path):从路径中获取qemu-img信息;
  • def get_active_image_from_info(self, volume):从指定的卷中获取状态为活跃的镜像快照的文件名;
  • def create_cloned_volume(self, volume, src_vref):建立指定卷的拷贝;
  • def create_volume(self, volume):实现建立指定的卷操作;
  • def create_volume_from_snapshot(self, volume, snapshot):实现从快照建立卷的操作(要求用于建立卷的快照的状态是活跃的);
  • def _copy_volume_from_snapshot(self, snapshot, volume, volume_size):实现从快照拷贝数据到目标卷的操作;
  • def delete_volume(self, volume):实现删除一个逻辑卷的操作;
  • def create_snapshot(self, snapshot):实现建立快照的操作;
  • def _create_qcow2_snap_file(self, snapshot, backing_filename,new_snap_path):建立QCOW2格式的快照文件,并备份于指定的用于备份的文件中;
  • def _create_snapshot(self, snapshot, path_to_disk, snap_id):实现建立快照的操作(离线状态下);
  • def _read_file(self, filename):实现都取指定文件内容信息;
  • def _read_info_file(self, info_path, empty_if_missing=False):获取包含快照信息的字典;
  • def _write_info_file(self, info_path, snap_info):将snap_info中的数据写入文件路径info_path中;
  • def delete_snapshot(self, snapshot):实现删除一个快照的操作;
  • def _delete_snapshot_online(self, context, snapshot, info):实现在线删除快照文件的操作;
  • def ensure_export(self, ctx, volume):为指定的逻辑卷重建一个导出;
  • def create_export(self, ctx, volume):实现导出卷的操作;
  • def remove_export(self, ctx, volume):实现删除指定逻辑卷的导出;
  • def initialize_connection(self, volume, connector):允许连接到连接器,并返回连接信息;
  • def terminate_connection(self, volume, connector, **kwargs):断开到连接器的链接;
  • def copy_volume_to_image(self, context, volume, image_service,image_meta):拷贝卷到指定的镜像image_service;
  • def extend_volume(self, volume, size_gb):根据给定的镜像大小值,实现为给定卷路径的卷的扩展操作;
  • def _do_create_volume(self, volume):实现在给定的GlusterFS共享文件系统上建立卷的操作;
  • def _ensure_shares_mounted(self):挂载所有配置GlusterFS共享文件,并存储所有的挂载点信息;
  • def _ensure_share_mounted(self, glusterfs_share):实现挂载GlusterFS共享文件系统;
  • def _find_share(self, volume_size_for):根据给定的卷大小在多个可用的GlusterFS共享文件系统中选取合适的GlusterFS共享文件系统;目前的实现是根据所拥有最大的capacity数据来进行确定;
  • def _get_hash_str(self, base_str):获取hash字符串;
  • def _get_mount_point_for_share(self, glusterfs_share):为共享文件获取挂载点(例子:172.18.194.100:/var/glusterfs);
  • def _get_available_capacity(self, glusterfs_share):计算GlusterFS共享文件的可用空间信息;
  • def _get_capacity_info(self, glusterfs_share):获取GlusterFS共享文件的capacity信息;
  • def _mount_glusterfs(self, glusterfs_share, mount_path, ensure=False):实现挂载GlusterFS共享磁盘到指定的路径mount_path上;
/cinder/volume/drivers/lvm.py----LVM卷存储驱动;
  •     class LVMVolumeDriver(driver.VolumeDriver):执行与卷相关的命令行;
  • def _delete_volume(self, volume, is_snapshot=False):实现删除一个逻辑卷操作;
  • def _create_volume(self, name, size, lvm_type, mirror_count, vg=None):在对象的VG上建立一个逻辑卷;
  • def create_volume(self, volume):实现建立逻辑卷;
  • def create_volume_from_snapshot(self, volume, snapshot):实现从给定的快照建立卷的操作;
  • def delete_volume(self, volume):实现删除一个逻辑卷的操作;
  • def clear_volume(self, volume, is_snapshot=False):清除旧的卷数据以防止用户之间的数据泄露;
  • def create_snapshot(self, snapshot):实现为逻辑卷建立快照;
  • def delete_snapshot(self, snapshot):实现删除一个逻辑卷快照操作;
  • def local_path(self, volume, vg=None):获取卷的本地路径信息;
  • def copy_image_to_volume(self, context, volume, image_service,image_id):实现从image_service中获取镜像数据,并写入到卷中;
  • def copy_volume_to_image(self, context, volume, image_service,image_meta):实现拷贝卷的数据到指定的镜像;
  • def create_cloned_volume(self, volume, src_vref):实现建立一个指定卷的拷贝操作;
  • def backup_volume(self, context, backup, backup_service):实现从一个已存在的卷建立一个新的备份操作;
  • def restore_backup(self, context, backup, volume, backup_service):还原一个现有的备份到一个新的或者是已存在的卷;
  • def get_volume_stats(self, refresh=False):获取卷的状态;如果refresh的值为True,则进行先更新卷的状态操作;
  • def _update_volume_stats(self):从卷组检索获取统计数据信息;
  • def extend_volume(self, volume, new_size):为存在的卷实现大小的扩展;
  •     class LVMISCSIDriver(LVMVolumeDriver, driver.ISCSIDriver):执行与ISCSI卷相关的命令行;
  • def _create_tgtadm_target(self, iscsi_name, iscsi_target, volume_path,chap_auth, lun=0, check_exit_code=False, old_name=None):实现建立tgtadm目标操作;
  • def ensure_export(self, context, volume):实现为逻辑卷同步重建导出的操作;
  • def _ensure_iscsi_targets(self, context, host):确认target在数据存储系统中已经建立;
  • def create_export(self, context, volume):实现建立逻辑卷的导出操作;
  • def _create_export(self, context, volume, vg=None):实现建立一个逻辑卷的导出操作;
  • def remove_export(self, context, volume):实现删除一个逻辑卷的导出操作;
  • def migrate_volume(self, ctxt, volume, host, thin=False,mirror_count=0):卷的迁移操作;如果卷的迁移的目标节点和源节点在相同的服务器上,则优化迁移操作;
  •     class LVMISERDriver(LVMISCSIDriver,driver.ISERDriver):执行与ISER卷相关的命令行;
  • def ensure_export(self, context, volume):实现为逻辑卷同步重建导出的操作;
  • def _ensure_iser_targets(self, context, host):确认target ids已经在数据存储中建立;
  • def create_export(self, context, volume):实现建立逻辑卷的导出操作;
  • def remove_export(self, context, volume):实现删除一个逻辑卷的导出操作;
/cinder/volume/drivers/sheepdog.py----sheepdog卷驱动;
  •     class SheepdogDriver(driver.VolumeDriver):执行和Sheepdog存储卷相关的命令;
  • def check_for_setup_error(self):如果必要条件不符合,则返回错误信息;
  • def create_volume(self, volume):实现建立一个sheepdog卷的操作;
  • def create_volume_from_snapshot(self, volume, snapshot):实现从快照建立一个sheepdog卷的操作;
  • def delete_volume(self, volume):实现删除一个逻辑卷的操作;
  • def _ensure_dir_exists(self, tmp_dir):检测tmp_dir路径是否存在,如果不存在的话,建立其指定的文件夹;
  • def _resize(self, volume, size=None):实现调整卷的大小操作;
  • def _delete(self, volume):实现删除一个逻辑卷的操作;
  • def create_snapshot(self, snapshot):实现建立一个sheepdog快照的操作;
  • def delete_snapshot(self, snapshot):实现删除一个sheepdog快照的操作;
  • def ensure_export(self, context, volume):实现重建并导出逻辑卷的操作;
  • def create_export(self, context, volume):实现导出卷的操作;
  • def remove_export(self, context, volume):实现删除一个逻辑卷的导出的操作;
  • def initialize_connection(self, volume, connector):实现初始化到连接器的连接操作;
  • def terminate_connection(self, volume, connector, **kwargs):实现中止到连接器的连接操作;
  • def _update_volume_stats(self):实现更新卷的统计数据信息的操作;
  • def get_volume_stats(self, refresh=False):实现获取卷的统计数据信息的操作;
  • def extend_volume(self, volume, new_size):扩展一个已存在的卷的大小;
  • def backup_volume(self, context, backup, backup_service):为已存在的卷建立一个新的备份;
  • def restore_backup(self, context, backup, volume, backup_service):还原一个现有的备份为新的卷或者已存在的卷;



相关文章



OpenStack Cinder源码分析之一
http://www.aboutyun.com/thread-10236-1-1.html


OpenStack Cinder源码分析之二
http://www.aboutyun.com/thread-10242-1-1.html


OpenStack Cinder源码分析之三
http://www.aboutyun.com/thread-10243-1-1.html


OpenStack Cinder源码分析之四
http://www.aboutyun.com/thread-10244-1-1.html

OpenStack Cinder源码分析之五
http://www.aboutyun.com/thread-10245-1-1.html



OpenStack Cinder源码分析之七
http://www.aboutyun.com/thread-10247-1-1.html


OpenStack Cinder源码分析之八
http://www.aboutyun.com/thread-10248-1-1.html






如果转载,请保留作者信息。
博客地址:http://blog.csdn.net/gaoxingnengjisuan
邮箱地址:dong.liu@siat.ac.cn

没找到任何评论,期待你打破沉寂

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

关闭

推荐上一条 /2 下一条