From nobody Tue Apr 23 10:28:32 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570639445; cv=none; d=zoho.com; s=zohoarc; b=Ubb3B48uJO7zLZq9caXd7KwrisgSFmQdO4cm8hgXmj4SHYlbJ0b0FvwKmyD/u3goHddC+qoPCp3GRzyUJSV93Y6SCpFEkjtTyGb7pZGzuSCcJmu0ktjIj+eO/FQB8cNsWQEudXKqhdGpBRGhnB2VUwmF3pxdY0IPU+UHvPWuHF4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570639445; h=Content-Type:Content-Transfer-Encoding:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=uzQ/9hJ0rPxXMpCgdLuCMp0M7hOAakncV69wPE1CYjo=; b=KfQDl72Wk9w80pWLaz2X/bMko9bRnQ8UVMZbCqUnEv+4BlqR5D2krHWY78M3umTx+U8nLQCSgozZOhbymEISIDIUybXO5Twi9vjfGPQi2XVeNxB0K2Aj4EwdT1PmRX8MMULSAr5rwF3tdyulE1FVElrCPh5zE98EVXZ5Yaz5XEw= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1570639445658574.9344223824651; Wed, 9 Oct 2019 09:44:05 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90F48308FBA6; Wed, 9 Oct 2019 16:44:03 +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 2DF6A60167; Wed, 9 Oct 2019 16:44:03 +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 48627180085A; Wed, 9 Oct 2019 16:44:02 +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 x99GdMMo014370 for ; Wed, 9 Oct 2019 12:39:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8F576046B; Wed, 9 Oct 2019 16:39:22 +0000 (UTC) Received: from vhost2.laine.org (ovpn-118-22.phx2.redhat.com [10.3.118.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 83D0560166 for ; Wed, 9 Oct 2019 16:39:20 +0000 (UTC) From: Laine Stump To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 12:39:15 -0400 Message-Id: <20191009163915.9506-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH] conf: remove parse code for long-extinct " X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 09 Oct 2019 16:44:04 +0000 (UTC) Content-Type: text/plain; charset="utf-8" Back in July 2009, in the days before libvirt supported explicitly assigning a PCI address to every device, code was added to save the PCI addresses of hotplugged network, disk, and hostdevs in the domain status with this XML element: This was added in commits 4e21a95a, 01654107, in v0.7.0, and 0c5b7b93 in v0.7.1. Then just a few months later, in November 2009, The code that actually formatted the "devaddr=3D'blah' into the status XML was removed by commit 1b0cce7d3 (which "Introduce[d] a standardized data structure for device addresses"). The code to *parse* the devaddr from the status was left in for backward compatibility though (it just parses it into the "standard" PCI address). At the time the devaddr attribute was added, a few other attributes already existed in the element for network devices, and these were removed over time (I haven't checked the exact dates of this), but 10 years later, in libvirt v5.8.0, we *still* maintain code to parse from the domain status. In the meantime, even distros so old that we no longer support them in upstream libvirt are using a libvirt new enough that it doesn't ever write to the domain status XML. Since the only way a current libvirt would ever encounter this element would be if someone was upgrading directly from libvirt <=3Dv0.7.5 with running guests, it seems safe to finally remove the code that parses it. Signed-off-by: Laine Stump Reviewed-by: J=C3=A1n Tomko --- The git commit ID's etc are probably not essential to have in the log message, but I did think it was interesting that we've been carrying this for so many years... src/conf/domain_conf.c | 76 +++++------------------------------------- 1 file changed, 8 insertions(+), 68 deletions(-) diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index a53cd6a725..423c242be9 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -7558,24 +7558,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xm= lopt ATTRIBUTE_UNUSED, return ret; } =20 -static int -virDomainParseLegacyDeviceAddress(char *devaddr, - virPCIDeviceAddressPtr pci) -{ - char *tmp; - - /* expected format: :: */ - if (/* domain */ - virStrToLong_ui(devaddr, &tmp, 16, &pci->domain) < 0 || *tmp !=3D = ':' || - /* bus */ - virStrToLong_ui(tmp + 1, &tmp, 16, &pci->bus) < 0 || *tmp !=3D ':'= || - /* slot */ - virStrToLong_ui(tmp + 1, NULL, 16, &pci->slot) < 0) - return -1; - - return 0; -} - static int virDomainHostdevSubsysUSBDefParseXML(xmlNodePtr node, virDomainHostdevDefPtr def) @@ -7758,19 +7740,7 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node, =20 if (virPCIDeviceAddressParseXML(cur, addr) < 0) goto out; - } else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && - virXMLNodeNameEqual(cur, "state")) { - /* Legacy back-compat. Don't add any more attributes here = */ - VIR_AUTOFREE(char *) devaddr =3D virXMLPropString(cur, "de= vaddr"); - if (devaddr && - virDomainParseLegacyDeviceAddress(devaddr, - &def->info->addr.pci= ) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%= s'"), - devaddr); - goto out; - } - def->info->type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; + } else if ((flags & VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES) && virXMLNodeNameEqual(cur, "origstates")) { virDomainHostdevOrigStatesPtr states =3D &def->origstates; @@ -9959,7 +9929,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt, VIR_AUTOFREE(char *) sgio =3D NULL; VIR_AUTOFREE(char *) target =3D NULL; VIR_AUTOFREE(char *) bus =3D NULL; - VIR_AUTOFREE(char *) devaddr =3D NULL; VIR_AUTOFREE(char *) serial =3D NULL; VIR_AUTOFREE(char *) startupPolicy =3D NULL; VIR_AUTOFREE(char *) tray =3D NULL; @@ -10126,10 +10095,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xml= opt, def->src->shared =3D true; } else if (virXMLNodeNameEqual(cur, "transient")) { def->transient =3D true; - } else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && - virXMLNodeNameEqual(cur, "state")) { - /* Legacy back-compat. Don't add any more attributes here */ - devaddr =3D virXMLPropString(cur, "devaddr"); } else if (!encryption && virXMLNodeNameEqual(cur, "encryption")) { /* If we've already parsed and found an = child, @@ -10314,19 +10279,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xml= opt, } } =20 - if (devaddr) { - if (virDomainParseLegacyDeviceAddress(devaddr, - &def->info.addr.pci) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%s'"), - devaddr); - goto error; - } - def->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; - } else { - if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, - flags | VIR_DOMAIN_DEF_PARSE_ALLOW= _BOOT) < 0) - goto error; + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, + flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOO= T) < 0) { + goto error; } =20 if (startupPolicy) { @@ -11488,7 +11443,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlop= t, VIR_AUTOFREE(char *) str =3D NULL; VIR_AUTOFREE(char *) filter =3D NULL; VIR_AUTOFREE(char *) internal =3D NULL; - VIR_AUTOFREE(char *) devaddr =3D NULL; VIR_AUTOFREE(char *) mode =3D NULL; VIR_AUTOFREE(char *) linkstate =3D NULL; VIR_AUTOFREE(char *) addrtype =3D NULL; @@ -11669,10 +11623,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlo= pt, filter =3D virXMLPropString(cur, "filter"); virHashFree(filterparams); filterparams =3D virNWFilterParseParamAttributes(cur); - } else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) && - virXMLNodeNameEqual(cur, "state")) { - /* Legacy back-compat. Don't add any more attributes here = */ - devaddr =3D virXMLPropString(cur, "devaddr"); } else if (virXMLNodeNameEqual(cur, "boot")) { /* boot is parsed as part of virDomainDeviceInfoParseXML */ } else if (!actual && @@ -11725,20 +11675,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xml= opt, def->mac_generated =3D true; } =20 - if (devaddr) { - if (virDomainParseLegacyDeviceAddress(devaddr, - &def->info.addr.pci) < 0) { - virReportError(VIR_ERR_INTERNAL_ERROR, - _("Unable to parse devaddr parameter '%s'"), - devaddr); - goto error; - } - def->info.type =3D VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI; - } else { - if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, - flags | VIR_DOMAIN_DEF_PARSE_ALLOW= _BOOT - | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) = < 0) - goto error; + if (virDomainDeviceInfoParseXML(xmlopt, node, &def->info, + flags | VIR_DOMAIN_DEF_PARSE_ALLOW_BOOT + | VIR_DOMAIN_DEF_PARSE_ALLOW_ROM) < 0)= { + goto error; } =20 if (model !=3D NULL && --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list