From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880247528885.6105982194456; Wed, 9 May 2018 08:37:27 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id AF186300370F; Wed, 9 May 2018 15:37:25 +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 6BD9B2010CCF; Wed, 9 May 2018 15:37:25 +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 10AC01808850; Wed, 9 May 2018 15:37:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49FbNQn010598 for ; Wed, 9 May 2018 11:37:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 7554065325; Wed, 9 May 2018 15:37:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 6037365321 for ; Wed, 9 May 2018 15:37:16 +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 DBB7319D241 for ; Wed, 9 May 2018 15:37:15 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FYfXa023881 for ; Wed, 9 May 2018 11:37:15 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv38utbs9-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:37:15 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:37:12 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:37:11 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWMXR51118150 for ; Wed, 9 May 2018 15:37:10 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 56636B758E for ; Wed, 9 May 2018 15:46:34 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 0E488B720E for ; Wed, 9 May 2018 15:46:30 +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:29 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:11 +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-0020-0000-0000-0000041AD00D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0021-0000-0000-000042B0107E Message-Id: <20180509145622.23049-2-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.29]); Wed, 09 May 2018 15:37:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 09 May 2018 15:37:16 +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.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 01/12] virsh: Force boot emulation is only required for virDomainCreateWithFlags 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 09 May 2018 15:37:26 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The force boot emulation is only required for virDomainCreateWithFlags as the flag VIR_DOMAIN_START_FORCE_BOOT was introduced with the commit 27c85260532f879be5674a4eed0811c21fd34f94 (2011). But virDomainCreateXMLWithFiles is newer and therefore already had support for VIR_DOMAIN_START_FORCE_BOOT. This means there is now no second call with VIR_DOMAIN_START_FORCE_BOOT removed from flags for virDomainCreateXMLWithFiles in case the first call fails. virDomainCreateXMLWithFiles was introduced with commit d76227bea35cc49374a94414f6d46e3493ac2a52 (2013). This patch takes this into account and simplifies the function. In addition, it's now easier to extend the function. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- tools/virsh-domain.c | 52 ++++++++++++++++++++++++++++--------------------= ---- 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 598d2fa4a4bd..7cf8373f05bc 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -4038,40 +4038,44 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "force-boot")) flags |=3D VIR_DOMAIN_START_FORCE_BOOT; =20 - /* We can emulate force boot, even for older servers that reject it. = */ - if (flags & VIR_DOMAIN_START_FORCE_BOOT) { - if ((nfds ? - virDomainCreateWithFiles(dom, nfds, fds, flags) : - virDomainCreateWithFlags(dom, flags)) =3D=3D 0) - goto started; - if (last_error->code !=3D VIR_ERR_NO_SUPPORT && - last_error->code !=3D VIR_ERR_INVALID_ARG) { - vshReportError(ctl); - goto cleanup; - } - vshResetLibvirtError(); - rc =3D virDomainHasManagedSaveImage(dom, 0); - if (rc < 0) { - /* No managed save image to remove */ - vshResetLibvirtError(); - } else if (rc > 0) { - if (virDomainManagedSaveRemove(dom, 0) < 0) { + /* Prefer older API unless we have to pass extra parameters */ + if (nfds) { + rc =3D virDomainCreateWithFiles(dom, nfds, fds, flags); + } else if (flags) { + rc =3D virDomainCreateWithFlags(dom, flags); + /* We can emulate force boot, even for older servers that + * reject it. */ + if (rc < 0 && flags & VIR_DOMAIN_START_FORCE_BOOT) { + if (last_error->code !=3D VIR_ERR_NO_SUPPORT && + last_error->code !=3D VIR_ERR_INVALID_ARG) { vshReportError(ctl); goto cleanup; } + vshResetLibvirtError(); + rc =3D virDomainHasManagedSaveImage(dom, 0); + if (rc < 0) { + /* No managed save image to remove */ + vshResetLibvirtError(); + } else if (rc > 0) { + if (virDomainManagedSaveRemove(dom, 0) < 0) { + vshReportError(ctl); + goto cleanup; + } + } + + /* now try it again without the force boot flag */ + flags &=3D ~VIR_DOMAIN_START_FORCE_BOOT; + rc =3D virDomainCreateWithFlags(dom, flags); } - flags &=3D ~VIR_DOMAIN_START_FORCE_BOOT; + } else { + rc =3D virDomainCreate(dom); } =20 - /* Prefer older API unless we have to pass a flag. */ - if ((nfds ? virDomainCreateWithFiles(dom, nfds, fds, flags) : - (flags ? virDomainCreateWithFlags(dom, flags) - : virDomainCreate(dom))) < 0) { + if (rc < 0) { vshError(ctl, _("Failed to start domain %s"), virDomainGetName(dom= )); goto cleanup; } =20 - started: vshPrintExtra(ctl, _("Domain %s started\n"), virDomainGetName(dom)); #ifndef WIN32 --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880233592666.7260945625129; Wed, 9 May 2018 08:37:13 -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 EA7384E05F; Wed, 9 May 2018 15:37:11 +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 B0C742C8EF; Wed, 9 May 2018 15:37:11 +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 684CE4CAA1; Wed, 9 May 2018 15:37:11 +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 w49Fb8w8010575 for ; Wed, 9 May 2018 11:37:08 -0400 Received: by smtp.corp.redhat.com (Postfix) id B7AD610840D2; Wed, 9 May 2018 15:37:08 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AEDCF10840D8 for ; Wed, 9 May 2018 15:37:03 +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 8DAC73003A5B for ; Wed, 9 May 2018 15:37:02 +0000 (UTC) Received: from pps.filterd (m0098396.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FZgGr056030 for ; Wed, 9 May 2018 11:37:02 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv1shqaxp-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:37:01 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:36:58 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:36:57 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWLp9262512 for ; Wed, 9 May 2018 15:36:57 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4212B7466 for ; Wed, 9 May 2018 15:46:34 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 39D0AB714A for ; Wed, 9 May 2018 15:46:31 +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:31 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:12 +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-00000457C1B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-000020FBCE59 Message-Id: <20180509145622.23049-3-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.42]); Wed, 09 May 2018 15:37:02 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 09 May 2018 15:37:02 +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.42 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 02/12] Introduce new domain create API 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 09 May 2018 15:37:12 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Introduce new libvirt API virDomainCreateWithParams that allows to temporarily boot from another boot device, to use another kernel, initrd, and cmdline than defined in the persistent domain definition. All typed parameters are optional. The design of the API was chosen to ease future extensions. Signed-off-by: Marc Hartmayer Reviewed-by: Stefan Zimmermann Reviewed-by: Boris Fiuczynski --- include/libvirt/libvirt-domain.h | 37 +++++++++++++++++++++++ src/driver-hypervisor.h | 6 ++++ src/libvirt-domain.c | 64 ++++++++++++++++++++++++++++++++++++= ++++ src/libvirt_public.syms | 4 +++ 4 files changed, 111 insertions(+) diff --git a/include/libvirt/libvirt-domain.h b/include/libvirt/libvirt-dom= ain.h index 12fd34037e5d..58e4de048a4f 100644 --- a/include/libvirt/libvirt-domain.h +++ b/include/libvirt/libvirt-domain.h @@ -1790,6 +1790,43 @@ int virConnectListAllDomains (vi= rConnectPtr conn, virDomainPtr **domains, unsigned int flags); int virDomainCreate (virDomainPtr domain); + +/** + * VIR_DOMAIN_CREATE_PARM_KERNEL: + * + * Macro for typed parameter name that represents the used kernel. It + * corresponds to the "kernel" node in the XML. + */ +# define VIR_DOMAIN_CREATE_PARM_KERNEL "kernel" + +/** + * VIR_DOMAIN_CREATE_PARM_CMDLINE: + * + * Macro for typed parameter name that represents the used cmdline. It + * corresponds to the "cmdline" node in the XML. + */ +# define VIR_DOMAIN_CREATE_PARM_CMDLINE "cmdline" + +/** + * VIR_DOMAIN_CREATE_PARM_INITRD: + * + * Macro for typed parameter name that represents the used initial + * ramdisk. It corresponds to the "initrd" node in the XML. + */ +# define VIR_DOMAIN_CREATE_PARM_INITRD "initrd" + +/** + * VIR_DOMAIN_CREATE_PARM_DEVICE_IDENTIFIER: + * + * Macro for typed parameter name that represents the identifier for + * the boot device. + */ +# define VIR_DOMAIN_CREATE_PARM_DEVICE_IDENTIFIER "bootdevice" + +int virDomainCreateWithParams (virDomainPtr domain, + virTypedParameterPtr pa= rams, + int nparams, + unsigned int flags); int virDomainCreateWithFlags (virDomainPtr domain, unsigned int flags); =20 diff --git a/src/driver-hypervisor.h b/src/driver-hypervisor.h index e71a72a44132..2fa9e09e12f6 100644 --- a/src/driver-hypervisor.h +++ b/src/driver-hypervisor.h @@ -313,6 +313,11 @@ typedef int unsigned int nfiles, int *files, unsigned int flags); +typedef int +(*virDrvDomainCreateWithParams)(virDomainPtr dom, + virTypedParameterPtr params, + int nparams, + unsigned int flags); =20 typedef virDomainPtr (*virDrvDomainDefineXML)(virConnectPtr conn, @@ -1383,6 +1388,7 @@ struct _virHypervisorDriver { virDrvDomainCreate domainCreate; virDrvDomainCreateWithFlags domainCreateWithFlags; virDrvDomainCreateWithFiles domainCreateWithFiles; + virDrvDomainCreateWithParams domainCreateWithParams; virDrvDomainDefineXML domainDefineXML; virDrvDomainDefineXMLFlags domainDefineXMLFlags; virDrvDomainUndefine domainUndefine; diff --git a/src/libvirt-domain.c b/src/libvirt-domain.c index 2d86e48979d3..36badab2d5d9 100644 --- a/src/libvirt-domain.c +++ b/src/libvirt-domain.c @@ -6682,6 +6682,70 @@ virDomainCreateWithFiles(virDomainPtr domain, unsign= ed int nfiles, =20 =20 /** + * virDomainCreateWithParams: + * @domain: pointer to a defined domain + * @params: pointer to boot parameter objects + * @nparams: number of boot parameter objects + * @flags: bitwise-OR of supported virDomainCreateFlags + * + * Launch a defined domain. If the call succeeds the domain moves from + * the defined to the running domains pools. + * + * @params provides an array of typed parameters with the length + * @nparams. This array will be used to configure the domain to be + * temporary started from the device specified by the typed parameter + * 'bootdevice'. With the typed parameters 'kernel', 'initrd', and + * 'cmdline' it's possible to temporarily override the corresponding + * values. All typed parameters are optional. + * + * For more control over @flags, see virDomainCreateWithFlags(). + * + * Returns 0 in case of success, -1 in case of error + */ +int +virDomainCreateWithParams(virDomainPtr domain, + virTypedParameterPtr params, + int nparams, + unsigned int flags) +{ + virConnectPtr conn; + + VIR_DOMAIN_DEBUG(domain, "params=3D%p, nparams=3D%d, flags=3D0x%x", + params, nparams, flags); + VIR_TYPED_PARAMS_DEBUG(params, nparams); + + virResetLastError(); + + virCheckDomainReturn(domain, -1); + conn =3D domain->conn; + + virCheckReadOnlyGoto(conn->flags, error); + virCheckNonNegativeArgGoto(nparams, error); + if (nparams > 0) + virCheckNonNullArgGoto(params, error); + + if (virTypedParameterValidateSet(conn, params, nparams) < 0) + goto error; + + if (conn->driver->domainCreateWithParams) { + int ret; + ret =3D conn->driver->domainCreateWithParams(domain, + params, + nparams, + flags); + if (ret < 0) + goto error; + return ret; + } + + virReportUnsupportedError(); + error: + virDispatchError(domain->conn); + return -1; +} + + +/** * virDomainGetAutostart: * @domain: a domain object * @autostart: the value returned diff --git a/src/libvirt_public.syms b/src/libvirt_public.syms index 95df3a0dbc7b..5d9b2697702c 100644 --- a/src/libvirt_public.syms +++ b/src/libvirt_public.syms @@ -785,4 +785,8 @@ LIBVIRT_4.1.0 { virStoragePoolLookupByTargetPath; } LIBVIRT_3.9.0; =20 +LIBVIRT_4.4.0 { + global: + virDomainCreateWithParams; +} LIBVIRT_4.1.0; # .... define new API here using predicted next version number .... --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525881010882634.0288070292055; Wed, 9 May 2018 08:50:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id DDB3830B79FF; Wed, 9 May 2018 15:50:08 +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 0C0A22010D09; Wed, 9 May 2018 15:50:08 +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 9364F4CAA1; Wed, 9 May 2018 15:50:06 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Fo4Nv013953 for ; Wed, 9 May 2018 11:50:04 -0400 Received: by smtp.corp.redhat.com (Postfix) id 4592264458; Wed, 9 May 2018 15:50:04 +0000 (UTC) Received: from mx1.redhat.com (ext-mx18.extmail.prod.ext.phx2.redhat.com [10.5.110.47]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3B8A364452 for ; Wed, 9 May 2018 15:50:00 +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 0F4F43002389 for ; Wed, 9 May 2018 15:49:59 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FnDxm057104 for ; Wed, 9 May 2018 11:49:58 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv14csvfa-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:49:58 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:49:56 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 9 May 2018 16:49:53 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FnqSi7864624 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 9 May 2018 15:49:52 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BB2A8B7232 for ; Wed, 9 May 2018 15:46:34 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6847EB728C for ; Wed, 9 May 2018 15:46:32 +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:32 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:13 +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-0020-0000-0000-0000041AD5C1 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0021-0000-0000-000042B01643 Message-Id: <20180509145622.23049-4-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=4 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-1805090148 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.47]); Wed, 09 May 2018 15:49:59 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 09 May 2018 15:49:59 +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.47 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 03/12] remote: 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.84 on 10.5.11.25 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 09 May 2018 15:50:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add support for virDomainCreateWithParams to the remote driver. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann --- src/remote/remote_driver.c | 1 + src/remote/remote_protocol.x | 22 +++++++++++++++++++++- src/remote_protocol-structs | 12 ++++++++++++ src/rpc/gendispatch.pl | 18 ++++++++++++------ 4 files changed, 46 insertions(+), 7 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 95437b43657e..1bbf42c1e1b2 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -8297,6 +8297,7 @@ static virHypervisorDriver hypervisor_driver =3D { .connectListDefinedDomains =3D remoteConnectListDefinedDomains, /* 0.3= .0 */ .connectNumOfDefinedDomains =3D remoteConnectNumOfDefinedDomains, /* 0= .3.0 */ .domainCreate =3D remoteDomainCreate, /* 0.3.0 */ + .domainCreateWithParams =3D remoteDomainCreateWithParams, /* 4.4.0 */ .domainCreateWithFlags =3D remoteDomainCreateWithFlags, /* 0.8.2 */ .domainCreateWithFiles =3D remoteDomainCreateWithFiles, /* 1.1.1 */ .domainDefineXML =3D remoteDomainDefineXML, /* 0.3.0 */ diff --git a/src/remote/remote_protocol.x b/src/remote/remote_protocol.x index 296a0871813a..d22299879429 100644 --- a/src/remote/remote_protocol.x +++ b/src/remote/remote_protocol.x @@ -73,6 +73,9 @@ const REMOTE_IOTHREAD_INFO_MAX =3D 16384; /* Upper limit on migrate cookie. */ const REMOTE_MIGRATE_COOKIE_MAX =3D 4194304; =20 +/* Upper limit on create params. */ +const REMOTE_CREATE_PARAMS_MAX =3D 4; + /* Upper limit on lists of networks. */ const REMOTE_NETWORK_LIST_MAX =3D 16384; =20 @@ -1054,6 +1057,16 @@ struct remote_domain_create_args { remote_nonnull_domain dom; }; =20 +struct remote_domain_create_with_params_args { + remote_nonnull_domain dom; + remote_typed_param params; + unsigned int flags; +}; + +struct remote_domain_create_with_params_ret { + remote_nonnull_domain dom; +}; + struct remote_domain_create_with_flags_args { remote_nonnull_domain dom; unsigned int flags; @@ -6135,5 +6148,12 @@ enum remote_procedure { * @priority: high * @acl: storage_pool:getattr */ - REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH =3D 391 + REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH =3D 391, + + /** + * @generate: both + * @acl: domain:start + * @acl: domain:write + */ + REMOTE_PROC_DOMAIN_CREATE_WITH_PARAMS =3D 392 }; diff --git a/src/remote_protocol-structs b/src/remote_protocol-structs index fe163db73f88..49ef88f07e62 100644 --- a/src/remote_protocol-structs +++ b/src/remote_protocol-structs @@ -684,6 +684,17 @@ struct remote_connect_num_of_defined_domains_ret { struct remote_domain_create_args { remote_nonnull_domain dom; }; +struct remote_domain_create_with_params_args { + remote_nonnull_domain dom; + struct { + u_int params_len; + remote_typed_param * params_val; + } params; + u_int flags; +}; +struct remote_domain_create_with_params_ret { + remote_nonnull_domain dom; +}; struct remote_domain_create_with_flags_args { remote_nonnull_domain dom; u_int flags; @@ -3269,4 +3280,5 @@ enum remote_procedure { REMOTE_PROC_DOMAIN_MANAGED_SAVE_DEFINE_XML =3D 389, REMOTE_PROC_DOMAIN_SET_LIFECYCLE_ACTION =3D 390, REMOTE_PROC_STORAGE_POOL_LOOKUP_BY_TARGET_PATH =3D 391, + REMOTE_PROC_DOMAIN_CREATE_WITH_PARAMS =3D 392, }; diff --git a/src/rpc/gendispatch.pl b/src/rpc/gendispatch.pl index b8b83b6b40d3..1e32c10e7b7a 100755 --- a/src/rpc/gendispatch.pl +++ b/src/rpc/gendispatch.pl @@ -783,9 +783,12 @@ elsif ($mode eq "server") { } elsif ($ret_member =3D~ m/^remote_nonnull_(domain|networ= k|storage_pool|storage_vol|interface|node_device|secret|nwfilter|domain_sna= pshot) (\S+);/) { my $type_name =3D name_to_TypeName($1); =20 - if ($call->{ProcName} eq "DomainCreateWithFlags") { - # SPECIAL: virDomainCreateWithFlags updates the gi= ven - # domain object instead of returning a ne= w one + if ($call->{ProcName} eq "DomainCreateWithFlags" || + $call->{ProcName} eq "DomainCreateWithParams") { + # SPECIAL: virDomainCreateWithFlags, + # virDomainCreateWithParams, + # updates the given domain object instead of + # returning a new one push(@ret_list, "make_nonnull_$1(&ret->$2, $2);"); $single_ret_var =3D undef; $single_ret_by_ref =3D 1; @@ -1576,9 +1579,12 @@ elsif ($mode eq "client") { my $arg_name =3D $2; my $type_name =3D name_to_TypeName($name); =20 - if ($call->{ProcName} eq "DomainCreateWithFlags") { - # SPECIAL: virDomainCreateWithFlags updates the gi= ven - # domain object instead of returning a ne= w one + if ($call->{ProcName} eq "DomainCreateWithFlags" || + $call->{ProcName} eq "DomainCreateWithParams") { + # SPECIAL: virDomainCreateWithFlags, + # virDomainCreateWithParams + # updates the given domain object instead of + # returning a new one push(@ret_list, "dom->id =3D ret.dom.id;"); push(@ret_list, "xdr_free((xdrproc_t)xdr_$call->{r= et}, (char *)&ret);"); push(@ret_list, "rv =3D 0;"); --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525879990062909.5898414307851; Wed, 9 May 2018 08:33:10 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7B7333002A6F; Wed, 9 May 2018 15:33:08 +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 4AF3A30012AD; Wed, 9 May 2018 15:33:08 +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 F3BF54CAA1; Wed, 9 May 2018 15:33:07 +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 w49FX6w1009879 for ; Wed, 9 May 2018 11:33:06 -0400 Received: by smtp.corp.redhat.com (Postfix) id 726D39EDEF; Wed, 9 May 2018 15:33:06 +0000 (UTC) Received: from mx1.redhat.com (ext-mx07.extmail.prod.ext.phx2.redhat.com [10.5.110.31]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 68C7A9EDEA for ; Wed, 9 May 2018 15:33:04 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 AE632C04BD40 for ; Wed, 9 May 2018 15:33:03 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FI4WY115624 for ; Wed, 9 May 2018 11:33:03 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hv3df18re-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:33:02 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:33:01 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 9 May 2018 16:32:58 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWvaM7733690 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 9 May 2018 15:32:57 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CF2B9B75D4 for ; Wed, 9 May 2018 15:46:34 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 93319B5CF4 for ; Wed, 9 May 2018 15:46:33 +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:33 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:14 +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-00000457BDBB X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-000020FBCA51 Message-Id: <20180509145622.23049-5-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=3 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-1805090142 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.31]); Wed, 09 May 2018 15:33:03 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 09 May 2018 15:33:03 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-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.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.31 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.27 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 04/12] utils: Add virStringUpdate 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.84 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); Wed, 09 May 2018 15:33:09 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" If @src is an empty string then @dst will be freed otherwise @dst will be a duplicate of @src. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann --- src/libvirt_private.syms | 1 + src/util/virstring.c | 27 +++++++++++++++++++++++++++ src/util/virstring.h | 2 ++ 3 files changed, 30 insertions(+) diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index f8883dc50da2..c684f21905af 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -2871,6 +2871,7 @@ virStringStripControlChars; virStringStripIPv6Brackets; virStringToUpper; virStringTrimOptionalNewline; +virStringUpdate; virStrncpy; virStrndup; virStrToDouble; diff --git a/src/util/virstring.c b/src/util/virstring.c index 15f367af7c18..1e9bf1f561b5 100644 --- a/src/util/virstring.c +++ b/src/util/virstring.c @@ -1248,6 +1248,33 @@ virStringReplace(const char *haystack, =20 =20 /** + * virStringUpdate: + * @dest: where to update string + * @src: string to duplicate + * + * If @src is an empty string then @dest will be freed otherwise @dest + * will be a duplicate of @src. + * + * Returns -1 on failure (with OOM error reported), 0 if @dest was + * freed only, 1 if @src was copied + */ +int +virStringUpdate(char **dest, const char *src) +{ + if (virStringIsEmpty(src)) { + VIR_FREE(*dest); + return 0; + } else { + char *temp =3D *dest; + if (VIR_STRDUP(*dest, src) < 0) + return -1; + VIR_FREE(temp); + return 1; + } +} + + +/** * virStringStripIPv6Brackets: * @str: the string to strip * diff --git a/src/util/virstring.h b/src/util/virstring.h index fa2ec1df4def..69f2cb69037d 100644 --- a/src/util/virstring.h +++ b/src/util/virstring.h @@ -290,6 +290,8 @@ char *virStringReplace(const char *haystack, const char *oldneedle, const char *newneedle) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); +int virStringUpdate(char **dest, const char *src) + ATTRIBUTE_NONNULL(1); =20 void virStringStripIPv6Brackets(char *str); bool virStringHasChars(const char *str, --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880354409622.454502706838; Wed, 9 May 2018 08:39:14 -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 C39BFC015C10; Wed, 9 May 2018 15:39:12 +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 451F15DC1E; Wed, 9 May 2018 15:39:12 +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 51972180BADB; Wed, 9 May 2018 15:39:11 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Fd9he010754 for ; Wed, 9 May 2018 11:39:09 -0400 Received: by smtp.corp.redhat.com (Postfix) id A28A130012CD; Wed, 9 May 2018 15:39:09 +0000 (UTC) Received: from mx1.redhat.com (ext-mx17.extmail.prod.ext.phx2.redhat.com [10.5.110.46]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A0FC30001E0 for ; Wed, 9 May 2018 15:39:07 +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 ACD8C30C4F4B for ; Wed, 9 May 2018 15:39:06 +0000 (UTC) Received: from pps.filterd (m0098393.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FYjvf136532 for ; Wed, 9 May 2018 11:39:06 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv38ttffr-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:39:06 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:39:03 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 9 May 2018 16:39:01 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49Fd0uq66519262 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for ; Wed, 9 May 2018 15:39:00 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E8D90AE276 for ; Wed, 9 May 2018 15:46:34 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BDBECB75C8 for ; Wed, 9 May 2018 15:46:34 +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:34 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:15 +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-00000457C348 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-000020FBCFE7 Message-Id: <20180509145622.23049-6-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.46]); Wed, 09 May 2018 15:39:06 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.46]); Wed, 09 May 2018 15:39:06 +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.46 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/12] conf: Add functions to change the boot configuration of a domain 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Wed, 09 May 2018 15:39:13 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add functions for changing the boot configuration of a domain in preparation for upcoming patches. It's possible to change the used kernel, initrd, cmdline, and the used boot device. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/conf/domain_conf.c | 226 +++++++++++++++++++++++++++++++++++++++++++= ++++ src/conf/domain_conf.h | 11 +++ src/libvirt_private.syms | 1 + 3 files changed, 238 insertions(+) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index f678e26b28fd..326afa196cc6 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -28712,6 +28712,232 @@ virDomainObjSetMetadata(virDomainObjPtr vm, } =20 =20 +/** + * virDomainDefSetBootDevice: + * @def: domain definition + * @device: set the boot order priority of this device to highest, + * the domain must contain this device + * + * Set @device as the new boot device for @def + * + * Increment all boot indices that are set (bootindex > 0) except for + * @device and all those devices that have a bootindex greater than + * the old bootindex of @device if the index was set. Additionally, it + * disables the boot order defined in the 'os' XML node of a domain + * definition. + * + * E.g. a domain has the following devices + * diskA: boot order 1 + * diskB: boot order 2 + * hostdevA: boot order 3 + * If we now set diskB to the new boot device. It results in + * diskA: boot order 2 + * diskB: boot order 1 + * hostdevA: boot order 3 (note: the boot order value remains the same) + * + * Returns 0 in case of success, -1 in case of error + */ +static int +virDomainDefSetBootDevice(virDomainDefPtr def, + virDomainDeviceDefPtr device) +{ + size_t i; + unsigned int oldBootIndex =3D 0; + virDomainDeviceInfoPtr info; + bool noOldBootIndex; + + /* Set nBootDevs to 0 so the per-device boot configuration will be + * used. def->os.bootDevs does not have to be freed here. */ + def->os.nBootDevs =3D 0; + + switch ((virDomainDeviceType) device->type) { + case VIR_DOMAIN_DEVICE_DISK: + case VIR_DOMAIN_DEVICE_NET: + case VIR_DOMAIN_DEVICE_HOSTDEV: + case VIR_DOMAIN_DEVICE_REDIRDEV: + info =3D virDomainDeviceGetInfo(device); + if (!info) { + virReportError(VIR_ERR_OPERATION_FAILED, + "%s", + _("No device information found for the selected= device")); + return -1; + } + oldBootIndex =3D info->bootIndex; + info->bootIndex =3D 1; + break; + case VIR_DOMAIN_DEVICE_NONE: + case VIR_DOMAIN_DEVICE_LEASE: + case VIR_DOMAIN_DEVICE_FS: + case VIR_DOMAIN_DEVICE_INPUT: + case VIR_DOMAIN_DEVICE_SOUND: + case VIR_DOMAIN_DEVICE_VIDEO: + case VIR_DOMAIN_DEVICE_WATCHDOG: + case VIR_DOMAIN_DEVICE_CONTROLLER: + case VIR_DOMAIN_DEVICE_GRAPHICS: + case VIR_DOMAIN_DEVICE_HUB: + case VIR_DOMAIN_DEVICE_SMARTCARD: + case VIR_DOMAIN_DEVICE_CHR: + case VIR_DOMAIN_DEVICE_MEMBALLOON: + case VIR_DOMAIN_DEVICE_NVRAM: + case VIR_DOMAIN_DEVICE_RNG: + case VIR_DOMAIN_DEVICE_SHMEM: + case VIR_DOMAIN_DEVICE_TPM: + case VIR_DOMAIN_DEVICE_PANIC: + case VIR_DOMAIN_DEVICE_MEMORY: + case VIR_DOMAIN_DEVICE_IOMMU: + case VIR_DOMAIN_DEVICE_LAST: + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("It's not supported to boot from the selected dev= ice type '%s'"), + virDomainDeviceTypeToString(device->type)); + return -1; + } + + noOldBootIndex =3D oldBootIndex =3D=3D 0; + + /* A precondition is that all the boot indexes must be numbered + consecutively or not defined. This is the case here. We must + change the boot index only of those devices that are affected + by the change of the old boot index. There are only two cases + were this is true: + + 1. Not the same device and it uses a boot index (> 0) and which + is less than the oldBootIndex + 2. Not the same device and it uses a boot index (> 0) and @device + used no boot index + */ + for (i =3D 0; i < def->ndisks; i++) { + if (device->type =3D=3D VIR_DOMAIN_DEVICE_DISK && + def->disks[i] =3D=3D device->data.disk) + continue; + + if (def->disks[i]->info.bootIndex > 0 && + (def->disks[i]->info.bootIndex < oldBootIndex || + noOldBootIndex)) + def->disks[i]->info.bootIndex++; + } + + for (i =3D 0; i < def->nnets; i++) { + if (device->type =3D=3D VIR_DOMAIN_DEVICE_NET && + def->nets[i] =3D=3D device->data.net) + continue; + + if (def->nets[i]->info.bootIndex > 0 && + (def->nets[i]->info.bootIndex < oldBootIndex || + noOldBootIndex)) + def->nets[i]->info.bootIndex++; + } + + for (i =3D 0; i < def->nhostdevs; i++) { + if (device->type =3D=3D VIR_DOMAIN_DEVICE_HOSTDEV && + def->hostdevs[i] =3D=3D device->data.hostdev) + continue; + + if (def->hostdevs[i]->info->bootIndex > 0 && + (def->hostdevs[i]->info->bootIndex < oldBootIndex || + noOldBootIndex)) + def->hostdevs[i]->info->bootIndex++; + } + + for (i =3D 0; i < def->nredirdevs; i++) { + if (device->type =3D=3D VIR_DOMAIN_DEVICE_REDIRDEV && + def->redirdevs[i] =3D=3D device->data.redirdev) + continue; + + if (def->redirdevs[i]->info.bootIndex > 0 && + (def->redirdevs[i]->info.bootIndex < oldBootIndex || + noOldBootIndex)) + def->redirdevs[i]->info.bootIndex++; + } + + return 0; +} + + +/** + * virDomainDefSetBootDeviceByIdentifier: + * @def: Domain definition + * @bootDeviceIdentifier: Selector for the device. + * Currently only disk and network devices are supp= orted. + * + * Returns 0 in case of success, -1 in case of error. + */ +static int +virDomainDefSetBootDeviceByIdentifier(virDomainDefPtr def, + const char *bootDeviceIdentifier) +{ + virDomainDiskDefPtr diskDef =3D NULL; + virDomainNetDefPtr netDef =3D NULL; + virDomainDeviceDef bootDevice; + + if (!bootDeviceIdentifier) + return 0; + + /* Look for the correct device. At first try to find a disk with + * this device name, if not found try to find a network device + * with this device name. Disk devices are identified by 'os; + + if (!params) + return 0; + + if (params->bootDeviceIdentifier && + virDomainDefSetBootDeviceByIdentifier(def, params->bootDeviceIdent= ifier) < 0) + return -1; + + if (params->kernel && virStringUpdate(&os->kernel, params->kernel) < 0) + return -1; + + if (params->initrd && virStringUpdate(&os->initrd, params->initrd) < 0) + return -1; + + if (params->cmdline && virStringUpdate(&os->cmdline, params->cmdline) = < 0) + return -1; + + return 0; +} + + bool virDomainDefNeedsPlacementAdvice(virDomainDefPtr def) { diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 15d228ba9e62..87c14dc9b2e7 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -3420,6 +3420,17 @@ int virDomainObjSetMetadata(virDomainObjPtr vm, const char *configDir, unsigned int flags); =20 +typedef struct { + const char *bootDeviceIdentifier; + const char *kernel; + const char *initrd; + const char *cmdline; +} virCreateParams; + +int +virDomainDefOverrideBootConf(virDomainDefPtr def, + const virCreateParams *params); + int virDomainParseMemory(const char *xpath, const char *units_xpath, diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index c684f21905af..d3e30beb87c0 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -285,6 +285,7 @@ virDomainDefMaybeAddInput; virDomainDefNeedsPlacementAdvice; virDomainDefNew; virDomainDefNewFull; +virDomainDefOverrideBootConf; virDomainDefParseFile; virDomainDefParseNode; virDomainDefParseString; --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525879988281198.6843097788868; Wed, 9 May 2018 08:33:08 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B9DBD3003A3E; Wed, 9 May 2018 15:33:06 +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 8909010840CC; Wed, 9 May 2018 15:33:06 +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 14C2A180BADB; Wed, 9 May 2018 15:33:06 +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 w49FX3VJ009866 for ; Wed, 9 May 2018 11:33:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id AF28010016C6; Wed, 9 May 2018 15:33:03 +0000 (UTC) Received: from mx1.redhat.com (ext-mx11.extmail.prod.ext.phx2.redhat.com [10.5.110.40]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A66AB1001645 for ; Wed, 9 May 2018 15:33:01 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 698BE32FEBC6 for ; Wed, 9 May 2018 15:33:00 +0000 (UTC) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FISL7117466 for ; Wed, 9 May 2018 11:32:59 -0400 Received: from e06smtp11.uk.ibm.com (e06smtp11.uk.ibm.com [195.75.94.107]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hv34wtjaj-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:32:59 -0400 Received: from localhost by e06smtp11.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:32:56 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp11.uk.ibm.com (192.168.101.141) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:32:54 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWNkf3408274 for ; Wed, 9 May 2018 15:32:53 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 1DC1CB57D1 for ; Wed, 9 May 2018 15:46:36 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 043EEAE96C for ; Wed, 9 May 2018 15:46:36 +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:35 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:16 +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-00000457BDA8 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-000020FBCA41 Message-Id: <20180509145622.23049-7-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-1805090142 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.40]); Wed, 09 May 2018 15:33:00 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.40]); Wed, 09 May 2018 15:33:00 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-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.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.40 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 06/12] qemu: Add the functionality to override the boot configuration 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.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Wed, 09 May 2018 15:33:07 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add the functionality to override the boot configuration of a domain at the start time to the QEMU driver. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski Reviewed-by: Stefan Zimmermann --- src/qemu/qemu_driver.c | 36 ++++++++++++++++++++++++++---------- src/qemu/qemu_migration.c | 3 ++- src/qemu/qemu_process.c | 16 +++++++++++----- src/qemu/qemu_process.h | 2 ++ 4 files changed, 41 insertions(+), 16 deletions(-) diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index c129321a5c25..9a43d4157b09 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -145,7 +145,8 @@ static int qemuDomainObjStart(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, unsigned int flags, - qemuDomainAsyncJob asyncJob); + qemuDomainAsyncJob asyncJob, + const virCreateParams *createParams); =20 static int qemuDomainManagedSaveLoad(virDomainObjPtr vm, void *opaque); @@ -257,6 +258,7 @@ qemuAutostartDomain(virDomainObjPtr vm, int flags =3D 0; virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); int ret =3D -1; + const virCreateParams createParams =3D { 0 }; =20 if (cfg->autoStartBypassCache) flags |=3D VIR_DOMAIN_START_BYPASS_CACHE; @@ -275,7 +277,7 @@ qemuAutostartDomain(virDomainObjPtr vm, } =20 if (qemuDomainObjStart(NULL, driver, vm, flags, - QEMU_ASYNC_JOB_START) < 0) { + QEMU_ASYNC_JOB_START, &createParams) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, _("Failed to autostart VM '%s': %s"), vm->def->name, virGetLastErrorMessage()); @@ -1735,6 +1737,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr= conn, virCapsPtr caps =3D NULL; unsigned int parse_flags =3D VIR_DOMAIN_DEF_PARSE_INACTIVE | VIR_DOMAIN_DEF_PARSE_ABI_UPDATE; + const virCreateParams createParams =3D { 0 }; =20 virCheckFlags(VIR_DOMAIN_START_PAUSED | VIR_DOMAIN_START_AUTODESTROY | @@ -1776,7 +1779,7 @@ static virDomainPtr qemuDomainCreateXML(virConnectPtr= conn, if (qemuProcessStart(conn, driver, vm, NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, NULL, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - start_flags) < 0) { + &createParams, start_flags) < 0) { virDomainAuditStart(vm, "booted", false); qemuDomainRemoveInactive(driver, vm); qemuProcessEndJob(driver, vm); @@ -6558,6 +6561,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); virQEMUSaveHeaderPtr header =3D &data->header; qemuDomainSaveCookiePtr cookie =3D NULL; + const virCreateParams createParams =3D { 0 }; =20 if (virSaveCookieParseString(data->cookie, (virObjectPtr *)&cookie, virDomainXMLOptionGetSaveCookie(driver->x= mlopt)) < 0) @@ -6592,7 +6596,7 @@ qemuDomainSaveImageStartVM(virConnectPtr conn, if (qemuProcessStart(conn, driver, vm, cookie ? cookie->cpu : NULL, asyncJob, "stdio", *fd, path, NULL, VIR_NETDEV_VPORT_PROFILE_OP_RESTORE, - VIR_QEMU_PROCESS_START_PAUSED) =3D=3D 0) + &createParams, VIR_QEMU_PROCESS_START_PAUSED) =3D= =3D 0) restored =3D true; =20 if (intermediatefd !=3D -1) { @@ -7234,7 +7238,8 @@ qemuDomainObjStart(virConnectPtr conn, virQEMUDriverPtr driver, virDomainObjPtr vm, unsigned int flags, - qemuDomainAsyncJob asyncJob) + qemuDomainAsyncJob asyncJob, + const virCreateParams *createParams) { int ret =3D -1; char *managed_save; @@ -7270,6 +7275,13 @@ qemuDomainObjStart(virConnectPtr conn, virDomainJobOperation op =3D priv->job.current->operation; priv->job.current->operation =3D VIR_DOMAIN_JOB_OPERATION_REST= ORE; =20 + if (createParams->bootDeviceIdentifier || createParams->kernel= || + createParams->initrd || createParams->cmdline) { + virReportError(VIR_ERR_OPERATION_INVALID, "%s", + _("Transient changes are not possible with = the managed save option.")); + goto cleanup; + } + ret =3D qemuDomainObjRestore(conn, driver, vm, managed_save, start_paused, bypass_cache, asyncJo= b); =20 @@ -7294,7 +7306,8 @@ qemuDomainObjStart(virConnectPtr conn, =20 ret =3D qemuProcessStart(conn, driver, vm, NULL, asyncJob, NULL, -1, NULL, NULL, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, start_flags= ); + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + createParams, start_flags); virDomainAuditStart(vm, "booted", ret >=3D 0); if (ret >=3D 0) { virObjectEventPtr event =3D @@ -7317,12 +7330,14 @@ qemuDomainObjStart(virConnectPtr conn, return ret; } =20 + static int qemuDomainCreateWithFlags(virDomainPtr dom, unsigned int flags) { virQEMUDriverPtr driver =3D dom->conn->privateData; virDomainObjPtr vm; int ret =3D -1; + const virCreateParams createParams =3D { 0 }; =20 virCheckFlags(VIR_DOMAIN_START_PAUSED | VIR_DOMAIN_START_AUTODESTROY | @@ -7348,7 +7363,7 @@ qemuDomainCreateWithFlags(virDomainPtr dom, unsigned = int flags) } =20 if (qemuDomainObjStart(dom->conn, driver, vm, flags, - QEMU_ASYNC_JOB_START) < 0) + QEMU_ASYNC_JOB_START, &createParams) < 0) goto endjob; =20 dom->id =3D vm->def->id; @@ -15769,6 +15784,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, bool was_stopped =3D false; qemuDomainSaveCookiePtr cookie; virCPUDefPtr origCPU =3D NULL; + const virCreateParams createParams =3D { 0 }; =20 virCheckFlags(VIR_DOMAIN_SNAPSHOT_REVERT_RUNNING | VIR_DOMAIN_SNAPSHOT_REVERT_PAUSED | @@ -15990,7 +16006,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, cookie ? cookie->cpu : NULL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, sn= ap, VIR_NETDEV_VPORT_PROFILE_OP_CREATE, - VIR_QEMU_PROCESS_START_PAUSED); + &createParams, VIR_QEMU_PROCESS_START_PA= USED); virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); detail =3D VIR_DOMAIN_EVENT_STARTED_FROM_SNAPSHOT; event =3D virDomainEventLifecycleNewFromObj(vm, @@ -16083,7 +16099,7 @@ qemuDomainRevertToSnapshot(virDomainSnapshotPtr sna= pshot, qemuDomainEventQueue(driver, event); rc =3D qemuProcessStart(snapshot->domain->conn, driver, vm, NU= LL, QEMU_ASYNC_JOB_START, NULL, -1, NULL, NU= LL, - VIR_NETDEV_VPORT_PROFILE_OP_CREATE, + VIR_NETDEV_VPORT_PROFILE_OP_CREATE, &cre= ateParams, start_flags); virDomainAuditStart(vm, "from-snapshot", rc >=3D 0); if (rc < 0) { @@ -18393,7 +18409,7 @@ qemuDomainGetBlockIoTune(virDomainPtr dom, qemuDomainObjPrivatePtr priv =3D NULL; virDomainDefPtr def =3D NULL; virDomainDefPtr persistentDef =3D NULL; - virDomainBlockIoTuneInfo reply =3D {0}; + virDomainBlockIoTuneInfo reply =3D { 0 }; char *device =3D NULL; int ret =3D -1; int maxparams; diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c index 7602a304c57f..6709af8cba16 100644 --- a/src/qemu/qemu_migration.c +++ b/src/qemu/qemu_migration.c @@ -2178,6 +2178,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, int rv; char *tlsAlias =3D NULL; char *secAlias =3D NULL; + const virCreateParams createParams =3D { 0 }; =20 virNWFilterReadLockFilterUpdates(); =20 @@ -2335,7 +2336,7 @@ qemuMigrationDstPrepareAny(virQEMUDriverPtr driver, startFlags =3D VIR_QEMU_PROCESS_START_AUTODESTROY; =20 if (qemuProcessInit(driver, vm, mig->cpu, QEMU_ASYNC_JOB_MIGRATION_IN, - true, startFlags) < 0) + true, &createParams, startFlags) < 0) goto stopjob; stopProcess =3D true; =20 diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c index 37876b8d0aa6..218eb4691a86 100644 --- a/src/qemu/qemu_process.c +++ b/src/qemu/qemu_process.c @@ -5008,6 +5008,7 @@ qemuProcessInit(virQEMUDriverPtr driver, virCPUDefPtr updatedCPU, qemuDomainAsyncJob asyncJob, bool migration, + const virCreateParams *createParams, unsigned int flags) { virQEMUDriverConfigPtr cfg =3D virQEMUDriverGetConfig(driver); @@ -5061,6 +5062,9 @@ qemuProcessInit(virQEMUDriverPtr driver, if (virDomainObjSetDefTransient(caps, driver->xmlopt, vm) < 0) goto cleanup; =20 + if (virDomainDefOverrideBootConf(vm->def, createParams) < 0) + goto cleanup; + if (flags & VIR_QEMU_PROCESS_START_PRETEND) { if (qemuDomainSetPrivatePaths(driver, vm) < 0) { virDomainObjRemoveTransientDef(vm); @@ -6296,6 +6300,7 @@ qemuProcessStart(virConnectPtr conn, const char *migratePath, virDomainSnapshotObjPtr snapshot, virNetDevVPortProfileOp vmop, + const virCreateParams *createParams, unsigned int flags) { qemuDomainObjPrivatePtr priv =3D vm->privateData; @@ -6307,11 +6312,11 @@ qemuProcessStart(virConnectPtr conn, =20 VIR_DEBUG("conn=3D%p driver=3D%p vm=3D%p name=3D%s id=3D%d asyncJob=3D= %s " "migrateFrom=3D%s migrateFd=3D%d migratePath=3D%s " - "snapshot=3D%p vmop=3D%d flags=3D0x%x", + "snapshot=3D%p vmop=3D%d createParams=3D%p flags=3D0x%x", conn, driver, vm, vm->def->name, vm->def->id, qemuDomainAsyncJobTypeToString(asyncJob), NULLSTR(migrateFrom), migrateFd, NULLSTR(migratePath), - snapshot, vmop, flags); + snapshot, vmop, createParams, flags); =20 virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | @@ -6320,8 +6325,8 @@ qemuProcessStart(virConnectPtr conn, if (!migrateFrom && !snapshot) flags |=3D VIR_QEMU_PROCESS_START_NEW; =20 - if (qemuProcessInit(driver, vm, updatedCPU, - asyncJob, !!migrateFrom, flags) < 0) + if (qemuProcessInit(driver, vm, updatedCPU, asyncJob, !!migrateFrom, + createParams, flags) < 0) goto cleanup; =20 if (migrateFrom) { @@ -6396,6 +6401,7 @@ qemuProcessCreatePretendCmd(virQEMUDriverPtr driver, unsigned int flags) { virCommandPtr cmd =3D NULL; + const virCreateParams createParams =3D { 0 }; =20 virCheckFlagsGoto(VIR_QEMU_PROCESS_START_COLD | VIR_QEMU_PROCESS_START_PAUSED | @@ -6405,7 +6411,7 @@ qemuProcessCreatePretendCmd(virQEMUDriverPtr driver, flags |=3D VIR_QEMU_PROCESS_START_NEW; =20 if (qemuProcessInit(driver, vm, NULL, QEMU_ASYNC_JOB_NONE, - !!migrateURI, flags) < 0) + !!migrateURI, &createParams, flags) < 0) goto cleanup; =20 if (qemuProcessPrepareDomain(driver, vm, flags) < 0) diff --git a/src/qemu/qemu_process.h b/src/qemu/qemu_process.h index 9dd5c97642db..e344ad532618 100644 --- a/src/qemu/qemu_process.h +++ b/src/qemu/qemu_process.h @@ -91,6 +91,7 @@ int qemuProcessStart(virConnectPtr conn, const char *stdin_path, virDomainSnapshotObjPtr snapshot, virNetDevVPortProfileOp vmop, + const virCreateParams *params, unsigned int flags); =20 virCommandPtr qemuProcessCreatePretendCmd(virQEMUDriverPtr driver, @@ -105,6 +106,7 @@ int qemuProcessInit(virQEMUDriverPtr driver, virCPUDefPtr updatedCPU, qemuDomainAsyncJob asyncJob, bool migration, + const virCreateParams *params, unsigned int flags); =20 int qemuProcessPrepareDomain(virQEMUDriverPtr driver, --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 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 From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880074370607.2380889912336; Wed, 9 May 2018 08:34:34 -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 672EE28213; Wed, 9 May 2018 15:34:32 +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 2B93668C9B; Wed, 9 May 2018 15:34:32 +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 C9A914CAAA; Wed, 9 May 2018 15:34:31 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49FYTeH009996 for ; Wed, 9 May 2018 11:34:29 -0400 Received: by smtp.corp.redhat.com (Postfix) id 1394B61D3B; Wed, 9 May 2018 15:34:29 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0789861D03 for ; Wed, 9 May 2018 15:34:26 +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 010F530CB6F7 for ; Wed, 9 May 2018 15:34:26 +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 w49FJakA050857 for ; Wed, 9 May 2018 11:34:25 -0400 Received: from e06smtp13.uk.ibm.com (e06smtp13.uk.ibm.com [195.75.94.109]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv1ve6px0-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:34:25 -0400 Received: from localhost by e06smtp13.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:34:20 +0100 Received: from b06cxnps3074.portsmouth.uk.ibm.com (9.149.109.194) by e06smtp13.uk.ibm.com (192.168.101.143) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:34:17 +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 w49FWM8s11141380 for ; Wed, 9 May 2018 15:34:12 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 7E4B0AE617 for ; Wed, 9 May 2018 15:46:38 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 69B68AE2B4 for ; Wed, 9 May 2018 15:46:38 +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:38 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:18 +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-0012-0000-0000-000005D46BDC X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0013-0000-0000-000019518380 Message-Id: <20180509145622.23049-9-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-1805090142 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.44]); Wed, 09 May 2018 15:34:26 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 09 May 2018 15:34:26 +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.44 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 08/12] test: Implement virConnectSupportsFeature 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.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.30]); Wed, 09 May 2018 15:34:33 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Implement virConnectSupportsFeature for the test driver as this API is used by various API functions (the functions usually use the macro VIR_DRV_SUPPORTS_FEATURE for calling virConnectSupportsFeature). The support for the feature VIR_DRV_FEATURE_TYPED_PARAM_STRING is needed for the upcoming test case for the API `virDomainCreateWithParams`. Signed-off-by: Marc Hartmayer Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski --- src/test/test_driver.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 467587b19fa8..2a85f87684dd 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -6810,6 +6810,33 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snap= shot, } =20 =20 +static int +testConnectSupportsFeature(virConnectPtr conn ATTRIBUTE_UNUSED, + int feature) +{ + switch (feature) { + case VIR_DRV_FEATURE_REMOTE_EVENT_CALLBACK: + case VIR_DRV_FEATURE_TYPED_PARAM_STRING: + return 1; + case VIR_DRV_FEATURE_REMOTE_CLOSE_CALLBACK: + case VIR_DRV_FEATURE_FD_PASSING: + case VIR_DRV_FEATURE_MIGRATION_V1: + case VIR_DRV_FEATURE_REMOTE: + case VIR_DRV_FEATURE_MIGRATION_V2: + case VIR_DRV_FEATURE_MIGRATION_P2P: + case VIR_DRV_FEATURE_MIGRATION_DIRECT: + case VIR_DRV_FEATURE_MIGRATION_V3: + case VIR_DRV_FEATURE_MIGRATE_CHANGE_PROTECTION: + case VIR_DRV_FEATURE_XML_MIGRATABLE: + case VIR_DRV_FEATURE_MIGRATION_OFFLINE: + case VIR_DRV_FEATURE_MIGRATION_PARAMS: + case VIR_DRV_FEATURE_PROGRAM_KEEPALIVE: + return 0; + } + + return 0; +} + =20 static virHypervisorDriver testHypervisorDriver =3D { .name =3D "Test", @@ -6818,6 +6845,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectGetVersion =3D testConnectGetVersion, /* 0.1.1 */ .connectGetHostname =3D testConnectGetHostname, /* 0.6.3 */ .connectGetMaxVcpus =3D testConnectGetMaxVcpus, /* 0.3.2 */ + .connectSupportsFeature =3D testConnectSupportsFeature, /* 4.4.0 */ .nodeGetInfo =3D testNodeGetInfo, /* 0.1.1 */ .nodeGetCPUStats =3D testNodeGetCPUStats, /* 2.3.0 */ .nodeGetFreeMemory =3D testNodeGetFreeMemory, /* 2.3.0 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880128033704.9384810827045; Wed, 9 May 2018 08:35:28 -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 D72435F798; Wed, 9 May 2018 15:35:25 +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 9C3F85D732; Wed, 9 May 2018 15:35:25 +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 29D3D180BADC; Wed, 9 May 2018 15:35:25 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49FZNZv010071 for ; Wed, 9 May 2018 11:35:23 -0400 Received: by smtp.corp.redhat.com (Postfix) id 06A9E2010CBA; Wed, 9 May 2018 15:35:23 +0000 (UTC) Received: from mx1.redhat.com (ext-mx14.extmail.prod.ext.phx2.redhat.com [10.5.110.43]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EEC972010D09 for ; Wed, 9 May 2018 15:35:20 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 41AD23001FBF for ; Wed, 9 May 2018 15:35:19 +0000 (UTC) Received: from pps.filterd (m0098420.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FZAZ4052488 for ; Wed, 9 May 2018 11:35:18 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0b-001b2d01.pphosted.com with ESMTP id 2hv3df1c1g-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:35:16 -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:40 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) 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:39 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWLij61145154 for ; Wed, 9 May 2018 15:34:39 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AEB1BAE698 for ; Wed, 9 May 2018 15:46:39 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 94830AE5E9 for ; Wed, 9 May 2018 15:46:39 +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:39 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:19 +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-00000437D1B7 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-0000263C130C Message-Id: <20180509145622.23049-10-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.43]); Wed, 09 May 2018 15:35:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 09 May 2018 15:35:19 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-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.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.43 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 09/12] test: 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 09 May 2018 15:35:27 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add support for virDomainCreateWithParams to the test driver. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/test/test_driver.c | 74 ++++++++++++++++++++++++++++++++++++++++++----= ---- 1 file changed, 62 insertions(+), 12 deletions(-) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 2a85f87684dd..cb5377004df7 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -650,7 +650,8 @@ testDomainShutdownState(virDomainPtr domain, static int testDomainStartState(testDriverPtr privconn, virDomainObjPtr dom, - virDomainRunningReason reason) + virDomainRunningReason reason, + const virCreateParams *createParams) { int ret =3D -1; =20 @@ -663,6 +664,9 @@ testDomainStartState(testDriverPtr privconn, goto cleanup; } =20 + if (virDomainDefOverrideBootConf(dom->def, createParams) < 0) + goto cleanup; + dom->hasManagedSave =3D false; ret =3D 0; cleanup: @@ -930,7 +934,7 @@ testParseDomains(testDriverPtr privconn, =20 if (nsdata->runstate !=3D VIR_DOMAIN_SHUTOFF) { if (testDomainStartState(privconn, obj, - VIR_DOMAIN_RUNNING_BOOTED) < 0) + VIR_DOMAIN_RUNNING_BOOTED, NULL) < 0) goto error; } else { testDomainShutdownState(NULL, obj, 0); @@ -1674,7 +1678,7 @@ testDomainCreateXML(virConnectPtr conn, const char *x= ml, goto cleanup; def =3D NULL; =20 - if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_BOOTED) < 0= ) { + if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_BOOTED, NUL= L) < 0) { if (!dom->persistent) virDomainObjListRemove(privconn->domains, dom); goto cleanup; @@ -2185,7 +2189,7 @@ testDomainRestoreFlags(virConnectPtr conn, goto cleanup; def =3D NULL; =20 - if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_RESTORED) <= 0) { + if (testDomainStartState(privconn, dom, VIR_DOMAIN_RUNNING_RESTORED, N= ULL) < 0) { if (!dom->persistent) virDomainObjListRemove(privconn->domains, dom); goto cleanup; @@ -2959,17 +2963,50 @@ testNodeGetFreePages(virConnectPtr conn ATTRIBUTE_U= NUSED, return 0; } =20 -static int testDomainCreateWithFlags(virDomainPtr domain, unsigned int fla= gs) + +static int +testDomainCreateWithParams(virDomainPtr domain, + virTypedParameterPtr params, + int nparams, + unsigned int flags) { testDriverPtr privconn =3D domain->conn->privateData; virDomainObjPtr privdom; virObjectEventPtr event =3D NULL; int ret =3D -1; + size_t i; + virCreateParams createParams =3D {0}; =20 virCheckFlags(0, -1); =20 - testDriverLock(privconn); + 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; =20 + 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; + } + } + + testDriverLock(privconn); if (!(privdom =3D testDomObjFromDomain(domain))) goto cleanup; =20 @@ -2980,13 +3017,14 @@ static int testDomainCreateWithFlags(virDomainPtr d= omain, unsigned int flags) } =20 if (testDomainStartState(privconn, privdom, - VIR_DOMAIN_RUNNING_BOOTED) < 0) + VIR_DOMAIN_RUNNING_BOOTED, &createParams) < 0) goto cleanup; + domain->id =3D privdom->def->id; =20 event =3D virDomainEventLifecycleNewFromObj(privdom, - VIR_DOMAIN_EVENT_STARTED, - VIR_DOMAIN_EVENT_STARTED_BOOTED); + VIR_DOMAIN_EVENT_STARTED, + VIR_DOMAIN_EVENT_STARTED_BOO= TED); ret =3D 0; =20 cleanup: @@ -2996,11 +3034,22 @@ static int testDomainCreateWithFlags(virDomainPtr d= omain, unsigned int flags) return ret; } =20 -static int testDomainCreate(virDomainPtr domain) + +static int +testDomainCreateWithFlags(virDomainPtr domain, + unsigned int flags) { - return testDomainCreateWithFlags(domain, 0); + return testDomainCreateWithParams(domain, NULL, 0, flags); } =20 + +static int +testDomainCreate(virDomainPtr domain) +{ + return testDomainCreateWithParams(domain, NULL, 0, 0); +} + + static int testDomainUndefineFlags(virDomainPtr domain, unsigned int flags) { @@ -6728,7 +6777,7 @@ testDomainRevertToSnapshot(virDomainSnapshotPtr snaps= hot, was_stopped =3D true; virDomainObjAssignDef(vm, config, false, NULL); if (testDomainStartState(privconn, vm, - VIR_DOMAIN_RUNNING_FROM_SNAPSHOT) < 0) + VIR_DOMAIN_RUNNING_FROM_SNAPSHOT, NUL= L) < 0) goto cleanup; event =3D virDomainEventLifecycleNewFromObj(vm, VIR_DOMAIN_EVENT_STARTED, @@ -6891,6 +6940,7 @@ static virHypervisorDriver testHypervisorDriver =3D { .connectNumOfDefinedDomains =3D testConnectNumOfDefinedDomains, /* 0.1= .11 */ .domainCreate =3D testDomainCreate, /* 0.1.11 */ .domainCreateWithFlags =3D testDomainCreateWithFlags, /* 0.8.2 */ + .domainCreateWithParams =3D testDomainCreateWithParams, /* 4.4.0 */ .domainDefineXML =3D testDomainDefineXML, /* 0.1.11 */ .domainDefineXMLFlags =3D testDomainDefineXMLFlags, /* 1.2.12 */ .domainUndefine =3D testDomainUndefine, /* 0.1.11 */ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 152587996411966.18926927643122; Wed, 9 May 2018 08:32:44 -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 42A37C00366A; Wed, 9 May 2018 15:32:42 +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 7019E18023; Wed, 9 May 2018 15:32:41 +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 439801808850; Wed, 9 May 2018 15:32:40 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.25]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49FWYtc009811 for ; Wed, 9 May 2018 11:32:37 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2FAC2010CBA; Wed, 9 May 2018 15:32:34 +0000 (UTC) Received: from mx1.redhat.com (ext-mx15.extmail.prod.ext.phx2.redhat.com [10.5.110.44]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A6EEE2010CA0 for ; Wed, 9 May 2018 15:32:32 +0000 (UTC) Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (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 B2FD830CB6F9 for ; Wed, 9 May 2018 15:32:30 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FKwDW076160 for ; Wed, 9 May 2018 11:32:30 -0400 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv2efcn6s-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:32:29 -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:32:28 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) 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:32:26 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWOtn51249174 for ; Wed, 9 May 2018 15:32:25 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id DDB54AE2E6 for ; Wed, 9 May 2018 15:46:40 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C544DAE590 for ; Wed, 9 May 2018 15:46:40 +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:40 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:20 +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-00000437CF1E X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0041-0000-0000-0000263C106E Message-Id: <20180509145622.23049-11-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=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1805090142 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.44]); Wed, 09 May 2018 15:32:31 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.44]); Wed, 09 May 2018 15:32:31 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-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.158.5 mx0b-001b2d01.pphosted.com 148.163.158.5 mx0b-001b2d01.pphosted.com X-Scanned-By: MIMEDefang 2.84 on 10.5.110.44 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.25 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 10/12] tests: Add tests 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.31]); Wed, 09 May 2018 15:32:43 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- src/test/test_driver.c | 6 + tests/objecteventtest.c | 321 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 2 files changed, 327 insertions(+) diff --git a/src/test/test_driver.c b/src/test/test_driver.c index cb5377004df7..6536e41bf4ad 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -444,6 +444,12 @@ static const char *defaultConnXML =3D " " " hvm" " " +" " +" " +" " +" " +" " +" " "" "" "" diff --git a/tests/objecteventtest.c b/tests/objecteventtest.c index 4b12572eb45b..cc7287e2fc66 100644 --- a/tests/objecteventtest.c +++ b/tests/objecteventtest.c @@ -472,6 +472,325 @@ testDomainStartStopEvent(const void *data) return ret; } =20 + +typedef struct { + int count_boot_order; + int count_os_boot; + char *bootdeviceIdentifier; + char *kernel; + char *initrd; + char *cmdline; +} bootConfiguration; + + +static void +bootConfigurationFree(bootConfiguration *conf) +{ + if (!conf) + return; + + VIR_FREE(conf->bootdeviceIdentifier); + VIR_FREE(conf->kernel); + VIR_FREE(conf->initrd); + VIR_FREE(conf->cmdline); + VIR_FREE(conf); +} + + +static bool +bootConfigurationEqual(bootConfiguration *a, + bootConfiguration *b) +{ + if (!a || !b) + return a =3D=3D b; + + return a->count_boot_order =3D=3D b->count_boot_order && + a->count_os_boot =3D=3D b->count_os_boot && + STREQ_NULLABLE(a->bootdeviceIdentifier, b->bootdeviceIdentifier) && + STREQ_NULLABLE(a->kernel, b->kernel) && + STREQ_NULLABLE(a->initrd, b->initrd) && + STREQ_NULLABLE(a->cmdline, b->cmdline); +} + + +/* Caller must free() the returned value */ +static bootConfiguration* +getBootConfiguration(virDomainPtr dom) +{ + bootConfiguration* ret; + char *xml =3D NULL; + xmlDocPtr doc =3D NULL; + xmlXPathContextPtr ctxt =3D NULL; + xmlNodePtr node =3D NULL; + + if (VIR_ALLOC(ret) < 0) + return NULL; + + if (!(xml =3D virDomainGetXMLDesc(dom, 0))) + goto error; + + if (!(doc =3D virXMLParseStringCtxt(xml, "(domain_definition)", &ctxt)= )) + goto error; + + ret->kernel =3D virXPathString("string(./os/kernel[1])", ctxt); + ret->initrd =3D virXPathString("string(./os/initrd[1])", ctxt); + ret->cmdline =3D virXPathString("string(./os/cmdline[1])", ctxt); + + if (virXPathInt("count(./os/boot)", ctxt, &ret->count_boot_order) < 0) + goto error; + + if ((virXPathInt("count(./devices/*/boot[@order=3D'1'])", ctxt, &ret->= count_boot_order) < 0)) + goto error; + + if (ret->count_boot_order > 0) { + node =3D virXPathNode("./devices/*/boot[@order=3D'1']/..", ctxt); + if (!node) + goto error; + + ctxt->node =3D node; + + /* As we're using a heuristic for setting the boot device do + * the same here. + * + * Represents the XML node a disk? */ + ret->bootdeviceIdentifier =3D virXPathString("string(./target/@dev= )", ctxt); + + /* Represents the XML node a network interface? (we only allow + * MAC addresses as boot device identifier for the tests (at + * least for the moment)) */ + if (!ret->bootdeviceIdentifier) + ret->bootdeviceIdentifier =3D virXPathString("string(./mac/@ad= dress)", ctxt); + } else { + ret->bootdeviceIdentifier =3D NULL; + } + + cleanup: + xmlFreeDoc(doc); + xmlXPathFreeContext(ctxt); + VIR_FREE(xml); + return ret; + + error: + bootConfigurationFree(ret); + ret =3D NULL; + goto cleanup; +} + + +static int +verifyOriginalState(virDomainPtr dom, bootConfiguration *original_conf) +{ + bool ret; + bootConfiguration *current_conf =3D getBootConfiguration(dom); + + if (!current_conf) + return false; + + ret =3D bootConfigurationEqual(original_conf, + current_conf); + bootConfigurationFree(current_conf); + return ret; +} + + +static int +verifyChanges(virDomainPtr dom, + const char *bootdevice, + const char *kernel, + const char *initrd, + const char *cmdline) +{ + int ret =3D -1; + bootConfiguration *current_conf; + + if (!(current_conf =3D getBootConfiguration(dom))) + goto cleanup; + + /* verify the new boot order */ + if (bootdevice) { + if (STRNEQ_NULLABLE(current_conf->bootdeviceIdentifier, bootdevice= )) + goto cleanup; + + if (current_conf->count_os_boot !=3D 0) + goto cleanup; + + if (current_conf->count_boot_order < 1) + goto cleanup; + } + + /* verify the other OS node changes */ + if ((kernel && virStringIsEmpty(kernel) && current_conf->kernel) || + (!virStringIsEmpty(kernel) && STRNEQ_NULLABLE(current_conf->kernel= , kernel))) + goto cleanup; + + if ((initrd && virStringIsEmpty(initrd) && current_conf->initrd) || + (!virStringIsEmpty(initrd) && STRNEQ_NULLABLE(current_conf->initrd= , initrd))) + goto cleanup; + + if ((cmdline && virStringIsEmpty(cmdline) && current_conf->cmdline) || + (!virStringIsEmpty(cmdline) && STRNEQ_NULLABLE(current_conf->cmdli= ne, cmdline))) + goto cleanup; + + ret =3D 0; + cleanup: + bootConfigurationFree(current_conf); + return ret; +} + + +static int +testDomainCreateWithParamsHelper(virDomainPtr dom, lifecycleEventCounter *= counter, + bool failure_expected, const char *bootde= vice, + const char *kernel, const char *initrd, + const char *cmdline, unsigned int flags, = bootConfiguration *original_conf) +{ + int rc; + int ret =3D -1; + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int maxparams =3D 0; + + lifecycleEventCounter_reset(counter); + + if (bootdevice) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_DEVICE_IDENTIFI= ER, + VIR_TYPED_PARAM_STRING, + bootdevice); + + if (kernel) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_KERNEL, + VIR_TYPED_PARAM_STRING, + kernel); + + if (initrd) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_INITRD, + VIR_TYPED_PARAM_STRING, + initrd); + + if (cmdline) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_CMDLINE, + VIR_TYPED_PARAM_STRING, + cmdline); + + rc =3D virDomainCreateWithParams(dom, + params, + nparams, + flags); + if (rc < 0) { + if (failure_expected) + ret =3D 0; + goto cleanup; + } + + if (virEventRunDefaultImpl() < 0) + goto cleanup; + + if (counter->startEvents !=3D 1 || + counter->stopEvents !=3D 0) + goto cleanup; + + if (verifyChanges(dom, bootdevice, kernel, initrd, cmdline) < 0) + goto cleanup; + + if (virDomainDestroy(dom) < 0) + goto cleanup; + + if (verifyOriginalState(dom, original_conf) < 0) + goto cleanup; + + if (virEventRunDefaultImpl() < 0) + goto cleanup; + + if (counter->startEvents !=3D 1 || + counter->stopEvents !=3D 1) + goto cleanup; + + ret =3D 0; + cleanup: + virTypedParamsFree(params, nparams); + return ret; +} + + +static int +testDomainCreateWithParams(const void *data) +{ + const objecteventTest *test =3D data; + lifecycleEventCounter counter; + int eventId =3D VIR_DOMAIN_EVENT_ID_LIFECYCLE; + int id; + int ret =3D -1; + virDomainPtr dom; + bootConfiguration *original_boot_conf =3D NULL; + + dom =3D virDomainLookupByName(test->conn, "test"); + if (!dom) + return -1; + + /* First clean up, register for the life cycle events, and get the + * original, persistent boot configuration of the domain */ + virDomainDestroy(dom); + + id =3D virConnectDomainEventRegisterAny(test->conn, dom, eventId, + VIR_DOMAIN_EVENT_CALLBACK(&domai= nLifecycleCb), + &counter, NULL); + + if (!(original_boot_conf =3D getBootConfiguration(dom))) + goto cleanup; + + if (testDomainCreateWithParamsHelper(dom, &counter, true, "notAvailabl= eBootDevice", + NULL, NULL, NULL, 0, original_boo= t_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, NULL,= NULL, + NULL, 0, original_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, "newK= ernel", + NULL, NULL, 0, original_boot_conf= ) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, NULL,= "newInitrd", + NULL, 0, original_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, true, "notAvailabl= eBootDevice", + "newInitrd", NULL, NULL, 0, origi= nal_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, NULL,= NULL, "newCmdline", + 0, original_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, "newK= ernel", "newInitrd", + "newCmdline", 0, original_boot_co= nf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, NULL, "", "= ", "", 0, + original_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, "vda", NULL= , NULL, NULL, + 0, original_boot_conf) < 0) + goto cleanup; + if (testDomainCreateWithParamsHelper(dom, &counter, false, "vda", NULL= , "blaa", "bla", + 0, original_boot_conf) < 0) + goto cleanup; + + ret =3D 0; + cleanup: + bootConfigurationFree(original_boot_conf); + virConnectDomainEventDeregisterAny(test->conn, id); + virDomainFree(dom); + + return ret; +} + + static int testNetworkCreateXML(const void *data) { @@ -864,6 +1183,8 @@ mymain(void) ret =3D EXIT_FAILURE; if (virTestRun("Domain start stop events", testDomainStartStopEvent, &= test) < 0) ret =3D EXIT_FAILURE; + if (virTestRun("Domain start stop events with params", testDomainCreat= eWithParams, &test) < 0) + ret =3D EXIT_FAILURE; =20 /* Network event tests */ /* Tests requiring the test network not to be set up*/ --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880167344466.8782511339796; Wed, 9 May 2018 08:36:07 -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 074FE81DFE; Wed, 9 May 2018 15:36:05 +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 96418611A9; Wed, 9 May 2018 15:36:04 +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 35F91180BAE6; Wed, 9 May 2018 15:36:04 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id w49Fa1uq010147 for ; Wed, 9 May 2018 11:36:01 -0400 Received: by smtp.corp.redhat.com (Postfix) id 0DF0730001E0; Wed, 9 May 2018 15:36:01 +0000 (UTC) Received: from mx1.redhat.com (ext-mx05.extmail.prod.ext.phx2.redhat.com [10.5.110.29]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 04D6530001DB for ; Wed, 9 May 2018 15:35:59 +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 18ED45277B for ; Wed, 9 May 2018 15:35:58 +0000 (UTC) Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FYg4V023919 for ; Wed, 9 May 2018 11:35:57 -0400 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv38ut98k-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:35:57 -0400 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:35:54 +0100 Received: from b06cxnps4075.portsmouth.uk.ibm.com (9.149.109.197) by e06smtp12.uk.ibm.com (192.168.101.142) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:35:51 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4075.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWOUo46858420 for ; Wed, 9 May 2018 15:35:50 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21C5BAE7DA for ; Wed, 9 May 2018 15:46:42 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id F3BB6AE5EE for ; Wed, 9 May 2018 15:46:41 +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:41 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:21 +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-0008-0000-0000-000004F4CD69 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0009-0000-0000-00001E8916AC Message-Id: <20180509145622.23049-12-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.29]); Wed, 09 May 2018 15:35:58 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Wed, 09 May 2018 15:35:58 +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.78 on 10.5.110.29 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.26 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 11/12] virsh: Add with-{bootdevice, kernel, initrd, cmdline} options for start 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Wed, 09 May 2018 15:36:06 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Add the options with-bootdevice, with-kernel, with-initrd, and with-cmdline to 'virsh start'. They allow to temporarily boot from another boot device, to use another kernel, initrd, and cmdline than defined in the persistent domain definition. Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- tools/virsh-domain.c | 84 ++++++++++++++++++++++++++++++++++++++++++++++++= ++++ tools/virsh.pod | 14 +++++++++ 2 files changed, 98 insertions(+) diff --git a/tools/virsh-domain.c b/tools/virsh-domain.c index 7cf8373f05bc..3cb597b90937 100644 --- a/tools/virsh-domain.c +++ b/tools/virsh-domain.c @@ -3953,6 +3953,25 @@ static const vshCmdOptDef opts_start[] =3D { .type =3D VSH_OT_STRING, .help =3D N_("pass file descriptors N,M,... to the guest") }, + {.name =3D "with-bootdevice", + .type =3D VSH_OT_STRING, + .help =3D N_("set boot device") + }, + {.name =3D "with-kernel", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_EMPTY_OK, + .help =3D N_("set boot kernel") + }, + {.name =3D "with-initrd", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_EMPTY_OK, + .help =3D N_("set boot initrd") + }, + {.name =3D "with-cmdline", + .type =3D VSH_OT_STRING, + .flags =3D VSH_OFLAG_EMPTY_OK, + .help =3D N_("set boot cmdline") + }, {.name =3D NULL} }; =20 @@ -4004,6 +4023,7 @@ cmdStartGetFDs(vshControl *ctl, return -1; } =20 + static bool cmdStart(vshControl *ctl, const vshCmd *cmd) { @@ -4016,6 +4036,10 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) int rc; size_t nfds =3D 0; int *fds =3D NULL; + const char *bootDeviceIdentifier =3D NULL; + const char *kernel =3D NULL; + const char *initrd =3D NULL; + const char *cmdline =3D NULL; =20 if (!(dom =3D virshCommandOptDomainBy(ctl, cmd, NULL, VIRSH_BYNAME | VIRSH_BYUUID))) @@ -4038,9 +4062,68 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) if (vshCommandOptBool(cmd, "force-boot")) flags |=3D VIR_DOMAIN_START_FORCE_BOOT; =20 + if (vshCommandOptStringReq(ctl, cmd, "with-bootdevice", + &bootDeviceIdentifier) < 0 || + vshCommandOptStringReq(ctl, cmd, "with-kernel", + &kernel) < 0 || + vshCommandOptStringReq(ctl, cmd, "with-initrd", + &initrd) < 0 || + vshCommandOptStringReq(ctl, cmd, "with-cmdline", + &cmdline) < 0) + goto cleanup; + + if (nfds && (bootDeviceIdentifier || kernel || initrd || cmdline)) { + vshError(ctl, + _("Passing file descriptors together with temporarily cha= nging" + " the boot configuration is currently not supported.")); + goto cleanup; + } + /* Prefer older API unless we have to pass extra parameters */ if (nfds) { rc =3D virDomainCreateWithFiles(dom, nfds, fds, flags); + } else if (bootDeviceIdentifier || kernel || initrd || cmdline) { + virTypedParameterPtr params =3D NULL; + int nparams =3D 0; + int maxparams =3D 0; + + if (bootDeviceIdentifier) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_DEVICE_IDEN= TIFIER, + VIR_TYPED_PARAM_STRING, + bootDeviceIdentifier); + + if (kernel) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_KERNEL, + VIR_TYPED_PARAM_STRING, + kernel); + + if (initrd) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_INITRD, + VIR_TYPED_PARAM_STRING, + initrd); + + if (cmdline) + virTypedParamsAddFromString(¶ms, + &nparams, + &maxparams, + VIR_DOMAIN_CREATE_PARM_CMDLINE, + VIR_TYPED_PARAM_STRING, + cmdline); + + rc =3D virDomainCreateWithParams(dom, + params, + nparams, + flags); + virTypedParamsFree(params, nparams); } else if (flags) { rc =3D virDomainCreateWithFlags(dom, flags); /* We can emulate force boot, even for older servers that @@ -4091,6 +4174,7 @@ cmdStart(vshControl *ctl, const vshCmd *cmd) return ret; } =20 + /* * "save" command */ diff --git a/tools/virsh.pod b/tools/virsh.pod index 929958a9533c..54316aa33b97 100644 --- a/tools/virsh.pod +++ b/tools/virsh.pod @@ -2655,6 +2655,8 @@ repeat the command. =20 =3Ditem B I [I<--console>] [I<--paused>] [I<--autodestroy>] [I<--bypass-cache>] [I<--force-boot>] [I<--pass-fds N,M= ,...>] +[I<--with-bootdevice DEVICE-IDENTIFIER>] [I<--with-kernel KERNEL>] +[I<--with-initrd INITRD>] [I<--with-cmdline CMDLINE>] =20 Start a (previously defined) inactive domain, either from the last B state, or via a fresh boot if no managedsave state is @@ -2668,6 +2670,18 @@ the restore will avoid the file system cache, althou= gh this may slow down the operation. If I<--force-boot> is specified, then any managedsave state is discarded and a fresh boot occurs. =20 +If the I<--with-bootdevice> option is used and supported by the driver +then the domain will start with the specified device overriding the +persistent defined boot order for this start only. Valid block devices +for this option are displayed using B. To specify a block +device the displayed I value has to be used. Valid network +devices are displayed using B. To specify a network device +the displayed I value has to be used. + +With I<--with-kernel>, I<--with-initrd>, and I<--with-cmdline> you can +specify the kernel, initrd, and cmdline to use for this start if the +used driver supports this. + If I<--pass-fds> is specified, the argument is a comma separated list of open file descriptors which should be pass on into the guest. The file descriptors will be re-numbered in the guest, starting from 3. This --=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Sat May 4 18:18:49 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 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1525880041958422.85392954814586; Wed, 9 May 2018 08:34:01 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx12.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 737F9C04C27C; Wed, 9 May 2018 15:34:00 +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 334879EDEE; Wed, 9 May 2018 15:34:00 +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 CE15C4CAAA; Wed, 9 May 2018 15:33:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx09.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 w49FXuTc009954 for ; Wed, 9 May 2018 11:33:56 -0400 Received: by smtp.corp.redhat.com (Postfix) id A77DE30012CE; Wed, 9 May 2018 15:33:56 +0000 (UTC) Received: from mx1.redhat.com (ext-mx12.extmail.prod.ext.phx2.redhat.com [10.5.110.41]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9DC9230012D7 for ; Wed, 9 May 2018 15:33:52 +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 606A431500A5 for ; Wed, 9 May 2018 15:33:51 +0000 (UTC) Received: from pps.filterd (m0098399.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w49FJMS0058466 for ; Wed, 9 May 2018 11:33:51 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0a-001b2d01.pphosted.com with ESMTP id 2hv14cs36x-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 09 May 2018 11:33:50 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 9 May 2018 16:33:48 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp15.uk.ibm.com (192.168.101.145) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 9 May 2018 16:33:46 +0100 Received: from d06av26.portsmouth.uk.ibm.com (d06av26.portsmouth.uk.ibm.com [9.149.105.62]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w49FWLgb61145154 for ; Wed, 9 May 2018 15:33:46 GMT Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 491AAAE750 for ; Wed, 9 May 2018 15:46:43 +0100 (BST) Received: from d06av26.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2B210AE83A for ; Wed, 9 May 2018 15:46:43 +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:43 +0100 (BST) From: Marc Hartmayer To: Date: Wed, 9 May 2018 16:56:22 +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-0020-0000-0000-0000041ACD28 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18050915-0021-0000-0000-000042B00D92 Message-Id: <20180509145622.23049-13-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-1805090142 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.41]); Wed, 09 May 2018 15:33:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Wed, 09 May 2018 15:33:51 +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.41 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.24 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 12/12] docs: Add news entry for new API 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.84 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 09 May 2018 15:34:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Signed-off-by: Marc Hartmayer Reviewed-by: Boris Fiuczynski --- docs/news.xml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/news.xml b/docs/news.xml index 80181415c635..06693985839a 100644 --- a/docs/news.xml +++ b/docs/news.xml @@ -35,6 +35,17 @@
+ + + Add virDomainCreateWithParams API + + + Provide a new API to allow to temporarily boot from another + boot device, to use another kernel, initrd, and cmdline than + defined in the persistent domain definition. It's + implemented for the QEMU, remote, and test driver. + +
--=20 2.13.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list