[libvirt-users] Libvirt newbie, need help with doubts

Eric Blake eblake at redhat.com
Fri Oct 7 16:08:57 UTC 2011


On 10/07/2011 05:28 AM, PREETHI RAMESH wrote:
> Hi,
> These are my doubts:

I'll answer what I can, but you'll have to hope that others chime in as 
well.

>
> 1. I tried live migration of Ubuntu 11.04 from the one physical machine to
> another using the migrate() function. I connected via tcp in the destination
> URI and migrated successfully(lesser than 2 seconds). I tried running virsh
> list --all on the destination PM and confirmed that the VM had been migrated
> successfully.
>
> When I tried checking ps aux | grep vmname where vmname was the name of the
> VM migrated, I could see that on the source PM the thread was still active
> with the PID though the machine had been migrated successfully.

That's odd - either the migration was still going on at the time of your 
ps, or something else went wrong.  What version of libvirt are you using 
on source and destination?  Migration should not complete until the qemu 
process on the source has gone away.  Are you sure you were interpreting 
the ps listing correctly?

>
> Shouldn't the vmname not be listed at all on the source PM's side,if it has
> been completely migrated?
>
> Isn't 2 seconds too little(considering the memory allotted to the VM was
> 128MB and I'm using a 100Mbps LAN switch, time taken=size/speed~10 seconds).

Not necessarily.  Migration can go faster than the memory size if the 
source can prove that some of the memory is untouched, and can therefore 
convey that information to the destination without copying entire blocks 
of 0 over the line.  That is, qemu can do some forms of compression to 
speed up migration.

>
> Why is virsh list --all showing me that the VM migrated to be shutdown on
> the source PM? If it's been completely migrated, shouldn't the entry be
> removed completely?

You probably didn't specify 'virsh migrate --persistent 
--undefinesource' - the --persistent flag says to keep the guest 
definition persistent on the definition, and the --undefinesource says 
to remove the guest definition on the source (all on successful 
migration, of course).  Without --persistent, the guest is transient; 
and without --undefinesource, 'virsh list --all' will still list the 
guest configuration on the source (and it is up to you to only run the 
guest on one of the two machines at a given time, although recent 
improvements in sanlock or fcntl lock managers can help prevent 
accidental running of the same guest from two machines).

>
> 2. Is there any way to set the CPU limit in terms of % of CPU used on a VCPU
> using libvirt function? As in, if I want my VM to use just 10% of VCPU 1.

To limit a guests' use of a VCPU, you have to do that within the guest. 
  You probably meant to ask whether you can constrain a guest using 100% 
of its VCPU to only consume 10% of the physical CPU on the host that is 
providing the VCPU to the guest.  And yes, with recent additions to the 
xml regarding cpu tuning, you can do something like that:
http://libvirt.org/formatdomain.html#elementsCPUTuning

>
> 3. I'm developing an application in Java to monitor VM usage(Memory,CPU,
> Network etc). Are there any easily integrable graph plotting applications I
> could integrate with?

Sorry, I can't answer this one.

-- 
Eric Blake   eblake at redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org




More information about the libvirt-users mailing list