From nobody Wed May 14 06:08:19 2025 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880147707401.71411069839814; Wed, 9 May 2018 08:35:47 -0700 (PDT) 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 D723B3002481; Wed, 9 May 2018 15:35:44 +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 7398A61D2C; Wed, 9 May 2018 15:35:44 +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 E19664CAA1; Wed, 9 May 2018 15:35:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49FZfDJ010087 for ; Wed, 9 May 2018 11:35:41 -0400 Received: by smtp.corp.redhat.com (Postfix) id 26D8E9EDEE; Wed, 9 May 2018 15:35:41 +0000 (UTC) Received: from mx1.redhat.com (ext-mx20.extmail.prod.ext.phx2.redhat.com [10.5.110.49]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 174FC9EDEA for ; Wed, 9 May 2018 15:35:39 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 82DF0300442D for ; Wed, 9 May 2018 15:35:38 +0000 (UTC) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FZFZK142113 for ; Wed, 9 May 2018 11:35:38 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv1ve6qmd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:35:25 -0400 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:34:45 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:34:42 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps3074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWNgL51380440 for ; Wed, 9 May 2018 15:34:40 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 55A83AE906 for ; Wed, 9 May 2018 15:46:37 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 33A37AE921 for ; Wed, 9 May 2018 15:46:37 +0100 (BST) Received: from marc-ibm.boeblingen.de.ibm.com (unknown [9.152.224.71]) by d06av26.portsmouth.uk.ibm.com (Postfix) with ESMTP for ; Wed, 9 May 2018 15:46:37 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:17 +0200 In-Reply-To: <20180509145622.23049-1-mhartmay@linux.vnet.ibm.com> References: <20180509145622.23049-1-mhartmay@linux.vnet.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18050915-0040-0000-0000-00000437D1C7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-0000263C1318 Message-Id: <20180509145622.23049-8-mhartmay@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2018-05-09_06:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805090146 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 207 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 09 May 2018 15:35:38 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); Wed, 09 May 2018 15:35:38 +0000 (UTC) for IP:'148.163.156.1' DOMAIN:'mx0a-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'mhartmay@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -0.7 (RCVD_IN_DNSWL_LOW) 148.163.156.1 mx0a-001b2d01.pphosted.com 148.163.156.1 mx0a-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.49 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 07/12] qemu: Add support for virDomainCreateWithParams 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 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.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Wed, 09 May 2018 15:35:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add support for the API virDomainCreateWithParams to the QEMU driver. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/qemu/qemu_driver.c | 49 +++++++++++++++++++++++++++++++++++++++++++++-= --- 1 file changed, 45 insertions(+), 4 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 9a43d4157b09..2156078feffe 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -7332,24 +7332,55 @@ qemuDomainObjStart(virConnectPtr conn, =20 =20 static int -qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) +qemuDomainCreateWithParams(virDomainPtr dom, + virTypedParameterPtr params, + int nparams, + unsigned int flags) { virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm; int ret =3D -1; - const virCreateParams createParams =3D { 0 }; + size_t i; + virCreateParams createParams =3D { 0 }; =20 virCheckFlags(VIR_DOMAIN_START_PAUSED | VIR_DOMAIN_START_AUTODESTROY | VIR_DOMAIN_START_BYPASS_CACHE | VIR_DOMAIN_START_FORCE_BOOT, -1); =20 + if (virTypedParamsValidate(params, nparams, + VIR_DOMAIN_CREATE_PARM_DEVICE_IDENTIFIER, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_CREATE_PARM_KERNEL, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_CREATE_PARM_INITRD, + VIR_TYPED_PARAM_STRING, + VIR_DOMAIN_CREATE_PARM_CMDLINE, + VIR_TYPED_PARAM_STRING, + NULL) < 0) + return -1; + + for (i =3D 0; i < nparams; i++) { + virTypedParameterPtr param =3D ¶ms[i]; + const char *value_str =3D param->value.s; + + if (STREQ(param->field, VIR_DOMAIN_CREATE_PARM_DEVICE_IDENTIFIER))= { + createParams.bootDeviceIdentifier =3D value_str; + } else if (STREQ(param->field, VIR_DOMAIN_CREATE_PARM_KERNEL)) { + createParams.kernel =3D value_str; + } else if (STREQ(param->field, VIR_DOMAIN_CREATE_PARM_INITRD)) { + createParams.initrd =3D value_str; + } else if (STREQ(param->field, VIR_DOMAIN_CREATE_PARM_CMDLINE)) { + createParams.cmdline =3D value_str; + } + } + virNWFilterReadLockFilterUpdates(); =20 if (!(vm =3D qemuDomObjFromDomain(dom))) goto cleanup; =20 - if (virDomainCreateWithFlagsEnsureACL(dom->conn, vm->def) < 0) + if (virDomainCreateWithParamsEnsureACL(dom->conn, vm->def) < 0) goto cleanup; =20 if (qemuProcessBeginJob(driver, vm, VIR_DOMAIN_JOB_OPERATION_START, @@ -7378,12 +7409,21 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigne= d int flags) return ret; } =20 + +static int +qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) +{ + return qemuDomainCreateWithParams(dom, NULL, 0, flags); +} + + static int qemuDomainCreate(virDomainPtr dom) { - return qemuDomainCreateWithFlags(dom, 0); + return qemuDomainCreateWithParams(dom, NULL, 0, 0); } =20 + static virDomainPtr qemuDomainDefineXMLFlags(virConnectPtr conn, const char *xml, @@ -21421,6 +21461,7 @@ static virHypervisorDriver qemuHypervisorDriver =3D= { .connectNumOfDefinedDomains =3D qemuConnectNumOfDefinedDomains, /* 0.2= .0 */ .domainCreate =3D qemuDomainCreate, /* 0.2.0 */ .domainCreateWithFlags =3D qemuDomainCreateWithFlags, /* 0.8.2 */ + .domainCreateWithParams =3D qemuDomainCreateWithParams, /* 4.4.0 */ .domainDefineXML =3D qemuDomainDefineXML, /* 0.2.0 */ .domainDefineXMLFlags =3D qemuDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine =3D qemuDomainUndefine, /* 0.2.0 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list