libvirt/tests/testutilsxen.c
Daniel P. Berrange 1c04f99970 Remove spurious whitespace between function name & open brackets
The libvirt coding standard is to use 'function(...args...)'
instead of 'function (...args...)'. A non-trivial number of
places did not follow this rule and are fixed in this patch.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-11-02 13:36:49 +00:00

80 lines
2.4 KiB
C

#include <config.h>
#include <sys/utsname.h>
#include <stdlib.h>
#include "testutilsxen.h"
#include "domain_conf.h"
static int testXenDefaultConsoleType(const char *ostype ATTRIBUTE_UNUSED)
{
if (STREQ(ostype, "hvm"))
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_SERIAL;
else
return VIR_DOMAIN_CHR_CONSOLE_TARGET_TYPE_XEN;
}
virCapsPtr testXenCapsInit(void) {
struct utsname utsname;
virCapsPtr caps;
virCapsGuestPtr guest;
virCapsGuestMachinePtr *machines;
int nmachines;
static const char *const x86_machines[] = {
"xenfv"
};
static const char *const xen_machines[] = {
"xenpv"
};
uname(&utsname);
if ((caps = virCapabilitiesNew(utsname.machine,
0, 0)) == NULL)
return NULL;
caps->defaultConsoleTargetType = testXenDefaultConsoleType;
nmachines = ARRAY_CARDINALITY(x86_machines);
if ((machines = virCapabilitiesAllocMachines(x86_machines, nmachines)) == NULL)
goto cleanup;
if ((guest = virCapabilitiesAddGuest(caps, "hvm", "i686", 32,
"/usr/lib/xen/bin/qemu-dm", NULL,
nmachines, machines)) == NULL)
goto cleanup;
machines = NULL;
if (virCapabilitiesAddGuestDomain(guest,
"xen",
NULL,
NULL,
0,
NULL) == NULL)
goto cleanup;
nmachines = ARRAY_CARDINALITY(xen_machines);
if ((machines = virCapabilitiesAllocMachines(xen_machines, nmachines)) == NULL)
goto cleanup;
if ((guest = virCapabilitiesAddGuest(caps, "xen", "i686", 32,
"/usr/lib/xen/bin/qemu-dm", NULL,
nmachines, machines)) == NULL)
goto cleanup;
machines = NULL;
if (virCapabilitiesAddGuestDomain(guest,
"xen",
NULL,
NULL,
0,
NULL) == NULL)
goto cleanup;
return caps;
cleanup:
virCapabilitiesFreeMachines(machines, nmachines);
virCapabilitiesFree(caps);
return NULL;
}