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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://listman.redhat.com/archives/libvirt-users/attachments/20120507/0fc28013/attachment.htm>
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>
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: > 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/20120508/bbcc696e/attachment.htm>
Possibly Parallel Threads
- Use libvirt-python to attach cdrom
- creating a domain
- Create volume wit libvirt API for Python
- libvirt and virt-manager - Unable to complete install: 'internal error: unsupported input bus usb'
- CentOS 7 Xen 4.12 libvirt/virt-manager wrong path for qemu-system-i386