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 \
|
#define USER_ALIAS_CHARS \
|
||||||
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
|
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
|
||||||
|
|
||||||
|
bool
|
||||||
|
virDomainDeviceAliasIsUserAlias(const char *aliasStr)
|
||||||
|
{
|
||||||
|
return STRPREFIX(aliasStr, USER_ALIAS_PREFIX);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Parse the XML definition for a device address
|
/* Parse the XML definition for a device address
|
||||||
* @param node XML nodeset to parse for device address definition
|
* @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) ||
|
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) ||
|
||||||
(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS &&
|
(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS &&
|
||||||
STRPREFIX(aliasStr, USER_ALIAS_PREFIX) &&
|
virDomainDeviceAliasIsUserAlias(aliasStr) &&
|
||||||
strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
|
strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
|
||||||
VIR_STEAL_PTR(info->alias, aliasStr);
|
VIR_STEAL_PTR(info->alias, aliasStr);
|
||||||
}
|
}
|
||||||
|
@ -2679,6 +2679,8 @@ int virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
|
|||||||
virDomainDeviceDefPtr dev,
|
virDomainDeviceDefPtr dev,
|
||||||
unsigned int flags);
|
unsigned int flags);
|
||||||
|
|
||||||
|
bool virDomainDeviceAliasIsUserAlias(const char *aliasStr);
|
||||||
|
|
||||||
int virDomainDefValidate(virDomainDefPtr def,
|
int virDomainDefValidate(virDomainDefPtr def,
|
||||||
virCapsPtr caps,
|
virCapsPtr caps,
|
||||||
unsigned int parseFlags,
|
unsigned int parseFlags,
|
||||||
|
@ -294,6 +294,7 @@ virDomainDefVcpuOrderClear;
|
|||||||
virDomainDeleteConfig;
|
virDomainDeleteConfig;
|
||||||
virDomainDeviceAddressIsValid;
|
virDomainDeviceAddressIsValid;
|
||||||
virDomainDeviceAddressTypeToString;
|
virDomainDeviceAddressTypeToString;
|
||||||
|
virDomainDeviceAliasIsUserAlias;
|
||||||
virDomainDeviceDefCopy;
|
virDomainDeviceDefCopy;
|
||||||
virDomainDeviceDefFree;
|
virDomainDeviceDefFree;
|
||||||
virDomainDeviceDefParse;
|
virDomainDeviceDefParse;
|
||||||
|
Loading…
Reference in New Issue
Block a user