mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-07-31 05:57:16 +00:00
src/xenconfig: wrap common parsing code
Wrap parsing code common to xm and xl in xenParseConfigCommon and export it. Signed-off-by: Kiarie Kahurani <davidkiarie4@gmail.com> Signed-off-by: Jim Fehlig <jfehlig@suse.com>
This commit is contained in:
parent
870c90c70f
commit
512f673835
@ -1263,12 +1263,59 @@ xenParseXMOS(virConfPtr conf, virDomainDefPtr def)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
xenParseConfigCommon(virConfPtr conf,
|
||||||
|
virDomainDefPtr def,
|
||||||
|
virCapsPtr caps,
|
||||||
|
int xendConfigVersion)
|
||||||
|
{
|
||||||
|
if (xenParseXMGeneralMeta(conf, def, caps) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMOS(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMMem(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMEventsActions(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMCPUFeatures(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMTimeOffset(conf, def, xendConfigVersion) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenXMConfigCopyStringOpt(conf, "device_model", &def->emulator) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMVif(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMPCI(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMEmulatedDevices(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMVfb(conf, def, xendConfigVersion) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
if (xenParseXMCharDev(conf, def) < 0)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Turn a config record into a lump of XML describing the
|
* Turn a config record into a lump of XML describing the
|
||||||
* domain, suitable for later feeding for virDomainCreateXML
|
* domain, suitable for later feeding for virDomainCreateXML
|
||||||
*/
|
*/
|
||||||
virDomainDefPtr
|
virDomainDefPtr
|
||||||
xenParseXM(virConfPtr conf, int xendConfigVersion,
|
xenParseXM(virConfPtr conf,
|
||||||
|
int xendConfigVersion,
|
||||||
virCapsPtr caps)
|
virCapsPtr caps)
|
||||||
{
|
{
|
||||||
virDomainDefPtr def = NULL;
|
virDomainDefPtr def = NULL;
|
||||||
@ -1279,44 +1326,11 @@ xenParseXM(virConfPtr conf, int xendConfigVersion,
|
|||||||
def->virtType = VIR_DOMAIN_VIRT_XEN;
|
def->virtType = VIR_DOMAIN_VIRT_XEN;
|
||||||
def->id = -1;
|
def->id = -1;
|
||||||
|
|
||||||
if (xenParseXMGeneralMeta(conf, def, caps) < 0)
|
if (xenParseConfigCommon(conf, def, caps, xendConfigVersion) < 0)
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMOS(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMMem(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMEventsActions(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMCPUFeatures(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMTimeOffset(conf, def, xendConfigVersion) < 0)
|
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (xenParseXMDisk(conf, def, xendConfigVersion) < 0)
|
if (xenParseXMDisk(conf, def, xendConfigVersion) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (xenXMConfigCopyStringOpt(conf, "device_model", &def->emulator) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMVif(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMPCI(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMEmulatedDevices(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMVfb(conf, def, xendConfigVersion) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
if (xenParseXMCharDev(conf, def) < 0)
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
return def;
|
return def;
|
||||||
|
|
||||||
|
@ -36,4 +36,9 @@ virConfPtr xenFormatXM(virConnectPtr conn, virDomainDefPtr def,
|
|||||||
virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
|
virDomainDefPtr xenParseXM(virConfPtr conf, int xendConfigVersion,
|
||||||
virCapsPtr caps);
|
virCapsPtr caps);
|
||||||
|
|
||||||
|
int xenParseConfigCommon(virConfPtr conf,
|
||||||
|
virDomainDefPtr def,
|
||||||
|
virCapsPtr caps,
|
||||||
|
int xendConfigVersion);
|
||||||
|
|
||||||
#endif /* __VIR_XEN_XM_H__ */
|
#endif /* __VIR_XEN_XM_H__ */
|
||||||
|
Loading…
Reference in New Issue
Block a user