Thanks a lot Justin for such a detailed explanation.
 
> If the domain has an XML definition for it in place, the "Destroy"
> command won't touch it.  You can start the domain again using the
> "Create" function:
>
http://libvirt.org/html/libvirt-libvirt.html#virDomainCreate
>
> If you want to get rid of an XML definition for the domain from a
> server, the command you're looking for is "undefine":
>
http://libvirt.org/html/libvirt-libvirt.html#virDomainUndefine
I understood now what the destroy function does. As for "domainUndefine":
To quote from the "undefine" method's documentation:
Undefine a domain but does not stop it if it is running
So, If the Domain remains as it is, what is the significance of removing the XML Description/Definition?
What I want to do, is to remove the Domain completely from the system, including its associated virtual disks. Is there any way to do this using the API?
 
>> Secondly, Is it possible to boot a domain on a completely different physical
>> host with the same Hypervisor configuration?
>
> You can use libvirt for this, but it's not automatic.  As far as I know,
> you'll need to have your software connect to each of the servers and
> launch the appropriate virDomainCreate() (and probably other) commands.
> So, it would be up to your application to make sure that the domain is
> not running on server A, before you launch it on server B.
I am sorry, but I did not get this quite completely. Could you please explain this a bit more? Especially the "it would be up to your application to make sure that the domain is
not running on server A, before you launch it on server B
" part. Firstly, how will I get the domain from server A to server B to launch it there? By migrating it to server B?
 
Please help.
 
Thanks and Regards
Sagar Barve
----- Original Message -----
From: "Justin Clift" <justin@salasaga.org>
To: "IKI-サガル バルウェ" <sagar.barve@ikic.co.jp>
Cc: <libvir-list@redhat.com>
Sent: Thursday, June 17, 2010 5:17 PM
Subject: Re: [libvirt] 1. Domain Destroy , 2. Domain boot on a different host and 3. Domain start time

> On 06/17/2010 05:50 PM, IKI-サガル バルウェ wrote:
>> Hello,
>>
>> Firstly, I have some confusion about the libvirt API  "virDomainDestroy"
>> method. here is the link to API:
>>
http://libvirt.org/html/libvirt-libvirt.html#virDomainDestroy
>
> "Destroy" here can be a bit confusing.  It doesn't really touch or
> remove the disk data.  "Destroy" in this case means to destroy just the
> running instance of the domain.  i.e. stop running it, free up the
> memory that was allocated to it, and free up any devices (network
> resource, etc) that had been assigned to it.
>
> If the domain has an XML definition for it in place, the "Destroy"
> command won't touch it.  You can start the domain again using the
> "Create" function:
>
http://libvirt.org/html/libvirt-libvirt.html#virDomainCreate
>
> If you want to get rid of an XML definition for the domain from a
> server, the command you're looking for is "undefine":
>
http://libvirt.org/html/libvirt-libvirt.html#virDomainUndefine
>
>
>> Secondly, Is it possible to boot a domain on a completely different physical
>> host with the same Hypervisor configuration?
>> For. E.g: if I have a domain on a host 192.168.101.1 running Xen with a
>> Domain "test" in shutdown state. If I have to start/boot the domain "test"
>> on a different physical host, running Xen say 192.168.101.2, is it possible
>> using libvirt API? If not, then is there any other method to do it?
>
> You can use libvirt for this, but it's not automatic.  As far as I know,
> you'll need to have your software connect to each of the servers and
> launch the appropriate virDomainCreate() (and probably other) commands.
> So, it would be up to your application to make sure that the domain is
> not running on server A, before you launch it on server B.
>
>
>> Thirdly, Is there a method to get the total running time of a domain? I
>> mean, the amount of time since the domain had been booted. Currently, I can
>> fetch the CPU time. But, is this the exact amount of time the domain is ON?
>> i.e. If the domain is in a "IDLE" state, the CPU time does not increase. But
>> what I want is the amount of time the domain was ON(including the idle
>> time). So, If I can get the start time of the domain, I can calculate the
>> duration.
>
> Sorry, I personally can't help with this one.  I haven't had to look at
> this stuff yet.
>
> Hope the above stuff helps though. :)
>
> Regards and best wishes,
>
> Justin Clift
>
> --
> Salasaga  -  Open Source eLearning IDE
>             
http://www.salasaga.org