mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-21 20:15:17 +00:00
conf: remove parse code for long-extinct "<state devaddr='d🅱️s'/>
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:
<state devaddr='domain🚌slot'/>
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='blah'" into the status XML was removed by
commit 1b0cce7d3 (which "introduced 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 <state> 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 <state devaddr='blah'/> 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 <state devaddr='blah'/> 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 <= v0.7.5 with
running guests, it seems safe to finally remove the code that parses it.
Signed-off-by: Laine Stump <laine@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
8d42211881
commit
382c762c45
@ -7560,24 +7560,6 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt G_GNUC_UNUSED,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainParseLegacyDeviceAddress(char *devaddr,
|
||||
virPCIDeviceAddressPtr pci)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
/* expected format: <domain>:<bus>:<slot> */
|
||||
if (/* domain */
|
||||
virStrToLong_ui(devaddr, &tmp, 16, &pci->domain) < 0 || *tmp != ':' ||
|
||||
/* bus */
|
||||
virStrToLong_ui(tmp + 1, &tmp, 16, &pci->bus) < 0 || *tmp != ':' ||
|
||||
/* slot */
|
||||
virStrToLong_ui(tmp + 1, NULL, 16, &pci->slot) < 0)
|
||||
return -1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
virDomainHostdevSubsysUSBDefParseXML(xmlNodePtr node,
|
||||
virDomainHostdevDefPtr def)
|
||||
@ -7760,19 +7742,6 @@ virDomainHostdevSubsysPCIDefParseXML(xmlNodePtr node,
|
||||
|
||||
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 */
|
||||
g_autofree char *devaddr = virXMLPropString(cur, "devaddr");
|
||||
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 = VIR_DOMAIN_DEVICE_ADDRESS_TYPE_PCI;
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_PCI_ORIG_STATES) &&
|
||||
virXMLNodeNameEqual(cur, "origstates")) {
|
||||
virDomainHostdevOrigStatesPtr states = &def->origstates;
|
||||
@ -9961,7 +9930,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
g_autofree char *sgio = NULL;
|
||||
g_autofree char *target = NULL;
|
||||
g_autofree char *bus = NULL;
|
||||
g_autofree char *devaddr = NULL;
|
||||
g_autofree char *serial = NULL;
|
||||
g_autofree char *startupPolicy = NULL;
|
||||
g_autofree char *tray = NULL;
|
||||
@ -10128,10 +10096,6 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->src->shared = true;
|
||||
} else if (virXMLNodeNameEqual(cur, "transient")) {
|
||||
def->transient = true;
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||
virXMLNodeNameEqual(cur, "state")) {
|
||||
/* Legacy back-compat. Don't add any more attributes here */
|
||||
devaddr = virXMLPropString(cur, "devaddr");
|
||||
} else if (!encryption &&
|
||||
virXMLNodeNameEqual(cur, "encryption")) {
|
||||
/* If we've already parsed <source> and found an <encryption> child,
|
||||
@ -10316,19 +10280,9 @@ virDomainDiskDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
}
|
||||
}
|
||||
|
||||
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 = 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_BOOT) < 0) {
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (startupPolicy) {
|
||||
@ -11490,7 +11444,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
g_autofree char *str = NULL;
|
||||
g_autofree char *filter = NULL;
|
||||
g_autofree char *internal = NULL;
|
||||
g_autofree char *devaddr = NULL;
|
||||
g_autofree char *mode = NULL;
|
||||
g_autofree char *linkstate = NULL;
|
||||
g_autofree char *addrtype = NULL;
|
||||
@ -11671,10 +11624,6 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
filter = virXMLPropString(cur, "filter");
|
||||
virHashFree(filterparams);
|
||||
filterparams = virNWFilterParseParamAttributes(cur);
|
||||
} else if ((flags & VIR_DOMAIN_DEF_PARSE_STATUS) &&
|
||||
virXMLNodeNameEqual(cur, "state")) {
|
||||
/* Legacy back-compat. Don't add any more attributes here */
|
||||
devaddr = virXMLPropString(cur, "devaddr");
|
||||
} else if (virXMLNodeNameEqual(cur, "boot")) {
|
||||
/* boot is parsed as part of virDomainDeviceInfoParseXML */
|
||||
} else if (!actual &&
|
||||
@ -11727,20 +11676,10 @@ virDomainNetDefParseXML(virDomainXMLOptionPtr xmlopt,
|
||||
def->mac_generated = true;
|
||||
}
|
||||
|
||||
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 = 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;
|
||||
}
|
||||
|
||||
if (model != NULL &&
|
||||
|
Loading…
x
Reference in New Issue
Block a user