2012-03-27 01:09:31 +08:00
|
|
|
#include <config.h>
|
|
|
|
#ifdef WITH_LXC
|
|
|
|
|
|
|
|
# include "testutilslxc.h"
|
|
|
|
# include "testutils.h"
|
2012-12-13 02:06:53 +08:00
|
|
|
# include "viralloc.h"
|
2012-03-27 01:09:31 +08:00
|
|
|
# include "domain_conf.h"
|
|
|
|
|
|
|
|
|
2014-03-18 16:13:43 +08:00
|
|
|
virCapsPtr testLXCCapsInit(void)
|
|
|
|
{
|
2012-03-27 01:09:31 +08:00
|
|
|
virCapsPtr caps;
|
|
|
|
virCapsGuestPtr guest;
|
|
|
|
|
2012-12-19 03:32:23 +08:00
|
|
|
if ((caps = virCapabilitiesNew(VIR_ARCH_X86_64,
|
2014-07-14 20:56:13 +08:00
|
|
|
false, false)) == NULL)
|
2012-03-27 01:09:31 +08:00
|
|
|
return NULL;
|
|
|
|
|
2015-04-18 06:09:16 +08:00
|
|
|
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
|
|
|
|
VIR_ARCH_I686,
|
2012-03-27 01:09:31 +08:00
|
|
|
"/usr/libexec/libvirt_lxc", NULL,
|
|
|
|
0, NULL)) == NULL)
|
|
|
|
goto error;
|
|
|
|
|
2015-04-18 06:38:10 +08:00
|
|
|
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
|
2012-03-27 01:09:31 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
2015-04-18 06:09:16 +08:00
|
|
|
if ((guest = virCapabilitiesAddGuest(caps, VIR_DOMAIN_OSTYPE_EXE,
|
|
|
|
VIR_ARCH_X86_64,
|
2012-03-27 01:09:31 +08:00
|
|
|
"/usr/libexec/libvirt_lxc", NULL,
|
|
|
|
0, NULL)) == NULL)
|
|
|
|
goto error;
|
|
|
|
|
2015-04-18 06:38:10 +08:00
|
|
|
if (!virCapabilitiesAddGuestDomain(guest, VIR_DOMAIN_VIRT_LXC, NULL, NULL, 0, NULL))
|
2012-03-27 01:09:31 +08:00
|
|
|
goto error;
|
|
|
|
|
|
|
|
|
|
|
|
if (virTestGetDebug()) {
|
|
|
|
char *caps_str;
|
|
|
|
|
|
|
|
caps_str = virCapabilitiesFormatXML(caps);
|
|
|
|
if (!caps_str)
|
|
|
|
goto error;
|
|
|
|
|
2015-04-24 01:38:00 +08:00
|
|
|
VIR_TEST_DEBUG("LXC driver capabilities:\n%s", caps_str);
|
2012-03-27 01:09:31 +08:00
|
|
|
|
|
|
|
VIR_FREE(caps_str);
|
|
|
|
}
|
|
|
|
|
|
|
|
return caps;
|
|
|
|
|
2014-03-25 14:53:44 +08:00
|
|
|
error:
|
2013-02-01 20:26:18 +08:00
|
|
|
virObjectUnref(caps);
|
2012-03-27 01:09:31 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
#endif
|