From patchwork Wed Apr 20 21:01:23 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 66256 Delivered-To: patch@linaro.org Received: by 10.140.93.198 with SMTP id d64csp2676011qge; Wed, 20 Apr 2016 14:05:20 -0700 (PDT) X-Received: by 10.194.92.163 with SMTP id cn3mr10652129wjb.3.1461186320729; Wed, 20 Apr 2016 14:05:20 -0700 (PDT) Return-Path: Received: from mx4-phx2.redhat.com (mx4-phx2.redhat.com. [209.132.183.25]) by mx.google.com with ESMTPS id v131si11982820wme.78.2016.04.20.14.05.20 (version=TLS1 cipher=AES128-SHA bits=128/128); Wed, 20 Apr 2016 14:05:20 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) client-ip=209.132.183.25; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.25 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by mx4-phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3KL2lXT006525; Wed, 20 Apr 2016 17:02:47 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id u3KL1S1D024535 for ; Wed, 20 Apr 2016 17:01:28 -0400 Received: from colepc.redhat.com (ovpn-113-99.phx2.redhat.com [10.3.113.99]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u3KL1QVq001960; Wed, 20 Apr 2016 17:01:27 -0400 From: Cole Robinson To: libvirt-list@redhat.com Date: Wed, 20 Apr 2016 17:01:23 -0400 Message-Id: In-Reply-To: <444830955dd0cf88a33dcb9546bf93add896c63d.1461186083.git.crobinso@redhat.com> References: <444830955dd0cf88a33dcb9546bf93add896c63d.1461186083.git.crobinso@redhat.com> In-Reply-To: <444830955dd0cf88a33dcb9546bf93add896c63d.1461186083.git.crobinso@redhat.com> References: <444830955dd0cf88a33dcb9546bf93add896c63d.1461186083.git.crobinso@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-loop: libvir-list@redhat.com Cc: Peter Krempa Subject: [libvirt] [PATCH 2/2] qemu: process: split out startup XML validation X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com And document that these specific bits are done at startup time for back compat reasons --- src/qemu/qemu_process.c | 43 +++++++++++++++++++++++++++++++------------ 1 file changed, 31 insertions(+), 12 deletions(-) -- 2.7.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 10e1b5a..8a2f65f 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -4546,6 +4546,36 @@ qemuProcessStartWarnShmem(virDomainObjPtr vm) } } +static int +qemuProcessStartValidateXML(virDomainObjPtr vm, + virQEMUCapsPtr qemuCaps, + bool migration, + bool snapshot) +{ + /* The bits we validate here are XML configs that we previously + * accepted. We reject them at VM startup time rather than parse + * time so that pre-existing VMs aren't rejected and dropped from + * the VM list when libvirt is updated. + * + * If back compat isn't a concern, XML validation should probably + * be done at parse time. + */ + if (qemuValidateCpuCount(vm->def, qemuCaps) < 0) + return -1; + + if (!migration && !snapshot && + virDomainDefCheckDuplicateDiskInfo(vm->def) < 0) + return -1; + + if (vm->def->mem.min_guarantee) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("Parameter 'min_guarantee' " + "not supported by QEMU.")); + return -1; + } + + return 0; +} /** * qemuProcessStartValidate: @@ -4590,20 +4620,9 @@ qemuProcessStartValidate(virQEMUDriverPtr driver, } - if (qemuValidateCpuCount(vm->def, qemuCaps) < 0) - return -1; - - if (!migration && !snapshot && - virDomainDefCheckDuplicateDiskInfo(vm->def) < 0) + if (qemuProcessStartValidateXML(vm, qemuCaps, migration, snapshot) < 0) return -1; - if (vm->def->mem.min_guarantee) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", - _("Parameter 'min_guarantee' " - "not supported by QEMU.")); - return -1; - } - VIR_DEBUG("Checking for any possible (non-fatal) issues"); qemuProcessStartWarnShmem(vm);