2008-01-30 02:15:54 +08:00
|
|
|
#include <config.h>
|
2007-11-26 20:03:34 +08:00
|
|
|
|
2006-08-24 23:05:19 +08:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <string.h>
|
2008-04-26 22:22:02 +08:00
|
|
|
#include <unistd.h>
|
2006-08-24 23:05:19 +08:00
|
|
|
|
Wed Dec 5 13:48:00 UTC 2007 Richard W.M. Jones <rjones@redhat.com>
* python/libvir.c, python/libvirt_wrap.h, qemud/qemud.c,
qemud/remote.c, src/internal.h, src/openvz_conf.c,
src/openvz_driver.c, src/proxy_internal.h, src/qemu_conf.c,
src/qemu_driver.c, src/remote_internal.h, src/test.h, src/util.c,
src/xen_unified.c, src/xen_unified.h, tests/nodeinfotest.c,
tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c, tests/reconnect.c,
tests/sexpr2xmltest.c, tests/virshtest.c, tests/xencapstest.c,
tests/xmconfigtest.c, tests/xml2sexprtest.c:
Change #include <> to #include "" for local includes.
Removed many includes from src/internal.h and put them in
the C files which actually use them.
Removed <ansidecl.h> - unused.
Added a comment around __func__.
Removed a clashing redefinition of VERSION symbol.
All limits (PATH_MAX etc) now done in src/internal.h, so we
don't need to include those headers in other files.
2007-12-05 21:56:22 +08:00
|
|
|
#include "internal.h"
|
2012-12-14 02:13:21 +08:00
|
|
|
#include "virxml.h"
|
2009-01-23 02:19:20 +08:00
|
|
|
#include "datatypes.h"
|
Move xen driver code into src/xen/ directory
* src/Makefile.am, src/proxy_internal.c, src/proxy_internal.h
src/sexpr.c, src/sexpr.h, src/xen_unified.c, src/xen_unified.h,
src/xen_internal.c, src/xen_internal.h, src/xen_inotify.c,
src/xen_inotify.h, src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h, src/xs_internal.c,
src/xs_internal.h: Move to src/xen/ directory
* proxy/Makefile.am, proxy/libvirt_proxy.c, src/Makefile.am,
src/libvirt.c, tests/sexpr2xmltest.c, tests/statstest.c,
tests/xencapstest.c, tests/xmconfigtest.c, tests/xml2sexprtest.c:
Adapt to changed xen location
* src/stats_linux.h, src/stats_linux.c: Remove xen specific block
stats APIs
* src/qemu_driver.c, src/uml_driver.c: Add missing sys/un.h include
uncovered after change to stats_linux.h
* src/xen/block_stats.h, src/xen/block_stats.c: Add xen specific
block stats APIs
2009-09-15 23:38:33 +08:00
|
|
|
#include "xen/xen_driver.h"
|
|
|
|
#include "xen/xend_internal.h"
|
2011-02-21 21:40:08 +08:00
|
|
|
#include "xenxs/xen_sxpr.h"
|
2006-08-24 23:05:19 +08:00
|
|
|
#include "testutils.h"
|
2009-01-23 02:19:20 +08:00
|
|
|
#include "testutilsxen.h"
|
2013-04-03 18:36:23 +08:00
|
|
|
#include "virstring.h"
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2013-06-07 23:10:28 +08:00
|
|
|
#define VIR_FROM_THIS VIR_FROM_NONE
|
|
|
|
|
2009-01-23 02:19:20 +08:00
|
|
|
static virCapsPtr caps;
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2011-04-25 06:25:10 +08:00
|
|
|
static int
|
|
|
|
testCompareFiles(const char *xml, const char *sexpr, int xendConfigVersion)
|
|
|
|
{
|
|
|
|
char *xmlData = NULL;
|
|
|
|
char *sexprData = NULL;
|
2006-08-24 23:05:19 +08:00
|
|
|
char *gotxml = NULL;
|
2011-02-21 21:40:08 +08:00
|
|
|
int id;
|
|
|
|
char * tty;
|
|
|
|
int vncport;
|
2006-10-06 23:32:48 +08:00
|
|
|
int ret = -1;
|
2008-07-25 18:49:33 +08:00
|
|
|
virDomainDefPtr def = NULL;
|
2009-01-23 02:19:20 +08:00
|
|
|
virConnectPtr conn;
|
|
|
|
struct _xenUnifiedPrivate priv;
|
|
|
|
|
|
|
|
|
|
|
|
conn = virGetConnect();
|
|
|
|
if (!conn) goto fail;
|
2007-11-14 18:35:58 +08:00
|
|
|
|
2011-04-25 06:25:10 +08:00
|
|
|
if (virtTestLoadFile(xml, &xmlData) < 0)
|
2008-04-26 22:22:02 +08:00
|
|
|
goto fail;
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2011-04-25 06:25:10 +08:00
|
|
|
if (virtTestLoadFile(sexpr, &sexprData) < 0)
|
2008-07-25 18:49:33 +08:00
|
|
|
goto fail;
|
|
|
|
|
2012-03-29 17:52:04 +08:00
|
|
|
memset(&priv, 0, sizeof(priv));
|
2009-01-23 02:19:20 +08:00
|
|
|
/* Many puppies died to bring you this code. */
|
|
|
|
priv.xendConfigVersion = xendConfigVersion;
|
|
|
|
priv.caps = caps;
|
|
|
|
conn->privateData = &priv;
|
|
|
|
if (virMutexInit(&priv.lock) < 0)
|
|
|
|
goto fail;
|
|
|
|
|
2013-09-25 16:31:30 +08:00
|
|
|
if (xenGetDomIdFromSxprString(sexprData, xendConfigVersion, &id) < 0)
|
|
|
|
goto fail;
|
2011-02-21 21:40:08 +08:00
|
|
|
xenUnifiedLock(&priv);
|
|
|
|
tty = xenStoreDomainGetConsolePath(conn, id);
|
|
|
|
vncport = xenStoreDomainGetVNCPort(conn, id);
|
|
|
|
xenUnifiedUnlock(&priv);
|
|
|
|
|
2011-02-21 21:40:12 +08:00
|
|
|
if (!(def = xenParseSxprString(sexprData, xendConfigVersion, tty, vncport)))
|
2008-04-26 22:22:02 +08:00
|
|
|
goto fail;
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2014-01-11 01:18:03 +08:00
|
|
|
if (!virDomainDefCheckABIStability(def, def)) {
|
|
|
|
fprintf(stderr, "ABI stability check failed on %s", xml);
|
|
|
|
goto fail;
|
|
|
|
}
|
|
|
|
|
2010-02-10 02:58:01 +08:00
|
|
|
if (!(gotxml = virDomainDefFormat(def, 0)))
|
2008-07-25 18:49:33 +08:00
|
|
|
goto fail;
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2008-04-26 22:22:02 +08:00
|
|
|
if (STRNEQ(xmlData, gotxml)) {
|
|
|
|
virtTestDifference(stderr, xmlData, gotxml);
|
|
|
|
goto fail;
|
2007-07-17 05:30:30 +08:00
|
|
|
}
|
2006-08-24 23:05:19 +08:00
|
|
|
|
2006-10-06 23:32:48 +08:00
|
|
|
ret = 0;
|
|
|
|
|
|
|
|
fail:
|
2012-02-03 07:16:43 +08:00
|
|
|
VIR_FREE(xmlData);
|
|
|
|
VIR_FREE(sexprData);
|
|
|
|
VIR_FREE(gotxml);
|
2008-07-25 18:49:33 +08:00
|
|
|
virDomainDefFree(def);
|
Convert public datatypes to inherit from virObject
This converts the following public API datatypes to use the
virObject infrastructure:
virConnectPtr
virDomainPtr
virDomainSnapshotPtr
virInterfacePtr
virNetworkPtr
virNodeDevicePtr
virNWFilterPtr
virSecretPtr
virStreamPtr
virStorageVolPtr
virStoragePoolPtr
The code is significantly simplified, since the mutex in the
virConnectPtr object now only needs to be held when accessing
the per-connection virError object instance. All other operations
are completely lock free.
* src/datatypes.c, src/datatypes.h, src/libvirt.c: Convert
public datatypes to use virObject
* src/conf/domain_event.c, src/phyp/phyp_driver.c,
src/qemu/qemu_command.c, src/qemu/qemu_migration.c,
src/qemu/qemu_process.c, src/storage/storage_driver.c,
src/vbox/vbox_tmpl.c, src/xen/xend_internal.c,
tests/qemuxml2argvtest.c, tests/qemuxmlnstest.c,
tests/sexpr2xmltest.c, tests/xmconfigtest.c: Convert
to use virObjectUnref/virObjectRef
Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
2012-08-01 00:55:36 +08:00
|
|
|
virObjectUnref(conn);
|
2006-10-06 23:32:48 +08:00
|
|
|
|
|
|
|
return ret;
|
2006-08-24 23:05:19 +08:00
|
|
|
}
|
|
|
|
|
2008-04-26 22:22:02 +08:00
|
|
|
struct testInfo {
|
|
|
|
const char *input;
|
|
|
|
const char *output;
|
|
|
|
int version;
|
|
|
|
};
|
2007-07-19 05:08:22 +08:00
|
|
|
|
2011-04-25 06:25:10 +08:00
|
|
|
static int
|
|
|
|
testCompareHelper(const void *data)
|
|
|
|
{
|
|
|
|
int result = -1;
|
2008-04-26 22:22:02 +08:00
|
|
|
const struct testInfo *info = data;
|
2011-04-25 06:25:10 +08:00
|
|
|
char *xml = NULL;
|
|
|
|
char *args = NULL;
|
|
|
|
|
|
|
|
if (virAsprintf(&xml, "%s/sexpr2xmldata/sexpr2xml-%s.xml",
|
|
|
|
abs_srcdir, info->input) < 0 ||
|
|
|
|
virAsprintf(&args, "%s/sexpr2xmldata/sexpr2xml-%s.sexpr",
|
|
|
|
abs_srcdir, info->output) < 0) {
|
|
|
|
goto cleanup;
|
|
|
|
}
|
|
|
|
|
|
|
|
result = testCompareFiles(xml, args, info->version);
|
2008-02-06 00:21:25 +08:00
|
|
|
|
2014-03-25 14:53:44 +08:00
|
|
|
cleanup:
|
2012-02-03 07:16:43 +08:00
|
|
|
VIR_FREE(xml);
|
|
|
|
VIR_FREE(args);
|
2011-04-25 06:25:10 +08:00
|
|
|
|
|
|
|
return result;
|
|
|
|
}
|
2007-07-17 05:30:30 +08:00
|
|
|
|
2008-05-29 23:31:49 +08:00
|
|
|
static int
|
2011-04-30 00:21:20 +08:00
|
|
|
mymain(void)
|
2006-08-24 23:05:19 +08:00
|
|
|
{
|
|
|
|
int ret = 0;
|
2007-11-14 18:35:58 +08:00
|
|
|
|
2009-01-23 02:19:20 +08:00
|
|
|
if (!(caps = testXenCapsInit()))
|
2012-03-22 19:33:35 +08:00
|
|
|
return EXIT_FAILURE;
|
2009-01-23 02:19:20 +08:00
|
|
|
|
2008-04-26 22:22:02 +08:00
|
|
|
#define DO_TEST(in, out, version) \
|
|
|
|
do { \
|
|
|
|
struct testInfo info = { in, out, version }; \
|
2009-04-01 18:31:01 +08:00
|
|
|
virResetLastError(); \
|
2008-04-26 22:22:02 +08:00
|
|
|
if (virtTestRun("Xen SEXPR-2-XML " in " -> " out, \
|
2013-09-21 02:13:35 +08:00
|
|
|
testCompareHelper, &info) < 0) \
|
2008-04-26 22:22:02 +08:00
|
|
|
ret = -1; \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
DO_TEST("pv", "pv", 1);
|
|
|
|
DO_TEST("fv", "fv", 1);
|
|
|
|
DO_TEST("pv", "pv", 2);
|
|
|
|
DO_TEST("fv-v2", "fv-v2", 2);
|
|
|
|
DO_TEST("pv-vfb-orig", "pv-vfb-orig", 2);
|
|
|
|
DO_TEST("pv-vfb-new", "pv-vfb-new", 3);
|
2008-09-09 21:53:58 +08:00
|
|
|
DO_TEST("pv-vfb-new-vncdisplay", "pv-vfb-new-vncdisplay", 3);
|
2009-08-19 05:10:41 +08:00
|
|
|
DO_TEST("pv-vfb-type-crash", "pv-vfb-type-crash", 3);
|
2009-01-30 01:02:00 +08:00
|
|
|
DO_TEST("fv-autoport", "fv-autoport", 3);
|
2008-04-26 22:22:02 +08:00
|
|
|
DO_TEST("pv-bootloader", "pv-bootloader", 1);
|
2011-07-07 09:17:16 +08:00
|
|
|
DO_TEST("pv-bootloader-cmdline", "pv-bootloader-cmdline", 1);
|
2010-10-05 22:18:52 +08:00
|
|
|
DO_TEST("pv-vcpus", "pv-vcpus", 1);
|
2008-04-26 22:22:02 +08:00
|
|
|
|
|
|
|
DO_TEST("disk-file", "disk-file", 2);
|
|
|
|
DO_TEST("disk-block", "disk-block", 2);
|
|
|
|
DO_TEST("disk-block-shareable", "disk-block-shareable", 2);
|
|
|
|
DO_TEST("disk-drv-blktap-raw", "disk-drv-blktap-raw", 2);
|
|
|
|
DO_TEST("disk-drv-blktap-qcow", "disk-drv-blktap-qcow", 2);
|
2010-08-25 05:49:00 +08:00
|
|
|
DO_TEST("disk-drv-blktap2-raw", "disk-drv-blktap2-raw", 2);
|
2008-04-26 22:22:02 +08:00
|
|
|
|
2008-05-08 22:41:56 +08:00
|
|
|
DO_TEST("curmem", "curmem", 2);
|
2008-04-26 22:22:02 +08:00
|
|
|
DO_TEST("net-routed", "net-routed", 2);
|
|
|
|
DO_TEST("net-bridged", "net-bridged", 2);
|
2008-04-30 20:30:55 +08:00
|
|
|
DO_TEST("net-e1000", "net-e1000", 2);
|
2009-01-23 09:48:47 +08:00
|
|
|
DO_TEST("bridge-ipaddr", "bridge-ipaddr", 3);
|
2008-05-08 22:41:56 +08:00
|
|
|
DO_TEST("no-source-cdrom", "no-source-cdrom", 2);
|
2009-04-01 18:36:52 +08:00
|
|
|
DO_TEST("pv-localtime", "pv-localtime", 2);
|
2009-04-03 20:38:52 +08:00
|
|
|
DO_TEST("pci-devs", "pci-devs", 2);
|
2008-04-26 22:22:02 +08:00
|
|
|
|
|
|
|
DO_TEST("fv-utc", "fv-utc", 1);
|
|
|
|
DO_TEST("fv-localtime", "fv-localtime", 1);
|
|
|
|
DO_TEST("fv-usbmouse", "fv-usbmouse", 1);
|
2008-07-25 18:49:33 +08:00
|
|
|
DO_TEST("fv-usbtablet", "fv-usbtablet", 1);
|
2008-04-26 22:22:02 +08:00
|
|
|
DO_TEST("fv-kernel", "fv-kernel", 1);
|
2011-05-10 19:24:14 +08:00
|
|
|
DO_TEST("fv-force-hpet", "fv-force-hpet", 1);
|
|
|
|
DO_TEST("fv-force-nohpet", "fv-force-nohpet", 1);
|
2008-04-26 22:22:02 +08:00
|
|
|
|
|
|
|
DO_TEST("fv-serial-null", "fv-serial-null", 1);
|
|
|
|
DO_TEST("fv-serial-file", "fv-serial-file", 1);
|
2011-02-25 22:41:12 +08:00
|
|
|
DO_TEST("fv-serial-dev-2-ports", "fv-serial-dev-2-ports", 1);
|
|
|
|
DO_TEST("fv-serial-dev-2nd-port", "fv-serial-dev-2nd-port", 1);
|
2008-04-26 22:22:02 +08:00
|
|
|
DO_TEST("fv-serial-stdio", "fv-serial-stdio", 1);
|
|
|
|
DO_TEST("fv-serial-pty", "fv-serial-pty", 1);
|
|
|
|
DO_TEST("fv-serial-pipe", "fv-serial-pipe", 1);
|
|
|
|
DO_TEST("fv-serial-tcp", "fv-serial-tcp", 1);
|
|
|
|
DO_TEST("fv-serial-udp", "fv-serial-udp", 1);
|
|
|
|
DO_TEST("fv-serial-tcp-telnet", "fv-serial-tcp-telnet", 1);
|
|
|
|
DO_TEST("fv-serial-unix", "fv-serial-unix", 1);
|
|
|
|
DO_TEST("fv-parallel-tcp", "fv-parallel-tcp", 1);
|
2008-02-06 00:21:25 +08:00
|
|
|
|
2008-05-07 22:04:40 +08:00
|
|
|
DO_TEST("fv-sound", "fv-sound", 1);
|
|
|
|
DO_TEST("fv-sound-all", "fv-sound-all", 1);
|
|
|
|
|
2009-12-05 00:01:34 +08:00
|
|
|
DO_TEST("fv-net-ioemu", "fv-net-ioemu", 1);
|
|
|
|
DO_TEST("fv-net-netfront", "fv-net-netfront", 1);
|
|
|
|
|
2011-10-11 00:22:44 +08:00
|
|
|
DO_TEST("fv-empty-kernel", "fv-empty-kernel", 1);
|
|
|
|
|
2010-08-23 21:00:22 +08:00
|
|
|
DO_TEST("boot-grub", "boot-grub", 1);
|
|
|
|
|
2013-02-01 20:26:18 +08:00
|
|
|
virObjectUnref(caps);
|
2009-04-01 18:31:01 +08:00
|
|
|
|
2014-03-17 17:38:38 +08:00
|
|
|
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
|
2006-08-24 23:05:19 +08:00
|
|
|
}
|
2008-05-29 23:31:49 +08:00
|
|
|
|
|
|
|
VIRT_TEST_MAIN(mymain)
|