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())
评论列表
文章目录