使用python libvirt 接口函数创建 dir 类型存储池、存储卷及删除 存储卷、存储池
来源:互联网 发布:巅峰霍华德身体数据 编辑:程序博客网 时间:2024/05/17 16:12
研究libvirt存储部分,简单例子进行测试验证:
import libvirtconn=libvirt.open('qemu:///system')#conn=libvirt.open('qemu:///system')xmldesc='''<pool type="dir"> <name>virttest</name> <target> <path>/var/images_test</path> </target></pool>'''#storage_pool.connect()storage_pool= conn.storagePoolDefineXML(xmldesc, 0) # virStoragePool 类对象print storage_pool.name()print conn.isAlive()storage_pool.build(0) # 创建storage_pool.create(0) # 开启存储storage_pool.isActive()xmldesd_vol='''<volume type="file"> <name>qcow2.img</name> <allocation unit="M">10</allocation> <capacity unit="M">1000</capacity> <target> <format type="qcow2"/> </target></volume>'''print storage_pool.createXML(xmldesd_vol,0) #virStorageVol 类对象print storage_pool.listVolumes()print storage_pool.isActive()
输出结果:
virttest1<libvirt.virStorageVol instance at 0x7faa5fa55518>['qcow2.img']1
删除存储卷、存储池
import libvirtconn=libvirt.open('qemu:///system')#conn=libvirt.open('qemu:///system')''' 删除 pool vol'''storage_pool=conn.storagePoolLookupByName("virttest")#storage_pool.create(0) # 开启存储池s_v=storage_pool.storageVolLookupByName('qcow2.img')print s_vprint s_v.delete(0) print storage_pool.destroy() #停用 存储print storage_pool.delete(0) # 删除 存储,删除前应保证存储池内没有vol了print storage_pool.undefine() # 删除 存储定义
- 使用python libvirt 接口函数创建 dir 类型存储池、存储卷及删除 存储卷、存储池
- KVM存储池\存储卷
- Libvirt源码分析Part1-存储池和卷的表象与细节之存储池
- Libvirt源码分析Part1-存储池和卷的表象与细节之存储池
- KVM存储池与存储卷,使用virt-install创建虚拟机
- KVM存储池与存储卷,使用virt-install创建虚拟机
- python libvirt 创建 iscsi 存储池、及存储池与iscsi 概念对应关系
- 存储卷的介绍
- kubernetes使用cephRBD作为存储卷
- docker使用lvm卷存储镜像
- 第五 使用逻辑卷管理器灵活存储
- 使用逻辑卷管理器管理灵活存储
- 使用逻辑卷管理器管理灵活存储
- 使用逻辑卷管理器管理灵活存储
- 使用逻辑卷管理灵活存储
- openstack kilo 卷备份使用nfs作为后端存储
- Linux下使用逻辑卷管理器管理灵活存储
- 5.使用逻辑卷管理器管理灵活存储 lvm
- 内存代表的实际含义
- PB11 WebService 安装时遇到的问题处理方法
- 无符号数与有符号数转换的原理
- ok6410学习笔记(5.阻塞字符驱动)
- 【Linux操作系统分析】进程——进程切换,进程的创建和撤销
- 使用python libvirt 接口函数创建 dir 类型存储池、存储卷及删除 存储卷、存储池
- jQuery中 $.fn的用法
- Eclipse – “Too many open files” Problem
- C#程序集
- Linux 性能监控分析
- Linux中断 - PIC
- 查看ADT版本,安装、卸载、更新eclipse中的ADT
- VC2008中影响exe大小和速度的全部编译选项
- JS、replace 利用正则表达式 ,一次性替换SQL所有参数为数据