From 4100aecd13dfa219b121ec3e0ea63609a22d2ef6 Mon Sep 17 00:00:00 2001 From: Pavel Hrdina Date: Thu, 7 Jan 2016 08:59:26 +0100 Subject: [PATCH] xen: move virDomainDefPostParse to xenParseSxpr This patch partially reverts previous commit 91a00424 and moves the post parse function to xenParseSxpr. This update is required because xen driver calls xenParseSxpr directly. Signed-off-by: Pavel Hrdina --- src/xen/xend_internal.c | 7 +++++-- src/xenconfig/xen_sxpr.c | 21 ++++++++++----------- src/xenconfig/xen_sxpr.h | 6 +++++- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/src/xen/xend_internal.c b/src/xen/xend_internal.c index db3820d965..cf7cdd034c 100644 --- a/src/xen/xend_internal.c +++ b/src/xen/xend_internal.c @@ -1552,7 +1552,9 @@ xenDaemonDomainFetch(virConnectPtr conn, int domid, const char *name, if (!(def = xenParseSxpr(root, cpus, tty, - vncport))) + vncport, + priv->caps, + priv->xmlopt))) goto cleanup; cleanup: @@ -3082,7 +3084,8 @@ xenDaemonDomainBlockPeek(virConnectPtr conn, vncport = xenStoreDomainGetVNCPort(conn, id); xenUnifiedUnlock(priv); - if (!(def = xenParseSxpr(root, NULL, tty, vncport))) + if (!(def = xenParseSxpr(root, NULL, tty, vncport, + priv->caps, priv->xmlopt))) goto cleanup; if (!(actual = virDomainDiskPathByName(def, path))) { diff --git a/src/xenconfig/xen_sxpr.c b/src/xenconfig/xen_sxpr.c index d99bac0038..d7b700d647 100644 --- a/src/xenconfig/xen_sxpr.c +++ b/src/xenconfig/xen_sxpr.c @@ -1065,7 +1065,11 @@ xenParseSxprPCI(virDomainDefPtr def, */ virDomainDefPtr xenParseSxpr(const struct sexpr *root, - const char *cpus, char *tty, int vncport) + const char *cpus, + char *tty, + int vncport, + virCapsPtr caps, + virDomainXMLOptionPtr xmlopt) { const char *tmp; virDomainDefPtr def; @@ -1371,6 +1375,10 @@ xenParseSxpr(const struct sexpr *root, goto error; } + if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, + xmlopt) < 0) + goto error; + return def; error: @@ -1405,16 +1413,7 @@ xenParseSxprString(const char *sexpr, if (!root) return NULL; - if (!(def = xenParseSxpr(root, NULL, tty, vncport))) - goto cleanup; - - if (virDomainDefPostParse(def, caps, VIR_DOMAIN_DEF_PARSE_ABI_UPDATE, - xmlopt) < 0) { - virDomainDefFree(def); - def = NULL; - } - - cleanup: + def = xenParseSxpr(root, NULL, tty, vncport, caps, xmlopt); sexpr_free(root); return def; diff --git a/src/xenconfig/xen_sxpr.h b/src/xenconfig/xen_sxpr.h index a4f4c449b2..e925208b5d 100644 --- a/src/xenconfig/xen_sxpr.h +++ b/src/xenconfig/xen_sxpr.h @@ -43,7 +43,11 @@ virDomainDefPtr xenParseSxprString(const char *sexpr, virDomainXMLOptionPtr xmlopt); virDomainDefPtr xenParseSxpr(const struct sexpr *root, - const char *cpus, char *tty, int vncport); + const char *cpus, + char *tty, + int vncport, + virCapsPtr caps, + virDomainXMLOptionPtr xmlopt); int xenParseSxprSound(virDomainDefPtr def, const char *str); -- GitLab