From patchwork Mon Apr 15 21:26:42 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cole Robinson X-Patchwork-Id: 162282 Delivered-To: patch@linaro.org Received: by 2002:a02:c6d8:0:0:0:0:0 with SMTP id r24csp3422356jan; Mon, 15 Apr 2019 14:26:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqz41HuGuFUg83BTjJvvFhtGuxOElN/o4DG4TJGABn4fMq9P6KyQcJlu6FFAxX8g9c/e4CPB X-Received: by 2002:ac8:f38:: with SMTP id e53mr62034770qtk.115.1555363619230; Mon, 15 Apr 2019 14:26:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555363619; cv=none; d=google.com; s=arc-20160816; b=sp1HDS5n90ZLPG8ZFxsI2JmpPSDxMPMWJahjbsSY+mh/ucwkmBxvnlMonaZLParIpx yaJc7UXY6KwzVtvJD1DE3o/+1z6AVBfWAHNmrp2UhCUKaGMkpjwr4QW0HoMlZERKDAUA R9IGSt1Uo7IDtxattHJ3jZxQ0t29j7wvZuFTwY0pgCfjeIzE7ngeoJrv3F4GmdCoA7C6 Fzu6BLu0pcHO0XrCa/zwNCYsxzd8LViaj52RGD9+SLVK1uq+qBSPNm6kYuGB6fG8PLJX 79zwknityuEU2C7g1/UI8YgqET23ik6K4lTGfzP81D5h2kcLoTmnkEFzdAA7Vf1MlP7p KzJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:sender:content-transfer-encoding:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence:subject :mime-version:references:in-reply-to:message-id:date:to:from :delivered-to; bh=eBfkAyahfpEOGyD3QaEqMX40TFJ5bDFDVn7UxZIQfHc=; b=AjOyGfCJ0c9kE3s8T2fXlrcm1TqBYJIKIPVq/NybIddLmSRI1X04yBs5/6U0FpSmIF VF9V/Vb/ndvZGvipz/NDB+X30M5A4kj0XspKOfWz19wza90XkxnmEq0vEe+ZfvynLMP7 lUPke57BjYNaf6StkhObsfZQygCMS7OIPks+cP2e6jhi5caZNFnWRGW/DIt+TToKnqYq ViD0Yhzdgjtrjvbezu7ZuOm3VbpeaCRwqA5j/7wn0JvWXHTtnEmGJfxOBHVClWNa7YIX FopZ2YkgAnBGHRAwJFTGaq016T/dELPSVesdw2nriLRbbZu2zgPQYiK3okVDvpw9bt9C etSQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id b18si1193113qte.123.2019.04.15.14.26.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 15 Apr 2019 14:26:59 -0700 (PDT) Received-SPF: pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of libvir-list-bounces@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C98EA30832E8; Mon, 15 Apr 2019 21:26:57 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A65AB5C1A1; Mon, 15 Apr 2019 21:26:57 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 62B0541F3F; Mon, 15 Apr 2019 21:26:57 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x3FLQsUd032262 for ; Mon, 15 Apr 2019 17:26:54 -0400 Received: by smtp.corp.redhat.com (Postfix) id BB399608C8; Mon, 15 Apr 2019 21:26:54 +0000 (UTC) Delivered-To: libvirt-list@redhat.com Received: from worklaptop.redhat.com (ovpn-124-108.rdu2.redhat.com [10.10.124.108]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3F1CE608C2; Mon, 15 Apr 2019 21:26:54 +0000 (UTC) From: Cole Robinson To: libvirt-list@redhat.com Date: Mon, 15 Apr 2019 17:26:42 -0400 Message-Id: <6426ebc4429aeb2d475e55ab8af8ca69a9197731.1555363506.git.crobinso@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v2 3/3] conf: Add virDomainVirtType enum error label 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: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Mon, 15 Apr 2019 21:26:58 +0000 (UTC) Signed-off-by: Cole Robinson --- Not sure if we should apply this now or after some flag day. I'm open to suggestions src/bhyve/bhyve_driver.c | 6 +----- src/conf/domain_conf.c | 12 +++--------- src/libxl/libxl_driver.c | 6 +----- src/qemu/qemu_capabilities.c | 5 +---- 4 files changed, 6 insertions(+), 23 deletions(-) -- 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list diff --git a/src/bhyve/bhyve_driver.c b/src/bhyve/bhyve_driver.c index 061888ab0b..ccfcee379f 100644 --- a/src/bhyve/bhyve_driver.c +++ b/src/bhyve/bhyve_driver.c @@ -1589,12 +1589,8 @@ bhyveConnectGetDomainCapabilities(virConnectPtr conn, return ret; if (virttype_str && - (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("unknown virttype: %s"), - virttype_str); + (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) goto cleanup; - } if (virttype != VIR_DOMAIN_VIRT_BHYVE) { virReportError(VIR_ERR_INVALID_ARG, diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 60b8feee0c..1fbe8c040b 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -104,7 +104,7 @@ VIR_ENUM_IMPL(virDomainTaint, NULL, "custom-ga-command", ); -VIR_ENUM_IMPL(virDomainVirt, NULL, +VIR_ENUM_IMPL(virDomainVirt, "domain type", VIR_DOMAIN_VIRT_LAST, "none", "qemu", @@ -19327,11 +19327,8 @@ virDomainDefParseCaps(virDomainDefPtr def, "%s", _("missing domain type attribute")); return -1; } - if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0) { - virReportError(VIR_ERR_CONFIG_UNSUPPORTED, - _("invalid domain type %s"), virttype); + if ((def->virtType = virDomainVirtTypeFromString(virttype)) < 0) return -1; - } if (!ostype) { if (def->os.bootloader) { @@ -28035,11 +28032,8 @@ virDomainDefFormatInternal(virDomainDefPtr def, VIR_DOMAIN_DEF_FORMAT_CLOCK_ADJUST, -1); - if (!(type = virDomainVirtTypeToString(def->virtType))) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("unexpected domain type %d"), def->virtType); + if (!(type = virDomainVirtTypeToString(def->virtType))) goto error; - } if (def->id == -1) flags |= VIR_DOMAIN_DEF_FORMAT_INACTIVE; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index a9edc8211d..428ef1f64e 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -6365,12 +6365,8 @@ libxlConnectGetDomainCapabilities(virConnectPtr conn, cfg = libxlDriverConfigGet(driver); if (virttype_str && - (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("unknown virttype: %s"), - virttype_str); + (virttype = virDomainVirtTypeFromString(virttype_str)) < 0) goto cleanup; - } if (virttype != VIR_DOMAIN_VIRT_XEN) { virReportError(VIR_ERR_INVALID_ARG, diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index 9eb5e418cc..27315efb15 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -4800,11 +4800,8 @@ virQEMUCapsCacheLookupDefault(virFileCachePtr cache, virQEMUCapsPtr ret = NULL; if (virttypeStr && - (virttype = virDomainVirtTypeFromString(virttypeStr)) < 0) { - virReportError(VIR_ERR_INVALID_ARG, - _("unknown virttype: %s"), virttypeStr); + (virttype = virDomainVirtTypeFromString(virttypeStr)) < 0) goto cleanup; - } if (archStr && (arch = virArchFromString(archStr)) == VIR_ARCH_NONE) {