[libvirt] question on kvm

Alex Jia ajia at redhat.com
Fri Dec 23 03:02:14 UTC 2011

On 12/23/2011 10:14 AM, hero wrote:
> hello everyone:
> during the days I use kvm,I have got some questions I want to 
> know,please read the following questions.
> 1.When a kvm VM is running, I use 'virsh setvcpus <domain> <count>' to 
> change the cpu numbers of the VM, and when I use 'virsh dumpxml 
> <domain>',there is a change from '<vcpus>count</vcpus>' to '<vcpus 
> current="currentcount">count</vcpus>', just because of this I can't 
> start the VM after I shutdown it. could you help me about this.
It works well for me, the guest can be successfully started after 
shutdowning, what's the libvirt version?
> 2. when I use "virsh setmaxmem <domain> <value>" to change the max 
> memory of the kvm VM, it says "error: Unable to change MaxMemorySize
> error: this function is not supported by the connection driver: 
> virDomainSetMaxMemory", I want to know if libvirt has bugs or not.
Also work for me, for a running domain, will meet the following error as 

# virsh setmaxmem vr-rhel5u7-x86_64-kvm 1048576
error: Unable to change MaxMemorySize
error: Requested operation is not valid: cannot resize the maximum 
memory on an active domain

For a inactive domain, original Max memory is 524288 kB, the change is 

# virsh dominfo vr-rhel5u7-x86_64-kvm
Id: -
Name: vr-rhel5u7-x86_64-kvm
UUID: 663ce18a-e257-2b05-91ae-fe29381b3a2f
OS Type: hvm
State: shut off
CPU(s): 3
Max memory: 1048576 kB
Used memory: 524288 kB
Persistent: yes
Autostart: disable
Managed save: no
Security model: selinux
Security DOI: 0
> 3.It works fine except I reboot the VM after I use "virsh setmem 
> <domain> <value>" to change the kvm VM boot memory, for example, I 
> change the memory 3000000k, but it can not save the value the next 
> time to reboot.
You should see options family of virsh setmem such as --live, --config 
and --current:

--config affect next boot Note: it is a option what you want.
--live affect running domain
--current affect current domain

Good Luck!
> Best wishes and Merry Christmas!
> SunYongGang
> --
> libvir-list mailing list
> libvir-list at redhat.com
> https://www.redhat.com/mailman/listinfo/libvir-list

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20111223/554c854d/attachment-0001.htm>

More information about the libvir-list mailing list