mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-08-28 11:31:16 +00:00
Introduce virDomainDeviceAliasIsUserAlias
Allow parts of code outside domain_conf to decide whether the alias is user-specified or not.
This commit is contained in:
parent
c703913cc0
commit
309cd46b40
@ -6660,6 +6660,13 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
|
||||
#define USER_ALIAS_CHARS \
|
||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
|
||||
|
||||
bool
|
||||
virDomainDeviceAliasIsUserAlias(const char *aliasStr)
|
||||
{
|
||||
return STRPREFIX(aliasStr, USER_ALIAS_PREFIX);
|
||||
}
|
||||
|
||||
|
||||
/* Parse the XML definition for a device address
|
||||
* @param node XML nodeset to parse for device address definition
|
||||
*/
|
||||
@ -6713,7 +6720,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED,
|
||||
|
||||
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) ||
|
||||
(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS &&
|
||||
STRPREFIX(aliasStr, USER_ALIAS_PREFIX) &&
|
||||
virDomainDeviceAliasIsUserAlias(aliasStr) &&
|
||||
strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
|
||||
VIR_STEAL_PTR(info->alias, aliasStr);
|
||||
}
|
||||
|
@ -2679,6 +2679,8 @@ int virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
|
||||
virDomainDeviceDefPtr dev,
|
||||
unsigned int flags);
|
||||
|
||||
bool virDomainDeviceAliasIsUserAlias(const char *aliasStr);
|
||||
|
||||
int virDomainDefValidate(virDomainDefPtr def,
|
||||
virCapsPtr caps,
|
||||
unsigned int parseFlags,
|
||||
|
@ -294,6 +294,7 @@ virDomainDefVcpuOrderClear;
|
||||
virDomainDeleteConfig;
|
||||
virDomainDeviceAddressIsValid;
|
||||
virDomainDeviceAddressTypeToString;
|
||||
virDomainDeviceAliasIsUserAlias;
|
||||
virDomainDeviceDefCopy;
|
||||
virDomainDeviceDefFree;
|
||||
virDomainDeviceDefParse;
|
||||
|
Loading…
Reference in New Issue
Block a user