diff --git a/tests/clitest.py b/tests/clitest.py index a1176e1d3..89928dc2a 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -411,7 +411,6 @@ vinst.add_valid("cpuram", "--cpu foobar,+x2apic,+x2apicagain,-distest,forbid=foo vinst.add_valid("cpuram", "--numatune 1,2,3,5-7,^6") # Simple --numatune vinst.add_invalid("cpuram", "--vcpus 32 --cpuset=969-1000") # Bogus cpuset vinst.add_invalid("cpuram", "--vcpus 32 --cpuset=autofoo") # Bogus cpuset -vinst.add_invalid("cpuram", "--vcpus 10000") # Over max vcpus vinst.add_invalid("cpuram", "--vcpus 20 --check-cpu") # Over host vcpus w/ --check-cpu vinst.add_invalid("cpuram", "--vcpus 5,maxvcpus=1") # maxvcpus less than cpus vinst.add_invalid("cpuram", "--vcpus foo=bar") # vcpus unknown option diff --git a/tests/validation.py b/tests/validation.py index c75909699..d665a320d 100644 --- a/tests/validation.py +++ b/tests/validation.py @@ -80,7 +80,7 @@ args = { 'valid' : ['12345678123456781234567812345678', '12345678-1234-1234-ABCD-ABCDEF123456']}, 'vcpus' : { - 'invalid' : [-1, 0, 1000, ''], + 'invalid' : [-1, 0, ''], 'valid' : [1, 32]}, 'type' : { 'invalid' : [], diff --git a/virtManager/connection.py b/virtManager/connection.py index 9df86680f..6e8bf486a 100644 --- a/virtManager/connection.py +++ b/virtManager/connection.py @@ -205,9 +205,6 @@ class vmmConnection(vmmGObject): self._check_caps() return self._caps - def get_max_vcpus(self, _type): - return virtinst.util.get_max_vcpus(self._backend, _type) - def get_host_info(self): return self.hostinfo diff --git a/virtManager/create.py b/virtManager/create.py index 28c5cc9ad..c2fc64e60 100644 --- a/virtManager/create.py +++ b/virtManager/create.py @@ -560,19 +560,8 @@ class vmmCreate(vmmGObjectUI): self.widget("phys-mem-label").set_markup(mem_label) # CPU - phys_cpus = self.conn.host_active_processor_count() - - max_v = self.conn.get_max_vcpus(self.capsdomain.hypervisor_type) + phys_cpus = int(self.conn.host_active_processor_count()) cmax = phys_cpus - if int(max_v) < int(phys_cpus): - cmax = max_v - cpu_tooltip = (_("Hypervisor only supports %d virtual CPUs.") % - max_v) - else: - cpu_tooltip = None - self.widget("config-cpus").set_tooltip_text(cpu_tooltip or "") - - cmax = int(cmax) if cmax <= 0: cmax = 1 cpu_label = (_("Up to %(numcpus)d available") % diff --git a/virtinst/Guest.py b/virtinst/Guest.py index 4b7a6fb90..4a013bb53 100644 --- a/virtinst/Guest.py +++ b/virtinst/Guest.py @@ -346,13 +346,9 @@ class Guest(XMLBuilderDomain.XMLBuilderDomain): xpath="./uuid") def __validate_cpus(self, val): - maxvcpus = util.get_max_vcpus(self.conn, self.type) val = int(val) if val < 1: raise ValueError(_("Number of vcpus must be a positive integer.")) - if val > maxvcpus: - raise ValueError(_("Number of vcpus must be no greater than %d " - "for this vm type.") % maxvcpus) return val # number of vcpus for the guest diff --git a/virtinst/util.py b/virtinst/util.py index 8514719c0..4a70b84e6 100644 --- a/virtinst/util.py +++ b/virtinst/util.py @@ -446,18 +446,6 @@ def randomUUID(conn): "%02x" * 6]) % tuple(u) -def get_max_vcpus(conn, typ): - """@param conn: libvirt connection to poll for max possible vcpus - @type type: optional guest type (kvm, etc.)""" - if typ is None: - typ = conn.getType() - try: - m = conn.getMaxVcpus(typ.lower()) - except libvirt.libvirtError: - m = 32 - return m - - def xml_escape(xml): """ Replaces chars ' " < > & with xml safe counterparts