[libvirt] [PATCH 1/4] Move USER_ALIAS_PREFIX to the header file

Ján Tomko jtomko at redhat.com
Wed Nov 29 14:58:54 UTC 2017


Allow other parts of code to decide whether the alias is user-specified
or not.
---
 src/conf/domain_conf.c | 3 +--
 src/conf/domain_conf.h | 2 ++
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index b31917dad..41c94ed18 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -6656,7 +6656,6 @@ virDomainDeviceAddressParseXML(xmlNodePtr address,
 }
 
 
-#define USER_ALIAS_PREFIX "ua-"
 #define USER_ALIAS_CHARS \
     "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_-"
 
@@ -6713,7 +6712,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) &&
+             STRPREFIX(aliasStr, VIR_DOMAIN_USER_ALIAS_PREFIX) &&
              strspn(aliasStr, USER_ALIAS_CHARS) == strlen(aliasStr)))
             VIR_STEAL_PTR(info->alias, aliasStr);
     }
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 48b07226e..afba0ede3 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -57,6 +57,8 @@
 # include "virtypedparam.h"
 # include "virsavecookie.h"
 
+# define VIR_DOMAIN_USER_ALIAS_PREFIX "ua-"
+
 /* forward declarations of all device types, required by
  * virDomainDeviceDef
  */
-- 
2.13.6




More information about the libvir-list mailing list