From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863450; cv=none; d=zoho.com; s=zohoarc; b=IrIN+Ur5cKGYGfWHF9UTmD4ZA8vtnVnKzPqmRMFpQkLlBR9l6L1CxbR6LAWXTu6JcjvaQGbwl6e81Yx9HY2d+Ky/p3BvsR91/oIFgnOlHep6ru632NctkkEhbN6L3fDVls0OEK78kfN1zQye0/MRg/RNwMcV+DF6pofhCH/eRRM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863450; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=6yKOka/ocFOr2h4TSc2Qk0WOgviVpndKWg9V8LiKJkU=; b=OmUGW/e9+RujGIGW9+VjB5flCi5LnWDe/KnfPVQKNgmTrPxIJTmUoOToXe4FWPuYiPyEHy/tSU3AKAUsprJLks8cEWbdxYTukqnV2SXXyww8oUicr3q1oQUDE+jmIzXNrIpABxfWD5NijrgV+yvUAPRjAPnIgSSQEqz5bdo6310= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863450306693.4180570387955; Tue, 18 Jun 2019 06:10:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4384A3082E71; Tue, 18 Jun 2019 13:10:41 +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 1822B82A35; Tue, 18 Jun 2019 13:10:36 +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 48BB054D3D; Tue, 18 Jun 2019 13:10:30 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAS94018671 for ; Tue, 18 Jun 2019 09:10:28 -0400 Received: by smtp.corp.redhat.com (Postfix) id D32D31001DDC; Tue, 18 Jun 2019 13:10:28 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 5F2EB1001DCB for ; Tue, 18 Jun 2019 13:10:28 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:10 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/15] qemu: Rename qemuDomainCmdlineDefPtr to qemuDomainXmlNsDefPtr 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Tue, 18 Jun 2019 13:10:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The data injected via the namespace may contain also other things than commandline passthrough definitions. Rename it to make it more universal. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_command.c | 16 ++++++++-------- src/qemu/qemu_conf.c | 2 +- src/qemu/qemu_conf.h | 8 ++++---- src/qemu/qemu_domain.c | 12 ++++++------ 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index 59dc134785..637de74e90 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -10881,14 +10881,14 @@ qemuBuildCommandLine(virQEMUDriverPtr driver, virCommandAddArgList(cmd, "-loadvm", snapshot->def->name, NULL); if (def->namespaceData) { - qemuDomainCmdlineDefPtr qemucmd; - - qemucmd =3D def->namespaceData; - for (i =3D 0; i < qemucmd->num_args; i++) - virCommandAddArg(cmd, qemucmd->args[i]); - for (i =3D 0; i < qemucmd->num_env; i++) - virCommandAddEnvPair(cmd, qemucmd->env_name[i], - NULLSTR_EMPTY(qemucmd->env_value[i])); + qemuDomainXmlNsDefPtr qemuxmlns; + + qemuxmlns =3D def->namespaceData; + for (i =3D 0; i < qemuxmlns->num_args; i++) + virCommandAddArg(cmd, qemuxmlns->args[i]); + for (i =3D 0; i < qemuxmlns->num_env; i++) + virCommandAddEnvPair(cmd, qemuxmlns->env_name[i], + NULLSTR_EMPTY(qemuxmlns->env_value[i])); } if (qemuBuildSeccompSandboxCommandLine(cmd, cfg, qemuCaps) < 0) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index daea11dacb..afff77b1f3 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -94,7 +94,7 @@ qemuDriverUnlock(virQEMUDriverPtr driver) virMutexUnlock(&driver->lock); } -void qemuDomainCmdlineDefFree(qemuDomainCmdlineDefPtr def) +void qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def) { size_t i; diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 983e74a3cf..26aa96f194 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -297,9 +297,9 @@ struct _virQEMUDriver { virHashAtomicPtr migrationErrors; }; -typedef struct _qemuDomainCmdlineDef qemuDomainCmdlineDef; -typedef qemuDomainCmdlineDef *qemuDomainCmdlineDefPtr; -struct _qemuDomainCmdlineDef { +typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef; +typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr; +struct _qemuDomainXmlNsDef { size_t num_args; char **args; @@ -310,7 +310,7 @@ struct _qemuDomainCmdlineDef { -void qemuDomainCmdlineDefFree(qemuDomainCmdlineDefPtr def); +void qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def); virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged); diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 8262107311..10215ffa47 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3094,9 +3094,9 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivate= DataCallbacks =3D { static void qemuDomainDefNamespaceFree(void *nsdata) { - qemuDomainCmdlineDefPtr cmd =3D nsdata; + qemuDomainXmlNsDefPtr cmd =3D nsdata; - qemuDomainCmdlineDefFree(cmd); + qemuDomainXmlNsDefFree(cmd); } static int @@ -3105,7 +3105,7 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_U= NUSED, xmlXPathContextPtr ctxt, void **data) { - qemuDomainCmdlineDefPtr cmd =3D NULL; + qemuDomainXmlNsDefPtr cmd =3D NULL; bool uses_qemu_ns =3D false; xmlNodePtr *nodes =3D NULL; int n; @@ -3205,7 +3205,7 @@ static int qemuDomainDefNamespaceFormatXML(virBufferPtr buf, void *nsdata) { - qemuDomainCmdlineDefPtr cmd =3D nsdata; + qemuDomainXmlNsDefPtr cmd =3D nsdata; size_t i; if (!cmd->num_args && !cmd->num_env) @@ -8182,8 +8182,8 @@ void qemuDomainObjCheckTaint(virQEMUDriverPtr driver, qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOOK, logCtxt); if (obj->def->namespaceData) { - qemuDomainCmdlineDefPtr qemucmd =3D obj->def->namespaceData; - if (qemucmd->num_args || qemucmd->num_env) + qemuDomainXmlNsDefPtr qemuxmlns =3D obj->def->namespaceData; + if (qemuxmlns->num_args || qemuxmlns->num_env) qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_CUSTOM_ARGV, = logCtxt); } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863470; cv=none; d=zoho.com; s=zohoarc; b=b1o3XhgWyOgTuoC9JBjnecnLLNomFUoluYNb5E05yJQl4xnvsZRF5C5/MxiWWLVeG+xjaQ/vXi7oxRt3TkE9o6HE8uyxFPo12NpXIGpDEJc1m3QKLpdxf6it+36boaNMx5fKYwi0rMmjqsEdFgDCdCvxtl0QRKvOA6NymIdyTMU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863470; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wsnlxlo8cQmeorXj/ef7Y+fyCRxA7CleBzRB7uoik3E=; b=OzTUrx6zOmz6HicMFQOQpXE5rRFhmeQ4P4no3sQab52g/bG7q1Pllo6J1BdYoTxG7Unwbk/QZw+FCUHOxHAkv9YcMDVQWZ0n3lP7kV5Z7y5sBz/b3VFHyzGGlMmX8VN4XM616n2fz3qwQ/4Sy1banhKedJbvSuupcZWXCfzrCwg= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863470146500.2198930572313; Tue, 18 Jun 2019 06:11:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 70E81307D935; Tue, 18 Jun 2019 13:11:03 +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 4960317595; Tue, 18 Jun 2019 13:11:02 +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 0851F206D2; Tue, 18 Jun 2019 13:11:00 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDATVP018680 for ; Tue, 18 Jun 2019 09:10:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id A252D1001DD7; Tue, 18 Jun 2019 13:10:29 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 2CAF01001DCB for ; Tue, 18 Jun 2019 13:10:29 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:11 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/15] qemu: Move qemuDomainXmlNsDef(Free) from qemu_conf.(ch) 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 18 Jun 2019 13:11:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" qemu_conf.c deals with the configuration file. Better fit for the structure and freeing function will be qemu_domain.c where the rest of the namespace parsing/formatting stuff resides. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_conf.c | 20 -------------------- src/qemu/qemu_conf.h | 15 --------------- src/qemu/qemu_domain.c | 21 +++++++++++++++++++++ src/qemu/qemu_domain.h | 13 +++++++++++++ 4 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/qemu/qemu_conf.c b/src/qemu/qemu_conf.c index afff77b1f3..d981001600 100644 --- a/src/qemu/qemu_conf.c +++ b/src/qemu/qemu_conf.c @@ -94,26 +94,6 @@ qemuDriverUnlock(virQEMUDriverPtr driver) virMutexUnlock(&driver->lock); } -void qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def) -{ - size_t i; - - if (!def) - return; - - for (i =3D 0; i < def->num_args; i++) - VIR_FREE(def->args[i]); - for (i =3D 0; i < def->num_env; i++) { - VIR_FREE(def->env_name[i]); - VIR_FREE(def->env_value[i]); - } - VIR_FREE(def->args); - VIR_FREE(def->env_name); - VIR_FREE(def->env_value); - VIR_FREE(def); -} - - #ifndef DEFAULT_LOADER_NVRAM # define DEFAULT_LOADER_NVRAM \ "/usr/share/OVMF/OVMF_CODE.fd:/usr/share/OVMF/OVMF_VARS.fd:" \ diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index 26aa96f194..386e774653 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -297,21 +297,6 @@ struct _virQEMUDriver { virHashAtomicPtr migrationErrors; }; -typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef; -typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr; -struct _qemuDomainXmlNsDef { - size_t num_args; - char **args; - - unsigned int num_env; - char **env_name; - char **env_value; -}; - - - -void qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def); - virQEMUDriverConfigPtr virQEMUDriverConfigNew(bool privileged); int virQEMUDriverConfigLoadFile(virQEMUDriverConfigPtr cfg, diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 10215ffa47..74d5186bc7 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3091,6 +3091,27 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPrivat= eDataCallbacks =3D { }; +static void +qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def) +{ + size_t i; + + if (!def) + return; + + for (i =3D 0; i < def->num_args; i++) + VIR_FREE(def->args[i]); + for (i =3D 0; i < def->num_env; i++) { + VIR_FREE(def->env_name[i]); + VIR_FREE(def->env_value[i]); + } + VIR_FREE(def->args); + VIR_FREE(def->env_name); + VIR_FREE(def->env_value); + VIR_FREE(def); +} + + static void qemuDomainDefNamespaceFree(void *nsdata) { diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h index f92f0dbc27..474c7b613a 100644 --- a/src/qemu/qemu_domain.h +++ b/src/qemu/qemu_domain.h @@ -531,6 +531,19 @@ struct _qemuDomainSaveCookie { virCPUDefPtr cpu; }; + +typedef struct _qemuDomainXmlNsDef qemuDomainXmlNsDef; +typedef qemuDomainXmlNsDef *qemuDomainXmlNsDefPtr; +struct _qemuDomainXmlNsDef { + size_t num_args; + char **args; + + unsigned int num_env; + char **env_name; + char **env_value; +}; + + qemuDomainSaveCookiePtr qemuDomainSaveCookieNew(virDomainObjPtr vm); const char *qemuDomainAsyncJobPhaseToString(qemuDomainAsyncJob job, --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863472; cv=none; d=zoho.com; s=zohoarc; b=mMpm7qrL3PienUsoa7PDWMf0TpIY81mn+fA6rdCkBgnx/Bvl1Wo8up4Mkw4PvvN0nQ7xG7lzxbSMOOFix0Lnrh9b0UB/4PjVGjXCL8Kal8pJLSx2KDFqqlmyg2zm1MKQLOb4V2wakUR/OXzqhAJ1jMyOjZSUvdPXtpk4/rXQJR4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863472; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=kyt/ZN5jYRAbthVUByj8L8DnNP5wgFxv/Nhpt4GJmqM=; b=f36K4FazAR7umI4VJR7n3fJxwpvTUIg/jsHjxQ124zX/WRCUlRtoev16yGV61SXGaffspJsLfq46zosTUlProldgY2nNFWeoE1gdp2dyG0Dg8pI1v9ZX6E2pO+0tg331jMv8AT64H6xR0ZSQiUPg6oKcsDxlxGWJ01LymYDFli8= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863472615300.3125331882293; Tue, 18 Jun 2019 06:11:12 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37219307D963; Tue, 18 Jun 2019 13:11:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 047096606C; Tue, 18 Jun 2019 13:11:01 +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 B42941806B18; Tue, 18 Jun 2019 13:10:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAUkK018688 for ; Tue, 18 Jun 2019 09:10:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id 6E0C81001DCB; Tue, 18 Jun 2019 13:10:30 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id EDC311001DE4 for ; Tue, 18 Jun 2019 13:10:29 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:12 +0200 Message-Id: <0dd365ba9921813b2c3e4668fc6a054e494dd97b.1560863172.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/15] qemu: domain: Use virStringListFreeCount in qemuDomainXmlNsDefFree 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 18 Jun 2019 13:11:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 74d5186bc7..362b860c73 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3094,20 +3094,13 @@ virDomainXMLPrivateDataCallbacks virQEMUDriverPriva= teDataCallbacks =3D { static void qemuDomainXmlNsDefFree(qemuDomainXmlNsDefPtr def) { - size_t i; - if (!def) return; - for (i =3D 0; i < def->num_args; i++) - VIR_FREE(def->args[i]); - for (i =3D 0; i < def->num_env; i++) { - VIR_FREE(def->env_name[i]); - VIR_FREE(def->env_value[i]); - } - VIR_FREE(def->args); - VIR_FREE(def->env_name); - VIR_FREE(def->env_value); + virStringListFreeCount(def->args, def->num_args); + virStringListFreeCount(def->env_name, def->num_env); + virStringListFreeCount(def->env_value, def->num_env); + VIR_FREE(def); } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863498; cv=none; d=zoho.com; s=zohoarc; b=EpICLtN+t+9bRsN+vAN1Aq/o3EMtaT4czwInpoqdot0g9tkS1m0+nkBqo/buadYmIXsx5Vdoo1YfSXzQKuNmqaimuq1prRjUL0IYMyEcTVphUKQYTK4Sgb2sU3T9CToaX+ndAJRscy8l262WAufeYIXFYRBp3/B7chtWGKz1rmA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863498; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=f5MB7MJtOX8g9HBzdtH/3g43QJg3p6Jr0USoP2cw4VQ=; b=cL3E9tQ2JcZqcZUDbCgxn9xzeLJ3nFltapU3viwGHDhLdCmpFOfvMwGylRWwLxdcd6UC/VH6masNEsFtuRp2IfGlNSzH9ezHN9rH+Z/W7s+stGbJ3ptizoehONhT5nTAh3TLAg4aI3K2PUDesqERvPs9IdJHW/HgzntXXgxqOPk= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863498423269.65136045790405; Tue, 18 Jun 2019 06:11:38 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 0108E30860A7; Tue, 18 Jun 2019 13:11:27 +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 BE1FF5F1B9; Tue, 18 Jun 2019 13:11:26 +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 758A8206D5; Tue, 18 Jun 2019 13:11:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAVdf018695 for ; Tue, 18 Jun 2019 09:10:31 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3D4081001DD7; Tue, 18 Jun 2019 13:10:31 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id BAA131001DCB for ; Tue, 18 Jun 2019 13:10:30 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:13 +0200 Message-Id: <1bcaf6eac0c9de88313b4d778cb8edec38cfc3a0.1560863172.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/15] qemu: Extract parsing of qemu namespace arguments into separate function 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Tue, 18 Jun 2019 13:11:31 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Simplify the main function by splitting out how we parse the extra passthrough commandline arguments. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 51 +++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 18 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 362b860c73..3dfe4fc544 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3113,6 +3113,36 @@ qemuDomainDefNamespaceFree(void *nsdata) qemuDomainXmlNsDefFree(cmd); } + +static int +qemuDomainDefNamespaceParseCommandlineArgs(qemuDomainXmlNsDefPtr nsdef, + xmlXPathContextPtr ctxt) +{ + VIR_AUTOFREE(xmlNodePtr *) nodes =3D NULL; + ssize_t nnodes; + size_t i; + + if ((nnodes =3D virXPathNodeSet("./qemu:commandline/qemu:arg", ctxt, &= nodes)) < 0) + return -1; + + if (nnodes =3D=3D 0) + return 0; + + if (VIR_ALLOC_N(nsdef->args, nnodes) < 0) + return -1; + + for (i =3D 0; i < nnodes; i++) { + if (!(nsdef->args[nsdef->num_args++] =3D virXMLPropString(nodes[i]= , "value"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No qemu command-line argument specified")); + return -1; + } + } + + return 0; +} + + static int qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, xmlNodePtr root ATTRIBUTE_UNUSED, @@ -3135,26 +3165,11 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE= _UNUSED, if (VIR_ALLOC(cmd) < 0) return -1; - /* first handle the extra command-line arguments */ - n =3D virXPathNodeSet("./qemu:commandline/qemu:arg", ctxt, &nodes); - if (n < 0) - goto error; - uses_qemu_ns |=3D n > 0; - - if (n && VIR_ALLOC_N(cmd->args, n) < 0) + if (qemuDomainDefNamespaceParseCommandlineArgs(cmd, ctxt) < 0) goto error; - for (i =3D 0; i < n; i++) { - cmd->args[cmd->num_args] =3D virXMLPropString(nodes[i], "value"); - if (cmd->args[cmd->num_args] =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No qemu command-line argument specifie= d")); - goto error; - } - cmd->num_args++; - } - - VIR_FREE(nodes); + if (cmd->num_args > 0) + uses_qemu_ns =3D true; /* now handle the extra environment variables */ n =3D virXPathNodeSet("./qemu:commandline/qemu:env", ctxt, &nodes); --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863495; cv=none; d=zoho.com; s=zohoarc; b=i1d2UU383U8hWf0Gdxum3yUmfuO6r1EFZOIWNoTJ1ZrtJOdUzejr0ziewG2OBSUkn+L4ii2oVYSw4db2nBbP+GxpD9dwzfGjb6lrATmwijOKTj8ZSR+5jZddMs8rJ1RyQdmB/xS7aP2dErqypnDTkNcgniqWGqxLSFtrofT8hvk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863495; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=tFGeZcnPCgd9mx3pUGYvJ6gCBGkWk7U/tt5bGN7Ha90=; b=AsV/6VWMU3egF+4o8xS36/dNDAPON0rJ6r7bO4uODd9VsAyTo27oENEXlcFBaLHEjyj5kYjmTZEiXpGrbSOsS2Vnh8nX/QoNFZ88tAaxKJn51WaTs4rn3HucdAB50XWX0LUR0vWcWJBoizCM2bRKayE7HXRE72KEvi23S9J4yXQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863495338455.8391602184603; Tue, 18 Jun 2019 06:11:35 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 28E5F30C1AFD; Tue, 18 Jun 2019 13:11:21 +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 0395617AE6; Tue, 18 Jun 2019 13:11:20 +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 B9C60206D5; Tue, 18 Jun 2019 13:11:17 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAWmt018701 for ; Tue, 18 Jun 2019 09:10:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id 09ED91001DD7; Tue, 18 Jun 2019 13:10:32 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 899571001DCB for ; Tue, 18 Jun 2019 13:10:31 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:14 +0200 Message-Id: <39e8a22ad59eafc3ae50e44e19ddd655212aa00b.1560863172.git.pkrempa@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/15] qemu: Extract parsing of qemu namespace env vars into separate function 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 18 Jun 2019 13:11:26 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Simplify the main function by splitting out how we parse the extra passthrough environment variables. Note that the validation function checks that the first letter must be a character or underscore which makes the check whether the name is redundant. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 111 ++++++++++++++++++++++------------------- 1 file changed, 59 insertions(+), 52 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 3dfe4fc544..5c4bca1c6a 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3143,6 +3143,62 @@ qemuDomainDefNamespaceParseCommandlineArgs(qemuDomai= nXmlNsDefPtr nsdef, } +static int +qemuDomainDefNamespaceParseCommandlineEnvNameValidate(const char *envname) +{ + if (!c_isalpha(envname[0]) && envname[0] !=3D '_') { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid environment name, it must begin with a l= etter or underscore")); + return -1; + } + + if (strspn(envname, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw= xyz0123456789_") !=3D strlen(envname)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("Invalid environment name, it must contain only a= lphanumerics and underscore")); + return -1; + } + + return 0; +} + + +static int +qemuDomainDefNamespaceParseCommandlineEnv(qemuDomainXmlNsDefPtr nsdef, + xmlXPathContextPtr ctxt) +{ + VIR_AUTOFREE(xmlNodePtr *) nodes =3D NULL; + ssize_t nnodes; + size_t i; + + if ((nnodes =3D virXPathNodeSet("./qemu:commandline/qemu:env", ctxt, &= nodes)) < 0) + return -1; + + if (nnodes =3D=3D 0) + return 0; + + if (VIR_ALLOC_N(nsdef->env_name, nnodes) < 0 || + VIR_ALLOC_N(nsdef->env_value, nnodes) < 0) + return -1; + + for (i =3D 0; i < nnodes; i++) { + if (!(nsdef->env_name[nsdef->num_env] =3D virXMLPropString(nodes[i= ], "name"))) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("No qemu environment name specified")); + return -1; + } + + if (qemuDomainDefNamespaceParseCommandlineEnvNameValidate(nsdef->e= nv_name[nsdef->num_env]) < 0) + return -1; + + nsdef->env_value[nsdef->num_env] =3D virXMLPropString(nodes[i], "v= alue"); + /* a NULL value for command is allowed, since it might be empty */ + nsdef->num_env++; + } + + return 0; +} + + static int qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_UNUSED, xmlNodePtr root ATTRIBUTE_UNUSED, @@ -3151,9 +3207,6 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_U= NUSED, { qemuDomainXmlNsDefPtr cmd =3D NULL; bool uses_qemu_ns =3D false; - xmlNodePtr *nodes =3D NULL; - int n; - size_t i; if (xmlXPathRegisterNs(ctxt, BAD_CAST "qemu", BAD_CAST QEMU_NAMESPACE_= HREF) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3165,58 +3218,13 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE= _UNUSED, if (VIR_ALLOC(cmd) < 0) return -1; - if (qemuDomainDefNamespaceParseCommandlineArgs(cmd, ctxt) < 0) + if (qemuDomainDefNamespaceParseCommandlineArgs(cmd, ctxt) < 0 || + qemuDomainDefNamespaceParseCommandlineEnv(cmd, ctxt) < 0) goto error; - if (cmd->num_args > 0) + if (cmd->num_args > 0 || cmd->num_env > 0) uses_qemu_ns =3D true; - /* now handle the extra environment variables */ - n =3D virXPathNodeSet("./qemu:commandline/qemu:env", ctxt, &nodes); - if (n < 0) - goto error; - uses_qemu_ns |=3D n > 0; - - if (n && VIR_ALLOC_N(cmd->env_name, n) < 0) - goto error; - - if (n && VIR_ALLOC_N(cmd->env_value, n) < 0) - goto error; - - for (i =3D 0; i < n; i++) { - char *tmp; - - tmp =3D virXMLPropString(nodes[i], "name"); - if (tmp =3D=3D NULL) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("No qemu environment name specified")); - goto error; - } - if (tmp[0] =3D=3D '\0') { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Empty qemu environment name specified"= )); - goto error; - } - if (!c_isalpha(tmp[0]) && tmp[0] !=3D '_') { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid environment name, it must begi= n with a letter or underscore")); - goto error; - } - if (strspn(tmp, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvw= xyz0123456789_") !=3D strlen(tmp)) { - virReportError(VIR_ERR_INTERNAL_ERROR, - "%s", _("Invalid environment name, it must cont= ain only alphanumerics and underscore")); - goto error; - } - - cmd->env_name[cmd->num_env] =3D tmp; - - cmd->env_value[cmd->num_env] =3D virXMLPropString(nodes[i], "value= "); - /* a NULL value for command is allowed, since it might be empty */ - cmd->num_env++; - } - - VIR_FREE(nodes); - if (uses_qemu_ns) *data =3D cmd; else @@ -3225,7 +3233,6 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_U= NUSED, return 0; error: - VIR_FREE(nodes); qemuDomainDefNamespaceFree(cmd); return -1; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863467; cv=none; d=zoho.com; s=zohoarc; b=kn1fdo2V4h4Sccwcq1faB2Iwlz4qXWNooZfev4aCRQwuddXLxcvorWAPkxCNSOdC7B/bCy2UnCQ5Qj1YgHSDTfE3acbTenBihv/OfyWCRFIPud2yuhGvPmiYdMO6NHQ51GmYCiQz3Ja/WpAQqIgr31VfsnFoduER1RTLTYqGG5U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863467; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=Kzl+PSzyzBu27P9BFgnskyueLgsDtNohb06rOBjqdFw=; b=W8o/wsXogbYwPKB/ZYohzIOKcvqcVy0LYIiRAjl/rzt8dVhkdbEIBeYcld2CdoIhSyw07MfsBZDRfsaIMEyMTmD28l7k3XP+JZ3KzuJfm5O/21KaYKL32SEcaSko0JK4/Mslx8ED9f7ztqovE5E43q3vlvdAemOG0Raq+aP96pQ= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863467682439.24437160777916; Tue, 18 Jun 2019 06:11:07 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B525A3092677; Tue, 18 Jun 2019 13:10:45 +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 4C6BA7C61C; Tue, 18 Jun 2019 13:10:42 +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 03A6D3F6E4; Tue, 18 Jun 2019 13:10:36 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAWvm018706 for ; Tue, 18 Jun 2019 09:10:32 -0400 Received: by smtp.corp.redhat.com (Postfix) id CC8161001DEE; Tue, 18 Jun 2019 13:10:32 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 567851001DCB for ; Tue, 18 Jun 2019 13:10:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:15 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/15] qemu: Refactor qemuDomainDefNamespaceParse 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Tue, 18 Jun 2019 13:11:01 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Rename 'cmd' to 'nsdef' and improve the control flow. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 29 ++++++++++++----------------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 5c4bca1c6a..ee8c9397e0 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3205,8 +3205,8 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE_U= NUSED, xmlXPathContextPtr ctxt, void **data) { - qemuDomainXmlNsDefPtr cmd =3D NULL; - bool uses_qemu_ns =3D false; + qemuDomainXmlNsDefPtr nsdata =3D NULL; + int ret =3D -1; if (xmlXPathRegisterNs(ctxt, BAD_CAST "qemu", BAD_CAST QEMU_NAMESPACE_= HREF) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, @@ -3215,26 +3215,21 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE= _UNUSED, return -1; } - if (VIR_ALLOC(cmd) < 0) + if (VIR_ALLOC(nsdata) < 0) return -1; - if (qemuDomainDefNamespaceParseCommandlineArgs(cmd, ctxt) < 0 || - qemuDomainDefNamespaceParseCommandlineEnv(cmd, ctxt) < 0) - goto error; - - if (cmd->num_args > 0 || cmd->num_env > 0) - uses_qemu_ns =3D true; + if (qemuDomainDefNamespaceParseCommandlineArgs(nsdata, ctxt) < 0 || + qemuDomainDefNamespaceParseCommandlineEnv(nsdata, ctxt) < 0) + goto cleanup; - if (uses_qemu_ns) - *data =3D cmd; - else - VIR_FREE(cmd); + if (nsdata->num_args > 0 || nsdata->num_env > 0) + VIR_STEAL_PTR(*data, nsdata); - return 0; + ret =3D 0; - error: - qemuDomainDefNamespaceFree(cmd); - return -1; + cleanup: + qemuDomainDefNamespaceFree(nsdata); + return ret; } static int --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863510; cv=none; d=zoho.com; s=zohoarc; b=kEj1MxII6aU4P6UmV+HitnIiJ9xGDURmZ0fQFPxNN6ekO/15FYQ9N7cv1xdgdFup/ohDpn8f44dxEU4pwfoXCu0Ba84Js/yizlT0WSvTowsmt5RVExN1xl+FmmsyII+rYTnSI54ZnitrGbocJavPN6mvLVWVIr1RsFfy+aqR/0o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863510; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=FUzfwwiHdjKM/yYEQcisgQKPPOJ8gRHyyaPItnKLfvI=; b=oRMYvVCX8vFBTd6PsdsUdAd0bXAhZXkPz8IqHrW+wRgjS0cEOtmhXnjSbFVH0XN/sEoJp6YkTWczccQ7QwfRIaEJHzVIKOEQ0YXw/WmFpbbcOIrVSgO+9jVNLDUEkAFGFSPmGOKnfqZXOfOushVXkUCx6FE53LT1fVX8++uZ0Tc= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863510786141.8323978857362; Tue, 18 Jun 2019 06:11:50 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 281BF3002F44; Tue, 18 Jun 2019 13:11:49 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E53F37E8EC; Tue, 18 Jun 2019 13:11:46 +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 A6BA71806B1C; Tue, 18 Jun 2019 13:11:45 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAZUi018735 for ; Tue, 18 Jun 2019 09:10:35 -0400 Received: by smtp.corp.redhat.com (Postfix) id 8476F1001B3D; Tue, 18 Jun 2019 13:10:35 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0FDE21001E67 for ; Tue, 18 Jun 2019 13:10:32 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:16 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/15] qemu: domain: Split out commandline namespace data formatting 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Tue, 18 Jun 2019 13:11:49 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Separate it from qemuDomainDefNamespaceFormatXML. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/qemu/qemu_domain.c | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index ee8c9397e0..864071220b 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -3232,15 +3232,15 @@ qemuDomainDefNamespaceParse(xmlDocPtr xml ATTRIBUTE= _UNUSED, return ret; } -static int -qemuDomainDefNamespaceFormatXML(virBufferPtr buf, - void *nsdata) + +static void +qemuDomainDefNamespaceFormatXMLCommandline(virBufferPtr buf, + qemuDomainXmlNsDefPtr cmd) { - qemuDomainXmlNsDefPtr cmd =3D nsdata; size_t i; if (!cmd->num_args && !cmd->num_env) - return 0; + return; virBufferAddLit(buf, "\n"); virBufferAdjustIndent(buf, 2); @@ -3257,6 +3257,17 @@ qemuDomainDefNamespaceFormatXML(virBufferPtr buf, virBufferAdjustIndent(buf, -2); virBufferAddLit(buf, "\n"); +} + + +static int +qemuDomainDefNamespaceFormatXML(virBufferPtr buf, + void *nsdata) +{ + qemuDomainXmlNsDefPtr cmd =3D nsdata; + + qemuDomainDefNamespaceFormatXMLCommandline(buf, cmd); + return 0; } --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863508; cv=none; d=zoho.com; s=zohoarc; b=VnXAZlOPhlqr264QEQJGPsP+mrMdu9u/qALkB6HLEocSEFJy5lSsYcNAGlZZMAEJhkE5K22ib0SbODv0Nq/4tp8KPoXLk+D7LZ8+ezziTSyyJ20MEHO35cVEP/fGxwsrLq4PVMHJmBmy5nQ5JLs6v8ePKdb9z+CgRd6GTvnA8BM= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863508; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=KxQB8ny13czd8SqG6dVlS3CY0PWZypshhyiHydRHOf8=; b=Cib1o7PVgNHSBsbyJ7YMXos/945oDe95bnr603vJMEvnrTBzRLCQ1uUzm87SHQNlm+X7v5K7e+Z4gP0qm2Wg6SyA87kyARk9AC59v7d/KtqrtzlZVMsa/f7NPASq4TiXmKfBj51GH842w0VMiffDYhl8OF3QUSLsCQJ18zKm7sY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863508784192.68000476019893; Tue, 18 Jun 2019 06:11:48 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E7B4E307D983; Tue, 18 Jun 2019 13:11:36 +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 BD80D19492; Tue, 18 Jun 2019 13:11:35 +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 5BB48206D9; Tue, 18 Jun 2019 13:11:34 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAaOm018743 for ; Tue, 18 Jun 2019 09:10:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id 52B3F1001B3D; Tue, 18 Jun 2019 13:10:36 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id D09091001DE4 for ; Tue, 18 Jun 2019 13:10:35 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:17 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/15] conf: Add taint flag for custom hypervisor features 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 18 Jun 2019 13:11:42 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Upcomming patches will allow enabling/disabling custom hypervisor features for debugging/testing purposes via the qemu namespace. Add a taint flag where we will flag such a domain so it's obvious what's happening. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- src/conf/domain_conf.c | 1 + src/conf/domain_conf.h | 1 + 2 files changed, 2 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index ee651e7742..5503f081f1 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -107,6 +107,7 @@ VIR_ENUM_IMPL(virDomainTaint, "cdrom-passthrough", "custom-dtb", "custom-ga-command", + "custom-hypervisor-feature", ); VIR_ENUM_IMPL(virDomainVirt, diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 2878050672..c1b5fc1337 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2530,6 +2530,7 @@ typedef enum { VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */ VIR_DOMAIN_TAINT_CUSTOM_DTB, /* Custom device tree blob was spec= ified */ VIR_DOMAIN_TAINT_CUSTOM_GA_COMMAND, /* Custom guest agent command */ + VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, /* custom hypervisor featu= re control */ VIR_DOMAIN_TAINT_LAST } virDomainTaintFlags; --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sun May 5 15:18:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1560863519; cv=none; d=zoho.com; s=zohoarc; b=dmnB2/y/tA5NqCTTT4Iue2f1Io5SzpnjWnW8w++H3Ju5W+/Nb8lzYgdcvbqKBDgVQS6W0K5kQFENGPtE7N1etPLoBnkagnpsyTgCDp5/3KmL8PLRMyGieD7ajUQZ8ymy5Zoyjp4Z4cykdFv5wQEBQ89cteK2q0q5O2qZwSqYZ3U= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1560863519; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=/D52iLhIYrVYYE35YRxwllB/g6Qh3d2dzMDMyA4VfZU=; b=ld8FMzu7Et3RfJudCtKAgTAW1wRAdqzXChOaSLuJMYJEBZbKJD/nE52bGHX8K61l9BgL04wJjM6QwpWLTcLLnvuXKqB+Ot+gVmheAA/7m3mbNe7vj5UtsCyQXbAiWmnFQ0+50LJldP8OfKewL64AtbAN3BcvzKmKoP7qOIr74I0= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1560863519582859.4001084057744; Tue, 18 Jun 2019 06:11:59 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5C6D2A836; Tue, 18 Jun 2019 13:11:48 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3906C7E8E6; Tue, 18 Jun 2019 13:11:48 +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 EB0D31806B18; Tue, 18 Jun 2019 13:11:47 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x5IDAduZ018762 for ; Tue, 18 Jun 2019 09:10:39 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7BC841001DD7; Tue, 18 Jun 2019 13:10:39 +0000 (UTC) Received: from angien.brq.redhat.com (unknown [10.43.2.229]) by smtp.corp.redhat.com (Postfix) with ESMTP id 073611001E73 for ; Tue, 18 Jun 2019 13:10:36 +0000 (UTC) From: Peter Krempa To: libvir-list@redhat.com Date: Tue, 18 Jun 2019 15:10:18 +0200 Message-Id: In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/15] qemu: Add support for controling qemu capabilities via the qemu XML namespace 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: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Tue, 18 Jun 2019 13:11:58 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Similarly how we allow adding arbitrary command line arguments and environment variables this patch introduces the ability to control libvirt's perception of the qemu process by tweaking the capability bits for testing purposes. The idea is to allow developers and users either test a new feature by enabling it early or disabling it to see whether it introduced regressions. This feature is not meant for production use though, so users should handle it with care. Signed-off-by: Peter Krempa Reviewed-by: J=C3=A1n Tomko --- docs/drvqemu.html.in | 30 ++++++++++++ docs/schemas/domaincommon.rng | 19 ++++++++ src/qemu/qemu_domain.c | 76 +++++++++++++++++++++++++++++- src/qemu/qemu_domain.h | 6 +++ tests/qemuxml2argvdata/qemu-ns.xml | 5 ++ 5 files changed, 134 insertions(+), 2 deletions(-) diff --git a/docs/drvqemu.html.in b/docs/drvqemu.html.in index cf36f6cc7b..aa61ee5ced 100644 --- a/docs/drvqemu.html.in +++ b/docs/drvqemu.html.in @@ -519,6 +519,36 @@ mount -t cgroup none /dev/cgroup -o devices <qemu:env name=3D'QEMU_ENV' value=3D'VAL'/> </qemu:commandline> </domain> + + +

QEMU feature configuration for testing=

+ +

+ In some cases e.g. when developing a new feature or for testing it= may + be required to control a given qemu feature (or qemu capability) t= o test + it before it's complete or disable it for debugging purposes. + Since 5.5.0 it's possible to use the = same + special qemu namespace as above + (http://libvirt.org/schemas/domain/qemu/1.0) and use + <qemu:capabilities> element to add + (<qemu:add capability=3D"capname"/>) or remove + (<qemu:del capability=3D"capname"/>) capability= bits. + The naming of the feature bits is the same libvirt uses in the sta= tus + XML. Note that this feature is meant for experiments only and shou= ld + _not_ be used in production. +

+ +

Example:

+<domain type=3D'qemu' xmlns:qemu=3D'http://libvirt.org/schemas/domain/q=
emu/1.0'>
+  <name>testvm</name>
+
+   [...]
+
+  <qemu:capabilities>
+    <qemu:add capability=3D'blockdev'/>
+    <qemu:del capability=3D'drive'/>
+  </qemu:capabilities>
+</domain>
 

Example domain XML config

diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 3661f0a556..ad4c32d480 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -72,6 +72,9 @@ + + + @@ -6197,6 +6200,22 @@ + + + + + + + + + + + + + + + +