From nobody Wed May 14 06:08:19 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 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