Thursday, May 2, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 3836  / 3 Years ago, tue, august 3, 2021, 7:35:36

I'm using libvirt with KVM/QEMU. I found a great PPA, uvtool (http://s3hh.wordpress.com/2013/12/12/quickly-run-ubuntu-cloud-images-locally-using-uvtool/), that manages images and metadata in a volume storage pool. I can quickly create new VM guests from the command line. This makes it easy to work with shell scripts to create/destroy using uvt-kvm (uvtool's wrapper) and start/stop using virsh (from libvirt package).



For some reason, guests have only one cpu/core and I need to set the number from the command line. I found references to virsh's setvcpu option, but no examples of how to use it. Here's what I tried with the error messages:



Start existing guest with 2 CPU's:



tahoar@pttools0:~$ virsh start test-host setvcpus --count 2
error: command 'start' doesn't support option --count


Start existing guest with defaults:



tahoar@pttools0:~$ virsh start test-host
Domain test-host started


Set CPU's on running guest:



tahoar@pttools0:~$ virsh setvcpus test-host --count 2
error: invalid argument: requested vcpus is greater than max allowable vcpus for the domain: 2 > 1


Thanks for any help.


More From » command-line

 Answers
4

When creating VMs with uvt-kvm create, you can use the --cpu cores option to set the number of CPUs in the VM.


[#26247] Wednesday, August 4, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
homerurhyth

Total Points: 338
Total Questions: 113
Total Answers: 105

Location: Moldova
Member since Sat, Aug 6, 2022
2 Years ago
;