vm/qubesvm: do not assign all host vCPUs to a qube

Fixes QubesOS/qubes-issues#2900
This commit is contained in:
Marek Marczykowski-Górecki 2017-07-17 12:30:52 +02:00
parent 11fac7be56
commit 4037bf9abc
No known key found for this signature in database
GPG Key ID: 063938BA42CFA724
3 changed files with 7 additions and 7 deletions

View File

@ -124,7 +124,7 @@ class TC_00_VMs(AdminAPITestCase):
def test_021_vm_property_get_int(self):
value = self.call_mgmt_func(b'admin.vm.property.Get', b'test-vm1',
b'vcpus')
self.assertEqual(value, 'default=True type=int 42')
self.assertEqual(value, 'default=True type=int 2')
def test_022_vm_property_get_bool(self):
value = self.call_mgmt_func(b'admin.vm.property.Get', b'test-vm1',

View File

@ -281,10 +281,10 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase):
def test_190_vcpus(self):
vm = self.get_vm()
self.assertPropertyDefaultValue(vm, 'vcpus', self.app.host.no_cpus)
self.assertPropertyDefaultValue(vm, 'vcpus', 2)
self.assertPropertyValue(vm, 'vcpus', 3, 3, '3')
del vm.vcpus
self.assertPropertyDefaultValue(vm, 'vcpus', self.app.host.no_cpus)
self.assertPropertyDefaultValue(vm, 'vcpus', 2)
self.assertPropertyValue(vm, 'vcpus', '3', 3, '3')
def test_191_vcpus_invalid(self):
@ -508,7 +508,7 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase):
<uuid>7db78950-c467-4863-94d1-af59806384ea</uuid>
<memory unit="MiB">500</memory>
<currentMemory unit="MiB">400</currentMemory>
<vcpu placement="static">4</vcpu>
<vcpu placement="static">2</vcpu>
<os>
<type arch="x86_64" machine="xenpv">linux</type>
<kernel>/tmp/kernel/vmlinuz</kernel>
@ -559,7 +559,7 @@ class TC_90_QubesVM(QubesVMTestsMixin, qubes.tests.QubesTestCase):
<uuid>7db78950-c467-4863-94d1-af59806384ea</uuid>
<memory unit="MiB">500</memory>
<currentMemory unit="MiB">400</currentMemory>
<vcpu placement="static">4</vcpu>
<vcpu placement="static">2</vcpu>
<cpu mode='host-passthrough'>
<!-- disable nested HVM -->
<feature name='vmx' policy='disable'/>

View File

@ -416,8 +416,8 @@ class QubesVM(qubes.vm.mix.net.NetVMMixin, qubes.vm.BaseVM):
vcpus = qubes.property('vcpus',
type=int,
setter=_setter_positive_int,
default=(lambda self: self.app.host.no_cpus),
doc='FIXME')
default=2,
doc='Number of virtual CPUs for a qube')
# CORE2: swallowed uses_default_kernel
kernel = qubes.property('kernel', type=str,