libvirt/tests/testutilslxc.c
Peter Krempa 482e5f159c virCaps: get rid of defaultConsoleTargetType callback
This patch refactors various places to allow removing of the
defaultConsoleTargetType callback from the virCaps structure.

A new console character device target type is introduced -
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_NONE - to mark that no type was
specified in the XML. This type is at the end converted to the standard
VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL. Other types that are
different from this default have to be processed separately in the
device post parse callback.
2013-04-04 22:42:39 +02:00

56 lines
1.3 KiB
C

#include <config.h>
#ifdef WITH_LXC
# include <stdlib.h>
# include "testutilslxc.h"
# include "testutils.h"
# include "viralloc.h"
# include "domain_conf.h"
virCapsPtr testLXCCapsInit(void) {
virCapsPtr caps;
virCapsGuestPtr guest;
if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
0, 0)) == NULL)
return NULL;
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686,
"/usr/libexec/libvirt_lxc", NULL,
0, NULL)) == NULL)
goto error;
if (!virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL))
goto error;
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_X86_64,
"/usr/libexec/libvirt_lxc", NULL,
0, NULL)) == NULL)
goto error;
if (!virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL))
goto error;
if (virTestGetDebug()) {
char *caps_str;
caps_str = virCapabilitiesFormatXML(caps);
if (!caps_str)
goto error;
fprintf(stderr, "LXC driver capabilities:\n%s", caps_str);
VIR_FREE(caps_str);
}
return caps;
error:
virObjectUnref(caps);
return NULL;
}
#endif