src/xenconfig: move common parsing/formatting to xen_common

XM and XL config are very similar.  Disks are specified differently
in XL, but the old XM disk config is still supported by XL.  XL also
supports new config like spice that was never supported by XM.

This patch moves all the common parsing and formatting functions to
the new file xen_common.c and adapts the XM parser/formatter accordingly.
This restructuring paves way for introducing an XL parser/formatter in
the future.

While moving the code, fixup whitespace, comments, and style issues.

Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
Jim Fehlig 2014-08-15 20:52:15 -06:00
parent f67bf6e9b5
commit 337a136282
6 changed files with 2145 additions and 2052 deletions

View File

@ -232,6 +232,7 @@ src/xen/xm_internal.c
src/xen/xs_internal.c
src/xenapi/xenapi_driver.c
src/xenapi/xenapi_utils.c
src/xenconfig/xen_common.c
src/xenconfig/xen_sxpr.c
src/xenconfig/xen_xm.c
tools/libvirt-guests.sh.in

View File

@ -966,6 +966,7 @@ VMX_SOURCES = \
XENCONFIG_SOURCES = \
xenconfig/xenxs_private.h \
xenconfig/xen_common.c xenconfig/xen_common.h \
xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \
xenconfig/xen_xm.c xenconfig/xen_xm.h

2072
src/xenconfig/xen_common.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
/*
* xen_common.h: Parsing and formatting functions for config common
*
* Copyright (C) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library. If not, see
* <http://www.gnu.org/licenses/>.
*
* Author: Jim Fehlig <jfehlig@suse.com>
*/
#ifndef __VIR_XEN_COMMON_H__
# define __VIR_XEN_COMMON_H__
# include "internal.h"
# include "virconf.h"
# include "domain_conf.h"
int
xenConfigGetString(virConfPtr conf,
const char *name,
const char **value,
const char *def);
int xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virCapsPtr caps,
int xendConfigVersion);
int xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virConnectPtr conn,
int xendConfigVersion);
#endif /* __VIR_XEN_COMMON_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -36,14 +36,4 @@ virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def,
virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
virCapsPtr caps);
int xenParseConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virCapsPtr caps,
int xendConfigVersion);
int xenFormatConfigCommon(virConfPtr conf,
virDomainDefPtr def,
virConnectPtr conn,
int xendConfigVersion);
#endif /* __VIR_XEN_XM_H__ */