2008-01-29 18:15:54 +00:00
|
|
|
#include <config.h>
|
2007-12-07 10:08:06 +00:00
|
|
|
|
2006-09-21 09:15:33 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
2007-12-07 14:38:34 +00: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 13:56:22 +00:00
|
|
|
#include "libvirt/libvirt.h"
|
|
|
|
#include "libvirt/virterror.h"
|
2007-03-06 21:55:44 +00:00
|
|
|
#include "internal.h"
|
2006-11-09 10:14:01 +00:00
|
|
|
|
2007-03-06 21:55:44 +00:00
|
|
|
static void errorHandler(void *userData ATTRIBUTE_UNUSED,
|
|
|
|
virErrorPtr error ATTRIBUTE_UNUSED) {
|
2006-11-09 10:14:01 +00:00
|
|
|
}
|
2006-09-21 09:15:33 +00:00
|
|
|
|
|
|
|
int main(void) {
|
|
|
|
int id = 0;
|
2006-11-09 10:14:01 +00:00
|
|
|
int ro = 0;
|
2006-09-21 09:15:33 +00:00
|
|
|
virConnectPtr conn;
|
|
|
|
virDomainPtr dom;
|
|
|
|
|
2006-11-09 10:14:01 +00:00
|
|
|
virSetErrorFunc(NULL, errorHandler);
|
|
|
|
|
|
|
|
conn = virConnectOpen(NULL);
|
|
|
|
if (conn == NULL) {
|
|
|
|
ro = 1;
|
|
|
|
conn = virConnectOpenReadOnly(NULL);
|
|
|
|
}
|
2006-09-21 09:15:33 +00:00
|
|
|
if (conn == NULL) {
|
|
|
|
fprintf(stderr, "First virConnectOpen() failed\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
dom = virDomainLookupByID(conn, id);
|
|
|
|
if (dom == NULL) {
|
|
|
|
fprintf(stderr, "First lookup for domain %d failed\n", id);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
virDomainFree(dom);
|
|
|
|
virConnectClose(conn);
|
2006-11-09 10:14:01 +00:00
|
|
|
if (ro == 1)
|
|
|
|
conn = virConnectOpenReadOnly(NULL);
|
|
|
|
else
|
|
|
|
conn = virConnectOpen(NULL);
|
2006-09-21 09:15:33 +00:00
|
|
|
if (conn == NULL) {
|
|
|
|
fprintf(stderr, "Second virConnectOpen() failed\n");
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
dom = virDomainLookupByID(conn, id);
|
|
|
|
if (dom == NULL) {
|
|
|
|
fprintf(stderr, "Second lookup for domain %d failed\n", id);
|
|
|
|
exit(1);
|
|
|
|
}
|
|
|
|
virDomainFree(dom);
|
|
|
|
virConnectClose(conn);
|
|
|
|
printf("OK\n");
|
|
|
|
exit(0);
|
2008-02-05 19:27:37 +00:00
|
|
|
|
2006-09-21 09:15:33 +00:00
|
|
|
}
|
|
|
|
|