vMConUtils.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:VManagePlatform 作者: welliamcao 项目源码 文件源码
def createVolumes(self,pool,volume_name,volume_capacity,drive=None):
        if drive is None:drive = 'qcow2'
        volume_xml = """<volume>
                            <name>{volume_name}</name>
                            <allocation>0</allocation>
                            <capacity unit="G">{volume_capacity}</capacity>
                            <target> 
                                <format type="{drive}"/> 
                            </target>                             
                        </volume>
        """        
        volume_xml = volume_xml.format(volume_name=volume_name,volume_capacity=volume_capacity,drive=drive)
        try:
            return pool.createXML(volume_xml, 0)
        except libvirt.libvirtError,e:
            return '?????????????{result}'.format(result=e.get_error_message())
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号