[libvirt-users] creation of storage volume fails

John Wayne m01z04-libvirt at yahoo.com
Tue May 8 02:54:36 UTC 2012


i figured out the problem, i had to change CreateXML to createXML


________________________________
 From: John Wayne <m01z04-libvirt at yahoo.com>
To: "libvirt-users at redhat.com" <libvirt-users at redhat.com> 
Sent: Monday, May 7, 2012 6:58 PM
Subject: [libvirt-users] creation of storage volume fails
 

hi,
i am getting this error below when i try to create a storage volume:

    libvirt.virStoragePool.CreateXML(storagepoolobject,xmldesc,0)
AttributeError: class virStoragePool has no attribute 'CreateXML'

my code is:
xmldesc="xml description of storage volume which i got from sudo virsh vol-dumpxml"

#get a storage pool object to use in creating a volume
storagepoolobject=libvirt.virConnect.storagePoolLookupByName(conn,'poolname')

#now try to create the volume using the above storage pool object
libvirt.virStoragePool.CreateXML(storagepoolobject,xmldesc,0)


from python:
-bash-4.1$ python
>>> import libvirt


>>> dir(libvirt.virStoragePool)
['UUID', 'UUIDString', 'XMLDesc', '__del__', '__doc__', '__init__', '__module__', 'autostart', 'build', 'connect', 'create', 'createXML', 'createXMLFrom', 'delete', 'destroy', 'info', 'isActive', 'isPersistent', 'listVolumes', 'name', 'numOfVolumes', 'refresh', 'setAutostart', 'storageVolLookupByName', 'undefine']

>>> help(libvirt.virStoragePool.createXML)
Help on method createXML in module libvirt:

createXML(self, xmldesc, flags) unbound libvirt.virStoragePool method
    Create a storage volume within a pool based
    on an XML description. Not all pools support
    creation of volumes

from the libvirt.org documentation:
http://libvirt.org/html/libvirt-libvirt.html#virStorageVolCreateXML
virStorageVolPtrvirStorageVolCreateXML(virStoragePoolPtr pool, 
 const char * xmldesc, 
 unsigned int flags)
Create a storage volume within a pool based on an XML description. Not all pools support creation of volumes
pool:pointer to storage pool
xmldesc:description of volume to create
flags:extra flags; not used yet, so callers should always pass 0
Returns:the storage volume, or NULL on error

_______________________________________________
libvirt-users mailing list
libvirt-users at redhat.com
https://www.redhat.com/mailman/listinfo/libvirt-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120507/24409bd1/attachment.htm>


More information about the libvirt-users mailing list