From nobody Tue Dec 16 08:36:45 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.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1496335022807621.4644025330134; Thu, 1 Jun 2017 09:37:02 -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 6069CC057FA8; Thu, 1 Jun 2017 16:37: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 2C57D171AB; Thu, 1 Jun 2017 16:37: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 D73DF4A48D; Thu, 1 Jun 2017 16:36:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v51GaarT027801 for ; Thu, 1 Jun 2017 12:36:36 -0400 Received: by smtp.corp.redhat.com (Postfix) id B2B5B53C80; Thu, 1 Jun 2017 16:36:36 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AB4345279C for ; Thu, 1 Jun 2017 16:36:34 +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 45A27C057FA8 for ; Thu, 1 Jun 2017 16:36:33 +0000 (UTC) Received: from pps.filterd (m0098417.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.20/8.16.0.20) with SMTP id v51GY4vR031954 for ; Thu, 1 Jun 2017 12:36:32 -0400 Received: from e31.co.us.ibm.com (e31.co.us.ibm.com [32.97.110.149]) by mx0a-001b2d01.pphosted.com with ESMTP id 2atm3qg47u-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Thu, 01 Jun 2017 12:36:32 -0400 Received: from localhost by e31.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Jun 2017 10:36:31 -0600 Received: from b03cxnp07029.gho.boulder.ibm.com (9.17.130.16) by e31.co.us.ibm.com (192.168.1.131) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Thu, 1 Jun 2017 10:36:30 -0600 Received: from b03ledav002.gho.boulder.ibm.com (b03ledav002.gho.boulder.ibm.com [9.17.130.233]) by b03cxnp07029.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v51GaSTW15204838; Thu, 1 Jun 2017 09:36:29 -0700 Received: from b03ledav002.gho.boulder.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id AE2EE13604B; Thu, 1 Jun 2017 10:36:29 -0600 (MDT) Received: from alifm-ThinkPad-W540.endicott.ibm.com (unknown [9.60.75.194]) by b03ledav002.gho.boulder.ibm.com (Postfix) with ESMTPS id 4EBDB13603A; Thu, 1 Jun 2017 10:36:29 -0600 (MDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6069CC057FA8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6069CC057FA8 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 45A27C057FA8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=linux.vnet.ibm.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=alifm@linux.vnet.ibm.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 45A27C057FA8 From: Farhan Ali To: libvir-list@redhat.com Date: Thu, 1 Jun 2017 12:36:24 -0400 In-Reply-To: References: In-Reply-To: References: X-TM-AS-GCONF: 00 x-cbid: 17060116-8235-0000-0000-00000B9E4F28 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007153; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000212; SDB=6.00868249; UDB=6.00431468; IPR=6.00648129; BA=6.00005388; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015670; XFM=3.00000015; UTC=2017-06-01 16:36:31 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17060116-8236-0000-0000-00003C130C86 Message-Id: <1317b6cd4e535d106ea51d7737170d7100275639.1496334363.git.alifm@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-06-01_03:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=43 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1706010309 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 203 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 01 Jun 2017 16:36:33 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 01 Jun 2017 16:36:33 +0000 (UTC) for IP:'148.163.158.5' DOMAIN:'mx0b-001b2d01.pphosted.com' HELO:'mx0a-001b2d01.pphosted.com' FROM:'alifm@linux.vnet.ibm.com' RCPT:'' X-RedHat-Spam-Score: -2.7 (BAYES_50, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2) 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.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Cc: pkrempa@redhat.com Subject: [libvirt] [PATCH v5 1/4] conf : Add loadparm boot option for a boot device 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.32]); Thu, 01 Jun 2017 16:37:01 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Update the per device boot schema to add an optional loadparm parameter. eg: Extend the virDomainDeviceInfo to support loadparm option. Modify the appropriate functions to parse loadparm from boot device xml. Signed-off-by: Farhan Ali Reviewed-by: Bjoern Walk Reviewed-by: Boris Fiuczynski Reviewed-by: Marc Hartmayer --- docs/formatdomain.html.in | 9 ++++-- docs/schemas/domaincommon.rng | 7 +++++ src/conf/device_conf.h | 1 + src/conf/domain_conf.c | 69 +++++++++++++++++++++++++++++++++++++++= ++-- 4 files changed, 82 insertions(+), 4 deletions(-) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index 07208ee..837be18 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -3022,8 +3022,13 @@
boot
Specifies that the disk is bootable. The order attribute determines the order in which devices will be tried duri= ng - boot sequence. The per-device boot elements cannot be - used together with general boot elements in + boot sequence. On S390 architecture only the first boot device is = used. + The optional loadparm attribute is an 8 byte parameter + which can be queried by guests on S390 via sclp or diag 308. Linux + guests on S390 can use loadparm to select a boot entr= y. + Since 3.5.0 + The per-device boot elements cannot be used together + with general boot elements in BIOS bootloader section. Since 0.8.8
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index 4d9f8d1..ef09860 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5031,6 +5031,13 @@ + + + + [a-zA-Z0-9.\s]{1,8} + + + diff --git a/src/conf/device_conf.h b/src/conf/device_conf.h index a20de85..48782be 100644 --- a/src/conf/device_conf.h +++ b/src/conf/device_conf.h @@ -167,6 +167,7 @@ struct _virDomainDeviceInfo { * assignment, never saved and never reported. */ int pciConnectFlags; /* enum virDomainPCIConnectFlags */ + char *loadparm; }; =20 =20 diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index c7e20b8..cd35ad2 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -3520,6 +3520,7 @@ void virDomainDeviceInfoClear(virDomainDeviceInfoPtr = info) memset(&info->addr, 0, sizeof(info->addr)); info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_NONE; VIR_FREE(info->romfile); + VIR_FREE(info->loadparm); } =20 =20 @@ -5213,6 +5214,48 @@ virDomainDefValidate(virDomainDefPtr def, return 0; } =20 +/** + * virDomainDeviceLoadparmIsValid + * @loadparm : The string to validate + * + * The valid set of values for loadparm are [a-zA-Z0-9.] + * and blank spaces. + * The maximum allowed length is 8 characters. + * An empty string is considered invalid + */ +static bool +virDomainDeviceLoadparmIsValid(const char *loadparm) +{ + size_t i; + + if (virStringIsEmpty(loadparm)) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("loadparm cannot be an empty string")); + return false; + } + + if (strlen(loadparm) > 8) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("loadparm '%s' exceeds 8 characters"), loadparm); + return false; + } + + for (i =3D 0; i < strlen(loadparm); i++) { + uint8_t c =3D loadparm[i]; + + if (('A' <=3D c && c <=3D 'Z') || ('0' <=3D c && c <=3D '9') || + (c =3D=3D '.') || (c =3D=3D ' ')) { + continue; + } else { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("invalid loadparm char '%c', expecting chars" + " in set of [a-zA-Z0-9.] and blank spaces"), = c); + return false; + } + } + + return true; +} =20 /* Generate a string representation of a device address * @info address Device address to stringify @@ -5222,9 +5265,14 @@ virDomainDeviceInfoFormat(virBufferPtr buf, virDomainDeviceInfoPtr info, unsigned int flags) { - if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) - virBufferAsprintf(buf, "\n", info->bootIndex); + if ((flags & VIR_DOMAIN_DEF_FORMAT_ALLOW_BOOT) && info->bootIndex) { + virBufferAsprintf(buf, "bootIndex); =20 + if (info->loadparm) + virBufferAsprintf(buf, " loadparm=3D'%s'", info->loadparm); + + virBufferAddLit(buf, "/>\n"); + } if (info->alias && !(flags & VIR_DOMAIN_DEF_FORMAT_INACTIVE)) { virBufferAsprintf(buf, "\n", info->alias); @@ -5650,6 +5698,7 @@ virDomainDeviceBootParseXML(xmlNodePtr node, virHashTablePtr bootHash) { char *order; + char *loadparm; int ret =3D -1; =20 if (!(order =3D virXMLPropString(node, "order"))) { @@ -5678,10 +5727,26 @@ virDomainDeviceBootParseXML(xmlNodePtr node, goto cleanup; } =20 + loadparm =3D virXMLPropString(node, "loadparm"); + if (loadparm) { + if (virStringToUpper(&info->loadparm, loadparm) !=3D 1) { + virReportError(VIR_ERR_INTERNAL_ERROR, + _("Failed to convert loadparm '%s' to upper cas= e"), + loadparm); + goto cleanup; + } + + if (!virDomainDeviceLoadparmIsValid(info->loadparm)) { + VIR_FREE(info->loadparm); + goto cleanup; + } + } + ret =3D 0; =20 cleanup: VIR_FREE(order); + VIR_FREE(loadparm); return ret; } =20 --=20 1.9.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list