From d216c44157e2223e98583aaeec4e2b6ef8de83f2 Mon Sep 17 00:00:00 2001 From: Cole Robinson Date: Mon, 20 Jan 2014 17:49:29 -0500 Subject: [PATCH] Stub out --check-cpu option It's old, uninteresting, and I don't think anyone is depending on it to work. Parse the command line option, but don't do anything differently. --- man/virt-image.pod | 4 ---- man/virt-install.pod | 5 ----- tests/clitest.py | 2 -- virt-image | 3 +-- virt-install | 2 +- virtinst/cli.py | 23 +---------------------- 6 files changed, 3 insertions(+), 36 deletions(-) diff --git a/man/virt-image.pod b/man/virt-image.pod index 3481c655e..b21848dc0 100644 --- a/man/virt-image.pod +++ b/man/virt-image.pod @@ -78,10 +78,6 @@ more info. Configure the CPU and CPU features exposed to the guest. Please see L for more info. -=item --check-cpu - -Check that vcpus do not exceed physical CPUs and warn if they do. - =item --os-variant=OS_VARIANT Optimize the guest configuration for a specific operating system (ex. diff --git a/man/virt-install.pod b/man/virt-install.pod index 79dff6835..371e40449 100644 --- a/man/virt-install.pod +++ b/man/virt-install.pod @@ -1386,11 +1386,6 @@ change host device configuration, or actually teach libvirt about the guest. virt-install may still fetch install media, since this is required to properly detect the OS to install. -=item --check-cpu - -Check that the number virtual cpus requested does not exceed physical CPUs and -warn if they do. - =item -q, --quiet Only print fatal error messages. diff --git a/tests/clitest.py b/tests/clitest.py index ccdc0fce1..84a9f222e 100644 --- a/tests/clitest.py +++ b/tests/clitest.py @@ -418,7 +418,6 @@ c.add_valid("--vcpus 4 --cpuset=1,3-5") # Cpuset c.add_valid("--vcpus 4 --cpuset=1,3-5,") # Cpuset with trailing comma c.add_valid("--vcpus 4 --cpuset=auto") # Cpuset with trailing comma c.add_valid("--ram 100000000000") # Ram overcommit -c.add_valid("--vcpus 5,maxvcpus=10 --check-cpu") # maxvcpus, --check-cpu shouldn't error c.add_valid("--vcpus 4,cores=2,threads=2,sockets=2") # Topology c.add_valid("--vcpus 4,cores=1") # Topology auto-fill c.add_valid("--vcpus sockets=2,threads=2") # Topology only @@ -429,7 +428,6 @@ c.add_valid("--numatune 1-3,4,mode=strict") # More complex, parser should do th c.add_compare("--connect %(DEFAULTURI)s --cpuset auto --vcpus 2", "cpuset-auto") # --cpuset=auto actually works c.add_invalid("--vcpus 32 --cpuset=969-1000") # Bogus cpuset c.add_invalid("--vcpus 32 --cpuset=autofoo") # Bogus cpuset -c.add_invalid("--vcpus 20 --check-cpu") # Over host vcpus w/ --check-cpu c.add_invalid("--cpu host") # --cpu host, but no host CPU in caps c.add_invalid("--clock foo_tickpolicy=merge") # Unknown timer diff --git a/virt-image b/virt-image index f9f5a510a..5bbb8c1d9 100755 --- a/virt-image +++ b/virt-image @@ -108,8 +108,7 @@ def main(conn=None): if options.uuid: guest.uuid = options.uuid - cli.get_vcpus(guest, options.vcpus or image.domain.vcpu or "", - options.check_cpu) + cli.parse_vcpus(guest, options.vcpu or image.domain.vcpu or "") cli.get_cpuset(guest, options.cpuset) cli.parse_cpu(guest, options.cpu) cli.get_networks(guest, options.network) diff --git a/virt-install b/virt-install index d4a490e7d..7d5c1b125 100755 --- a/virt-install +++ b/virt-install @@ -505,7 +505,7 @@ def build_guest_instance(conn, options): guest.os.init = options.init if options.uuid: guest.uuid = options.uuid - cli.get_vcpus(guest, options.vcpus, options.check_cpu) + cli.parse_vcpus(guest, options.vcpus) cli.parse_numatune(guest, options.numatune) cli.parse_cpu(guest, options.cpu) cli.parse_security(guest, options.security) diff --git a/virtinst/cli.py b/virtinst/cli.py index 2b15c7105..b37b634d2 100644 --- a/virtinst/cli.py +++ b/virtinst/cli.py @@ -564,27 +564,6 @@ def get_memory(guest, memory): func=check_memory) -def get_vcpus(guest, vcpus, check_cpu): - if vcpus is None: - vcpus = "" - - parse_vcpu(guest, vcpus) - if not check_cpu: - return - - hostinfo = guest.conn.getInfo() - pcpus = hostinfo[4] * hostinfo[5] * hostinfo[6] * hostinfo[7] - - if guest.vcpus > pcpus: - msg = _("You have asked for more virtual CPUs (%d) than there " - "are physical CPUs (%d) on the host. This will work, " - "but performance will be poor. ") % (guest.vcpus, pcpus) - askmsg = _("Are you sure? (yes or no)") - - if not prompt_for_yes_no(msg, askmsg): - nice_exit() - - def get_cpuset(guest, cpuset): memory = guest.memory conn = guest.conn @@ -1236,7 +1215,7 @@ class ParserVCPU(VirtCLIParser): inst.vcpus = inst.cpu.vcpus_from_topology() return ret -parse_vcpu = ParserVCPU().parse +parse_vcpus = ParserVCPU().parse #################