2012-03-26 17:09:31 +00:00
|
|
|
#include <config.h>
|
|
|
|
#ifdef WITH_LXC
|
|
|
|
# include <stdlib.h>
|
|
|
|
|
|
|
|
# include "testutilslxc.h"
|
|
|
|
# include "testutils.h"
|
2012-12-12 18:06:53 +00:00
|
|
|
# include "viralloc.h"
|
2012-03-26 17:09:31 +00:00
|
|
|
# include "domain_conf.h"
|
|
|
|
|
|
|
|
|
2012-11-09 15:00:36 +00:00
|
|
|
static int testLXCDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED,
|
2012-12-18 19:32:23 +00:00
|
|
|
virArch arch ATTRIBUTE_UNUSED)
|
2012-03-26 17:09:31 +00:00
|
|
|
{
|
|
|
|
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
virCapsPtr testLXCCapsInit(void) {
|
|
|
|
virCapsPtr caps;
|
|
|
|
virCapsGuestPtr guest;
|
|
|
|
|
2012-12-18 19:32:23 +00:00
|
|
|
if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
|
2012-03-26 17:09:31 +00:00
|
|
|
0, 0)) == NULL)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
caps->defaultConsoleTargetType = testLXCDefaultConsoleType;
|
|
|
|
|
2012-12-18 19:32:23 +00:00
|
|
|
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_I686,
|
2012-03-26 17:09:31 +00:00
|
|
|
"/usr/libexec/libvirt_lxc", NULL,
|
|
|
|
0, NULL)) == NULL)
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
if (!virCapabilitiesAddGuestDomain(guest, "lxc", NULL, NULL, 0, NULL))
|
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
2012-12-18 19:32:23 +00:00
|
|
|
if ((guest = virCapabilitiesAddGuest(caps, "exe", VIR_ARCH_X86_64,
|
2012-03-26 17:09:31 +00:00
|
|
|
"/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:
|
2013-02-01 12:26:18 +00:00
|
|
|
virObjectUnref(caps);
|
2012-03-26 17:09:31 +00:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|