Hi Alex,

Thanks for your flow chart. But I'm stuck in getting Storage Pool here.
I try to get StoragePoolPtr by using something like

 int num = virConnectNumOfStoragePools( conn );

it truns out num = 0;

I think I missed something and missunderstand the Storage Pool & Storage 
Volume. So I refer to the http://libvirt.org/archstorage.html and 
http://libvirt.org/guide/html/ , but guide book about storage is in status 
"TBD".  So, is there some tutorial or guideline I can follow to get the Storage 
Ptr and then get the XML description and finally clone one?

Thank you

Regards


2010-11-14 



Lancer 



发件人: ajia 
发送时间: 2010-11-12  10:40:27 
收件人: 黄亮 
抄送: libvir-list 
主题: Re: [libvirt] Is there an API for clone? 
 
On 11/12/2010 02:07 AM, 黄亮 wrote: 
Hi Alex

Thank you for your reply.
I just wanna make sure I'm not misunderstanding, virStorageVolGetXMLDesc & 
virStorageVolCreateXMLFrom together can do the clone process, am I right?
In fact, libvirt will call a group of APIs to complete vol-clone operation, you 
can track the whole calling process, it  looks like this:
                                              virsh vol-clone <vol-key> 
<newname>
                                                                           |
                                                                          V
                                                             virConnectOpenAuth
                                                                           |
                                                                          V
                                                        virStorageVolLookupByKey
                                                                           |
                                                                          V
                                                       
virStoragePoolLookupByVolume  ('default' is default pool)
                                                                           |
                                                                          V
                                                       virStorageVolGetXMLDesc
                                                                           |
                                                                          V
                                                     virStorageVolCreateXMLFrom
                                                                           |
                                                                          V
                                                           virStorageVolGetName 
(twice)
                                                                           |
                                                                          V
                                                              virStorageVolFree 
   (twice) 
                                                                           |
                                                                          V
                                                             virStoragePoolFree
                                                                           |
                                                                          V
                                                               virConnectClose
                                                    
                                                                                
                   
  Alex


Regards


2010-11-12 



Lancer 



发件人: Alex Jia 
发送时间: 2010-11-10  13:28:21 
收件人: 黄亮 
抄送: libvir-list 
主题: Re: [libvirt] Is there an API for clone? 
Hi lancer,
As Osier said, libvirt hasn't a independent API for cloning an
existing guest, instead of using virStorageVolGetXMLDesc API to 
get a guest volume xml description and then calling  
virStorageVolCreateXMLFrom API to clone a new volume.
For python-virtinst component, you may use virt-clone to implement
this, for libvirt component, you may directly use python binding
API or virsh tool 'vol-clone' to implement it.
I hope it's helpful for you.
- Alex
----- Original Message -----
From: "黄亮" <lancerhu...@163.com>
To: "libvir-list" <libvir-list@redhat.com>
Sent: Wednesday, November 10, 2010 9:30:28 AM GMT +08:00 Beijing / Chongqing / 
Hong Kong / Urumqi
Subject: [libvirt] Is there an API for clone?
Hi, guys 
I know there is a command "virt-clone", but I couldn't find the equivalent API 
here : http://libvirt.org/html/libvirt-libvirt.html 
So, is there an API to clone an existing VM or not? 
Thank you! 
Regards 
2010-11-10 
Lancer 
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
__________ Information from ESET Smart Security, version of virus signature 
database 5605 (20101109) __________
The message was checked by ESET Smart Security.
http://www.eset.com



__________ Information from ESET Smart Security, version of virus signature 
database 5612 (20101111) __________

The message was checked by ESET Smart Security.

http://www.eset.com
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list

Reply via email to