summaryrefslogtreecommitdiff
blob: e6193afcf04644929c33e557ddd874087860e865 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include <config.h>
#ifdef WITH_LXC
# include <stdlib.h>

# include "testutilslxc.h"
# include "testutils.h"
# include "memory.h"
# include "domain_conf.h"


static int testLXCDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
{
    return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_LXC;
}


virCapsPtr testLXCCapsInit(void) {
    virCapsPtr caps;
    virCapsGuestPtr guest;

    if ((caps = virCapabilitiesNew("x86_64",
                                   0, 0)) == NULL)
        return NULL;

    caps->defaultConsoleTargetType = testLXCDefaultConsoleType;

    if ((guest = virCapabilitiesAddGuest(caps, "exe", "i686", 32,
                                         "/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", "x86_64", 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:
    virCapabilitiesFree(caps);
    return NULL;
}
#endif