[libvirt] [PATCH V4 1/3] Introduce support for parsing/formatting Xen xl config format
Eric Blake
eblake at redhat.com
Tue Jan 13 21:01:29 UTC 2015
On 01/13/2015 08:53 AM, Jim Fehlig wrote:
> Introduce a parser/formatter for the xl config format. Since the
> deprecation of xm/xend, the VM config file format has diverged as
> new features are added to libxl. This patch adds support for parsing
> and formating the xl config format. It supports the existing xm config
> format, plus adds support for spice graphics and xl disk config syntax.
>
> xl disk config is parsed with the help of xlu_disk_parse() from
> libxlutil, libxl's utility library. Although the library exists
> in all Xen versions supported by the libxl virt driver, only
> recently has the corresponding header file been included. A check
> for the header is done in configure.ac. If not found, xlu_disk_parse()
> is declared externally.
>
> Signed-off-by: Kiarie Kahurani <davidkiarie4 at gmail.com>
> Signed-off-by: Jim Fehlig <jfehlig at suse.com>
> ---
> +++ b/src/Makefile.am
> @@ -1005,6 +1005,10 @@ XENCONFIG_SOURCES = \
> xenconfig/xen_common.c xenconfig/xen_common.h \
> xenconfig/xen_sxpr.c xenconfig/xen_sxpr.h \
> xenconfig/xen_xm.c xenconfig/xen_xm.h
> +if WITH_LIBXL
> +XENCONFIG_SOURCES += \
> + xenconfig/xen_xl.c xenconfig/xen_xl.h
> +endif WITH_LIBXL
Missing an EXTRA_DIST listing to ensure these two files are part of a
tarball even when configure does not build libxl sources (that is, make
sure 'make distcheck' will not fail if configured on a machine without
libxl support).
> +xenParseXLDisk(virConfPtr conf, virDomainDefPtr def)
> + while (list) {
> + const char *disk_spec = list->str;
> +
> + if ((list->type != VIR_CONF_STRING) || (list->str == NULL))
Over-parenthesized.
> + goto skipdisk;
> +
> + libxl_device_disk_init(libxldisk);
> +
> + if (xlu_disk_parse(xluconf, 1, &disk_spec, libxldisk))
> + goto fail;
> +
> + if (!(disk = virDomainDiskDefNew()))
> + goto fail;
> +
> + if (VIR_STRDUP(disk->dst, libxldisk->vdev) < 0)
> + goto fail;
> +
> + if (virDomainDiskSetSource(disk, libxldisk->pdev_path) < 0)
> + goto fail;
> +
> + disk->src->readonly = libxldisk->readwrite ? 0 : 1;
Isn't disk->src->readonly a bool? In which case, this should be:
disk->src->readonly = !libxldisk->readwrite;
for correct typing.
I'd wait for John to confirm that Coverity is happy, but ACK if you fix
the spots I pointed out.
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20150113/75296ffb/attachment-0001.sig>
More information about the libvir-list
mailing list