Re: creation of storage volume fails

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/08/2012 09:58 AM, John Wayne wrote:
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'
Please see the above error message carefully, you're calling a error function name, it should be
'createXML' not 'CreateXML':

>>> 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']


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:
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

_______________________________________________ libvirt-users mailing list libvirt-users@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvirt-users

_______________________________________________
libvirt-users mailing list
libvirt-users@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvirt-users

[Index of Archives]     [Virt Tools]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [KDE Users]

  Powered by Linux