|
|
404507 |
From c4df501b589eb7d4315c13bfe6ba653321135841 Mon Sep 17 00:00:00 2001
|
|
|
404507 |
Message-Id: <c4df501b589eb7d4315c13bfe6ba653321135841@dist-git>
|
|
|
404507 |
From: =?UTF-8?q?J=C3=A1n=20Tomko?= <jtomko@redhat.com>
|
|
|
404507 |
Date: Thu, 30 Nov 2017 17:45:57 +0100
|
|
|
404507 |
Subject: [PATCH] Introduce virDomainDeviceAliasIsUserAlias
|
|
|
404507 |
MIME-Version: 1.0
|
|
|
404507 |
Content-Type: text/plain; charset=UTF-8
|
|
|
404507 |
Content-Transfer-Encoding: 8bit
|
|
|
404507 |
|
|
|
404507 |
Allow parts of code outside domain_conf to decide whether the alias
|
|
|
404507 |
is user-specified or not.
|
|
|
404507 |
|
|
|
404507 |
(cherry picked from commit 309cd46b400d80420615b19adfebf7158492ae3b)
|
|
|
404507 |
|
|
|
404507 |
https://bugzilla.redhat.com/show_bug.cgi?id=1518148
|
|
|
404507 |
|
|
|
404507 |
Signed-off-by: Ján Tomko <jtomko@redhat.com>
|
|
|
404507 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
404507 |
---
|
|
|
404507 |
src/conf/domain_conf.c | 9 ++++++++-
|
|
|
404507 |
src/conf/domain_conf.h | 2 ++
|
|
|
404507 |
src/libvirt_private.syms | 1 +
|
|
|
404507 |
3 files changed, 11 insertions(+), 1 deletion(-)
|
|
|
404507 |
|
|
|
404507 |
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
|
|
|
404507 |
index 83392a42c0..bd6d851f21 100644
|
|
|
404507 |
--- a/src/conf/domain_conf.c
|
|
|
404507 |
+++ b/src/conf/domain_conf.c
|
|
|
404507 |
@@ -6662,6 +6662,13 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
|
|
|
404507 |
#define USER_ALIAS_CHARS \
|
|
|
404507 |
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
|
|
|
404507 |
|
|
|
404507 |
+bool
|
|
|
404507 |
+virDomainDeviceAliasIsUserAlias(const char *aliasStr)
|
|
|
404507 |
+{
|
|
|
404507 |
+ return STRPREFIX(aliasStr, USER_ALIAS_PREFIX);
|
|
|
404507 |
+}
|
|
|
404507 |
+
|
|
|
404507 |
+
|
|
|
404507 |
/* Parse the XML definition for a device address
|
|
|
404507 |
* @param node XML nodeset to parse for device address definition
|
|
|
404507 |
*/
|
|
|
404507 |
@@ -6715,7 +6722,7 @@ virDomainDeviceInfoParseXML(virDomainXMLOptionPtr xmlopt ATTRIBUTE_UNUSED,
|
|
|
404507 |
|
|
|
404507 |
if (!(flags & VIR_DOMAIN_DEF_PARSE_INACTIVE) ||
|
|
|
404507 |
(xmlopt->config.features & VIR_DOMAIN_DEF_FEATURE_USER_ALIAS &&
|
|
|
404507 |
- STRPREFIX(aliasStr, USER_ALIAS_PREFIX) &&
|
|
|
404507 |
+ virDomainDeviceAliasIsUserAlias(aliasStr) &&
|
|
|
404507 |
strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
|
|
|
404507 |
VIR_STEAL_PTR(info->alias, aliasStr);
|
|
|
404507 |
}
|
|
|
404507 |
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
|
|
|
404507 |
index 0e97f0437e..479a791f29 100644
|
|
|
404507 |
--- a/src/conf/domain_conf.h
|
|
|
404507 |
+++ b/src/conf/domain_conf.h
|
|
|
404507 |
@@ -2674,6 +2674,8 @@ int virDomainDeviceValidateAliasForHotplug(virDomainObjPtr vm,
|
|
|
404507 |
virDomainDeviceDefPtr dev,
|
|
|
404507 |
unsigned int flags);
|
|
|
404507 |
|
|
|
404507 |
+bool virDomainDeviceAliasIsUserAlias(const char *aliasStr);
|
|
|
404507 |
+
|
|
|
404507 |
int virDomainDefValidate(virDomainDefPtr def,
|
|
|
404507 |
virCapsPtr caps,
|
|
|
404507 |
unsigned int parseFlags,
|
|
|
404507 |
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
|
|
|
404507 |
index 0449b0185f..19c1ecc408 100644
|
|
|
404507 |
--- a/src/libvirt_private.syms
|
|
|
404507 |
+++ b/src/libvirt_private.syms
|
|
|
404507 |
@@ -292,6 +292,7 @@ virDomainDefVcpuOrderClear;
|
|
|
404507 |
virDomainDeleteConfig;
|
|
|
404507 |
virDomainDeviceAddressIsValid;
|
|
|
404507 |
virDomainDeviceAddressTypeToString;
|
|
|
404507 |
+virDomainDeviceAliasIsUserAlias;
|
|
|
404507 |
virDomainDeviceDefCopy;
|
|
|
404507 |
virDomainDeviceDefFree;
|
|
|
404507 |
virDomainDeviceDefParse;
|
|
|
404507 |
--
|
|
|
404507 |
2.15.1
|
|
|
404507 |
|