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
virStorageVolPtr virStorageVolCreateXML (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