Devel
Threads by month
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
January 2009
- 51 participants
- 192 discussions
This should be applied to libvirt-0.4.0. It is a bit old one, sorry, but
this patch is just hooking around. So I think I can merge it to latest
libvirt with a little effort.
Please note that uid is essential for access control and the uid is
available only in a local machine. For this reason, our access control
takes effect only in a local machine by virsh. This means that
remotely connecting to libvirtd is currently out of scope.
diff -r d5dbadfb6161 -r 62d2ebb8d23b configure
--- a/configure Wed Apr 02 13:13:06 2008 +0900
+++ b/configure Tue Jan 27 03:13:46 2009 +0900
@@ -35181,7 +35181,12 @@
sysconfdir='/etc'
fi
-
+# Check whether --with-rbac was given.
+if test "${with_rbac+set}" = set; then
+ withval=$with_rbac;
+else
+ with_rbac=no
+fi
# Check whether --with-xen was given.
if test "${with_xen+set}" = set; then
@@ -39753,6 +39758,9 @@
test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
DEFS=-DHAVE_CONFIG_H
+if test "$with_rbac" = "yes" ; then
+ DEFS="$DEFS -DRBAC"
+fi
ac_libobjs=
ac_ltlibobjs=
@@ -41743,6 +41751,9 @@
{ echo "$as_me:$LINENO: polkit: no" >&5
echo "$as_me: polkit: no" >&6;}
fi
+{ echo "$as_me:$LINENO: RBAC: $with_rbac" >&5
+echo "$as_me: RBAC: $with_rbac" >&6;}
+
{ echo "$as_me:$LINENO: " >&5
echo "$as_me: " >&6;}
{ echo "$as_me:$LINENO: Miscellaneous" >&5
diff -r d5dbadfb6161 -r 62d2ebb8d23b include/libvirt/libvirt.h
--- a/include/libvirt/libvirt.h Wed Apr 02 13:13:06 2008 +0900
+++ b/include/libvirt/libvirt.h Tue Jan 27 03:13:46 2009 +0900
@@ -514,6 +514,11 @@
char * virDomainGetXMLDesc (virDomainPtr domain,
int flags);
+#ifdef RBAC
+char * virDomainGetXMLDesc_XRBAC (int op_id,
+ virDomainPtr domain,
+ int flags);
+#endif
int virDomainBlockStats (virDomainPtr dom,
const char *path,
virDomainBlockStatsPtr stats,
@@ -697,6 +702,11 @@
char **const names,
int maxnames);
+#ifdef RBAC
+int virConnectListNetworks_QEMUD (virConnectPtr conn,
+ char **const names,
+ int maxnames);
+#endif
/*
* List inactive networks
*/
@@ -705,6 +715,11 @@
char **const names,
int maxnames);
+#ifdef RBAC
+int virConnectListDefinedNetworks_QEMUD (virConnectPtr conn,
+ char **const names,
+ int maxnames);
+#endif
/*
* Lookup network by name or uuid
*/
@@ -721,26 +736,43 @@
virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char *xmlDesc);
+#ifdef RBAC
+virNetworkPtr virNetworkCreateXML_QEMUD (virConnectPtr conn,
+ const char *xmlDesc);
+#endif
/*
* Define inactive persistent network
*/
virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char *xmlDesc);
+#ifdef RBAC
+virNetworkPtr virNetworkDefineXML_QEMUD (virConnectPtr conn,
+ const char *xml);
+#endif
/*
* Delete persistent network
*/
int virNetworkUndefine (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkUndefine_QEMUD (virNetworkPtr network);
+#endif
/*
* Activate persistent network
*/
int virNetworkCreate (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkCreate_QEMUD (virNetworkPtr network);
+#endif
/*
* Network destroy/free
*/
int virNetworkDestroy (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkDestroy_QEMUD (virNetworkPtr network);
+#endif
int virNetworkFree (virNetworkPtr network);
/*
@@ -753,12 +785,20 @@
char *buf);
char * virNetworkGetXMLDesc (virNetworkPtr network,
int flags);
+#ifdef RBAC
+char * virNetworkGetXMLDesc_QEMUD (virNetworkPtr network,
+ int flags);
+#endif
char * virNetworkGetBridgeName (virNetworkPtr network);
int virNetworkGetAutostart (virNetworkPtr network,
int *autostart);
int virNetworkSetAutostart (virNetworkPtr network,
int autostart);
+#ifdef RBAC
+int virNetworkSetAutostart_QEMUD (virNetworkPtr network,
+ int autostart);
+#endif
#ifdef __cplusplus
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b include/libvirt/libvirt.h.in
--- a/include/libvirt/libvirt.h.in Wed Apr 02 13:13:06 2008 +0900
+++ b/include/libvirt/libvirt.h.in Tue Jan 27 03:13:46 2009 +0900
@@ -514,6 +514,11 @@
char * virDomainGetXMLDesc (virDomainPtr domain,
int flags);
+#ifdef RBAC
+char * virDomainGetXMLDesc_XRBAC (int op_id,
+ virDomainPtr domain,
+ int flags);
+#endif
int virDomainBlockStats (virDomainPtr dom,
const char *path,
virDomainBlockStatsPtr stats,
@@ -697,6 +702,11 @@
char **const names,
int maxnames);
+#ifdef RBAC
+int virConnectListNetworks_QEMUD (virConnectPtr conn,
+ char **const names,
+ int maxnames);
+#endif
/*
* List inactive networks
*/
@@ -705,6 +715,11 @@
char **const names,
int maxnames);
+#ifdef RBAC
+int virConnectListDefinedNetworks_QEMUD (virConnectPtr conn,
+ char **const names,
+ int maxnames);
+#endif
/*
* Lookup network by name or uuid
*/
@@ -721,26 +736,43 @@
virNetworkPtr virNetworkCreateXML (virConnectPtr conn,
const char *xmlDesc);
+#ifdef RBAC
+virNetworkPtr virNetworkCreateXML_QEMUD (virConnectPtr conn,
+ const char *xmlDesc);
+#endif
/*
* Define inactive persistent network
*/
virNetworkPtr virNetworkDefineXML (virConnectPtr conn,
const char *xmlDesc);
+#ifdef RBAC
+virNetworkPtr virNetworkDefineXML_QEMUD (virConnectPtr conn,
+ const char *xml);
+#endif
/*
* Delete persistent network
*/
int virNetworkUndefine (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkUndefine_QEMUD (virNetworkPtr network);
+#endif
/*
* Activate persistent network
*/
int virNetworkCreate (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkCreate_QEMUD (virNetworkPtr network);
+#endif
/*
* Network destroy/free
*/
int virNetworkDestroy (virNetworkPtr network);
+#ifdef RBAC
+int virNetworkDestroy_QEMUD (virNetworkPtr network);
+#endif
int virNetworkFree (virNetworkPtr network);
/*
@@ -753,12 +785,20 @@
char *buf);
char * virNetworkGetXMLDesc (virNetworkPtr network,
int flags);
+#ifdef RBAC
+char * virNetworkGetXMLDesc_QEMUD (virNetworkPtr network,
+ int flags);
+#endif
char * virNetworkGetBridgeName (virNetworkPtr network);
int virNetworkGetAutostart (virNetworkPtr network,
int *autostart);
int virNetworkSetAutostart (virNetworkPtr network,
int autostart);
+#ifdef RBAC
+int virNetworkSetAutostart_QEMUD (virNetworkPtr network,
+ int autostart);
+#endif
#ifdef __cplusplus
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b include/libvirt/virterror.h
--- a/include/libvirt/virterror.h Wed Apr 02 13:13:06 2008 +0900
+++ b/include/libvirt/virterror.h Tue Jan 27 03:13:46 2009 +0900
@@ -54,6 +54,9 @@
VIR_FROM_OPENVZ, /* Error from OpenVZ driver */
VIR_FROM_XENXM, /* Error at Xen XM layer */
VIR_FROM_STATS_LINUX, /* Error in the Linux Stats code */
+#ifdef RBAC
+ VIR_FROM_XENRBAC, /* Error form Xen RBAC */
+#endif
} virErrorDomain;
@@ -132,6 +135,9 @@
VIR_ERR_NO_NETWORK, /* network not found */
VIR_ERR_INVALID_MAC, /* invalid MAC adress */
VIR_ERR_AUTH_FAILED, /* authentication failed */
+#ifdef RBAC
+ VIR_ERR_PERMISSION, /* operation not permitted */
+#endif
} virErrorNumber;
/**
diff -r d5dbadfb6161 -r 62d2ebb8d23b libvirt.pc
--- a/libvirt.pc Wed Apr 02 13:13:06 2008 +0900
+++ b/libvirt.pc Tue Jan 27 03:13:46 2009 +0900
@@ -1,4 +1,4 @@
-prefix=/usr
+prefix=/usr/local
exec_prefix=${prefix}
libdir=${exec_prefix}/lib
includedir=${prefix}/include
diff -r d5dbadfb6161 -r 62d2ebb8d23b libvirt.spec
--- a/libvirt.spec Wed Apr 02 13:13:06 2008 +0900
+++ b/libvirt.spec Tue Jan 27 03:13:46 2009 +0900
@@ -1,17 +1,14 @@
# -*- rpm-spec -*-
-%if "%{fedora}" >= "8"
-%define with_polkit 1
-%define with_proxy no
-%else
+# For Xen RBAC 20080910
%define with_polkit 0
%define with_proxy yes
-%endif
+%define with_rbac yes
Summary: Library providing a simple API virtualization
Name: libvirt
Version: 0.4.0
-Release: 1
+Release: 1%{?dist}
License: LGPL
Group: Development/Libraries
Source: libvirt-%{version}.tar.gz
@@ -35,6 +32,7 @@
Requires: PolicyKit >= 0.6
%endif
BuildRequires: xen-devel
+BuildRequires: libxenrbac >= 2.0.0
BuildRequires: libxml2-devel
BuildRequires: readline-devel
BuildRequires: ncurses-devel
@@ -85,7 +83,8 @@
%configure --with-init-script=redhat \
--with-qemud-pid-file=%{_localstatedir}/run/libvirt_qemud.pid \
--with-remote-file=%{_localstatedir}/run/libvirtd.pid \
- --with-xen-proxy=%{with_proxy}
+ --with-xen-proxy=%{with_proxy} \
+ --with-rbac=%{with_rbac}
make
%install
diff -r d5dbadfb6161 -r 62d2ebb8d23b libvirt.spec.in
--- a/libvirt.spec.in Wed Apr 02 13:13:06 2008 +0900
+++ b/libvirt.spec.in Tue Jan 27 03:13:46 2009 +0900
@@ -1,17 +1,14 @@
# -*- rpm-spec -*-
-%if "%{fedora}" >= "8"
-%define with_polkit 1
-%define with_proxy no
-%else
+# For Xen RBAC 20080910
%define with_polkit 0
%define with_proxy yes
-%endif
+%define with_rbac yes
Summary: Library providing a simple API virtualization
Name: libvirt
Version: @VERSION@
-Release: 1
+Release: 1%{?dist}
License: LGPL
Group: Development/Libraries
Source: libvirt-%{version}.tar.gz
@@ -35,6 +32,7 @@
Requires: PolicyKit >= 0.6
%endif
BuildRequires: xen-devel
+BuildRequires: libxenrbac >= 2.0.0
BuildRequires: libxml2-devel
BuildRequires: readline-devel
BuildRequires: ncurses-devel
@@ -85,7 +83,8 @@
%configure --with-init-script=redhat \
--with-qemud-pid-file=%{_localstatedir}/run/libvirt_qemud.pid \
--with-remote-file=%{_localstatedir}/run/libvirtd.pid \
- --with-xen-proxy=%{with_proxy}
+ --with-xen-proxy=%{with_proxy} \
+ --with-rbac=%{with_rbac}
make
%install
diff -r d5dbadfb6161 -r 62d2ebb8d23b proxy/libvirt_proxy.c
--- a/proxy/libvirt_proxy.c Wed Apr 02 13:13:06 2008 +0900
+++ b/proxy/libvirt_proxy.c Tue Jan 27 03:13:46 2009 +0900
@@ -363,6 +363,9 @@
virProxyPacketPtr req = (virProxyPacketPtr) &request;
int ret;
char *xml, *ostype;
+#ifdef RBAC
+ char *sched_type;
+#endif /* RBAC */
retry:
ret = read(pollInfos[nr].fd, req, sizeof(virProxyPacket));
@@ -662,6 +665,28 @@
free(ostype);
}
break;
+#ifdef RBAC
+ case VIR_PROXY_GET_SCHEDTYPE:
+ if (req->len != sizeof(virProxyPacket))
+ goto comm_error;
+ sched_type = xenHypervisorGetSchedType(conn, &request.extra.arg[0]);
+ if (!sched_type) {
+ req->data.arg = -1;
+ req->len = sizeof (virProxyPacket);
+ } else {
+ int type_len = strlen(sched_type);
+ if (type_len > (int) sizeof (request.extra.str)) {
+ req->data.arg = -2;
+ req->len = sizeof (virProxyPacket);
+ } else {
+ req->data.arg = 0;
+ memmove (&request.extra.str[4], sched_type, type_len);
+ req->len = sizeof (virProxyPacket) + sizeof(int) + type_len;
+ }
+ free (sched_type);
+ }
+ break;
+#endif /* RBAC */
default:
goto comm_error;
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b qemud/qemud.c
--- a/qemud/qemud.c Wed Apr 02 13:13:06 2008 +0900
+++ b/qemud/qemud.c Tue Jan 27 03:13:46 2009 +0900
@@ -73,7 +73,11 @@
static char *tcp_port = (char *) LIBVIRTD_TCP_PORT;
static gid_t unix_sock_gid = 0; /* Only root by default */
+#ifdef RBAC
+static int unix_sock_rw_mask = 0777; /* Allow world */
+#else
static int unix_sock_rw_mask = 0700; /* Allow user only */
+#endif
static int unix_sock_ro_mask = 0777; /* Allow world */
#if HAVE_POLKIT
diff -r d5dbadfb6161 -r 62d2ebb8d23b qemud/remote.c
--- a/qemud/remote.c Wed Apr 02 13:13:06 2008 +0900
+++ b/qemud/remote.c Tue Jan 27 03:13:46 2009 +0900
@@ -1705,9 +1705,15 @@
/* Allocate return buffer. */
ret->names.names_val = calloc (args->maxnames, sizeof (*(ret->names.names_val)));
+#ifdef RBAC
+ ret->names.names_len =
+ virConnectListDefinedNetworks_QEMUD (client->conn,
+ ret->names.names_val, args->maxnames);
+#else
ret->names.names_len =
virConnectListDefinedNetworks (client->conn,
ret->names.names_val, args->maxnames);
+#endif
if (ret->names.names_len == -1) return -1;
return 0;
@@ -1756,9 +1762,15 @@
/* Allocate return buffer. */
ret->names.names_val = calloc (args->maxnames, sizeof (*(ret->names.names_val)));
+#ifdef RBAC
+ ret->names.names_len =
+ virConnectListNetworks_QEMUD (client->conn,
+ ret->names.names_val, args->maxnames);
+#else
ret->names.names_len =
virConnectListNetworks (client->conn,
ret->names.names_val, args->maxnames);
+#endif
if (ret->names.names_len == -1) return -1;
return 0;
@@ -1780,10 +1792,17 @@
return -2;
}
+#ifdef RBAC
+ if (virNetworkCreate_QEMUD (net) == -1) {
+ virNetworkFree(net);
+ return -1;
+ }
+#else
if (virNetworkCreate (net) == -1) {
virNetworkFree(net);
return -1;
}
+#endif
virNetworkFree(net);
return 0;
}
@@ -1798,7 +1817,11 @@
virNetworkPtr net;
CHECK_CONN(client);
+#ifdef RBAC
+ net = virNetworkCreateXML_QEMUD (client->conn, args->xml);
+#else
net = virNetworkCreateXML (client->conn, args->xml);
+#endif
if (net == NULL) return -1;
make_nonnull_network (&ret->net, net);
@@ -1816,7 +1839,11 @@
virNetworkPtr net;
CHECK_CONN(client);
+#ifdef RBAC
+ net = virNetworkDefineXML_QEMUD (client->conn, args->xml);
+#else
net = virNetworkDefineXML (client->conn, args->xml);
+#endif
if (net == NULL) return -1;
make_nonnull_network (&ret->net, net);
@@ -1840,10 +1867,17 @@
return -2;
}
+#ifdef RBAC
+ if (virNetworkDestroy_QEMUD (net) == -1) {
+ virNetworkFree(net);
+ return -1;
+ }
+#else
if (virNetworkDestroy (net) == -1) {
virNetworkFree(net);
return -1;
}
+#endif
virNetworkFree(net);
return 0;
}
@@ -1865,7 +1899,11 @@
}
/* remoteDispatchClientRequest will free this. */
+#ifdef RBAC
+ ret->xml = virNetworkGetXMLDesc_QEMUD (net, args->flags);
+#else
ret->xml = virNetworkGetXMLDesc (net, args->flags);
+#endif
if (!ret->xml) {
virNetworkFree(net);
return -1;
@@ -1976,10 +2014,17 @@
return -2;
}
+#ifdef RBAC
+ if (virNetworkSetAutostart_QEMUD (net, args->autostart) == -1) {
+ virNetworkFree(net);
+ return -1;
+ }
+#else
if (virNetworkSetAutostart (net, args->autostart) == -1) {
virNetworkFree(net);
return -1;
}
+#endif
virNetworkFree(net);
return 0;
}
@@ -2000,10 +2045,17 @@
return -2;
}
+#ifdef RBAC
+ if (virNetworkUndefine_QEMUD (net) == -1) {
+ virNetworkFree(net);
+ return -1;
+ }
+#else
if (virNetworkUndefine (net) == -1) {
virNetworkFree(net);
return -1;
}
+#endif
virNetworkFree(net);
return 0;
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/Makefile.in
--- a/src/Makefile.in Wed Apr 02 13:13:06 2008 +0900
+++ b/src/Makefile.in Tue Jan 27 03:13:46 2009 +0900
@@ -122,7 +122,8 @@
libvirt_la-iptables.lo libvirt_la-uuid.lo \
libvirt_la-qemu_driver.lo libvirt_la-qemu_conf.lo \
libvirt_la-openvz_conf.lo libvirt_la-openvz_driver.lo \
- libvirt_la-nodeinfo.lo libvirt_la-util.lo
+ libvirt_la-nodeinfo.lo libvirt_la-util.lo \
+ libvirt_la-xenrbac_libvirt.lo
am__objects_2 = libvirt_la-remote_protocol.lo
am_libvirt_la_OBJECTS = $(am__objects_1) $(am__objects_2)
libvirt_la_OBJECTS = $(am_libvirt_la_OBJECTS)
@@ -359,6 +360,7 @@
LIBVIRT_VERSION_NUMBER = @LIBVIRT_VERSION_NUMBER@
LIBXML_CFLAGS = @LIBXML_CFLAGS@
LIBXML_LIBS = @LIBXML_LIBS@
+LIBXENRBAC = -lxenrbac
LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
@@ -569,7 +571,8 @@
openvz_conf.c openvz_conf.h \
openvz_driver.c openvz_driver.h \
nodeinfo.h nodeinfo.c \
- util.c util.h
+ util.c util.h \
+ xenrbac_libvirt.c xenrbac_libvirt.h
SERVER_SOURCES = \
../qemud/remote_protocol.c ../qemud/remote_protocol.h
@@ -652,7 +655,7 @@
rm -f "$${dir}/so_locations"; \
done
libvirt.la: $(libvirt_la_OBJECTS) $(libvirt_la_DEPENDENCIES)
- $(libvirt_la_LINK) -rpath $(libdir) $(libvirt_la_OBJECTS) $(libvirt_la_LIBADD) $(LIBS)
+ $(libvirt_la_LINK) -rpath $(libdir) $(libvirt_la_OBJECTS) $(libvirt_la_LIBADD) $(LIBS) $(LIBXENRBAC)
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)"
@@ -683,7 +686,7 @@
done
virsh$(EXEEXT): $(virsh_OBJECTS) $(virsh_DEPENDENCIES)
@rm -f virsh$(EXEEXT)
- $(virsh_LINK) $(virsh_OBJECTS) $(virsh_LDADD) $(LIBS)
+ $(virsh_LINK) $(virsh_OBJECTS) $(virsh_LDADD) $(LIBS) $(LIBXENRBAC)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
@@ -719,6 +722,8 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_la-xm_internal.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_la-xml.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_la-xs_internal.Plo@am__quote@
+#RBAC
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libvirt_la-xenrbac_libvirt.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virsh-console.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virsh-virsh.Po@am__quote@
@@ -813,6 +818,13 @@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_la_CFLAGS) $(CFLAGS) -c -o libvirt_la-xs_internal.lo `test -f 'xs_internal.c' || echo '$(srcdir)/'`xs_internal.c
+libvirt_la-xenrbac_libvirt.lo: xenrbac_libvirt.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_la_CFLAGS) $(CFLAGS) -MT libvirt_la-xenrbac_libvirt.lo -MD -MP -MF $(DEPDIR)/libvirt_la-xenrbac_libvirt.Tpo -c -o libvirt_la-xenrbac_libvirt.lo `test -f 'xenrbac_libvirt.c' || echo '$(srcdir)/'`xenrbac_libvirt.c
+@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libvirt_la-xenrbac_libvirt.Tpo $(DEPDIR)/libvirt_la-xenrbac_libvirt.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xenrbac_libvirt.c' object='libvirt_la-xenrbac_libvirt.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_la_CFLAGS) $(CFLAGS) -c -o libvirt_la-xenrbac_libvirt.lo `test -f 'xenrbac_libvirt.c' || echo '$(srcdir)/'`xenrbac_libvirt.c
+
libvirt_la-xend_internal.lo: xend_internal.c
@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libvirt_la_CFLAGS) $(CFLAGS) -MT libvirt_la-xend_internal.lo -MD -MP -MF $(DEPDIR)/libvirt_la-xend_internal.Tpo -c -o libvirt_la-xend_internal.lo `test -f 'xend_internal.c' || echo '$(srcdir)/'`xend_internal.c
@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libvirt_la-xend_internal.Tpo $(DEPDIR)/libvirt_la-xend_internal.Plo
@@ -1181,7 +1193,7 @@
# target to ease building test programs
#
tst: tst.c
- $(CC) $(CFLAGS) $(INCLUDES) -I../include -o tst tst.c .libs/libvirt.a $(LIBXML_LIBS) $(VIRSH_LIBS) $(GNUTLS_LIBS) $(LIBS)
+ $(CC) $(CFLAGS) $(INCLUDES) -I../include -o tst tst.c .libs/libvirt.a $(LIBXML_LIBS) $(VIRSH_LIBS) $(GNUTLS_LIBS) $(LIBS) $(LIBXENRBAC)
cov: clean-cov $(COVERAGE_FILES)
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/libvirt.c
--- a/src/libvirt.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/libvirt.c Tue Jan 27 03:13:46 2009 +0900
@@ -40,6 +40,9 @@
#ifdef WITH_OPENVZ
#include "openvz_driver.h"
#endif
+#ifdef RBAC
+#include "xenrbac_libvirt.h"
+#endif
/*
* TODO:
@@ -481,6 +484,11 @@
if (libVer == NULL)
return (-1);
+
+#ifdef RBAC
+ if(xenRBACdomain( XR_VERSION, NULL, NULL) == -1)
+ return (-1);
+#endif
*libVer = LIBVIR_VERSION_NUMBER;
if (typeVer != NULL) {
@@ -815,6 +823,10 @@
return NULL;
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_HOSTNAME, NULL, conn) == -1)
+ return NULL;
+#endif
if (conn->driver->getHostname)
return conn->driver->getHostname (conn);
@@ -849,6 +861,10 @@
return NULL;
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_HYPERVISER_URI, NULL, conn) == -1)
+ return NULL;
+#endif
/* Drivers may override getURI, but if they don't then
* we provide a default implementation.
*/
@@ -917,6 +933,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_LIST_VM, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->listDomains)
return conn->driver->listDomains (conn, ids, maxids);
@@ -1006,6 +1026,10 @@
return (NULL);
}
+#ifdef RBAC
+ if(xenRBACxml(XR_CREATE_VM, xmlDesc, conn) == -1)
+ return (NULL);
+#endif
if (conn->driver->domainCreateLinux)
return conn->driver->domainCreateLinux (conn, xmlDesc, flags);
@@ -1189,6 +1213,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_DESTROY_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainDestroy)
return conn->driver->domainDestroy (domain);
@@ -1248,6 +1276,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_PAUSE_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainSuspend)
return conn->driver->domainSuspend (domain);
@@ -1282,6 +1314,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_PAUSE_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainResume)
return conn->driver->domainResume (domain);
@@ -1322,6 +1358,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_SAVE_VM, NULL, conn) == -1)
+ return (-1);
+#endif
/*
* We must absolutize the file path as the save is done out of process
* TODO: check for URI when libxml2 is linked in.
@@ -1377,6 +1417,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_SAVE_VM, NULL, conn) == -1)
+ return (-1);
+#endif
/*
* We must absolutize the file path as the restore is done out of process
* TODO: check for URI when libxml2 is linked in.
@@ -1436,6 +1480,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_DUMP_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
/*
* We must absolutize the file path as the save is done out of process
* TODO: check for URI when libxml2 is linked in.
@@ -1493,6 +1541,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SHUTDOWN_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainShutdown)
return conn->driver->domainShutdown (domain);
@@ -1528,6 +1580,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_REBOOT_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainReboot)
return conn->driver->domainReboot (domain, flags);
@@ -1661,6 +1717,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_LIST_VM, domain->name, conn) == -1)
+ return (NULL);
+#endif
if (conn->driver->domainGetOSType)
return conn->driver->domainGetOSType (domain);
@@ -1734,6 +1794,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SET_MEM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainSetMaxMemory)
return conn->driver->domainSetMaxMemory (domain, memory);
@@ -1778,6 +1842,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SET_MEM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainSetMemory)
return conn->driver->domainSetMemory (domain, memory);
@@ -1926,6 +1994,11 @@
return NULL;
}
conn = domain->conn; /* Source connection. */
+
+#ifdef RBAC
+ if(xenRBACdomain( XR_MIGRATE_VM, domain->name, conn) == -1)
+ return NULL;
+#endif
if (!VIR_IS_CONNECT (dconn)) {
virLibConnError (conn, VIR_ERR_INVALID_CONN, __FUNCTION__);
return NULL;
@@ -2150,6 +2223,10 @@
return 0;
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_AVAILABLE_MEM, NULL, conn) == -1)
+ return 0;
+#endif
if (conn->driver->getFreeMemory)
return conn->driver->getFreeMemory (conn);
@@ -2179,6 +2256,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_GET_SCHEDULER, domain->name, conn) == -1)
+ return NULL;
+#endif
if (conn->driver->domainGetSchedulerType){
schedtype = conn->driver->domainGetSchedulerType (domain, nparams);
return schedtype;
@@ -2216,6 +2297,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_GET_SCHEDULER, domain->name, conn) == -1)
+ return -1;
+#endif
if (conn->driver->domainGetSchedulerParameters)
return conn->driver->domainGetSchedulerParameters (domain, params, nparams);
@@ -2248,6 +2333,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SET_SCHEDULER, domain->name, conn) == -1)
+ return -1;
+#endif
if (conn->driver->domainSetSchedulerParameters)
return conn->driver->domainSetSchedulerParameters (domain, params, nparams);
@@ -2297,6 +2386,10 @@
}
conn = dom->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_LOAD_VM, dom->name, conn) == -1)
+ return -1;
+#endif
if (conn->driver->domainBlockStats) {
if (conn->driver->domainBlockStats (dom, path, &stats2) == -1)
return -1;
@@ -2349,6 +2442,10 @@
}
conn = dom->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_LOAD_VM, dom->name, conn) == -1)
+ return -1;
+#endif
if (conn->driver->domainInterfaceStats) {
if (conn->driver->domainInterfaceStats (dom, path, &stats2) == -1)
return -1;
@@ -2396,6 +2493,10 @@
return (NULL);
}
+#ifdef RBAC
+ if(xenRBACxml(XR_DEFINE_VM, xml, conn) == -1)
+ return (NULL);
+#endif
if (conn->driver->domainDefineXML)
return conn->driver->domainDefineXML (conn, xml);
@@ -2426,6 +2527,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_UNDEFINE_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainUndefine)
return conn->driver->domainUndefine (domain);
@@ -2483,6 +2588,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_LIST_VM, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->listDefinedDomains)
return conn->driver->listDefinedDomains (conn, names, maxnames);
@@ -2518,6 +2627,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_START_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainCreate)
return conn->driver->domainCreate (domain);
@@ -2585,6 +2698,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_AUTOSTART_VM, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainSetAutostart)
return conn->driver->domainSetAutostart (domain, autostart);
@@ -2630,6 +2747,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SET_VCPU, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainSetVcpus)
return conn->driver->domainSetVcpus (domain, nvcpus);
@@ -2682,6 +2803,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_SET_VCPU, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainPinVcpu)
return conn->driver->domainPinVcpu (domain, vcpu, cpumap, maplen);
@@ -2736,6 +2861,10 @@
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_GET_VCPU, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainGetVcpus)
return conn->driver->domainGetVcpus (domain, info, maxinfo,
cpumaps, maplen);
@@ -2802,6 +2931,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_ATTACH_DEVICE, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainAttachDevice)
return conn->driver->domainAttachDevice (domain, xml);
@@ -2834,6 +2967,10 @@
}
conn = domain->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_DETACH_DEVICE, domain->name, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->domainDetachDevice)
return conn->driver->domainDetachDevice (domain, xml);
@@ -2876,6 +3013,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_AVAILABLE_MEM, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->driver->nodeGetCellsFreeMemory)
return conn->driver->nodeGetCellsFreeMemory (conn, freeMems, startCell, maxCells);
@@ -2959,6 +3100,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_LIST_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->listNetworks)
return conn->networkDriver->listNetworks (conn, names, maxnames);
@@ -3017,6 +3162,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_LIST_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->listDefinedNetworks)
return conn->networkDriver->listDefinedNetworks (conn,
names, maxnames);
@@ -3166,6 +3315,10 @@
return (NULL);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_CREATE_VNET, NULL, conn) == -1)
+ return (NULL);
+#endif
if (conn->networkDriver && conn->networkDriver->networkCreateXML)
return conn->networkDriver->networkCreateXML (conn, xmlDesc);
@@ -3200,6 +3353,10 @@
return (NULL);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_DEFINE_VNET, NULL, conn) == -1)
+ return (NULL);
+#endif
if (conn->networkDriver && conn->networkDriver->networkDefineXML)
return conn->networkDriver->networkDefineXML (conn, xml);
@@ -3230,6 +3387,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_DEFINE_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->networkUndefine)
return conn->networkDriver->networkUndefine (network);
@@ -3266,6 +3427,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_CREATE_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->networkCreate)
return conn->networkDriver->networkCreate (network);
@@ -3302,6 +3467,10 @@
return (-1);
}
+#ifdef RBAC
+ if(xenRBACdomain( XR_DESTROY_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->networkDestroy)
return conn->networkDriver->networkDestroy (network);
@@ -3441,6 +3610,10 @@
conn = network->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_DETAIL_VNET, NULL, conn) == -1)
+ return (NULL);
+#endif
if (conn->networkDriver && conn->networkDriver->networkDumpXML)
return conn->networkDriver->networkDumpXML (network, flags);
@@ -3538,6 +3711,10 @@
conn = network->conn;
+#ifdef RBAC
+ if(xenRBACdomain( XR_AUTOSTART_VNET, NULL, conn) == -1)
+ return (-1);
+#endif
if (conn->networkDriver && conn->networkDriver->networkSetAutostart)
return conn->networkDriver->networkSetAutostart (network, autostart);
@@ -3545,6 +3722,340 @@
return -1;
}
+#ifdef RBAC
+/**
+ * virDomainGetXMLDesc_XRBAC:
+ * @op_id: a access ID
+ * @domain: a domain object
+ * @flags: an OR'ed set of virDomainXMLFlags
+ *
+ * Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of error.
+ * the caller must free() the returned value.
+ */
+char *
+virDomainGetXMLDesc_XRBAC(int op_id, virDomainPtr domain, int flags)
+{
+ /* parameter Check */
+ if( domain == NULL ) {
+ virLibConnError( domain->conn, VIR_ERR_INTERNAL_ERROR, "domain name");
+ return NULL;
+ }
+ if( (domain->name == NULL) || (strlen(domain->name) == 0) ){
+ virLibConnError( domain->conn, VIR_ERR_INTERNAL_ERROR, "domain name");
+ return NULL;
+ }
+
+ if(xenRBACdomain( op_id, domain->name, domain->conn) == -1)
+ return NULL;
+
+ return virDomainGetXMLDesc(domain, flags);
+}
+
+/**
+ * virConnectListNetworks_QEMUD:
+ * @conn: pointer to the hypervisor connection
+ * @names: array to collect the list of names of active networks
+ * @maxnames: size of @names
+ *
+ * Collect the list of active networks, and store their names in @names
+ *
+ * Returns the number of networks found or -1 in case of error
+ */
+int
+virConnectListNetworks_QEMUD(virConnectPtr conn, char **const names, int maxnames)
+{
+ DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+
+ if ((names == NULL) || (maxnames < 0)) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return (-1);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->listNetworks)
+ return conn->networkDriver->listNetworks (conn, names, maxnames);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+
+/**
+ * virConnectListDefinedNetworks_QEMUD:
+ * @conn: pointer to the hypervisor connection
+ * @names: pointer to an array to store the names
+ * @maxnames: size of the array
+ *
+ * list the inactive networks, stores the pointers to the names in @names
+ *
+ * Returns the number of names provided in the array or -1 in case of error
+ */
+int
+virConnectListDefinedNetworks_QEMUD(virConnectPtr conn, char **const names,
+ int maxnames)
+{
+ DEBUG("conn=%p, names=%p, maxnames=%d", conn, names, maxnames);
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (-1);
+ }
+
+ if ((names == NULL) || (maxnames < 0)) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return (-1);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->listDefinedNetworks)
+ return conn->networkDriver->listDefinedNetworks (conn,
+ names, maxnames);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+
+/**
+ * virNetworkCreateXML_QEMUD:
+ * @conn: pointer to the hypervisor connection
+ * @xmlDesc: an XML description of the network
+ *
+ * Create and start a new virtual network, based on an XML description
+ * similar to the one returned by virNetworkGetXMLDesc()
+ *
+ * Returns a new network object or NULL in case of failure
+ */
+virNetworkPtr
+virNetworkCreateXML_QEMUD(virConnectPtr conn, const char *xmlDesc)
+{
+ DEBUG("conn=%p, xmlDesc=%s", conn, xmlDesc);
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (NULL);
+ }
+ if (xmlDesc == NULL) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return (NULL);
+ }
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ return (NULL);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->networkCreateXML)
+ return conn->networkDriver->networkCreateXML (conn, xmlDesc);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return NULL;
+}
+
+/**
+ * virNetworkDefineXML_QEMUD:
+ * @conn: pointer to the hypervisor connection
+ * @xml: the XML description for the network, preferably in UTF-8
+ *
+ * Define a network, but does not create it
+ *
+ * Returns NULL in case of error, a pointer to the network otherwise
+ */
+virNetworkPtr
+virNetworkDefineXML_QEMUD(virConnectPtr conn, const char *xml)
+{
+ DEBUG("conn=%p, xml=%s", conn, xml);
+
+ if (!VIR_IS_CONNECT(conn)) {
+ virLibConnError(NULL, VIR_ERR_INVALID_CONN, __FUNCTION__);
+ return (NULL);
+ }
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibConnError(conn, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ return (NULL);
+ }
+ if (xml == NULL) {
+ virLibConnError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return (NULL);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->networkDefineXML)
+ return conn->networkDriver->networkDefineXML (conn, xml);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return NULL;
+}
+
+/**
+ * virNetworkUndefine_QEMUD:
+ * @network: pointer to a defined network
+ *
+ * Undefine a network but does not stop it if it is running
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+int
+virNetworkUndefine_QEMUD(virNetworkPtr network) {
+ virConnectPtr conn;
+ DEBUG("network=%p", network);
+
+ if (!VIR_IS_CONNECTED_NETWORK(network)) {
+ virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+ return (-1);
+ }
+ conn = network->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ return (-1);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->networkUndefine)
+ return conn->networkDriver->networkUndefine (network);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+
+/**
+ * virNetworkCreate_QEMUD:
+ * @network: pointer to a defined network
+ *
+ * Create and start a defined network. If the call succeed the network
+ * moves from the defined to the running networks pools.
+ *
+ * Returns 0 in case of success, -1 in case of error
+ */
+int
+virNetworkCreate_QEMUD(virNetworkPtr network)
+{
+ virConnectPtr conn;
+ DEBUG("network=%p", network);
+
+ if (network == NULL) {
+ TODO
+ return (-1);
+ }
+ if (!VIR_IS_CONNECTED_NETWORK(network)) {
+ virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+ return (-1);
+ }
+ conn = network->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ return (-1);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->networkCreate)
+ return conn->networkDriver->networkCreate (network);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+
+/**
+ * virNetworkDestroy_QEMUD:
+ * @network: a network object
+ *
+ * Destroy the network object. The running instance is shutdown if not down
+ * already and all resources used by it are given back to the hypervisor.
+ * The data structure is freed and should not be used thereafter if the
+ * call does not return an error.
+ * This function may requires priviledged access
+ *
+ * Returns 0 in case of success and -1 in case of failure.
+ */
+int
+virNetworkDestroy_QEMUD(virNetworkPtr network)
+{
+ virConnectPtr conn;
+ DEBUG("network=%p", network);
+
+ if (!VIR_IS_CONNECTED_NETWORK(network)) {
+ virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+ return (-1);
+ }
+
+ conn = network->conn;
+ if (conn->flags & VIR_CONNECT_RO) {
+ virLibNetworkError(network, VIR_ERR_OPERATION_DENIED, __FUNCTION__);
+ return (-1);
+ }
+
+ if (conn->networkDriver && conn->networkDriver->networkDestroy)
+ return conn->networkDriver->networkDestroy (network);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+
+/**
+ * virNetworkGetXMLDesc_QEMUD:
+ * @network: a network object
+ * @flags: and OR'ed set of extraction flags, not used yet
+ *
+ * Provide an XML description of the network. The description may be reused
+ * later to relaunch the network with virNetworkCreateXML().
+ *
+ * Returns a 0 terminated UTF-8 encoded XML instance, or NULL in case of error.
+ * the caller must free() the returned value.
+ */
+char *
+virNetworkGetXMLDesc_QEMUD(virNetworkPtr network, int flags)
+{
+ virConnectPtr conn;
+ DEBUG("network=%p, flags=%d", network, flags);
+
+ if (!VIR_IS_NETWORK(network)) {
+ virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+ return (NULL);
+ }
+ if (flags != 0) {
+ virLibNetworkError(network, VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return (NULL);
+ }
+
+ conn = network->conn;
+
+ if (conn->networkDriver && conn->networkDriver->networkDumpXML)
+ return conn->networkDriver->networkDumpXML (network, flags);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return NULL;
+}
+
+/**
+ * virNetworkSetAutostart_QEMUD:
+ * @network: a network object
+ * @autostart: whether the network should be automatically started 0 or 1
+ *
+ * Configure the network to be automatically started
+ * when the host machine boots.
+ *
+ * Returns -1 in case of error, 0 in case of success
+ */
+int
+virNetworkSetAutostart_QEMUD(virNetworkPtr network,
+ int autostart)
+{
+ virConnectPtr conn;
+ DEBUG("network=%p, autostart=%d", network, autostart);
+
+ if (!VIR_IS_NETWORK(network)) {
+ virLibNetworkError(NULL, VIR_ERR_INVALID_NETWORK, __FUNCTION__);
+ return (-1);
+ }
+
+ conn = network->conn;
+
+ if (conn->networkDriver && conn->networkDriver->networkSetAutostart)
+ return conn->networkDriver->networkSetAutostart (network, autostart);
+
+ virLibConnError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
+ return -1;
+}
+#endif
+
+
/*
* vim: set tabstop=4:
* vim: set shiftwidth=4:
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/libvirt_sym.version
--- a/src/libvirt_sym.version Wed Apr 02 13:13:06 2008 +0900
+++ b/src/libvirt_sym.version Tue Jan 27 03:13:46 2009 +0900
@@ -28,6 +28,7 @@
virDomainGetName;
virDomainGetOSType;
virDomainGetXMLDesc;
+ virDomainGetXMLDesc_XRBAC;
virDomainLookupByID;
virDomainLookupByName;
virDomainLookupByUUID;
@@ -99,6 +100,15 @@
virNetworkGetBridgeName;
virNetworkGetAutostart;
virNetworkSetAutostart;
+ virConnectListNetworks_QEMUD;
+ virConnectListDefinedNetworks_QEMUD;
+ virNetworkCreateXML_QEMUD;
+ virNetworkDefineXML_QEMUD;
+ virNetworkUndefine_QEMUD;
+ virNetworkCreate_QEMUD;
+ virNetworkDestroy_QEMUD;
+ virNetworkGetXMLDesc_QEMUD;
+ virNetworkSetAutostart_QEMUD;
/* Symbols with __ are private only
for use by the libvirtd daemon.
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/proxy_internal.c
--- a/src/proxy_internal.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/proxy_internal.c Tue Jan 27 03:13:46 2009 +0900
@@ -42,6 +42,9 @@
static unsigned long xenProxyDomainGetMaxMemory(virDomainPtr domain);
static int xenProxyDomainGetInfo(virDomainPtr domain, virDomainInfoPtr info);
static char *xenProxyDomainGetOSType(virDomainPtr domain);
+#ifdef RBAC
+static char *xenProxyGetSchedulerType(virDomainPtr domain, int *nparams);
+#endif
struct xenUnifiedDriver xenProxyDriver = {
xenProxyOpen, /* open */
@@ -80,7 +83,11 @@
NULL, /* domainDetachDevice */
NULL, /* domainGetAutostart */
NULL, /* domainSetAutostart */
+#ifdef RBAC
+ xenProxyGetSchedulerType, /* domainGetInfo */
+#else
NULL, /* domainGetSchedulerType */
+#endif
NULL, /* domainGetSchedulerParameters */
NULL, /* domainSetSchedulerParameters */
};
@@ -533,9 +540,11 @@
int ret;
int fd;
xenUnifiedPrivatePtr priv;
-
+
+#ifndef RBAC
if (!(flags & VIR_CONNECT_RO))
return(-1);
+#endif
priv = (xenUnifiedPrivatePtr) conn->privateData;
priv->proxy = -1;
@@ -1113,6 +1122,54 @@
return(ostype);
}
+#ifdef RBAC
+static char *
+xenProxyGetSchedulerType(virDomainPtr domain, int *nparams)
+{
+ virProxyPacket req;
+ virProxyFullPacket ans;
+ int ret, type_len;
+ char *sched_type;
+
+ if (!VIR_IS_CONNECTED_DOMAIN(domain)) {
+ if (domain == NULL)
+ virProxyError(NULL, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ else
+ virProxyError(domain->conn, VIR_ERR_INVALID_DOMAIN, __FUNCTION__);
+ return NULL;
+ }
+ if (domain->id < 0)
+ return NULL;
+
+ memset(&req, 0, sizeof(req));
+ req.command = VIR_PROXY_GET_SCHEDTYPE;
+ req.len = sizeof(req);
+ ret = xenProxyCommand(domain->conn, &req, &ans, 0);
+ if (ret < 0) {
+ xenProxyClose(domain->conn);
+ return NULL;
+ }
+ if (ans.data.arg == -1)
+ return NULL;
+ if (ans.len <= sizeof(virProxyPacket)) {
+ virProxyError(domain->conn, VIR_ERR_OPERATION_FAILED, __FUNCTION__);
+ return NULL;
+ }
+
+ type_len = ans.len - sizeof (virProxyPacket) - sizeof(int);
+ sched_type = malloc (type_len + 1);
+ if (!sched_type) {
+ virProxyError (domain->conn, VIR_ERR_NO_MEMORY, __FUNCTION__);
+ return NULL;
+ }
+
+ *nparams = ans.extra.arg[0];
+ memmove (sched_type, &ans.extra.str[4], type_len);
+ sched_type[type_len] = '\0';
+
+ return sched_type;
+}
+#endif
#endif /* WITH_XEN */
/*
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/proxy_internal.h
--- a/src/proxy_internal.h Wed Apr 02 13:13:06 2008 +0900
+++ b/src/proxy_internal.h Tue Jan 27 03:13:46 2009 +0900
@@ -37,7 +37,12 @@
VIR_PROXY_DOMAIN_INFO = 9,
VIR_PROXY_DOMAIN_XML = 10,
VIR_PROXY_DOMAIN_OSTYPE = 11,
+#ifdef RBAC
+ VIR_PROXY_GET_CAPABILITIES = 12,
+ VIR_PROXY_GET_SCHEDTYPE = 13
+#else
VIR_PROXY_GET_CAPABILITIES = 12
+#endif
} virProxyCommand;
/*
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/remote_internal.c
--- a/src/remote_internal.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/remote_internal.c Tue Jan 27 03:13:46 2009 +0900
@@ -677,7 +677,7 @@
cmd_argv[j++] = strdup (sockname ? sockname : LIBVIRTD_PRIV_UNIX_SOCKET);
cmd_argv[j++] = 0;
assert (j == nr_args);
- for (j = 0; j < nr_args; j++)
+ for (j = 0; j < (nr_args-1); j++)
if (cmd_argv[j] == NULL) {
error (conn, VIR_ERR_SYSTEM_ERROR, strerror (ENOMEM));
goto failed;
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/virsh.c
--- a/src/virsh.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/virsh.c Tue Jan 27 03:13:46 2009 +0900
@@ -49,6 +49,10 @@
#include "internal.h"
#include "console.h"
+#ifdef RBAC
+#include "xenrbac_libvirt.h"
+#endif
+
static char *progname;
#ifndef TRUE
@@ -1066,12 +1070,13 @@
if (!(dom = vshCommandOptDomainBy(ctl, cmd, "name", NULL, VSH_BYNAME)))
return FALSE;
+#ifndef RBAC
if (virDomainGetID(dom) != (unsigned int)-1) {
vshError(ctl, FALSE, _("Domain is already active"));
virDomainFree(dom);
return FALSE;
}
-
+#endif
if (virDomainCreate(dom) == 0) {
vshPrint(ctl, _("Domain %s started\n"),
virDomainGetName(dom));
@@ -1549,6 +1554,25 @@
if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", NULL)))
return FALSE;
+#ifdef RBAC
+ if ((str = virDomainGetOSType(dom))) {
+ id = virDomainGetID(dom);
+ if (id == ((unsigned int)-1))
+ vshPrint(ctl, "%-15s %s\n", _("Id:"), "-");
+ else
+ vshPrint(ctl, "%-15s %d\n", _("Id:"), id);
+ vshPrint(ctl, "%-15s %s\n", _("Name:"), virDomainGetName(dom));
+
+ if (virDomainGetUUIDString(dom, &uuid[0])==0)
+ vshPrint(ctl, "%-15s %s\n", _("UUID:"), uuid);
+
+ vshPrint(ctl, "%-15s %s\n", _("OS Type:"), str);
+ free(str);
+ } else {
+ virDomainFree(dom);
+ return FALSE;
+ }
+#else
id = virDomainGetID(dom);
if (id == ((unsigned int)-1))
vshPrint(ctl, "%-15s %s\n", _("Id:"), "-");
@@ -1563,6 +1587,7 @@
vshPrint(ctl, "%-15s %s\n", _("OS Type:"), str);
free(str);
}
+#endif
if (virDomainGetInfo(dom, &info) == 0) {
vshPrint(ctl, "%-15s %s\n", _("State:"),
@@ -2116,7 +2141,11 @@
if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", NULL)))
return FALSE;
+#ifdef RBAC
+ dump = virDomainGetXMLDesc_XRBAC(XR_DETAIL_VM, dom, 0);
+#else
dump = virDomainGetXMLDesc(dom, 0);
+#endif
if (dump != NULL) {
printf("%s", dump);
free(dump);
@@ -2555,7 +2584,6 @@
}
if (maxactive) {
activeNames = vshMalloc(ctl, sizeof(char *) * maxactive);
-
if ((maxactive = virConnectListNetworks(ctl->conn, activeNames,
maxactive)) < 0) {
vshError(ctl, FALSE, _("Failed to list active networks"));
@@ -2576,7 +2604,6 @@
}
if (maxinactive) {
inactiveNames = vshMalloc(ctl, sizeof(char *) * maxinactive);
-
if ((maxinactive = virConnectListDefinedNetworks(ctl->conn, inactiveNames, maxinactive)) < 0) {
vshError(ctl, FALSE, _("Failed to list inactive networks"));
if (activeNames)
@@ -2824,6 +2851,13 @@
return FALSE;
}
+#ifdef RBAC
+ ret = virGetVersion(&libVersion, hvType, &apiVersion);
+ if (ret < 0) {
+ vshError(ctl, FALSE, _("failed to get the library version"));
+ return FALSE;
+ }
+
includeVersion = LIBVIR_VERSION_NUMBER;
major = includeVersion / 1000000;
includeVersion %= 1000000;
@@ -2831,12 +2865,22 @@
rel = includeVersion % 1000;
vshPrint(ctl, _("Compiled against library: libvir %d.%d.%d\n"),
major, minor, rel);
+#else
+ includeVersion = LIBVIR_VERSION_NUMBER;
+ major = includeVersion / 1000000;
+ includeVersion %= 1000000;
+ minor = includeVersion / 1000;
+ rel = includeVersion % 1000;
+ vshPrint(ctl, _("Compiled against library: libvir %d.%d.%d\n"),
+ major, minor, rel);
ret = virGetVersion(&libVersion, hvType, &apiVersion);
if (ret < 0) {
vshError(ctl, FALSE, _("failed to get the library version"));
return FALSE;
}
+#endif
+
major = libVersion / 1000000;
libVersion %= 1000000;
minor = libVersion / 1000;
@@ -2961,7 +3005,11 @@
if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", NULL)))
return FALSE;
+#ifdef RBAC
+ doc = virDomainGetXMLDesc_XRBAC(XR_DETAIL_VM, dom, 0);
+#else
doc = virDomainGetXMLDesc(dom, 0);
+#endif
if (!doc)
goto cleanup;
@@ -3038,7 +3086,11 @@
if (!(dom = vshCommandOptDomain(ctl, cmd, "domain", NULL)))
return FALSE;
+#ifdef RBAC
+ doc = virDomainGetXMLDesc_XRBAC(XR_DETAIL_VM, dom, 0);
+#else
doc = virDomainGetXMLDesc(dom, 0);
+#endif
if (!doc)
goto cleanup;
@@ -4532,12 +4584,15 @@
/* set up the library error handler */
virSetErrorFunc(NULL, virshErrorHandler);
+#ifdef RBAC
+#else
#ifndef __MINGW32__
/* Force a non-root, Xen connection to readonly */
if ((ctl->name == NULL ||
!strcasecmp(ctl->name, "xen")) && ctl->uid != 0)
ctl->readonly = 1;
#endif
+#endif /* RBAC */
ctl->conn = virConnectOpenAuth(ctl->name,
virConnectAuthPtrDefault,
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/virterror.c
--- a/src/virterror.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/virterror.c Tue Jan 27 03:13:46 2009 +0900
@@ -300,6 +300,11 @@
case VIR_FROM_STATS_LINUX:
dom = "Linux Stats ";
break;
+#ifdef RBAC
+ case VIR_FROM_XENRBAC:
+ dom = "Xen RBAC ";
+ break;
+#endif
}
if ((err->dom != NULL) && (err->code != VIR_ERR_INVALID_DOMAIN)) {
@@ -679,6 +684,14 @@
else
errmsg = _("authentication failed: %s");
break;
+#ifdef RBAC
+ case VIR_ERR_PERMISSION:
+ if (info == NULL)
+ errmsg = _("operation not permitted");
+ else
+ errmsg = _("operation not permitted: %s");
+ break;
+#endif
}
return (errmsg);
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xen_internal.c
--- a/src/xen_internal.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/xen_internal.c Tue Jan 27 03:13:46 2009 +0900
@@ -741,7 +741,6 @@
errmsg, info, NULL, value, 0, errmsg, info, value);
}
-#ifndef PROXY
/**
* virXenErrorFunc:
@@ -779,7 +778,6 @@
}
}
-#endif /* PROXY */
/**
* virXenPerror:
@@ -1069,7 +1067,6 @@
}
-#ifndef PROXY
/**
* xenHypervisorGetSchedulerType:
* @domain: pointer to the Xen Hypervisor block
@@ -1082,19 +1079,35 @@
char *
xenHypervisorGetSchedulerType(virDomainPtr domain, int *nparams)
{
+ if ((domain == NULL) || (domain->conn == NULL)) {
+ virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "domain is NULL", 0);
+ return NULL;
+ }
+ if (domain->id < 0) {
+ virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "domain->id invalid", 0);
+ return NULL;
+ }
+ return(xenHypervisorGetSchedType(domain->conn, nparams));
+}
+
+char *
+xenHypervisorGetSchedType(virConnectPtr conn, int *nparams)
+{
char *schedulertype = NULL;
xenUnifiedPrivatePtr priv;
- if ((domain == NULL) || (domain->conn == NULL)) {
+ if (conn == NULL) {
virXenErrorFunc(NULL, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "domain or conn is NULL", 0);
+ "conn is NULL", 0);
return NULL;
}
- priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
- if (priv->handle < 0 || domain->id < 0) {
- virXenErrorFunc(domain->conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
- "priv->handle or domain->id invalid", 0);
+ priv = (xenUnifiedPrivatePtr) conn->privateData;
+ if (priv->handle < 0) {
+ virXenErrorFunc(conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__,
+ "priv->handle invalid", 0);
return NULL;
}
@@ -1104,8 +1117,8 @@
* TODO: check on Xen 3.0.3
*/
if (dom_interface_version < 5) {
- virXenErrorFunc(domain->conn, VIR_ERR_NO_XEN, __FUNCTION__,
- "unsupported in dom interface < 5", 0);
+ virXenErrorFunc(conn, VIR_ERR_NO_XEN, __FUNCTION__,
+ "unsupported in dom interface < 5", 0);
return NULL;
}
@@ -1138,6 +1151,7 @@
return schedulertype;
}
+#ifndef PROXY
static const char *str_weight = "weight";
static const char *str_cap = "cap";
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xen_internal.h
--- a/src/xen_internal.h Wed Apr 02 13:13:06 2008 +0900
+++ b/src/xen_internal.h Tue Jan 27 03:13:46 2009 +0900
@@ -76,8 +76,10 @@
int maplen);
int xenHypervisorGetVcpuMax (virDomainPtr domain);
-char * xenHypervisorGetSchedulerType (virDomainPtr domain,
- int *nparams);
+char * xenHypervisorGetSchedulerType (virDomainPtr domain,
+ int *nparams);
+char * xenHypervisorGetSchedType (virConnectPtr conn,
+ int *nparams);
int xenHypervisorGetSchedulerParameters (virDomainPtr domain,
virSchedParameterPtr params,
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xen_unified.c
--- a/src/xen_unified.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/xen_unified.c Tue Jan 27 03:13:46 2009 +0900
@@ -40,6 +40,9 @@
#include "xm_internal.h"
#include "xml.h"
+#ifdef RBAC
+#include <xen/xen.h>
+#endif
static int
xenUnifiedNodeGetInfo (virConnectPtr conn, virNodeInfoPtr info);
static int
@@ -266,6 +269,11 @@
priv->xendConfigVersion > 2)
continue;
+#ifdef RBAC
+ /* Ignore proxy for non-root */
+ if (i == XEN_UNIFIED_HYPERVISOR_OFFSET && getuid() != 0)
+ continue;
+#endif
/* Ignore proxy for root */
if (i == XEN_UNIFIED_PROXY_OFFSET && getuid() == 0)
continue;
@@ -282,10 +290,15 @@
#endif
}
+#ifdef RBAC
+ if (!priv->opened[i] &&
+ (!(conn->flags & VIR_CONNECT_RO) || getuid() == 0 || i == XEN_UNIFIED_PROXY_OFFSET)) {
+#else
/* If as root, then all drivers must succeed.
If non-root, then only proxy must succeed */
if (!priv->opened[i] &&
(getuid() == 0 || i == XEN_UNIFIED_PROXY_OFFSET)) {
+#endif
for (j = 0; j < i; ++j)
if (priv->opened[j]) drivers[j]->close (conn);
free (priv);
@@ -381,6 +394,9 @@
static int
xenUnifiedGetMaxVcpus (virConnectPtr conn, const char *type)
{
+#ifdef RBAC
+ return MAX_VIRT_CPUS;
+#else
GET_PRIVATE(conn);
if (type && STRCASENEQ (type, "Xen")) {
@@ -394,6 +410,7 @@
xenUnifiedError (conn, VIR_ERR_NO_SUPPORT, __FUNCTION__);
return -1;
}
+#endif
}
static int
@@ -889,6 +906,9 @@
static int
xenUnifiedDomainGetMaxVcpus (virDomainPtr dom)
{
+#ifdef RBAC
+ return MAX_VIRT_CPUS;
+#else
GET_PRIVATE(dom->conn);
int i, ret;
@@ -899,6 +919,7 @@
}
return -1;
+#endif
}
static char *
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xend_internal.c
--- a/src/xend_internal.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/xend_internal.c Tue Jan 27 03:13:46 2009 +0900
@@ -62,6 +62,12 @@
static int xenDaemonDomainCoreDump(virDomainPtr domain, const char *filename,
int flags);
#endif /* PROXY */
+#ifdef RBAC
+static int xenDaemonGetSchedulerParameters(virDomainPtr domain,
+ virSchedParameterPtr params, int *nparams);
+static int xenDaemonSetSchedulerParameters(virDomainPtr domain,
+ virSchedParameterPtr params, int nparams);
+#endif /* RBAC */
#ifndef PROXY
struct xenUnifiedDriver xenDaemonDriver = {
@@ -102,8 +108,13 @@
NULL, /* domainGetAutostart */
NULL, /* domainSetAutostart */
NULL, /* domainGetSchedulerType */
+#ifdef RBAC
+ xenDaemonGetSchedulerParameters, /* domainGetSchedulerParameters */
+ xenDaemonSetSchedulerParameters, /* domainSetSchedulerParameters */
+#else
NULL, /* domainGetSchedulerParameters */
NULL, /* domainSetSchedulerParameters */
+#endif
};
/**
@@ -235,7 +246,11 @@
* is rather normal, this should fallback to the proxy (or
* remote) mechanism.
*/
+#ifdef RBAC
+ if (getuid() == 0) {
+#else
if ((getuid() == 0) || (xend->flags & VIR_CONNECT_RO)) {
+#endif
virXendError(xend, VIR_ERR_INTERNAL_ERROR,
"failed to connect to xend");
}
@@ -3591,6 +3606,109 @@
return(ret);
}
+
+#ifdef RBAC
+static const char *str_weight = "weight";
+static const char *str_cap = "cap";
+
+static int
+xenDaemonGetSchedulerParameters(virDomainPtr domain,
+ virSchedParameterPtr params, int *nparams)
+{
+ xenUnifiedPrivatePtr priv;
+ struct sexpr *root;
+ int weight, cap;
+
+ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)) {
+ virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
+ __FUNCTION__);
+ return (-1);
+ }
+
+ priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
+ if (domain->id < 0 && priv->xendConfigVersion < 3)
+ return (-1);
+
+ root = sexpr_get(domain->conn, "/xend/domain/%d?detail=1", domain->id);
+ if (root == NULL)
+ return (-1);
+
+ weight = sexpr_int(root, "domain/cpu_weight");
+ cap = sexpr_int(root, "domain/cpu_cap");
+
+ strncpy (params[0].field, str_weight, VIR_DOMAIN_SCHED_FIELD_LENGTH);
+ params[0].type = VIR_DOMAIN_SCHED_FIELD_INT;
+ params[0].value.i = weight;
+
+ strncpy (params[1].field, str_cap, VIR_DOMAIN_SCHED_FIELD_LENGTH);
+ params[1].type = VIR_DOMAIN_SCHED_FIELD_INT;
+ params[1].value.i = cap;
+
+ return (0);
+}
+
+static int
+xenDaemonSetSchedulerParameters(virDomainPtr domain,
+ virSchedParameterPtr params, int nparams)
+{
+ int i;
+ int weight_set = 0;
+ int cap_set = 0;
+ char buf_weight[VIR_UUID_BUFLEN];
+ char buf_cap[VIR_UUID_BUFLEN];
+ xenUnifiedPrivatePtr priv;
+ int weight, cap;
+ struct sexpr *root;
+
+ if ((domain == NULL) || (domain->conn == NULL) || (domain->name == NULL)
+ || (nparams == 0) || (params == NULL)) {
+ virXendError((domain ? domain->conn : NULL), VIR_ERR_INVALID_ARG,
+ __FUNCTION__);
+ return (-1);
+ }
+
+ priv = (xenUnifiedPrivatePtr) domain->conn->privateData;
+
+ if (domain->id < 0 && priv->xendConfigVersion < 3)
+ return(-1);
+
+ /* search specified parameter */
+ memset(&buf_weight, 0, VIR_UUID_BUFLEN);
+ memset(&buf_cap, 0, VIR_UUID_BUFLEN);
+ for (i = 0; i < nparams; i++) {
+ if (STREQ (params[i].field, str_weight) &&
+ params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
+ snprintf(buf_weight, sizeof(buf_weight), "%d", params[i].value.ui);
+ weight_set = 1;
+ } else if (STREQ (params[i].field, str_cap) &&
+ params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
+ snprintf(buf_cap, sizeof(buf_cap), "%d", params[i].value.ui);
+ cap_set = 1;
+ } else {
+ virXendError((domain ? domain->conn : NULL),
+ VIR_ERR_INVALID_ARG, __FUNCTION__);
+ return(-1);
+ }
+ }
+
+ /* get the current setting from xend */
+ root = sexpr_get(domain->conn, "/xend/domain/%d?detail=1", domain->id);
+ weight = sexpr_int(root, "domain/cpu_weight");
+ cap = sexpr_int(root, "domain/cpu_cap");
+
+
+ /* if not specified parameter, set the current value */
+ if (weight_set != 1)
+ snprintf(buf_weight, sizeof(buf_weight), "%d", weight);
+ if (cap_set != 1)
+ snprintf(buf_cap, sizeof(buf_weight), "%d", cap);
+
+ /* xend operation */
+ return(xend_op(domain->conn, domain->name, "op", "domain_sched_credit_set",
+ "weight", buf_weight, "cap", buf_cap, NULL));
+}
+#endif /* RBAC */
+
#endif /* ! PROXY */
#endif /* WITH_XEN */
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xenrbac.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/xenrbac.h Tue Jan 27 03:13:46 2009 +0900
@@ -0,0 +1,39 @@
+/*
+ Copyright (C) 2008 Fujitsu Limited.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ MA 02110-1301 USA.
+*/
+
+#ifndef __XENRBAC_H__
+#define __XENRBAC_H__
+
+#include <errno.h>
+
+int xr_judge(char *username, int opeid, char *domainname, int flag_all);
+
+#define XR_ANY 0
+#define XR_ALL 1
+
+#define XR_ACCEPT 0
+#define XR_DENY EPERM
+
+#endif /*__XENRBAC_H__*/
+/*
+ * Local variables:
+ * c-indent-level: 8
+ * c-basic-offset: 8
+ * End:
+ */
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xenrbac_libvirt.c
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/xenrbac_libvirt.c Tue Jan 27 03:13:46 2009 +0900
@@ -0,0 +1,162 @@
+/*
+ * xr_internal.c: access to Xen RBAC
+ *
+ * Copyright (C) 2008 FUJITSU Limited.
+ *
+ * See COPYING.LIB for the License of this software
+ *
+ */
+
+#include "libvirt/libvirt.h"
+#include "libvirt/virterror.h"
+#include "internal.h"
+
+#include <stdio.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <unistd.h>
+
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/uri.h>
+
+#include "xenrbac_libvirt.h"
+#include "xenrbac.h"
+
+
+/**
+ * xenRBACError:
+ * @error: the error number
+ * @info: extra information string
+ *
+ * Handle an error at the connection level
+ */
+static void
+xenRBACError(virConnectPtr conn, virErrorNumber error, const char *info)
+{
+ const char *errmsg;
+
+ if (error == VIR_ERR_OK)
+ return;
+
+ errmsg = __virErrorMsg(error, info);
+ __virRaiseError(conn, NULL, NULL, VIR_FROM_XENRBAC, error, VIR_ERR_ERROR,
+ errmsg, info, NULL, 0, 0, errmsg, info);
+}
+
+int
+xenRBACdomain(int op_id, char *domname, virConnectPtr conn)
+{
+ struct passwd *pw = NULL;
+ int ret=0;
+ char msg_buff[256];
+
+ memset((char *)msg_buff, (char)NULL, 256);
+
+ /* parameter Check */
+ if( op_id <= 0 ) {
+ snprintf(msg_buff, 256, "unknown access ID ID = %d", op_id);
+ xenRBACError( conn, VIR_ERR_INTERNAL_ERROR, msg_buff);
+ return -1;
+ }
+
+ if( (domname != NULL) && (strlen(domname) == 0) ){
+ xenRBACError( conn, VIR_ERR_INTERNAL_ERROR, "domain name");
+ return -1;
+ }
+ /* Get username */
+ if( !(pw = getpwuid( getuid())) ){
+ if(errno == 0)
+ xenRBACError( conn, VIR_ERR_SYSTEM_ERROR, NULL);
+ else
+ xenRBACError( conn, VIR_ERR_SYSTEM_ERROR, strerror(errno));
+ return -1;
+ }
+
+ ret = xr_judge( pw->pw_name, op_id, domname, XR_ANY);
+ if ( ret != 0 ){
+ switch(ret) {
+ case EPERM:
+ xenRBACError( conn, VIR_ERR_PERMISSION, NULL);
+ return -1;
+
+ case EINVAL:
+ xenRBACError( conn, VIR_ERR_INTERNAL_ERROR, NULL);
+ return -1;
+
+ case ENOMEM:
+ xenRBACError( conn, VIR_ERR_NO_MEMORY, NULL);
+ return -1;
+
+ case ENOENT:
+ case EACCES:
+ xenRBACError( conn, VIR_ERR_OPEN_FAILED, NULL);
+ return -1;
+
+ default:
+ xenRBACError( conn, VIR_ERR_INTERNAL_ERROR, NULL);
+ return -1;
+
+ } //switch_end
+ }
+
+ return 0;
+}
+
+int
+xenRBACxml( int op_id, const char *xmlDesc, virConnectPtr conn)
+{
+
+ xmlDocPtr xml = NULL;
+ xmlXPathObjectPtr obj = NULL;
+ xmlXPathContextPtr ctxt = NULL;
+ int ret = 0;
+
+ /* parameter Check */
+ if( xmlDesc == NULL ){
+ xenRBACError( conn, VIR_ERR_INTERNAL_ERROR, "xmlDesc");
+ return -1;
+ }
+
+ xml = xmlReadDoc((const xmlChar *) xmlDesc, "domain.xml", NULL,
+ XML_PARSE_NOENT | XML_PARSE_NONET |
+ XML_PARSE_NOWARNING);
+ if (!xml) {
+ xenRBACError( conn, VIR_ERR_XML_ERROR, NULL);
+ ret = -1;
+ goto cleanup;
+ }
+
+ ctxt = xmlXPathNewContext(xml);
+ if (!ctxt) {
+ xenRBACError( conn, VIR_ERR_XML_ERROR, NULL);
+ ret = -1;
+ goto cleanup;
+ }
+
+ obj = xmlXPathEval(BAD_CAST "string(/domain/name)" , ctxt);
+ if (!obj) {
+ xenRBACError( conn, VIR_ERR_XML_ERROR, NULL);
+ ret = -1;
+ goto cleanup;
+ }
+ if ( (obj->type == XPATH_STRING) && (obj->stringval != NULL) && (obj->stringval[0] != 0) ) {
+ ret = xenRBACdomain( op_id, (char *)obj->stringval, conn);
+ } else {
+ xenRBACError( conn, VIR_ERR_XML_ERROR, NULL);
+ ret = -1;
+ goto cleanup;
+ }
+
+ cleanup:
+ if (obj)
+ xmlXPathFreeObject(obj);
+ if (ctxt)
+ xmlXPathFreeContext(ctxt);
+ if (xml)
+ xmlFreeDoc(xml);
+
+ return ret;
+}
+
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xenrbac_libvirt.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/xenrbac_libvirt.h Tue Jan 27 03:13:46 2009 +0900
@@ -0,0 +1,68 @@
+/*
+ * xenrbac_libvirt.h: internal API for access to Xen RBAC
+ *
+ * Copyright (C) 2008 FUJITSU Limited.
+ *
+ * See COPYING.LIB for the License of this software
+ *
+ */
+
+
+#ifndef __VIR_XR_JUDGE_H__
+#define __VIR_XR_JUDGE_H__
+
+int xenRBACdomain(int op_id, char *domainname, virConnectPtr conn);
+int xenRBACxml(int op_id, const char *xmlDesc, virConnectPtr conn);
+
+#ifdef RBAC
+/* ACCESS LIST */
+#define XR_CREATE_VM 1
+#define XR_START_VM 2
+#define XR_DESTROY_VM 3
+#define XR_SHUTDOWN_VM 4
+#define XR_PAUSE_VM 5
+#define XR_SUSPEND_VM 6
+#define XR_SAVE_VM 7
+#define XR_DEFINE_VM 8
+#define XR_MIGRATE_VM 9
+#define XR_REBOOT_VM 10
+#define XR_DUMP_VM 11
+#define XR_RENAME_VM 12
+#define XR_SYSREQ_VM 13
+#define XR_AUTOSTART_VM 14
+#define XR_UNDEFINE_VM 15 /* Step2 2008.8.13 */
+#define XR_LIST_VM 16
+#define XR_DETAIL_VM 17
+#define XR_LOAD_VM 18
+#define XR_UPTIME_VM 19
+#define XR_XEND_LOG 20
+#define XR_XEND_MSG 21
+#define XR_HOSTNAME 22
+#define XR_AVAILABLE_MEM 23
+
+#define XR_SET_VCPU 30
+#define XR_GET_VCPU 31
+#define XR_SET_SCHEDULER 32
+#define XR_GET_SCHEDULER 33
+#define XR_SET_MEM 34
+#define XR_ATTACH_DEVICE 35 /* Step2 2008.8.13 */
+#define XR_LIST_VBD 36
+#define XR_LIST_VNIF 37
+#define XR_LIST_VTPM 38
+#define XR_CREATE_VNET 40
+#define XR_LIST_VNET 41
+#define XR_DETAIL_VNET 42
+#define XR_AUTOSTART_VNET 43
+#define XR_DEFINE_VNET 44
+#define XR_DETACH_DEVICE 45 /* Step2 2008.8.13 */
+#define XR_CHANGE_DEVICE 46 /* Step2 2008.8.13 */
+#define XR_DESTROY_VNET 47 /* Step2 2008.8.13 */
+
+#define XR_HYPERVISER_URI 61
+#define XR_VERSION 62
+#define XR_SEND_TRIGGER 63
+#define XR_SEND_DEBUG_KEY 64
+#endif
+
+#endif /* __VIR_XR_JUDGE_H__ */
+
diff -r d5dbadfb6161 -r 62d2ebb8d23b src/xs_internal.c
--- a/src/xs_internal.c Wed Apr 02 13:13:06 2008 +0900
+++ b/src/xs_internal.c Tue Jan 27 03:13:46 2009 +0900
@@ -336,7 +336,11 @@
#ifdef PROXY
priv->xshandle = xs_daemon_open_readonly();
#else
+#ifdef RBAC
+ if ((getuid != 0) || (flags & VIR_CONNECT_RO))
+#else
if (flags & VIR_CONNECT_RO)
+#endif
priv->xshandle = xs_daemon_open_readonly();
else
priv->xshandle = xs_daemon_open();
@@ -348,7 +352,11 @@
* is rather normal, this should fallback to the proxy (or
* remote) mechanism.
*/
+#ifdef RBAC
+ if (!(flags & VIR_CONNECT_RO)) {
+#else
if (getuid() == 0) {
+#endif
virXenStoreError(NULL, VIR_ERR_NO_XEN,
_("failed to connect to Xen Store"));
}
diff -r d5dbadfb6161 -r 62d2ebb8d23b tests/Makefile.in
--- a/tests/Makefile.in Wed Apr 02 13:13:06 2008 +0900
+++ b/tests/Makefile.in Tue Jan 27 03:13:46 2009 +0900
@@ -387,6 +387,7 @@
LIBXML_CFLAGS = @LIBXML_CFLAGS@
LIBXML_LIBS = @LIBXML_LIBS@
LN_S = @LN_S@
+LIBXENRBAC = -lxenrbac
LTLIBICONV = @LTLIBICONV@
LTLIBINTL = @LTLIBINTL@
LTLIBOBJS = @LTLIBOBJS@
@@ -693,37 +694,37 @@
done
conftest$(EXEEXT): $(conftest_OBJECTS) $(conftest_DEPENDENCIES)
@rm -f conftest$(EXEEXT)
- $(LINK) $(conftest_OBJECTS) $(conftest_LDADD) $(LIBS)
+ $(LINK) $(conftest_OBJECTS) $(conftest_LDADD) $(LIBS) $(LIBXENRBAC)
nodeinfotest$(EXEEXT): $(nodeinfotest_OBJECTS) $(nodeinfotest_DEPENDENCIES)
@rm -f nodeinfotest$(EXEEXT)
- $(LINK) $(nodeinfotest_OBJECTS) $(nodeinfotest_LDADD) $(LIBS)
+ $(LINK) $(nodeinfotest_OBJECTS) $(nodeinfotest_LDADD) $(LIBS) $(LIBXENRBAC)
qemuxml2argvtest$(EXEEXT): $(qemuxml2argvtest_OBJECTS) $(qemuxml2argvtest_DEPENDENCIES)
@rm -f qemuxml2argvtest$(EXEEXT)
- $(LINK) $(qemuxml2argvtest_OBJECTS) $(qemuxml2argvtest_LDADD) $(LIBS)
+ $(LINK) $(qemuxml2argvtest_OBJECTS) $(qemuxml2argvtest_LDADD) $(LIBS) $(LIBXENRBAC)
qemuxml2xmltest$(EXEEXT): $(qemuxml2xmltest_OBJECTS) $(qemuxml2xmltest_DEPENDENCIES)
@rm -f qemuxml2xmltest$(EXEEXT)
- $(LINK) $(qemuxml2xmltest_OBJECTS) $(qemuxml2xmltest_LDADD) $(LIBS)
+ $(LINK) $(qemuxml2xmltest_OBJECTS) $(qemuxml2xmltest_LDADD) $(LIBS) $(LIBXENRBAC)
reconnect$(EXEEXT): $(reconnect_OBJECTS) $(reconnect_DEPENDENCIES)
@rm -f reconnect$(EXEEXT)
- $(LINK) $(reconnect_OBJECTS) $(reconnect_LDADD) $(LIBS)
+ $(LINK) $(reconnect_OBJECTS) $(reconnect_LDADD) $(LIBS) $(LIBXENRBAC)
sexpr2xmltest$(EXEEXT): $(sexpr2xmltest_OBJECTS) $(sexpr2xmltest_DEPENDENCIES)
@rm -f sexpr2xmltest$(EXEEXT)
- $(LINK) $(sexpr2xmltest_OBJECTS) $(sexpr2xmltest_LDADD) $(LIBS)
+ $(LINK) $(sexpr2xmltest_OBJECTS) $(sexpr2xmltest_LDADD) $(LIBS) $(LIBXENRBAC)
virshtest$(EXEEXT): $(virshtest_OBJECTS) $(virshtest_DEPENDENCIES)
@rm -f virshtest$(EXEEXT)
- $(LINK) $(virshtest_OBJECTS) $(virshtest_LDADD) $(LIBS)
+ $(LINK) $(virshtest_OBJECTS) $(virshtest_LDADD) $(LIBS) $(LIBXENRBAC)
xencapstest$(EXEEXT): $(xencapstest_OBJECTS) $(xencapstest_DEPENDENCIES)
@rm -f xencapstest$(EXEEXT)
- $(LINK) $(xencapstest_OBJECTS) $(xencapstest_LDADD) $(LIBS)
+ $(LINK) $(xencapstest_OBJECTS) $(xencapstest_LDADD) $(LIBS) $(LIBXENRBAC)
xmconfigtest$(EXEEXT): $(xmconfigtest_OBJECTS) $(xmconfigtest_DEPENDENCIES)
@rm -f xmconfigtest$(EXEEXT)
- $(LINK) $(xmconfigtest_OBJECTS) $(xmconfigtest_LDADD) $(LIBS)
+ $(LINK) $(xmconfigtest_OBJECTS) $(xmconfigtest_LDADD) $(LIBS) $(LIBXENRBAC)
xml2sexprtest$(EXEEXT): $(xml2sexprtest_OBJECTS) $(xml2sexprtest_DEPENDENCIES)
@rm -f xml2sexprtest$(EXEEXT)
- $(LINK) $(xml2sexprtest_OBJECTS) $(xml2sexprtest_LDADD) $(LIBS)
+ $(LINK) $(xml2sexprtest_OBJECTS) $(xml2sexprtest_LDADD) $(LIBS) $(LIBXENRBAC)
xmlrpctest$(EXEEXT): $(xmlrpctest_OBJECTS) $(xmlrpctest_DEPENDENCIES)
@rm -f xmlrpctest$(EXEEXT)
- $(LINK) $(xmlrpctest_OBJECTS) $(xmlrpctest_LDADD) $(LIBS)
+ $(LINK) $(xmlrpctest_OBJECTS) $(xmlrpctest_LDADD) $(LIBS) $(LIBXENRBAC)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
1
0
What are these files supposed to be? Dan V's 2105:ed8c8b0ec3c5 changeset
backed out my change:
install-data-local:
$(mkinstalldirs) $(DESTDIR)$(HTML_DIR)
-@INSTALL@ -m 0644 $(srcdir)/*.html $(srcdir)/*.c
$(srcdir)/*.xml \
- $(srcdir)/*.xsl $(DESTDIR)$(HTML_DIR)
+ $(srcdir)/*.xsl $(srcdir)/*.res $(DESTDIR)$(HTML_DIR)
They don't exist in the repository, so $(srcdir) can't be right, but nor
can I see any rules to generate them in the objdir...
regards
john
2
3
[libvirt] [PATCH] xend driver: handle new-format sched-credit options
by john.levonï¼ sun.com 23 Jan '09
by john.levonï¼ sun.com 23 Jan '09
23 Jan '09
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232675291 28800
# Node ID ad7f82da983cc0ba07f7f4e94a2f23a4edc3be57
# Parent 3ef027308b88b47b2f3ca721bf88f2e606d8e3bc
xend driver: handle new-format sched-credit options
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -4634,9 +4634,15 @@ xenDaemonSetSchedulerParameters(virDomai
if (STREQ (params[i].field, str_weight) &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
snprintf(buf_weight, sizeof(buf_weight), "%u", params[i].value.ui);
+ } else if (STREQ (params[i].field, str_weight) &&
+ params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
+ snprintf(buf_weight, sizeof(buf_weight), "%lld", params[i].value.l);
} else if (STREQ (params[i].field, str_cap) &&
params[i].type == VIR_DOMAIN_SCHED_FIELD_UINT) {
snprintf(buf_cap, sizeof(buf_cap), "%u", params[i].value.ui);
+ } else if (STREQ (params[i].field, str_cap) &&
+ params[i].type == VIR_DOMAIN_SCHED_FIELD_LLONG) {
+ snprintf(buf_cap, sizeof(buf_cap), "%lld", params[i].value.l);
} else {
virXendError(domain->conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
goto error;
3
2
I'll push these shortly:
The updates to .m4 files from gnulib are required to avoid
new warnings (about a subtle problem) from the very latest
version of autoconf, built from yesterday's upstream sources.
>From fe911bb6a39f88dd25dce5edea1f9e03d156cd86 Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 23 Jan 2009 11:14:17 +0100
Subject: [PATCH 1/2] correct and tighten up .*ignore files
* .cvsignore: Don't ignore *.orig or *.rej. They're not build products.
Don't ignore the entire m4 directory.
* Makefile.maint (sync-vcs-ignore-files): Correct quoting.
Use sed rather than a for loop.
Search only version-controled files (for reproducibility)
* gnulib/lib/netinet/.cvsignore: Append missing newline-at-EOF,
so that the use of sed doesn't mistakenly concatenate lines.
* gnulib/lib/sys/.cvsignore: Likewise.
* m4/.cvsignore: Ignore acinclude.m4 and aclocal.m4, not *.m4.
* .hgignore: Regenerate.
* all .gitignore files: Regenerate.
---
.cvsignore | 3 -
.gitignore | 3 -
.hgignore | 485 ++++++++++++++++++++---------------------
Makefile.maint | 12 +-
gnulib/lib/.cvsignore | 12 +-
gnulib/lib/.gitignore | 12 +-
gnulib/lib/netinet/.cvsignore | 2 +-
gnulib/lib/netinet/.gitignore | 2 +-
gnulib/lib/sys/.cvsignore | 2 +-
gnulib/lib/sys/.gitignore | 2 +-
m4/.cvsignore | 3 +-
m4/.gitignore | 3 +-
12 files changed, 267 insertions(+), 274 deletions(-)
diff --git a/.cvsignore b/.cvsignore
index ecb8bf0..1b36694 100644
--- a/.cvsignore
+++ b/.cvsignore
@@ -1,7 +1,5 @@
*.a
*.o
-*.orig
-*.rej
*~
.git
ABOUT-NLS
@@ -27,7 +25,6 @@ libvirt.pc
libvirt.spec
ltconfig
ltmain.sh
-m4
mingw32-libvirt.spec
mkinstalldirs
results.log
diff --git a/.gitignore b/.gitignore
index ecb8bf0..1b36694 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,5 @@
*.a
*.o
-*.orig
-*.rej
*~
.git
ABOUT-NLS
@@ -27,7 +25,6 @@ libvirt.pc
libvirt.spec
ltconfig
ltmain.sh
-m4
mingw32-libvirt.spec
mkinstalldirs
results.log
diff --git a/.hgignore b/.hgignore
index 728e7e7..5fe04cd 100644
--- a/.hgignore
+++ b/.hgignore
@@ -1,245 +1,242 @@
syntax: glob
-./proxy/Makefile
-./proxy/Makefile.in
-./proxy/.deps
-./proxy/.libs
-./proxy/libvirt_proxy
-./build-aux/compile
-./build-aux/config.guess
-./build-aux/config.rpath
-./build-aux/config.sub
-./build-aux/depcomp
-./build-aux/install-sh
-./build-aux/ltmain.sh
-./build-aux/missing
-./build-aux/mkinstalldirs
-./build-aux/mktempd
-./qemud/*.gcda
-./qemud/*.gcno
-./qemud/*.la
-./qemud/*.lo
-./qemud/.deps
-./qemud/.libs
-./qemud/Makefile
-./qemud/Makefile.in
-./qemud/libvirt_qemud
-./qemud/libvirtd
-./qemud/libvirtd.init
-./qemud/libvirtd.logrotate
-./m4/acinclude.m4
-./m4/aclocal.m4
-./m4/Makefile
-./m4/Makefile.in
-./docs/devhelp/Makefile
-./docs/devhelp/Makefile.in
-./docs/devhelp/libvirt.devhelp
-./docs/examples/.memdump
-./docs/examples/Makefile.in
-./docs/examples/Makefile
-./docs/examples/.deps
-./docs/examples/.libs
-./docs/examples/info1
-./docs/examples/suspend
-./docs/examples/python/Makefile
-./docs/examples/python/Makefile.in
-./docs/Makefile
-./docs/Makefile.in
-./docs/.memdump
-./docs/apibuild.pyc
-./po/stamp-po
-./po/remove-potcdate.sin
-./po/quot.sed
-./po/insert-header.sin
-./po/*.gmo
-./po/en(a)quot.header
-./po/en(a)boldquot.header
-./po/boldquot.sed
-./po/Rules-quot
-./po/POTFILES
-./po/Makevars.template
-./po/Makefile.in.in
-./po/Makefile.in
-./po/Makefile
-./po/remove-potcdate.sed
-./gnulib/lib/arpa/inet.h
-./gnulib/lib/sys/select.h
-./gnulib/lib/sys/socket.h
-./gnulib/lib/sys/stat.h
-./gnulib/lib/sys/time.h
-./gnulib/lib/alloca.h
-./gnulib/lib/arpa_inet.h
-./gnulib/lib/.deps
-./gnulib/lib/errno.h
-./gnulib/lib/float.h
-./gnulib/lib/*.la
-./gnulib/lib/.libs
-./gnulib/lib/*.lo
-./gnulib/lib/Makefile
-./gnulib/lib/Makefile.in
-./gnulib/lib/netdb.h
-./gnulib/lib/netinet_in.h
-./gnulib/lib/poll.h
-./gnulib/lib/stdbool.h
-./gnulib/lib/stdint.h
-./gnulib/lib/stdio.h
-./gnulib/lib/stdlib.h
-./gnulib/lib/string.h
-./gnulib/lib/sys_ioctl.h
-./gnulib/lib/sys_select.h
-./gnulib/lib/sys_socket.h
-./gnulib/lib/sys_stat.h
-./gnulib/lib/sys_time.h
-./gnulib/lib/time.h
-./gnulib/lib/unistd.h
-./gnulib/lib/wchar.h
-./gnulib/lib/netinet/in.h
-./gnulib/tests/.deps
-./gnulib/tests/.libs
-./gnulib/tests/Makefile
-./gnulib/tests/Makefile.in
-./gnulib/tests/sys
-./gnulib/tests/test-EOVERFLOW
-./gnulib/tests/test-alloca-opt
-./gnulib/tests/test-arpa_inet
-./gnulib/tests/test-c-ctype
-./gnulib/tests/test-errno
-./gnulib/tests/test-fseeko
-./gnulib/tests/test-getaddrinfo
-./gnulib/tests/test-getdelim
-./gnulib/tests/test-gethostname
-./gnulib/tests/test-getline
-./gnulib/tests/test-gettimeofday
-./gnulib/tests/test-lseek
-./gnulib/tests/test-lstat
-./gnulib/tests/test-netdb
-./gnulib/tests/test-netinet_in
-./gnulib/tests/test-perror
-./gnulib/tests/test-poll
-./gnulib/tests/test-random_r
-./gnulib/tests/test-snprintf
-./gnulib/tests/test-sockets
-./gnulib/tests/test-stdbool
-./gnulib/tests/test-stdint
-./gnulib/tests/test-stdio
-./gnulib/tests/test-stdlib
-./gnulib/tests/test-strerror
-./gnulib/tests/test-string
-./gnulib/tests/test-sys_select
-./gnulib/tests/test-sys_socket
-./gnulib/tests/test-sys_stat
-./gnulib/tests/test-sys_time
-./gnulib/tests/test-unistd
-./gnulib/tests/test-vasnprintf
-./gnulib/tests/test-vasprintf
-./gnulib/tests/test-wchar
-./gnulib/tests/test-time
-./examples/domain-events/events-c/Makefile
-./examples/domain-events/events-c/Makefile.in
-./examples/domain-events/events-c/*.exe
-./examples/domain-events/events-c/.deps
-./examples/domain-events/events-c/.libs
-./examples/domain-events/events-c/event-test
-./src/Makefile
-./src/Makefile.in
-./src/.deps
-./src/.libs
-./src/*.lo
-./src/*.loT
-./src/*.la
-./src/virsh
-./src/*.exe
-./src/*.gcda
-./src/*.gcno
-./src/*.gcov
-./src/*.cov
-./src/libvirt_parthelper
-./src/libvirt_lxc
-./src/virsh-net-edit.c
-./src/virsh-pool-edit.c
-./src/libvirt.syms
-./*.a
-./*.o
-./ChangeLog.orig
-./ChangeLog.rej
-./*~
-./.git
-./ABOUT-NLS
-./COPYING
-./INSTALL
-./Makefile
-./Makefile.in
-./aclocal.m4
-./autom4te.cache
-./config.cache
-./config.guess
-./config.h
-./config.h.in
-./config.log
-./config.rpath
-./config.status
-./config.sub
-./configure
-./coverage
-./libtool
-./libvirt-*.tar.gz
-./libvirt.pc
-./libvirt.spec
-./ltconfig
-./ltmain.sh
-./m4
-./mingw32-libvirt.spec
-./mkinstalldirs
-./results.log
-./stamp-h
-./stamp-h.in
-./stamp-h1
-./update.log
-./python/Makefile
-./python/Makefile.in
-./python/.deps
-./python/.libs
-./python/*.lo
-./python/*.la
-./python/*.loT
-./python/libvirt.py
-./python/libvirt-export.c
-./python/libvirtclass.txt
-./python/libvirt-py.[ch]
-./python/libvirtclass.py
-./python/gen_prog
-./python/*.pyc
-./python/tests/Makefile
-./python/tests/Makefile.in
-./tests/xml2sexprdata/Makefile
-./tests/xml2sexprdata/Makefile.in
-./tests/sexpr2xmldata/Makefile
-./tests/sexpr2xmldata/Makefile.in
-./tests/confdata/Makefile
-./tests/confdata/Makefile.in
-./tests/xmconfigdata/Makefile
-./tests/xmconfigdata/Makefile.in
-./tests/Makefile
-./tests/Makefile.in
-./tests/.deps
-./tests/.libs
-./tests/sexpr2xmltest
-./tests/xml2sexprtest
-./tests/virshtest
-./tests/conftest
-./tests/reconnect
-./tests/xmconfigtest
-./tests/xencapstest
-./tests/qemuxml2xmltest
-./tests/qemuxml2argvtest
-./tests/nodeinfotest
-./tests/statstest
-./tests/qparamtest
-./tests/*.gcda
-./tests/*.gcno
-./tests/*.exe
-./tests/xencapsdata/Makefile
-./tests/xencapsdata/Makefile.in
-./include/libvirt/Makefile
-./include/libvirt/Makefile.in
-./include/Makefile
-./include/Makefile.in
+*.a
+*.o
+*~
+.git
+ABOUT-NLS
+COPYING
+INSTALL
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache
+build-aux/compile
+build-aux/config.guess
+build-aux/config.rpath
+build-aux/config.sub
+build-aux/depcomp
+build-aux/install-sh
+build-aux/ltmain.sh
+build-aux/missing
+build-aux/mkinstalldirs
+build-aux/mktempd
+config.cache
+config.guess
+config.h
+config.h.in
+config.log
+config.rpath
+config.status
+config.sub
+configure
+coverage
+docs/.memdump
+docs/Makefile
+docs/Makefile.in
+docs/apibuild.pyc
+docs/devhelp/Makefile
+docs/devhelp/Makefile.in
+docs/devhelp/libvirt.devhelp
+docs/examples/.deps
+docs/examples/.libs
+docs/examples/.memdump
+docs/examples/Makefile
+docs/examples/Makefile.in
+docs/examples/info1
+docs/examples/python/Makefile
+docs/examples/python/Makefile.in
+docs/examples/suspend
+examples/domain-events/events-c/*.exe
+examples/domain-events/events-c/.deps
+examples/domain-events/events-c/.libs
+examples/domain-events/events-c/Makefile
+examples/domain-events/events-c/Makefile.in
+examples/domain-events/events-c/event-test
+gnulib/lib/*.la
+gnulib/lib/*.lo
+gnulib/lib/.deps
+gnulib/lib/.libs
+gnulib/lib/Makefile
+gnulib/lib/Makefile.in
+gnulib/lib/alloca.h
+gnulib/lib/arpa/inet.h
+gnulib/lib/arpa_inet.h
+gnulib/lib/errno.h
+gnulib/lib/float.h
+gnulib/lib/netdb.h
+gnulib/lib/netinet/in.h
+gnulib/lib/netinet_in.h
+gnulib/lib/poll.h
+gnulib/lib/stdbool.h
+gnulib/lib/stdint.h
+gnulib/lib/stdio.h
+gnulib/lib/stdlib.h
+gnulib/lib/string.h
+gnulib/lib/sys/select.h
+gnulib/lib/sys/socket.h
+gnulib/lib/sys/stat.h
+gnulib/lib/sys/time.h
+gnulib/lib/sys_ioctl.h
+gnulib/lib/sys_select.h
+gnulib/lib/sys_socket.h
+gnulib/lib/sys_stat.h
+gnulib/lib/sys_time.h
+gnulib/lib/time.h
+gnulib/lib/unistd.h
+gnulib/lib/wchar.h
+gnulib/tests/.deps
+gnulib/tests/.libs
+gnulib/tests/Makefile
+gnulib/tests/Makefile.in
+gnulib/tests/sys
+gnulib/tests/test-EOVERFLOW
+gnulib/tests/test-alloca-opt
+gnulib/tests/test-arpa_inet
+gnulib/tests/test-c-ctype
+gnulib/tests/test-errno
+gnulib/tests/test-fseeko
+gnulib/tests/test-getaddrinfo
+gnulib/tests/test-getdelim
+gnulib/tests/test-gethostname
+gnulib/tests/test-getline
+gnulib/tests/test-gettimeofday
+gnulib/tests/test-lseek
+gnulib/tests/test-lstat
+gnulib/tests/test-netdb
+gnulib/tests/test-netinet_in
+gnulib/tests/test-perror
+gnulib/tests/test-poll
+gnulib/tests/test-random_r
+gnulib/tests/test-snprintf
+gnulib/tests/test-sockets
+gnulib/tests/test-stdbool
+gnulib/tests/test-stdint
+gnulib/tests/test-stdio
+gnulib/tests/test-stdlib
+gnulib/tests/test-strerror
+gnulib/tests/test-string
+gnulib/tests/test-sys_select
+gnulib/tests/test-sys_socket
+gnulib/tests/test-sys_stat
+gnulib/tests/test-sys_time
+gnulib/tests/test-time
+gnulib/tests/test-unistd
+gnulib/tests/test-vasnprintf
+gnulib/tests/test-vasprintf
+gnulib/tests/test-wchar
+include/Makefile
+include/Makefile.in
+include/libvirt/Makefile
+include/libvirt/Makefile.in
+libtool
+libvirt-*.tar.gz
+libvirt.pc
+libvirt.spec
+ltconfig
+ltmain.sh
+m4/Makefile
+m4/Makefile.in
+m4/acinclude.m4
+m4/aclocal.m4
+mingw32-libvirt.spec
+mkinstalldirs
+po/*.gmo
+po/Makefile
+po/Makefile.in
+po/Makefile.in.in
+po/Makevars.template
+po/POTFILES
+po/Rules-quot
+po/boldquot.sed
+po/en(a)boldquot.header
+po/en(a)quot.header
+po/insert-header.sin
+po/quot.sed
+po/remove-potcdate.sed
+po/remove-potcdate.sin
+po/stamp-po
+proxy/.deps
+proxy/.libs
+proxy/Makefile
+proxy/Makefile.in
+proxy/libvirt_proxy
+python/*.la
+python/*.lo
+python/*.loT
+python/*.pyc
+python/.deps
+python/.libs
+python/Makefile
+python/Makefile.in
+python/gen_prog
+python/libvirt-export.c
+python/libvirt-py.[ch]
+python/libvirt.py
+python/libvirtclass.py
+python/libvirtclass.txt
+python/tests/Makefile
+python/tests/Makefile.in
+qemud/*.gcda
+qemud/*.gcno
+qemud/*.la
+qemud/*.lo
+qemud/.deps
+qemud/.libs
+qemud/Makefile
+qemud/Makefile.in
+qemud/libvirt_qemud
+qemud/libvirtd
+qemud/libvirtd.init
+qemud/libvirtd.logrotate
+results.log
+src/*.cov
+src/*.exe
+src/*.gcda
+src/*.gcno
+src/*.gcov
+src/*.la
+src/*.lo
+src/*.loT
+src/.deps
+src/.libs
+src/Makefile
+src/Makefile.in
+src/libvirt.syms
+src/libvirt_lxc
+src/libvirt_parthelper
+src/virsh
+src/virsh-net-edit.c
+src/virsh-pool-edit.c
+stamp-h
+stamp-h.in
+stamp-h1
+tests/*.exe
+tests/*.gcda
+tests/*.gcno
+tests/.deps
+tests/.libs
+tests/Makefile
+tests/Makefile.in
+tests/confdata/Makefile
+tests/confdata/Makefile.in
+tests/conftest
+tests/nodeinfotest
+tests/qemuxml2argvtest
+tests/qemuxml2xmltest
+tests/qparamtest
+tests/reconnect
+tests/sexpr2xmldata/Makefile
+tests/sexpr2xmldata/Makefile.in
+tests/sexpr2xmltest
+tests/statstest
+tests/virshtest
+tests/xencapsdata/Makefile
+tests/xencapsdata/Makefile.in
+tests/xencapstest
+tests/xmconfigdata/Makefile
+tests/xmconfigdata/Makefile.in
+tests/xmconfigtest
+tests/xml2sexprdata/Makefile
+tests/xml2sexprdata/Makefile.in
+tests/xml2sexprtest
+update.log
diff --git a/Makefile.maint b/Makefile.maint
index 43675f6..84309cf 100644
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -718,9 +718,9 @@ sync-vcs-ignore-files:
perl $(c2g)
rm -f $(c2g)
echo "syntax: glob" > .hgignore
- for ignore in `find $(srcdir) -name .gitignore`; do \
- dir=`dirname $$ignore`; \
- for rule in `cat $$ignore`; do \
- echo "$$dir/$$rule" >> .hgignore; \
- done ; \
- done
+ ( for ignore in $$($(VC_LIST) \
+ | grep -E '(^|/)\.gitignore$$'); do \
+ dir=$$(dirname "$$ignore"); \
+ test "$$dir" = . && pfx= || pfx=$$dir/; \
+ sed "s!^!$$pfx!" "$$ignore"; \
+ done ) | sort -u >> .hgignore
diff --git a/gnulib/lib/.cvsignore b/gnulib/lib/.cvsignore
index ba817ae..9d6b35f 100644
--- a/gnulib/lib/.cvsignore
+++ b/gnulib/lib/.cvsignore
@@ -1,13 +1,13 @@
-alloca.h
-arpa_inet.h
-.deps
-errno.h
-float.h
*.la
-.libs
*.lo
+.deps
+.libs
Makefile
Makefile.in
+alloca.h
+arpa_inet.h
+errno.h
+float.h
netdb.h
netinet_in.h
poll.h
diff --git a/gnulib/lib/.gitignore b/gnulib/lib/.gitignore
index ba817ae..9d6b35f 100644
--- a/gnulib/lib/.gitignore
+++ b/gnulib/lib/.gitignore
@@ -1,13 +1,13 @@
-alloca.h
-arpa_inet.h
-.deps
-errno.h
-float.h
*.la
-.libs
*.lo
+.deps
+.libs
Makefile
Makefile.in
+alloca.h
+arpa_inet.h
+errno.h
+float.h
netdb.h
netinet_in.h
poll.h
diff --git a/gnulib/lib/netinet/.cvsignore b/gnulib/lib/netinet/.cvsignore
index 95f1a2e..00fea9e 100644
--- a/gnulib/lib/netinet/.cvsignore
+++ b/gnulib/lib/netinet/.cvsignore
@@ -1 +1 @@
-in.h
\ No newline at end of file
+in.h
diff --git a/gnulib/lib/netinet/.gitignore b/gnulib/lib/netinet/.gitignore
index 95f1a2e..00fea9e 100644
--- a/gnulib/lib/netinet/.gitignore
+++ b/gnulib/lib/netinet/.gitignore
@@ -1 +1 @@
-in.h
\ No newline at end of file
+in.h
diff --git a/gnulib/lib/sys/.cvsignore b/gnulib/lib/sys/.cvsignore
index f6e392f..62c8ffb 100644
--- a/gnulib/lib/sys/.cvsignore
+++ b/gnulib/lib/sys/.cvsignore
@@ -1,4 +1,4 @@
select.h
socket.h
stat.h
-time.h
\ No newline at end of file
+time.h
diff --git a/gnulib/lib/sys/.gitignore b/gnulib/lib/sys/.gitignore
index f6e392f..62c8ffb 100644
--- a/gnulib/lib/sys/.gitignore
+++ b/gnulib/lib/sys/.gitignore
@@ -1,4 +1,4 @@
select.h
socket.h
stat.h
-time.h
\ No newline at end of file
+time.h
diff --git a/m4/.cvsignore b/m4/.cvsignore
index 0063d7a..09797f0 100644
--- a/m4/.cvsignore
+++ b/m4/.cvsignore
@@ -1,3 +1,4 @@
-*.m4
Makefile
Makefile.in
+acinclude.m4
+aclocal.m4
diff --git a/m4/.gitignore b/m4/.gitignore
index 0063d7a..09797f0 100644
--- a/m4/.gitignore
+++ b/m4/.gitignore
@@ -1,3 +1,4 @@
-*.m4
Makefile
Makefile.in
+acinclude.m4
+aclocal.m4
--
1.6.1.399.g0d272
>From e718a0203a74f370cca32250708e5765d6f03b8e Mon Sep 17 00:00:00 2001
From: Jim Meyering <meyering(a)redhat.com>
Date: Fri, 23 Jan 2009 11:55:59 +0100
Subject: [PATCH 2/2] m4: update from gnulib to avoid warnings from cutting-edge autoconf
* gnulib/m4/errno_h.m4
* gnulib/m4/gnulib-comp.m4
* gnulib/m4/multiarch.m4
---
gnulib/m4/errno_h.m4 | 12 +++---------
gnulib/m4/gnulib-comp.m4 | 5 ++---
gnulib/m4/multiarch.m4 | 16 ++++------------
3 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/gnulib/m4/errno_h.m4 b/gnulib/m4/errno_h.m4
index 0682d1a..4d77672 100644
--- a/gnulib/m4/errno_h.m4
+++ b/gnulib/m4/errno_h.m4
@@ -1,17 +1,11 @@
-# errno_h.m4 serial 3
+# errno_h.m4 serial 4
dnl Copyright (C) 2004, 2006, 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
-AC_DEFUN([gl_HEADER_ERRNO_H],
-[
- dnl Use AC_REQUIRE here, so that the default behavior below is expanded
- dnl once only, before all statements that occur in other macros.
- AC_REQUIRE([gl_HEADER_ERRNO_H_BODY])
-])
-
-AC_DEFUN([gl_HEADER_ERRNO_H_BODY],
+dnl This macro must pass through AC_REQUIRE (never directly invoke it).
+AC_DEFUN_ONCE([gl_HEADER_ERRNO_H],
[
AC_REQUIRE([AC_PROG_CC])
AC_CACHE_CHECK([for complete errno.h], [gl_cv_header_errno_h_complete], [
diff --git a/gnulib/m4/gnulib-comp.m4 b/gnulib/m4/gnulib-comp.m4
index e8747d8..3879843 100644
--- a/gnulib/m4/gnulib-comp.m4
+++ b/gnulib/m4/gnulib-comp.m4
@@ -25,7 +25,6 @@ AC_DEFUN([gl_EARLY],
m4_pattern_allow([^gl_LIBOBJS$])dnl a variable
m4_pattern_allow([^gl_LTLIBOBJS$])dnl a variable
AC_REQUIRE([AC_PROG_RANLIB])
- AC_REQUIRE([AC_GNU_SOURCE])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_REQUIRE([AC_FUNC_FSEEKO])
])
@@ -57,7 +56,7 @@ AC_SUBST([LTALLOCA])
AC_LIBOBJ([connect])
fi
gl_SYS_SOCKET_MODULE_INDICATOR([connect])
- gl_HEADER_ERRNO_H
+ AC_REQUIRE([gl_HEADER_ERRNO_H])
gl_FUNC_FCLOSE
gl_STDIO_MODULE_INDICATOR([fclose])
gl_FLOAT_H
@@ -97,7 +96,7 @@ AC_SUBST([LTALLOCA])
gl_STDLIB_MODULE_INDICATOR([malloc-posix])
gl_FUNC_MKSTEMP
gl_STDLIB_MODULE_INDICATOR([mkstemp])
- gl_MULTIARCH
+ AC_REQUIRE([gl_MULTIARCH])
gl_HEADER_NETDB
gl_HEADER_NETINET_IN
AC_PROG_MKDIR_P
diff --git a/gnulib/m4/multiarch.m4 b/gnulib/m4/multiarch.m4
index 7b73e15..3948e6e 100644
--- a/gnulib/m4/multiarch.m4
+++ b/gnulib/m4/multiarch.m4
@@ -1,5 +1,5 @@
-# multiarch.m4 serial 3
-dnl Copyright (C) 2008 Free Software Foundation, Inc.
+# multiarch.m4 serial 4
+dnl Copyright (C) 2008, 2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
dnl with or without modifications, as long as this notice is preserved.
@@ -19,16 +19,8 @@ dnl with or without modifications, as long as this notice is preserved.
# Detect this situation and set the macro AA_APPLE_UNIVERSAL_BUILD at the
# beginning of config.h and set APPLE_UNIVERSAL_BUILD accordingly.
-AC_DEFUN([gl_MULTIARCH],
-[
- dnl This AC_REQUIRE is not necessary in theory. It works around a bug in
- dnl autoconf <= 2.63: AC_REQUIRE invocations inside AC_REQUIREd macros are
- dnl being handled better than AC_REQUIRE invocations inside normally invoked
- dnl macros.
- AC_REQUIRE([gl_MULTIARCH_BODY])
-])
-
-AC_DEFUN([gl_MULTIARCH_BODY],
+dnl This macro must pass through AC_REQUIRE (never directly invoke it).
+AC_DEFUN_ONCE([gl_MULTIARCH],
[
dnl Code similar to autoconf-2.63 AC_C_BIGENDIAN.
gl_cv_c_multiarch=no
--
1.6.1.399.g0d272
1
0
23 Jan '09
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232675291 28800
# Node ID 903a29e99c80a35ce7f4754a3bcc3ab34bf32d8a
# Parent b83af161640c69b1de279547b270b8acb101152e
Fix recursive lock in xenstore driver
The watch handlers take the driver lock, so must use an internalized
version of xenStoreListDomains().
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/xs_internal.c b/src/xs_internal.c
--- a/src/xs_internal.c
+++ b/src/xs_internal.c
@@ -565,6 +565,46 @@ xenStoreNumOfDomains(virConnectPtr conn)
}
/**
+ * xenStoreDoListDomains:
+ * @conn: pointer to the hypervisor connection
+ * @ids: array to collect the list of IDs of active domains
+ * @maxids: size of @ids
+ *
+ * Internal API: collect the list of active domains, and store
+ * their ID in @maxids. The driver lock must be held.
+ *
+ * Returns the number of domain found or -1 in case of error
+ */
+int
+xenStoreDoListDomains(xenUnifiedPrivatePtr priv, int *ids, int maxids)
+{
+ char **idlist = NULL, *endptr;
+ unsigned int num, i;
+ int ret = -1;
+ long id;
+
+ if (priv->xshandle == NULL)
+ goto out;
+
+ idlist = xs_directory (priv->xshandle, 0, "/local/domain", &num);
+ if (idlist == NULL)
+ goto out;
+
+ for (ret = 0, i = 0; (i < num) && (ret < maxids); i++) {
+ id = strtol(idlist[i], &endptr, 10);
+ if ((endptr == idlist[i]) || (*endptr != 0))
+ goto out;
+ ids[ret++] = (int) id;
+ }
+
+ free(idlist);
+
+out:
+ VIR_FREE (idlist);
+ return ret;
+}
+
+/**
* xenStoreListDomains:
* @conn: pointer to the hypervisor connection
* @ids: array to collect the list of IDs of active domains
@@ -577,11 +617,8 @@ int
int
xenStoreListDomains(virConnectPtr conn, int *ids, int maxids)
{
- char **idlist = NULL, *endptr;
- unsigned int num, i;
+ xenUnifiedPrivatePtr priv;
int ret;
- long id;
- xenUnifiedPrivatePtr priv;
if ((conn == NULL) || (ids == NULL)) {
virXenStoreError(conn, VIR_ERR_INVALID_ARG, __FUNCTION__);
@@ -591,32 +628,10 @@ xenStoreListDomains(virConnectPtr conn,
priv = (xenUnifiedPrivatePtr) conn->privateData;
xenUnifiedLock(priv);
- if (priv->xshandle == NULL)
- goto error;
-
- idlist = xs_directory (priv->xshandle, 0, "/local/domain", &num);
- if (idlist == NULL)
- goto error;
-
- for (ret = 0, i = 0; (i < num) && (ret < maxids); i++) {
- id = strtol(idlist[i], &endptr, 10);
- if ((endptr == idlist[i]) || (*endptr != 0)) {
- ret = -1;
- break;
- }
-#if 0
- if (virConnectCheckStoreID(conn, (int) id) < 0)
- continue;
-#endif
- ids[ret++] = (int) id;
- }
- free(idlist);
+ ret = xenStoreDoListDomains(priv, ids, maxids);
xenUnifiedUnlock(priv);
+
return(ret);
-
-error:
- xenUnifiedUnlock(priv);
- return -1;
}
/**
@@ -1260,7 +1275,7 @@ retry:
"%s", _("failed to allocate domids"));
return -1;
}
- nread = xenStoreListDomains(conn, new_domids, new_domain_cnt);
+ nread = xenStoreDoListDomains(priv, new_domids, new_domain_cnt);
if (nread != new_domain_cnt) {
// mismatch. retry this read
VIR_FREE(new_domids);
@@ -1342,7 +1357,7 @@ retry:
"%s", _("failed to allocate domids"));
return -1;
}
- nread = xenStoreListDomains(conn, new_domids, new_domain_cnt);
+ nread = xenStoreDoListDomains(priv, new_domids, new_domain_cnt);
if (nread != new_domain_cnt) {
// mismatch. retry this read
VIR_FREE(new_domids);
2
1
22 Jan '09
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232562942 28800
# Node ID 14b7020610538fbaf0cd5db5e713abe5769de2af
# Parent e0b0295722ecf4645983e3a9a090e0aaabc40da7
Parse ipaddr for bridge network types
As well as supporting round-tripping of the IP address, this fixes a
leak if ipaddr was specified in the Xen domain config.
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/domain_conf.c b/src/domain_conf.c
--- a/src/domain_conf.c
+++ b/src/domain_conf.c
@@ -289,6 +289,7 @@ void virDomainNetDefFree(virDomainNetDef
case VIR_DOMAIN_NET_TYPE_BRIDGE:
VIR_FREE(def->data.bridge.brname);
VIR_FREE(def->data.bridge.script);
+ VIR_FREE(def->data.bridge.ipaddr);
break;
}
@@ -887,7 +888,8 @@ virDomainNetDefParseXML(virConnectPtr co
address = virXMLPropString(cur, "address");
port = virXMLPropString(cur, "port");
} else if ((address == NULL) &&
- (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET) &&
+ (def->type == VIR_DOMAIN_NET_TYPE_ETHERNET ||
+ def->type == VIR_DOMAIN_NET_TYPE_BRIDGE) &&
(xmlStrEqual(cur->name, BAD_CAST "ip"))) {
address = virXMLPropString(cur, "address");
} else if ((ifname == NULL) &&
@@ -953,6 +955,10 @@ virDomainNetDefParseXML(virConnectPtr co
if (script != NULL) {
def->data.bridge.script = script;
script = NULL;
+ }
+ if (address != NULL) {
+ def->data.bridge.ipaddr = address;
+ address = NULL;
}
break;
@@ -2889,6 +2895,9 @@ virDomainNetDefFormat(virConnectPtr conn
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virBufferEscapeString(buf, " <source bridge='%s'/>\n",
def->data.bridge.brname);
+ if (def->data.bridge.ipaddr)
+ virBufferVSprintf(buf, " <ip address='%s'/>\n",
+ def->data.bridge.ipaddr);
if (def->data.bridge.script)
virBufferEscapeString(buf, " <script path='%s'/>\n",
def->data.bridge.script);
diff --git a/src/domain_conf.h b/src/domain_conf.h
--- a/src/domain_conf.h
+++ b/src/domain_conf.h
@@ -155,6 +155,7 @@ struct _virDomainNetDef {
struct {
char *brname;
char *script;
+ char *ipaddr;
} bridge;
} data;
char *ifname;
diff --git a/src/xend_internal.c b/src/xend_internal.c
--- a/src/xend_internal.c
+++ b/src/xend_internal.c
@@ -1756,10 +1756,18 @@ xenDaemonParseSxprNets(virConnectPtr con
net->type == VIR_DOMAIN_NET_TYPE_BRIDGE &&
!(net->data.bridge.script = strdup(tmp2)))
goto no_memory;
+ tmp = sexpr_node(node, "device/vif/ip");
+ if (tmp &&
+ !(net->data.bridge.ipaddr = strdup(tmp)))
+ goto no_memory;
} else {
net->type = VIR_DOMAIN_NET_TYPE_ETHERNET;
if (tmp2 &&
!(net->data.ethernet.script = strdup(tmp2)))
+ goto no_memory;
+ tmp = sexpr_node(node, "device/vif/ip");
+ if (tmp &&
+ !(net->data.ethernet.ipaddr = strdup(tmp)))
goto no_memory;
}
@@ -1793,11 +1801,6 @@ xenDaemonParseSxprNets(virConnectPtr con
net->mac[4] = mac[4];
net->mac[5] = mac[5];
}
-
- tmp = sexpr_node(node, "device/vif/ip");
- if (tmp &&
- !(net->data.ethernet.ipaddr = strdup(tmp)))
- goto no_memory;
if (model &&
!(net->model = strdup(model)))
@@ -5104,6 +5107,8 @@ xenDaemonFormatSxprNet(virConnectPtr con
script = def->data.bridge.script;
virBufferVSprintf(buf, "(script '%s')", script);
+ if (def->data.bridge.ipaddr != NULL)
+ virBufferVSprintf(buf, "(ip '%s')", def->data.bridge.ipaddr);
break;
case VIR_DOMAIN_NET_TYPE_NETWORK:
diff --git a/src/xm_internal.c b/src/xm_internal.c
--- a/src/xm_internal.c
+++ b/src/xm_internal.c
@@ -1071,6 +1071,9 @@ xenXMDomainConfigParse(virConnectPtr con
if (script[0] &&
!(net->data.bridge.script = strdup(script)))
goto no_memory;
+ if (ip[0] &&
+ !(net->data.bridge.ipaddr = strdup(ip)))
+ goto no_memory;
} else {
if (script[0] &&
!(net->data.ethernet.script = strdup(script)))
@@ -1832,6 +1835,8 @@ static int xenXMDomainConfigFormatNet(vi
switch (net->type) {
case VIR_DOMAIN_NET_TYPE_BRIDGE:
virBufferVSprintf(&buf, ",bridge=%s", net->data.bridge.brname);
+ if (net->data.bridge.ipaddr)
+ virBufferVSprintf(&buf, ",ip=%s", net->data.bridge.ipaddr);
break;
case VIR_DOMAIN_NET_TYPE_ETHERNET:
diff --git a/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.sexpr b/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.sexpr
new file mode 100644
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.sexpr
@@ -0,0 +1,2 @@
+(domain (domid 6)(name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d2171f48fb2e068e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5… ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge')(ip '192.0.2.1')))
+
diff --git a/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml b/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml
new file mode 100644
--- /dev/null
+++ b/tests/sexpr2xmldata/sexpr2xml-bridge-ipaddr.xml
@@ -0,0 +1,34 @@
+<domain type='xen' id='6'>
+ <name>pvtest</name>
+ <uuid>596a5d21-71f4-8fb2-e068-e2386a5c413e</uuid>
+ <memory>430080</memory>
+ <currentMemory>430080</currentMemory>
+ <vcpu>2</vcpu>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5… </cmdline>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <driver name='file'/>
+ <source file='/root/some.img'/>
+ <target dev='xvda' bus='xen'/>
+ </disk>
+ <interface type='bridge'>
+ <mac address='00:11:22:33:44:55'/>
+ <source bridge='xenbr2'/>
+ <ip address='192.0.2.1'/>
+ <script path='vif-bridge'/>
+ <target dev='vif6.0'/>
+ </interface>
+ <console type='pty'>
+ <target port='0'/>
+ </console>
+ </devices>
+</domain>
diff --git a/tests/sexpr2xmltest.c b/tests/sexpr2xmltest.c
--- a/tests/sexpr2xmltest.c
+++ b/tests/sexpr2xmltest.c
@@ -117,6 +117,7 @@ mymain(int argc, char **argv)
DO_TEST("net-routed", "net-routed", 2);
DO_TEST("net-bridged", "net-bridged", 2);
DO_TEST("net-e1000", "net-e1000", 2);
+ DO_TEST("bridge-ipaddr", "bridge-ipaddr", 3);
DO_TEST("no-source-cdrom", "no-source-cdrom", 2);
DO_TEST("fv-utc", "fv-utc", 1);
diff --git a/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.sexpr b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.sexpr
new file mode 100644
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.sexpr
@@ -0,0 +1,1 @@
+(vm (name 'pvtest')(memory 420)(maxmem 420)(vcpus 2)(uuid '596a5d21-71f4-8fb2-e068-e2386a5c413e')(on_poweroff 'destroy')(on_reboot 'destroy')(on_crash 'destroy')(image (linux (kernel '/var/lib/xen/vmlinuz.2Dn2YT')(ramdisk '/var/lib/xen/initrd.img.0u-Vhq')(args ' method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5… ')))(device (vbd (dev 'xvda')(uname 'file:/root/some.img')(mode 'w')))(device (vif (mac '00:11:22:33:44:55')(bridge 'xenbr2')(script 'vif-bridge')(ip '192.0.2.1'))))
\ No newline at end of file
diff --git a/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml
new file mode 100644
--- /dev/null
+++ b/tests/xml2sexprdata/xml2sexpr-bridge-ipaddr.xml
@@ -0,0 +1,30 @@
+<domain type='xen' id='15'>
+ <name>pvtest</name>
+ <uuid>596a5d2171f48fb2e068e2386a5c413e</uuid>
+ <os>
+ <type>linux</type>
+ <kernel>/var/lib/xen/vmlinuz.2Dn2YT</kernel>
+ <initrd>/var/lib/xen/initrd.img.0u-Vhq</initrd>
+ <cmdline> method=http://download.fedora.devel.redhat.com/pub/fedora/linux/core/test/5… </cmdline>
+ </os>
+ <memory>430080</memory>
+ <vcpu>2</vcpu>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>destroy</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <disk type='file' device='disk'>
+ <source file='/root/some.img'/>
+ <target dev='xvda'/>
+ </disk>
+ <interface type="bridge">
+ <mac address="00:11:22:33:44:55"/>
+ <source bridge="xenbr2"/>
+ <ip address="192.0.2.1"/>
+ <script path="vif-bridge"/>
+ <target dev="vif4.0"/>
+ </interface>
+ <console tty='/dev/pts/4'/>
+ </devices>
+</domain>
+
diff --git a/tests/xml2sexprtest.c b/tests/xml2sexprtest.c
--- a/tests/xml2sexprtest.c
+++ b/tests/xml2sexprtest.c
@@ -126,6 +126,7 @@ mymain(int argc, char **argv)
DO_TEST("net-routed", "net-routed", "pvtest", 2);
DO_TEST("net-bridged", "net-bridged", "pvtest", 2);
DO_TEST("net-e1000", "net-e1000", "pvtest", 2);
+ DO_TEST("bridge-ipaddr", "bridge-ipaddr", "pvtest", 2);
DO_TEST("no-source-cdrom", "no-source-cdrom", "test", 2);
DO_TEST("fv-utc", "fv-utc", "fvtest", 1);
4
4
Hi,
i tried to use virt-viewer to connect to a remote machine
running libvirt & kvm-qemu at FC9 - but it failed.
So, I run virsh without the URL directly on FC9, it works (e.g. virsh
list).
If I use a connection URL, it failed.
Did I miss something ?
regards
Danny
[root@xxx03 ~]# virsh list
Id Name State
----------------------------------
oot@xxx03 ~]# virsh -c qemu+tls://localhost list
libvir: Remote error : Certificate's owner does not match the hostname
(localhost)
libvir: Remote error : unable to connect to 'localhost': Invalid
argument
error: failed to connect to the hypervisor
[root@xxx03 ~]# virsh -c qemu+tls://xxx03.domainname.com list
libvir: error : could not connect to qemu://
error: failed to connect to the hypervisor
*** Port is available:
[root@ xxx03 ~]# netstat -nl | grep 16514
tcp 0 0 0.0.0.0:16514 0.0.0.0:*
LISTEN
*** Also, a ssh does not work:
[root@xxx03 ~]# virsh -c qemu+ssh://xxx03.domainname.com list
root(a)xxx03.domainname.com password:
libvir: error : could not connect to qemu://
error: failed to connect to the hypervisor
** Connecting directly works:
[root@ xxx03 ~]# virsh -c qemu:///system list
Id Name State
----------------------------------
** but not with the remote name like
[root@ xxx03 ~]# virsh -c qemu://xxx03.domainname.com /system list
libvir: error : could not connect to qemu://xxx03.domainname.com /system
error: failed to connect to the hypervisor
2
4
22 Jan '09
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232574142 28800
# Node ID 0a35ce4ac7e0cf83df188dea0fc37818b4c39d48
# Parent fc06d88e4140cebc9d0b7795019c0c2741c3f8a9
Remove non-existent symbol from linker script
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -205,7 +205,6 @@ virNetworkObjListFree;
virNetworkObjListFree;
virNetworkDefParseNode;
virNetworkRemoveInactive;
-virNetworkSaveConfigXML;
virNetworkSaveConfig;
virNetworkObjLock;
virNetworkObjUnlock;
4
4
# HG changeset patch
# User john.levon(a)sun.com
# Date 1232576262 28800
# Node ID c58822f94b2b5e87a363128a4bd36ec2846054fe
# Parent c109dd0801246b82aed8d5f9b1fa4196432868d0
Add a rule for generating .hgignore
Signed-off-by: John Levon <john.levon(a)sun.com>
diff --git a/Makefile.maint b/Makefile.maint
--- a/Makefile.maint
+++ b/Makefile.maint
@@ -717,3 +717,5 @@ sync-vcs-ignore-files:
mv $(c2g)-t $(c2g)
perl $(c2g)
rm -f $(c2g)
+ find $(srcdir) -name .gitignore | xargs cat \
+ | sort -u | sed 's+\*+.*+' >.hgignore
4
5
[libvirt] PATCH: Add RNG schemas for capabilities, storage and node device XML
by Daniel P. Berrange 22 Jan '09
by Daniel P. Berrange 22 Jan '09
22 Jan '09
We currently only have RNG schemas for the domain XML and network XML.
This patch adds more RNG schemas covering the host capabilities XML,
the storage pool and storage volume XML and node device XML
In addition it sets up the makefile to install all these schemas
into /usr/share/libvirt/schemas/, instead if just randomly stuffing
them into RPM %docs section
Finally, test cases and example XML files are added to check correctness
of the schemas and XML
a/docs/libvirt.rng | 1111 ----------
a/docs/network.rng | 69
b/docs/schemas/Makefile.am | 12
b/docs/schemas/capability.rng | 287 ++
b/docs/schemas/domain.rng | 1111 ++++++++++
b/docs/schemas/network.rng | 69
b/docs/schemas/nodedev.rng | 360 +++
b/docs/schemas/storagepool.rng | 371 +++
b/docs/schemas/storagevol.rng | 187 +
b/tests/capabilityschemadata/caps-qemu-kvm.xml | 111
b/tests/capabilityschemadata/caps-test.xml | 71
b/tests/capabilityschematest | 34
b/tests/networkschematest | 33
b/tests/nodedevschemadata/DVD_GCC_4247N.xml | 17
b/tests/nodedevschemadata/computer.xml | 18
b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml | 11
b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml | 11
b/tests/nodedevschemadata/pci_1002_71c4.xml | 14
b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml | 9
b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml | 9
b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml | 13
b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml | 9
b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml | 14
b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml | 12
b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml | 12
b/tests/nodedevschematest | 33
b/tests/storagepoolschemadata/pool-dir.xml | 17
b/tests/storagepoolschemadata/pool-disk.xml | 22
b/tests/storagepoolschemadata/pool-fs.xml | 20
b/tests/storagepoolschemadata/pool-iscsi.xml | 10
b/tests/storagepoolschemadata/pool-logical.xml | 19
b/tests/storagepoolschemadata/pool-netfs.xml | 21
b/tests/storagepoolschematest | 33
b/tests/storagevolschemadata/vol-logical.xml | 21
b/tests/storagevolschemadata/vol-partition.xml | 21
b/tests/storagevolschemadata/vol-qcow2.xml | 28
b/tests/storagevolschematest | 33
configure.in | 1
docs/Makefile.am | 8
libvirt.spec.in | 11
mingw32-libvirt.spec.in | 9
tests/Makefile.am | 20
tests/domainschematest | 3
43 files changed, 3115 insertions(+), 1190 deletions(-)
Daniel
diff -r 8eb4d4028b98 configure.in
--- a/configure.in Wed Jan 21 15:47:23 2009 +0000
+++ b/configure.in Wed Jan 21 16:28:43 2009 +0000
@@ -1272,6 +1272,7 @@ cp -f COPYING.LIB COPYING
AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
docs/examples/Makefile docs/devhelp/Makefile \
docs/examples/python/Makefile \
+ docs/schemas/Makefile \
gnulib/lib/Makefile \
gnulib/tests/Makefile \
libvirt.pc libvirt.spec mingw32-libvirt.spec \
diff -r 8eb4d4028b98 docs/Makefile.am
--- a/docs/Makefile.am Wed Jan 21 15:47:23 2009 +0000
+++ b/docs/Makefile.am Wed Jan 21 16:28:43 2009 +0000
@@ -1,5 +1,5 @@
## Process this file with automake to produce Makefile.in
-SUBDIRS= . examples devhelp
+SUBDIRS= schemas examples devhelp
# The directory containing the source code (if it contains documentation).
DOC_SOURCE_DIR=../src
@@ -52,10 +52,6 @@ xml = \
testnetpriv.xml \
testnode.xml
-rng = \
- libvirt.rng \
- network.rng
-
fig = \
libvirt-net-logical.fig \
libvirt-net-physical.fig
@@ -64,7 +60,7 @@ EXTRA_DIST= \
libvirt-api.xml libvirt-refs.xml apibuild.py \
site.xsl newapi.xsl news.xsl page.xsl ChangeLog.xsl \
$(dot_html) $(dot_html_in) $(gif) $(apihtml) $(apipng) \
- $(xml) $(rng) $(fig) $(png) \
+ $(xml) $(fig) $(png) \
virsh.pod ChangeLog.awk
all: web $(top_builddir)/NEWS $(man_MANS)
diff -r 8eb4d4028b98 docs/libvirt.rng
--- a/docs/libvirt.rng Wed Jan 21 15:47:23 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,1111 +0,0 @@
-<?xml version="1.0" ?>
-<grammar xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <!-- We handle only document defining a domain -->
- <start>
- <ref name='domain'/>
- </start>
-
- <!--
- We handle only document defining a domain
- -->
- <define name='domain'>
- <element name="domain">
- <ref name='hvs'/>
- <ref name='ids'/>
- <interleave>
- <ref name='os'/>
- <ref name='clock'/>
- <ref name='resources'/>
- <ref name='features'/>
- <ref name='termination'/>
- <optional>
- <ref name='devices'/>
- </optional>
- </interleave>
- </element>
- </define>
-
- <define name='hvs'>
- <attribute name='type'>
- <choice>
- <value>xen</value>
- <value>kvm</value>
- <value>kqemu</value>
- <value>qemu</value>
- <value>lxc</value>
- <value>openvz</value>
- <value>test</value>
- </choice>
- </attribute>
- </define>
-
- <define name='os'>
- <choice>
- <ref name='osxen'/>
- <ref name='oshvm'/>
- <ref name='osexe'/>
- </choice>
- </define>
-
- <define name='osxen'>
- <choice>
- <group>
- <optional>
- <ref name='bootloader'/>
- </optional>
- <element name='os'>
- <ref name='ostypexen'/>
- <ref name='osbootkernel'/>
- </element>
- </group>
- <group>
- <ref name='bootloader'/>
- <optional>
- <element name='os'>
- <ref name='ostypexen'/>
- <optional>
- <ref name='osbootkernel'/>
- </optional>
- </element>
- </optional>
- </group>
- </choice>
- </define>
-
-
- <define name='oshvm'>
- <element name='os'>
- <ref name='ostypehvm'/>
- <interleave>
- <optional>
- <element name='loader'>
- <ref name='absFilePath'/>
- </element>
- </optional>
- <choice>
- <ref name='osbootkernel'/>
- <ref name='osbootdev'/>
- </choice>
- </interleave>
- </element>
- </define>
-
-
- <define name='ostypexen'>
- <element name='type'>
- <optional>
- <attribute name='arch'>
- <choice>
- <value>i686</value>
- <value>x86_64</value>
- <value>ia64</value>
- </choice>
- </attribute>
- </optional>
- <optional>
- <attribute name='machine'>
- <choice>
- <value>xenpv</value>
- <value>xenner</value>
- </choice>
- </attribute>
- </optional>
- <choice>
- <value>xen</value>
- <value>linux</value>
- </choice>
- </element>
- </define>
-
- <define name='ostypehvm'>
- <element name='type'>
- <optional>
- <choice>
- <ref name='hvmx86'/>
- <ref name='hvmmips'/>
- <ref name='hvmsparc'/>
- <ref name='hvmppc'/>
- </choice>
- </optional>
- <value>hvm</value>
- </element>
- </define>
-
- <define name='hvmx86'>
- <group>
- <attribute name='arch'>
- <choice>
- <value>i686</value>
- <value>x86_64</value>
- </choice>
- </attribute>
- <attribute name='machine'>
- <choice>
- <value>xenfv</value>
- <value>pc</value>
- <value>isapc</value>
- </choice>
- </attribute>
- </group>
- </define>
-
- <define name='hvmmips'>
- <group>
- <attribute name='arch'>
- <value>mips</value>
- </attribute>
- <attribute name='machine'>
- <value>mips</value>
- </attribute>
- </group>
- </define>
-
- <define name='hvmsparc'>
- <group>
- <attribute name='arch'>
- <value>sparc</value>
- </attribute>
- <attribute name='machine'>
- <value>sun4m</value>
- </attribute>
- </group>
- </define>
-
- <define name='hvmppc'>
- <group>
- <attribute name='arch'>
- <value>ppc</value>
- </attribute>
- <attribute name='machine'>
- <choice>
- <value>g3bw</value>
- <value>mac99</value>
- <value>prep</value>
- </choice>
- </attribute>
- </group>
- </define>
-
-
- <define name='osexe'>
- <element name='os'>
- <element name='type'>
- <value>exe</value>
- </element>
- <interleave>
- <optional>
- <element name='init'>
- <ref name='absFilePath'/>
- </element>
- </optional>
- </interleave>
- </element>
- </define>
-
-
-
- <!--
- The Identifiers can be:
- - an optional id attribute with a number on the domain element
- - a mandatory name
- - an optional uuid
- -->
- <define name='ids'>
- <optional>
- <attribute name='id'>
- <ref name='unsignedInt'/>
- </attribute>
- </optional>
- <interleave>
- <element name="name">
- <ref name='domainName'/>
- </element>
- <optional>
- <element name="uuid">
- <ref name='UUID'/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <!--
- Resources usage defines the amount of memory (maximum and possibly
- current usage) and number of virtual CPUs used by that domain.
- We can't check here the rule that currentMemory <= memory
- -->
-
- <define name='resources'>
- <interleave>
- <element name='memory'>
- <ref name='memoryKB'/>
- </element>
- <optional>
- <element name='currentMemory'>
- <ref name='memoryKB'/>
- </element>
- </optional>
- <optional>
- <element name='vcpu'>
- <optional>
- <attribute name='cpuset' />
- </optional>
- <ref name='countCPU'/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <define name='clock'>
- <optional>
- <element name='clock'>
- <attribute name='offset'>
- <choice>
- <value>localtime</value>
- <value>utc</value>
- </choice>
- </attribute>
- <empty/>
- </element>
- </optional>
- </define>
-
- <!--
- A bootloader may be used to extract the OS information instead of
- defining the OS parameter in the instance. It points just to the
- binary or script used to extract the data from the first disk device.
- -->
- <define name='bootloader'>
- <interleave>
- <element name='bootloader'>
- <choice>
- <ref name='absFilePath'/>
- <empty/>
- </choice>
- </element>
- <optional>
- <element name='bootloader_args'>
- <text/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <define name='osbootkernel'>
- <interleave>
- <element name='kernel'>
- <ref name='absFilePath'/>
- </element>
- <optional>
- <element name='initrd'>
- <ref name='absFilePath'/>
- </element>
- </optional>
- <optional>
- <element name='root'>
- <ref name='devicePath'/>
- </element>
- </optional>
- <optional>
- <element name='cmdline'>
- <text/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <define name='osbootdev'>
- <element name='boot'>
- <attribute name='dev'>
- <choice>
- <value>hd</value>
- <value>fd</value>
- <value>cdrom</value>
- <value>network</value>
- </choice>
- </attribute>
- <empty/>
- </element>
- </define>
-
-
- <define name='diskspec'>
- <optional>
- <ref name='driver'/>
- </optional>
- <ref name='target'/>
- <optional>
- <element name='readonly'>
- <empty/>
- </element>
- </optional>
- <optional>
- <element name='shareable'>
- <empty/>
- </element>
- </optional>
- </define>
-
- <!--
- A disk description can be either of type file or block
- The name of the attribute on the source element depends on the type
-
- -->
- <define name='disk'>
- <element name='disk'>
- <optional>
- <attribute name='device'>
- <choice>
- <value>floppy</value>
- <value>disk</value>
- <value>cdrom</value>
- </choice>
- </attribute>
- </optional>
- <choice>
- <group>
- <attribute name='type'>
- <value>file</value>
- </attribute>
- <interleave>
- <optional>
- <element name='source'>
- <attribute name='file'>
- <ref name='absFilePath'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <ref name='diskspec'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>block</value>
- </attribute>
- <interleave>
- <optional>
- <element name='source'>
- <attribute name='dev'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <ref name='diskspec'/>
- </interleave>
- </group>
- <ref name='diskspec'/>
- </choice>
- </element>
- </define>
-
- <define name='target'>
- <element name='target'>
- <attribute name='dev'>
- <ref name='deviceName'/>
- </attribute>
- <optional>
- <attribute name='bus'>
- <choice>
- <value>ide</value>
- <value>virtio</value>
- <value>fdc</value>
- <value>xen</value>
- <value>usb</value>
- </choice>
- </attribute>
- </optional>
- </element>
- </define>
-
- <!--
- Disk may use a special driver for access. Currently this is
- only defined for Xen for tap/aio and file, but will certainly be
- extended in the future, and libvirt doesn't look for specific values.
- -->
- <define name='driver'>
- <element name='driver'>
- <attribute name='name'>
- <ref name='genericName'/>
- </attribute>
- <optional>
- <attribute name='type'>
- <ref name='genericName'/>
- </attribute>
- </optional>
- <empty/>
- </element>
- </define>
-
- <define name='filesystem'>
- <element name='filesystem'>
- <choice>
- <group>
- <attribute name='type'>
- <value>file</value>
- </attribute>
- <interleave>
- <element name='source'>
- <attribute name='file'>
- <ref name='absFilePath'/>
- </attribute>
- <empty/>
- </element>
- <ref name='filesystemtgt'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>block</value>
- </attribute>
- <interleave>
- <element name='source'>
- <attribute name='dev'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- <ref name='filesystemtgt'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>mount</value>
- </attribute>
- <interleave>
- <element name='source'>
- <attribute name='dir'>
- <ref name='absFilePath'/>
- </attribute>
- <empty/>
- </element>
- <ref name='filesystemtgt'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>template</value>
- </attribute>
- <interleave>
- <element name='source'>
- <attribute name='name'>
- <ref name='genericName'/>
- </attribute>
- <empty/>
- </element>
- <ref name='filesystemtgt'/>
- </interleave>
- </group>
- </choice>
- </element>
- </define>
-
- <define name='filesystemtgt'>
- <element name='target'>
- <attribute name='dir'>
- <ref name='absDirPath'/>
- </attribute>
- <empty/>
- </element>
- </define>
-
- <!--
- An interface description can either be of type bridge in which case
- it will use a bridging source, or of type ethernet which uses a device
- source and a device target instead. They both share a set of interface
- options. FIXME
- -->
- <define name='interface'>
- <element name='interface'>
- <choice>
- <group>
- <attribute name='type'>
- <value>bridge</value>
- </attribute>
- <interleave>
- <optional>
- <element name='source'>
- <attribute name='bridge'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <ref name='interface-options'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>ethernet</value>
- </attribute>
- <interleave>
- <optional>
- <element name='source'>
- <attribute name='dev'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <ref name='interface-options'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>network</value>
- </attribute>
- <interleave>
- <element name='source'>
- <attribute name='network'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- <ref name='interface-options'/>
- </interleave>
- </group>
- <group>
- <attribute name='type'>
- <value>user</value>
- </attribute>
- <interleave>
- <ref name='interface-options'/>
- </interleave>
- </group>
- </choice>
- </element>
- </define>
-
- <!--
- The interface options possible are:
- - the MAC address
- - the IP address bound to the interface
- - the name of the script used to set up the binding
- - the target device used
- -->
- <define name='interface-options'>
- <interleave>
- <optional>
- <element name='target'>
- <attribute name='dev'>
- <ref name='deviceName'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <optional>
- <element name='mac'>
- <attribute name='address'>
- <ref name='addrMAC'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <optional>
- <element name='ip'>
- <attribute name='address'>
- <ref name='addrIP'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <optional>
- <element name='script'>
- <attribute name='path'>
- <ref name='filePath'/>
- </attribute>
- <empty/>
- </element>
- </optional>
- <optional>
- <element name='model'>
- <attribute name='type' />
- <empty/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <!--
- An emulator description is just a path to the binary used for the task
- -->
- <define name='emulator'>
- <element name='emulator'>
- <ref name='absFilePath'/>
- </element>
- </define>
-
- <!--
- A graphic description, currently in Xen only 2 types are supported:
- - sdl with optional display, xauth and fullscreen
- - vnc with a required port and optional listen IP address, password
- and keymap
- -->
- <define name='graphic'>
- <element name='graphics'>
- <choice>
- <group>
- <attribute name='type'>
- <value>sdl</value>
- </attribute>
- <optional>
- <attribute name='display'>
- <text/>
- </attribute>
- </optional>
- <optional>
- <attribute name='xauth'>
- <text/>
- </attribute>
- </optional>
- <optional>
- <attribute name='fullscreen'>
- <choice>
- <value>yes</value>
- <value>no</value>
- </choice>
- </attribute>
- </optional>
- </group>
- <group>
- <attribute name='type'>
- <value>vnc</value>
- </attribute>
- <optional>
- <attribute name='port'>
- <ref name='PortNumber'/>
- </attribute>
- </optional>
- <optional>
- <attribute name='autoport'>
- <choice>
- <value>yes</value>
- <value>no</value>
- </choice>
- </attribute>
- </optional>
- <optional>
- <attribute name='listen'>
- <ref name='addrIP'/>
- </attribute>
- </optional>
- <optional>
- <attribute name='passwd'>
- <text/>
- </attribute>
- </optional>
- <optional>
- <attribute name='keymap'>
- <text/>
- </attribute>
- </optional>
- </group>
- </choice>
- </element>
- </define>
-
- <!--
- When a domain terminates multiple policies can be applied depending
- on how it ended:
- -->
- <define name='termination'>
- <interleave>
- <optional>
- <element name='on_reboot'>
- <ref name='offOptions'/>
- </element>
- </optional>
- <optional>
- <element name='on_poweroff'>
- <ref name='offOptions'/>
- </element>
- </optional>
- <optional>
- <element name='on_crash'>
- <ref name='offOptions'/>
- </element>
- </optional>
- </interleave>
- </define>
-
- <!--
- Options when a domain terminates:
- destroy: The domain is cleaned up
- restart: A new domain is started in place of the old one
- preserve: The domain will remain in memory until it is destroyed manually
- rename-restart: a variant of the previous one but where the old domain is
- renamed before being saved to allow a restart
- -->
- <define name='offOptions'>
- <choice>
- <value>destroy</value>
- <value>restart</value>
- <value>preserve</value>
- <value>rename-restart</value>
- </choice>
- </define>
-
- <!--
- Specific setup for a qemu emulated character device. Note: this
- definition doesn't fully specify the constraints on this node.
- -->
- <define name='qemucdev'>
- <attribute name='type'>
- <choice>
- <value>dev</value>
- <value>file</value>
- <value>pipe</value>
- <value>unix</value>
- <value>tcp</value>
- <value>udp</value>
- <value>null</value>
- <value>stdio</value>
- <value>vc</value>
- <value>pty</value>
- </choice>
- </attribute>
-
- <interleave>
- <optional>
- <oneOrMore>
- <element name='source'>
- <optional>
- <attribute name='mode' />
- </optional>
- <optional>
- <attribute name='path' />
- </optional>
- <optional>
- <attribute name='host' />
- </optional>
- <optional>
- <attribute name='service' />
- </optional>
- <optional>
- <attribute name='wiremode' />
- </optional>
- </element>
- </oneOrMore>
- </optional>
- <optional>
- <element name='protocol'>
- <optional>
- <attribute name='type' />
- </optional>
- </element>
- </optional>
- <optional>
- <element name='target'>
- <optional>
- <attribute name='port' />
- </optional>
- </element>
- </optional>
- </interleave>
- </define>
-
- <!--
- The description for a console
- just a tty device
- -->
- <define name='console'>
- <element name='console'>
- <choice>
- <group>
- <optional>
- <attribute name='tty'>
- <ref name='devicePath'/>
- </attribute>
- </optional>
- <empty/>
- </group>
- <ref name='qemucdev' />
- </choice>
- </element>
- </define>
-
- <define name='sound'>
- <element name='sound'>
- <attribute name='model'>
- <choice>
- <value>sb16</value>
- <value>es1370</value>
- <value>pcspk</value>
- </choice>
- </attribute>
- </element>
- </define>
-
- <define name='parallel'>
- <element name='parallel'>
- <ref name='qemucdev' />
- </element>
- </define>
-
- <define name='serial'>
- <element name='serial'>
- <ref name='qemucdev' />
- </element>
- </define>
-
- <define name='input'>
- <element name='input'>
- <attribute name='type'>
- <choice>
- <value>tablet</value>
- <value>mouse</value>
- </choice>
- </attribute>
- <optional>
- <attribute name='bus'>
- <choice>
- <value>ps2</value>
- <value>usb</value>
- <value>xen</value>
- </choice>
- </attribute>
- </optional>
- </element>
- </define>
-
- <define name='hostdev'>
- <element name='hostdev'>
- <optional>
- <attribute name='mode'>
- <choice>
- <value>subsystem</value>
- <value>capabilities</value>
- </choice>
- </attribute>
- <attribute name='type'>
- <choice>
- <value>usb</value>
- <value>pci</value>
- </choice>
- </attribute>
- </optional>
- <group>
- <element name='source'>
- <choice>
- <ref name="usbproduct"/>
- <ref name="usbaddress"/>
- <ref name="pciaddress"/>
- </choice>
- </element>
- </group>
- </element>
- </define>
-
- <define name="usbproduct">
- <element name="vendor">
- <attribute name="id">
- <ref name="usbId"/>
- </attribute>
- </element>
- <element name="product">
- <attribute name="id">
- <ref name="usbId"/>
- </attribute>
- </element>
- </define>
-
- <define name="usbaddress">
- <element name="address">
- <attribute name="bus">
- <ref name="usbAddr"/>
- </attribute>
- <attribute name="device">
- <ref name="usbAddr"/>
- </attribute>
- </element>
- </define>
-
- <define name="pciaddress">
- <element name="address">
- <optional>
- <attribute name="domain">
- <ref name="pciDomain"/>
- </attribute>
- </optional>
- <attribute name="bus">
- <ref name="pciBus"/>
- </attribute>
- <attribute name="slot">
- <ref name="pciSlot"/>
- </attribute>
- <attribute name="function">
- <ref name="pciFunc"/>
- </attribute>
- </element>
- </define>
- <!--
- Devices attached to a domain.
- -->
- <define name='devices'>
- <element name='devices'>
- <interleave>
- <optional>
- <ref name='emulator'/>
- </optional>
- <zeroOrMore>
- <choice>
- <ref name='graphic'/>
- <ref name='disk'/>
- <ref name='filesystem'/>
- <ref name='interface'/>
- <ref name='console'/>
- <ref name='sound'/>
- <ref name='parallel'/>
- <ref name='serial'/>
- <ref name='input'/>
- <ref name='hostdev'/>
- </choice>
- </zeroOrMore>
- </interleave>
- </element>
- </define>
-
- <!--
- A set of optional features: PAE, APIC and ACPI support
- -->
- <define name='features'>
- <optional>
- <element name="features">
- <interleave>
- <optional>
- <element name="pae">
- <empty/>
- </element>
- </optional>
- <optional>
- <element name="apic">
- <empty/>
- </element>
- </optional>
- <optional>
- <element name="acpi">
- <empty/>
- </element>
- </optional>
- </interleave>
- </element>
- </optional>
- </define>
-
- <!--
- Type library
-
- Our unsignedInt doesn't allow a leading '+' in its lexical form
- A domain name shoul be made of ascii, numbers, _-+ and is non-empty
- UUID currently allows only the 32 characters strict syntax
- memoryKB request at least 4Mbytes though Xen will grow bigger if too low
- -->
- <define name='unsignedInt'>
- <data type='unsignedInt'>
- <param name="pattern">[0-9]+</param>
- </data>
- </define>
- <define name='countCPU'>
- <data type='unsignedShort'>
- <param name="pattern">[0-9]+</param>
- <param name="minInclusive">1</param>
- </data>
- </define>
- <define name='PortNumber'>
- <data type='short'>
- <param name="minInclusive">-1</param>
- </data>
- </define>
- <define name='memoryKB'>
- <data type='unsignedInt'>
- <param name="pattern">[0-9]+</param>
- <param name="minInclusive">4000</param>
- </data>
- </define>
- <define name='domainName'>
- <data type='string'>
- <param name="pattern">[A-Za-z0-9_\.\+\-&:/]+</param>
- </data>
- </define>
- <define name='genericName'>
- <data type='string'>
- <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
- </data>
- </define>
- <define name='UUID'>
- <choice>
- <data type='string'>
- <param name="pattern">[a-fA-F0-9]{32}</param>
- </data>
- <data type='string'>
- <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
- </data>
- </choice>
- </define>
- <define name='filePath'>
- <data type='string'>
- <param name="pattern">[a-zA-Z0-9_\.\+\-&/%]+</param>
- </data>
- </define>
- <define name='absFilePath'>
- <data type='string'>
- <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]+</param>
- </data>
- </define>
- <define name='absDirPath'>
- <data type='string'>
- <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]*</param>
- </data>
- </define>
- <define name='devicePath'>
- <data type='string'>
- <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
- </data>
- </define>
- <define name='deviceName'>
- <data type='string'>
- <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
- </data>
- </define>
- <define name='addrMAC'>
- <data type='string'>
- <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
- </data>
- </define>
- <define name='addrIP'>
- <data type='string'>
- <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
- </data>
- </define>
- <define name='usbId'>
- <data type='string'>
- <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
- </data>
- </define>
- <define name='usbAddr'>
- <data type='string'>
- <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
- </data>
- </define>
- <define name='pciDomain'>
- <data type='string'>
- <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
- </data>
- </define>
- <define name='pciBus'>
- <data type='string'>
- <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
- </data>
- </define>
- <define name='pciSlot'>
- <data type='string'>
- <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
- </data>
- </define>
- <define name='pciFunc'>
- <data type='string'>
- <param name="pattern">(0x)?[0-7]</param>
- </data>
- </define>
-</grammar>
diff -r 8eb4d4028b98 docs/network.rng
--- a/docs/network.rng Wed Jan 21 15:47:23 2009 +0000
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-<!-- A Relax NG schema for the libvirt network XML format -->
-<element name="network" xmlns="http://relaxng.org/ns/structure/1.0"
- datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
- <!-- The name of the network, used to refer to it through the API
- and in virsh -->
- <element name="name"><text/></element>
- <optional>
- <element name="uuid"><text/></element>
- </optional>
- <optional>
- <!-- The name of the network to be set up; this will back
- the network on the host -->
- <element name="bridge">
- <optional>
- <attribute name="name"><text/></attribute>
- </optional>
- <optional>
- <attribute name="stp">
- <choice>
- <value>on</value>
- <value>off</value>
- </choice>
- </attribute>
- </optional>
- <optional>
- <attribute name="delay"><data type="integer"/></attribute>
- </optional>
- </element>
- </optional>
- <optional>
- <!-- The IP element sets up NAT'ing and an optional DHCP server
- local to the host. -->
- <!-- FIXME: address, netmask and the start and end of the ranges
- are IP addresses, and should be validated as such in the scheme -->
- <element name="ip">
- <optional>
- <attribute name="address"><text/></attribute>
- </optional>
- <optional>
- <attribute name="netmask"><text/></attribute>
- </optional>
- <!-- Define the range(s) of IP addresses that the DHCP
- server should hand out -->
- <element name="dhcp">
- <zeroOrMore>
- <element name="range">
- <attribute name="start"><text/></attribute>
- <attribute name="end"><text/></attribute>
- </element>
- </zeroOrMore>
- </element>
- </element>
- </optional>
- <optional>
- <!-- The device through which the bridge is connected to the
- rest of the network -->
- <element name="forward">
- <optional><attribute name="dev"><text/></attribute></optional>
- <optional>
- <attribute name="mode">
- <choice>
- <value>nat</value>
- <value>routed</value>
- </choice>
- </attribute>
- </optional>
- </element>
- </optional>
-</element>
diff -r 8eb4d4028b98 docs/schemas/Makefile.am
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/Makefile.am Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,12 @@
+
+
+schemadir = $(pkgdatadir)/schemas
+schema_DATA = \
+ domain.rng \
+ network.rng \
+ storagepool.rng \
+ storagevol.rng \
+ nodedev.rng \
+ capability.rng
+
+EXTRA_DIST = $(schema_DATA)
diff -r 8eb4d4028b98 docs/schemas/capability.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/capability.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,287 @@
+<!-- A Relax NG schema for the libvirt node device XML format -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- We handle only document defining a domain -->
+ <start>
+ <ref name='capabilities'/>
+ </start>
+
+
+ <define name='capabilities'>
+ <element name='capabilities'>
+ <ref name='hostcaps'/>
+
+ <zeroOrMore>
+ <ref name='guestcaps'/>
+ </zeroOrMore>
+ </element>
+ </define>
+
+ <define name='hostcaps'>
+ <element name='host'>
+ <element name='cpu'>
+ <element name='arch'>
+ <ref name='archnames'/>
+ </element>
+ <optional>
+ <ref name='cpufeatures'/>
+ </optional>
+ </element>
+ <optional>
+ <ref name='migration'/>
+ </optional>
+ <optional>
+ <ref name='topology'/>
+ </optional>
+ </element>
+ </define>
+
+ <define name='cpufeatures'>
+ <element name='features'>
+ <optional>
+ <element name='pae'><empty/></element>
+ </optional>
+ <optional>
+ <element name='nonpae'><empty/></element>
+ </optional>
+ <optional>
+ <element name='vmx'><empty/></element>
+ </optional>
+ <optional>
+ <element name='svm'><empty/></element>
+ </optional>
+ </element>
+ </define>
+
+ <define name='migration'>
+ <element name='migration_features'>
+ <optional>
+ <element name='live'>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='uri_transports'>
+ <oneOrMore>
+ <element name='uri_transport'>
+ <choice>
+ <value>xenmigr</value>
+ </choice>
+ </element>
+ </oneOrMore>
+ </element>
+ </optional>
+ </element>
+ </define>
+
+ <define name='topology'>
+ <element name='topology'>
+ <element name='cells'>
+ <attribute name='num'>
+ <ref name='uint'/>
+ </attribute>
+ <oneOrMore>
+ <ref name='cell'/>
+ </oneOrMore>
+ </element>
+ </element>
+ </define>
+
+ <define name='cell'>
+ <element name='cell'>
+ <attribute name='id'>
+ <ref name='uint'/>
+ </attribute>
+
+ <optional>
+ <element name='cpus'>
+ <attribute name='num'>
+ <ref name='uint'/>
+ </attribute>
+ <oneOrMore>
+ <ref name='cpu'/>
+ </oneOrMore>
+ </element>
+ </optional>
+ </element>
+ </define>
+
+ <define name='cpu'>
+ <element name='cpu'>
+ <attribute name='id'>
+ <ref name='uint'/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name='guestcaps'>
+ <element name='guest'>
+ <ref name='ostype'/>
+ <ref name='arch'/>
+ <optional>
+ <ref name='features'/>
+ </optional>
+ </element>
+ </define>
+
+ <define name='ostype'>
+ <element name='os_type'>
+ <choice>
+ <value>xen</value> <!-- Xen 3.0 pv -->
+ <value>linux</value> <!-- same as 'xen' - legacy -->
+ <value>hvm</value> <!-- unmodified OS -->
+ <value>exe</value> <!-- For container based virt -->
+ <value>uml</value> <!-- user mode linux -->
+ </choice>
+ </element>
+ </define>
+
+ <define name='arch'>
+ <element name='arch'>
+ <attribute name='name'>
+ <ref name='archnames'/>
+ </attribute>
+ <ref name='wordsize'/>
+ <optional>
+ <ref name='emulator'/>
+ </optional>
+ <optional>
+ <ref name='loader'/>
+ </optional>
+ <zeroOrMore>
+ <ref name='machine'/>
+ </zeroOrMore>
+ <oneOrMore>
+ <ref name='domain'/>
+ </oneOrMore>
+ </element>
+ </define>
+
+ <define name='emulator'>
+ <element name='emulator'>
+ <ref name='path'/>
+ </element>
+ </define>
+
+ <define name='loader'>
+ <element name='loader'>
+ <ref name='path'/>
+ </element>
+ </define>
+
+ <define name='wordsize'>
+ <element name='wordsize'>
+ <choice>
+ <value>31</value>
+ <value>32</value>
+ <value>64</value>
+ </choice>
+ </element>
+ </define>
+
+ <define name='machine'>
+ <element name='machine'>
+ <text/>
+ </element>
+ </define>
+
+ <define name='domain'>
+ <element name='domain'>
+ <attribute name='type'>
+ <choice>
+ <value>qemu</value>
+ <value>kqemu</value>
+ <value>kvm</value>
+ <value>xen</value>
+ <value>uml</value>
+ <value>lxc</value>
+ <value>openvz</value>
+ <value>test</value>
+ </choice>
+ </attribute>
+
+ <optional>
+ <ref name='emulator'/>
+ </optional>
+ <optional>
+ <ref name='machine'/>
+ </optional>
+ </element>
+ </define>
+
+ <define name='features'>
+ <element name='features'>
+ <optional>
+ <element name='pae'>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='nonpae'>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='ia64_be'>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='acpi'>
+ <ref name='featuretoggle'/>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='apic'>
+ <ref name='featuretoggle'/>
+ <empty/>
+ </element>
+ </optional>
+ </element>
+ </define>
+
+ <define name='featuretoggle'>
+ <attribute name='toggle'>
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ <attribute name='default'>
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ </define>
+
+ <define name='archnames'>
+ <choice>
+ <value>i686</value>
+ <value>x86_64</value>
+ <value>ppc</value>
+ <value>ppc64</value>
+ <value>ia64</value>
+ <value>s390</value>
+ <value>mips</value>
+ <value>mipsel</value>
+ <value>sparc</value>
+ </choice>
+ </define>
+
+
+ <define name='uint'>
+ <data type='string'>
+ <param name="pattern">[0-9]+</param>
+ </data>
+ </define>
+
+ <define name='path'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
+ </data>
+ </define>
+
+</grammar>
+
diff -r 8eb4d4028b98 docs/schemas/domain.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/domain.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,1111 @@
+<?xml version="1.0" ?>
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- We handle only document defining a domain -->
+ <start>
+ <ref name='domain'/>
+ </start>
+
+ <!--
+ We handle only document defining a domain
+ -->
+ <define name='domain'>
+ <element name="domain">
+ <ref name='hvs'/>
+ <ref name='ids'/>
+ <interleave>
+ <ref name='os'/>
+ <ref name='clock'/>
+ <ref name='resources'/>
+ <ref name='features'/>
+ <ref name='termination'/>
+ <optional>
+ <ref name='devices'/>
+ </optional>
+ </interleave>
+ </element>
+ </define>
+
+ <define name='hvs'>
+ <attribute name='type'>
+ <choice>
+ <value>xen</value>
+ <value>kvm</value>
+ <value>kqemu</value>
+ <value>qemu</value>
+ <value>lxc</value>
+ <value>openvz</value>
+ <value>test</value>
+ </choice>
+ </attribute>
+ </define>
+
+ <define name='os'>
+ <choice>
+ <ref name='osxen'/>
+ <ref name='oshvm'/>
+ <ref name='osexe'/>
+ </choice>
+ </define>
+
+ <define name='osxen'>
+ <choice>
+ <group>
+ <optional>
+ <ref name='bootloader'/>
+ </optional>
+ <element name='os'>
+ <ref name='ostypexen'/>
+ <ref name='osbootkernel'/>
+ </element>
+ </group>
+ <group>
+ <ref name='bootloader'/>
+ <optional>
+ <element name='os'>
+ <ref name='ostypexen'/>
+ <optional>
+ <ref name='osbootkernel'/>
+ </optional>
+ </element>
+ </optional>
+ </group>
+ </choice>
+ </define>
+
+
+ <define name='oshvm'>
+ <element name='os'>
+ <ref name='ostypehvm'/>
+ <interleave>
+ <optional>
+ <element name='loader'>
+ <ref name='absFilePath'/>
+ </element>
+ </optional>
+ <choice>
+ <ref name='osbootkernel'/>
+ <ref name='osbootdev'/>
+ </choice>
+ </interleave>
+ </element>
+ </define>
+
+
+ <define name='ostypexen'>
+ <element name='type'>
+ <optional>
+ <attribute name='arch'>
+ <choice>
+ <value>i686</value>
+ <value>x86_64</value>
+ <value>ia64</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='machine'>
+ <choice>
+ <value>xenpv</value>
+ <value>xenner</value>
+ </choice>
+ </attribute>
+ </optional>
+ <choice>
+ <value>xen</value>
+ <value>linux</value>
+ </choice>
+ </element>
+ </define>
+
+ <define name='ostypehvm'>
+ <element name='type'>
+ <optional>
+ <choice>
+ <ref name='hvmx86'/>
+ <ref name='hvmmips'/>
+ <ref name='hvmsparc'/>
+ <ref name='hvmppc'/>
+ </choice>
+ </optional>
+ <value>hvm</value>
+ </element>
+ </define>
+
+ <define name='hvmx86'>
+ <group>
+ <attribute name='arch'>
+ <choice>
+ <value>i686</value>
+ <value>x86_64</value>
+ </choice>
+ </attribute>
+ <attribute name='machine'>
+ <choice>
+ <value>xenfv</value>
+ <value>pc</value>
+ <value>isapc</value>
+ </choice>
+ </attribute>
+ </group>
+ </define>
+
+ <define name='hvmmips'>
+ <group>
+ <attribute name='arch'>
+ <value>mips</value>
+ </attribute>
+ <attribute name='machine'>
+ <value>mips</value>
+ </attribute>
+ </group>
+ </define>
+
+ <define name='hvmsparc'>
+ <group>
+ <attribute name='arch'>
+ <value>sparc</value>
+ </attribute>
+ <attribute name='machine'>
+ <value>sun4m</value>
+ </attribute>
+ </group>
+ </define>
+
+ <define name='hvmppc'>
+ <group>
+ <attribute name='arch'>
+ <value>ppc</value>
+ </attribute>
+ <attribute name='machine'>
+ <choice>
+ <value>g3bw</value>
+ <value>mac99</value>
+ <value>prep</value>
+ </choice>
+ </attribute>
+ </group>
+ </define>
+
+
+ <define name='osexe'>
+ <element name='os'>
+ <element name='type'>
+ <value>exe</value>
+ </element>
+ <interleave>
+ <optional>
+ <element name='init'>
+ <ref name='absFilePath'/>
+ </element>
+ </optional>
+ </interleave>
+ </element>
+ </define>
+
+
+
+ <!--
+ The Identifiers can be:
+ - an optional id attribute with a number on the domain element
+ - a mandatory name
+ - an optional uuid
+ -->
+ <define name='ids'>
+ <optional>
+ <attribute name='id'>
+ <ref name='unsignedInt'/>
+ </attribute>
+ </optional>
+ <interleave>
+ <element name="name">
+ <ref name='domainName'/>
+ </element>
+ <optional>
+ <element name="uuid">
+ <ref name='UUID'/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <!--
+ Resources usage defines the amount of memory (maximum and possibly
+ current usage) and number of virtual CPUs used by that domain.
+ We can't check here the rule that currentMemory <= memory
+ -->
+
+ <define name='resources'>
+ <interleave>
+ <element name='memory'>
+ <ref name='memoryKB'/>
+ </element>
+ <optional>
+ <element name='currentMemory'>
+ <ref name='memoryKB'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='vcpu'>
+ <optional>
+ <attribute name='cpuset' />
+ </optional>
+ <ref name='countCPU'/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <define name='clock'>
+ <optional>
+ <element name='clock'>
+ <attribute name='offset'>
+ <choice>
+ <value>localtime</value>
+ <value>utc</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ </define>
+
+ <!--
+ A bootloader may be used to extract the OS information instead of
+ defining the OS parameter in the instance. It points just to the
+ binary or script used to extract the data from the first disk device.
+ -->
+ <define name='bootloader'>
+ <interleave>
+ <element name='bootloader'>
+ <choice>
+ <ref name='absFilePath'/>
+ <empty/>
+ </choice>
+ </element>
+ <optional>
+ <element name='bootloader_args'>
+ <text/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <define name='osbootkernel'>
+ <interleave>
+ <element name='kernel'>
+ <ref name='absFilePath'/>
+ </element>
+ <optional>
+ <element name='initrd'>
+ <ref name='absFilePath'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='root'>
+ <ref name='devicePath'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='cmdline'>
+ <text/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <define name='osbootdev'>
+ <element name='boot'>
+ <attribute name='dev'>
+ <choice>
+ <value>hd</value>
+ <value>fd</value>
+ <value>cdrom</value>
+ <value>network</value>
+ </choice>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+
+ <define name='diskspec'>
+ <optional>
+ <ref name='driver'/>
+ </optional>
+ <ref name='target'/>
+ <optional>
+ <element name='readonly'>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='shareable'>
+ <empty/>
+ </element>
+ </optional>
+ </define>
+
+ <!--
+ A disk description can be either of type file or block
+ The name of the attribute on the source element depends on the type
+
+ -->
+ <define name='disk'>
+ <element name='disk'>
+ <optional>
+ <attribute name='device'>
+ <choice>
+ <value>floppy</value>
+ <value>disk</value>
+ <value>cdrom</value>
+ </choice>
+ </attribute>
+ </optional>
+ <choice>
+ <group>
+ <attribute name='type'>
+ <value>file</value>
+ </attribute>
+ <interleave>
+ <optional>
+ <element name='source'>
+ <attribute name='file'>
+ <ref name='absFilePath'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <ref name='diskspec'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>block</value>
+ </attribute>
+ <interleave>
+ <optional>
+ <element name='source'>
+ <attribute name='dev'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <ref name='diskspec'/>
+ </interleave>
+ </group>
+ <ref name='diskspec'/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='target'>
+ <element name='target'>
+ <attribute name='dev'>
+ <ref name='deviceName'/>
+ </attribute>
+ <optional>
+ <attribute name='bus'>
+ <choice>
+ <value>ide</value>
+ <value>virtio</value>
+ <value>fdc</value>
+ <value>xen</value>
+ <value>usb</value>
+ </choice>
+ </attribute>
+ </optional>
+ </element>
+ </define>
+
+ <!--
+ Disk may use a special driver for access. Currently this is
+ only defined for Xen for tap/aio and file, but will certainly be
+ extended in the future, and libvirt doesn't look for specific values.
+ -->
+ <define name='driver'>
+ <element name='driver'>
+ <attribute name='name'>
+ <ref name='genericName'/>
+ </attribute>
+ <optional>
+ <attribute name='type'>
+ <ref name='genericName'/>
+ </attribute>
+ </optional>
+ <empty/>
+ </element>
+ </define>
+
+ <define name='filesystem'>
+ <element name='filesystem'>
+ <choice>
+ <group>
+ <attribute name='type'>
+ <value>file</value>
+ </attribute>
+ <interleave>
+ <element name='source'>
+ <attribute name='file'>
+ <ref name='absFilePath'/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name='filesystemtgt'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>block</value>
+ </attribute>
+ <interleave>
+ <element name='source'>
+ <attribute name='dev'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name='filesystemtgt'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>mount</value>
+ </attribute>
+ <interleave>
+ <element name='source'>
+ <attribute name='dir'>
+ <ref name='absFilePath'/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name='filesystemtgt'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>template</value>
+ </attribute>
+ <interleave>
+ <element name='source'>
+ <attribute name='name'>
+ <ref name='genericName'/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name='filesystemtgt'/>
+ </interleave>
+ </group>
+ </choice>
+ </element>
+ </define>
+
+ <define name='filesystemtgt'>
+ <element name='target'>
+ <attribute name='dir'>
+ <ref name='absDirPath'/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+ <!--
+ An interface description can either be of type bridge in which case
+ it will use a bridging source, or of type ethernet which uses a device
+ source and a device target instead. They both share a set of interface
+ options. FIXME
+ -->
+ <define name='interface'>
+ <element name='interface'>
+ <choice>
+ <group>
+ <attribute name='type'>
+ <value>bridge</value>
+ </attribute>
+ <interleave>
+ <optional>
+ <element name='source'>
+ <attribute name='bridge'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <ref name='interface-options'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>ethernet</value>
+ </attribute>
+ <interleave>
+ <optional>
+ <element name='source'>
+ <attribute name='dev'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <ref name='interface-options'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>network</value>
+ </attribute>
+ <interleave>
+ <element name='source'>
+ <attribute name='network'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ <ref name='interface-options'/>
+ </interleave>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>user</value>
+ </attribute>
+ <interleave>
+ <ref name='interface-options'/>
+ </interleave>
+ </group>
+ </choice>
+ </element>
+ </define>
+
+ <!--
+ The interface options possible are:
+ - the MAC address
+ - the IP address bound to the interface
+ - the name of the script used to set up the binding
+ - the target device used
+ -->
+ <define name='interface-options'>
+ <interleave>
+ <optional>
+ <element name='target'>
+ <attribute name='dev'>
+ <ref name='deviceName'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='mac'>
+ <attribute name='address'>
+ <ref name='addrMAC'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='ip'>
+ <attribute name='address'>
+ <ref name='addrIP'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='script'>
+ <attribute name='path'>
+ <ref name='filePath'/>
+ </attribute>
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name='model'>
+ <attribute name='type' />
+ <empty/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <!--
+ An emulator description is just a path to the binary used for the task
+ -->
+ <define name='emulator'>
+ <element name='emulator'>
+ <ref name='absFilePath'/>
+ </element>
+ </define>
+
+ <!--
+ A graphic description, currently in Xen only 2 types are supported:
+ - sdl with optional display, xauth and fullscreen
+ - vnc with a required port and optional listen IP address, password
+ and keymap
+ -->
+ <define name='graphic'>
+ <element name='graphics'>
+ <choice>
+ <group>
+ <attribute name='type'>
+ <value>sdl</value>
+ </attribute>
+ <optional>
+ <attribute name='display'>
+ <text/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='xauth'>
+ <text/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='fullscreen'>
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </optional>
+ </group>
+ <group>
+ <attribute name='type'>
+ <value>vnc</value>
+ </attribute>
+ <optional>
+ <attribute name='port'>
+ <ref name='PortNumber'/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='autoport'>
+ <choice>
+ <value>yes</value>
+ <value>no</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='listen'>
+ <ref name='addrIP'/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='passwd'>
+ <text/>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name='keymap'>
+ <text/>
+ </attribute>
+ </optional>
+ </group>
+ </choice>
+ </element>
+ </define>
+
+ <!--
+ When a domain terminates multiple policies can be applied depending
+ on how it ended:
+ -->
+ <define name='termination'>
+ <interleave>
+ <optional>
+ <element name='on_reboot'>
+ <ref name='offOptions'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='on_poweroff'>
+ <ref name='offOptions'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='on_crash'>
+ <ref name='offOptions'/>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <!--
+ Options when a domain terminates:
+ destroy: The domain is cleaned up
+ restart: A new domain is started in place of the old one
+ preserve: The domain will remain in memory until it is destroyed manually
+ rename-restart: a variant of the previous one but where the old domain is
+ renamed before being saved to allow a restart
+ -->
+ <define name='offOptions'>
+ <choice>
+ <value>destroy</value>
+ <value>restart</value>
+ <value>preserve</value>
+ <value>rename-restart</value>
+ </choice>
+ </define>
+
+ <!--
+ Specific setup for a qemu emulated character device. Note: this
+ definition doesn't fully specify the constraints on this node.
+ -->
+ <define name='qemucdev'>
+ <attribute name='type'>
+ <choice>
+ <value>dev</value>
+ <value>file</value>
+ <value>pipe</value>
+ <value>unix</value>
+ <value>tcp</value>
+ <value>udp</value>
+ <value>null</value>
+ <value>stdio</value>
+ <value>vc</value>
+ <value>pty</value>
+ </choice>
+ </attribute>
+
+ <interleave>
+ <optional>
+ <oneOrMore>
+ <element name='source'>
+ <optional>
+ <attribute name='mode' />
+ </optional>
+ <optional>
+ <attribute name='path' />
+ </optional>
+ <optional>
+ <attribute name='host' />
+ </optional>
+ <optional>
+ <attribute name='service' />
+ </optional>
+ <optional>
+ <attribute name='wiremode' />
+ </optional>
+ </element>
+ </oneOrMore>
+ </optional>
+ <optional>
+ <element name='protocol'>
+ <optional>
+ <attribute name='type' />
+ </optional>
+ </element>
+ </optional>
+ <optional>
+ <element name='target'>
+ <optional>
+ <attribute name='port' />
+ </optional>
+ </element>
+ </optional>
+ </interleave>
+ </define>
+
+ <!--
+ The description for a console
+ just a tty device
+ -->
+ <define name='console'>
+ <element name='console'>
+ <choice>
+ <group>
+ <optional>
+ <attribute name='tty'>
+ <ref name='devicePath'/>
+ </attribute>
+ </optional>
+ <empty/>
+ </group>
+ <ref name='qemucdev' />
+ </choice>
+ </element>
+ </define>
+
+ <define name='sound'>
+ <element name='sound'>
+ <attribute name='model'>
+ <choice>
+ <value>sb16</value>
+ <value>es1370</value>
+ <value>pcspk</value>
+ </choice>
+ </attribute>
+ </element>
+ </define>
+
+ <define name='parallel'>
+ <element name='parallel'>
+ <ref name='qemucdev' />
+ </element>
+ </define>
+
+ <define name='serial'>
+ <element name='serial'>
+ <ref name='qemucdev' />
+ </element>
+ </define>
+
+ <define name='input'>
+ <element name='input'>
+ <attribute name='type'>
+ <choice>
+ <value>tablet</value>
+ <value>mouse</value>
+ </choice>
+ </attribute>
+ <optional>
+ <attribute name='bus'>
+ <choice>
+ <value>ps2</value>
+ <value>usb</value>
+ <value>xen</value>
+ </choice>
+ </attribute>
+ </optional>
+ </element>
+ </define>
+
+ <define name='hostdev'>
+ <element name='hostdev'>
+ <optional>
+ <attribute name='mode'>
+ <choice>
+ <value>subsystem</value>
+ <value>capabilities</value>
+ </choice>
+ </attribute>
+ <attribute name='type'>
+ <choice>
+ <value>usb</value>
+ <value>pci</value>
+ </choice>
+ </attribute>
+ </optional>
+ <group>
+ <element name='source'>
+ <choice>
+ <ref name="usbproduct"/>
+ <ref name="usbaddress"/>
+ <ref name="pciaddress"/>
+ </choice>
+ </element>
+ </group>
+ </element>
+ </define>
+
+ <define name="usbproduct">
+ <element name="vendor">
+ <attribute name="id">
+ <ref name="usbId"/>
+ </attribute>
+ </element>
+ <element name="product">
+ <attribute name="id">
+ <ref name="usbId"/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="usbaddress">
+ <element name="address">
+ <attribute name="bus">
+ <ref name="usbAddr"/>
+ </attribute>
+ <attribute name="device">
+ <ref name="usbAddr"/>
+ </attribute>
+ </element>
+ </define>
+
+ <define name="pciaddress">
+ <element name="address">
+ <optional>
+ <attribute name="domain">
+ <ref name="pciDomain"/>
+ </attribute>
+ </optional>
+ <attribute name="bus">
+ <ref name="pciBus"/>
+ </attribute>
+ <attribute name="slot">
+ <ref name="pciSlot"/>
+ </attribute>
+ <attribute name="function">
+ <ref name="pciFunc"/>
+ </attribute>
+ </element>
+ </define>
+ <!--
+ Devices attached to a domain.
+ -->
+ <define name='devices'>
+ <element name='devices'>
+ <interleave>
+ <optional>
+ <ref name='emulator'/>
+ </optional>
+ <zeroOrMore>
+ <choice>
+ <ref name='graphic'/>
+ <ref name='disk'/>
+ <ref name='filesystem'/>
+ <ref name='interface'/>
+ <ref name='console'/>
+ <ref name='sound'/>
+ <ref name='parallel'/>
+ <ref name='serial'/>
+ <ref name='input'/>
+ <ref name='hostdev'/>
+ </choice>
+ </zeroOrMore>
+ </interleave>
+ </element>
+ </define>
+
+ <!--
+ A set of optional features: PAE, APIC and ACPI support
+ -->
+ <define name='features'>
+ <optional>
+ <element name="features">
+ <interleave>
+ <optional>
+ <element name="pae">
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name="apic">
+ <empty/>
+ </element>
+ </optional>
+ <optional>
+ <element name="acpi">
+ <empty/>
+ </element>
+ </optional>
+ </interleave>
+ </element>
+ </optional>
+ </define>
+
+ <!--
+ Type library
+
+ Our unsignedInt doesn't allow a leading '+' in its lexical form
+ A domain name shoul be made of ascii, numbers, _-+ and is non-empty
+ UUID currently allows only the 32 characters strict syntax
+ memoryKB request at least 4Mbytes though Xen will grow bigger if too low
+ -->
+ <define name='unsignedInt'>
+ <data type='unsignedInt'>
+ <param name="pattern">[0-9]+</param>
+ </data>
+ </define>
+ <define name='countCPU'>
+ <data type='unsignedShort'>
+ <param name="pattern">[0-9]+</param>
+ <param name="minInclusive">1</param>
+ </data>
+ </define>
+ <define name='PortNumber'>
+ <data type='short'>
+ <param name="minInclusive">-1</param>
+ </data>
+ </define>
+ <define name='memoryKB'>
+ <data type='unsignedInt'>
+ <param name="pattern">[0-9]+</param>
+ <param name="minInclusive">4000</param>
+ </data>
+ </define>
+ <define name='domainName'>
+ <data type='string'>
+ <param name="pattern">[A-Za-z0-9_\.\+\-&:/]+</param>
+ </data>
+ </define>
+ <define name='genericName'>
+ <data type='string'>
+ <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
+ </data>
+ </define>
+ <define name='UUID'>
+ <choice>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{32}</param>
+ </data>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
+ </data>
+ </choice>
+ </define>
+ <define name='filePath'>
+ <data type='string'>
+ <param name="pattern">[a-zA-Z0-9_\.\+\-&/%]+</param>
+ </data>
+ </define>
+ <define name='absFilePath'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]+</param>
+ </data>
+ </define>
+ <define name='absDirPath'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\.\+\-&/%]*</param>
+ </data>
+ </define>
+ <define name='devicePath'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
+ </data>
+ </define>
+ <define name='deviceName'>
+ <data type='string'>
+ <param name="pattern">[a-zA-Z0-9_\.\-:/]+</param>
+ </data>
+ </define>
+ <define name='addrMAC'>
+ <data type='string'>
+ <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
+ </data>
+ </define>
+ <define name='addrIP'>
+ <data type='string'>
+ <param name="pattern">([0-2]?[0-9]?[0-9]\.){3}[0-2]?[0-9]?[0-9]</param>
+ </data>
+ </define>
+ <define name='usbId'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
+ </data>
+ </define>
+ <define name='usbAddr'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,3}</param>
+ </data>
+ </define>
+ <define name='pciDomain'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,4}</param>
+ </data>
+ </define>
+ <define name='pciBus'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-9a-fA-F]{1,2}</param>
+ </data>
+ </define>
+ <define name='pciSlot'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-1]?[0-9a-fA-F]</param>
+ </data>
+ </define>
+ <define name='pciFunc'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-7]</param>
+ </data>
+ </define>
+</grammar>
diff -r 8eb4d4028b98 docs/schemas/network.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/network.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,69 @@
+<!-- A Relax NG schema for the libvirt network XML format -->
+<element name="network" xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- The name of the network, used to refer to it through the API
+ and in virsh -->
+ <element name="name"><text/></element>
+ <optional>
+ <element name="uuid"><text/></element>
+ </optional>
+ <optional>
+ <!-- The name of the network to be set up; this will back
+ the network on the host -->
+ <element name="bridge">
+ <optional>
+ <attribute name="name"><text/></attribute>
+ </optional>
+ <optional>
+ <attribute name="stp">
+ <choice>
+ <value>on</value>
+ <value>off</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="delay"><data type="integer"/></attribute>
+ </optional>
+ </element>
+ </optional>
+ <optional>
+ <!-- The device through which the bridge is connected to the
+ rest of the network -->
+ <element name="forward">
+ <optional><attribute name="dev"><text/></attribute></optional>
+ <optional>
+ <attribute name="mode">
+ <choice>
+ <value>nat</value>
+ <value>routed</value>
+ </choice>
+ </attribute>
+ </optional>
+ </element>
+ </optional>
+ <optional>
+ <!-- The IP element sets up NAT'ing and an optional DHCP server
+ local to the host. -->
+ <!-- FIXME: address, netmask and the start and end of the ranges
+ are IP addresses, and should be validated as such in the scheme -->
+ <element name="ip">
+ <optional>
+ <attribute name="address"><text/></attribute>
+ </optional>
+ <optional>
+ <attribute name="netmask"><text/></attribute>
+ </optional>
+ <!-- Define the range(s) of IP addresses that the DHCP
+ server should hand out -->
+ <element name="dhcp">
+ <zeroOrMore>
+ <element name="range">
+ <attribute name="start"><text/></attribute>
+ <attribute name="end"><text/></attribute>
+ </element>
+ </zeroOrMore>
+ </element>
+ </element>
+ </optional>
+</element>
diff -r 8eb4d4028b98 docs/schemas/nodedev.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/nodedev.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,360 @@
+<!-- A Relax NG schema for the libvirt node device XML format -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- We handle only document defining a domain -->
+ <start>
+ <ref name='device'/>
+ </start>
+
+ <!--
+ We handle only document defining a domain
+ -->
+ <define name='device'>
+ <element name="device">
+ <!-- The name of the network, used to refer to it through the API
+ and in virsh -->
+ <element name="name"><text/></element>
+ <optional>
+ <element name="parent"><text/></element>
+ </optional>
+
+ <zeroOrMore>
+ <ref name="capability"/>
+ </zeroOrMore>
+ </element>
+ </define>
+
+ <define name='capability'>
+ <element name="capability">
+ <choice>
+ <ref name="capsystem"/>
+ <ref name="cappcidev"/>
+ <ref name="capusbdev"/>
+ <ref name="capusbinterface"/>
+ <ref name="capnet"/>
+ <ref name="capscsihost"/>
+ <ref name="capscsi"/>
+ <ref name="capstorage"/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='capsystem'>
+ <attribute name='type'>
+ <value>system</value>
+ </attribute>
+
+ <optional>
+ <element name='product'><text/></element>
+ </optional>
+
+ <element name='hardware'>
+ <optional>
+ <element name='vendor'><text/></element>
+ </optional>
+ <optional>
+ <element name='version'><text/></element>
+ </optional>
+ <optional>
+ <element name='serial'><text/></element>
+ </optional>
+
+ <element name='uuid'>
+ <ref name='uuid'/>
+ </element>
+ </element>
+
+
+ <element name='firmware'>
+ <optional>
+ <element name='vendor'><text/></element>
+ </optional>
+ <optional>
+ <element name='version'><text/></element>
+ </optional>
+ <optional>
+ <element name='release_date'><text/></element>
+ </optional>
+ </element>
+ </define>
+
+ <define name='cappcidev'>
+ <attribute name='type'>
+ <value>pci</value>
+ </attribute>
+
+ <element name='domain'>
+ <ref name='uint'/>
+ </element>
+ <element name='bus'>
+ <ref name='uint'/>
+ </element>
+ <element name='slot'>
+ <ref name='uint'/>
+ </element>
+ <element name='function'>
+ <ref name='uint'/>
+ </element>
+
+ <element name='product'>
+ <attribute name='id'>
+ <ref name='hexuint'/>
+ </attribute>
+
+ <choice>
+ <text/>
+ <empty/>
+ </choice>
+ </element>
+
+ <element name='vendor'>
+ <attribute name='id'>
+ <ref name='hexuint'/>
+ </attribute>
+
+ <choice>
+ <text/>
+ <empty/>
+ </choice>
+ </element>
+
+ </define>
+
+ <define name='capusbdev'>
+ <attribute name='type'>
+ <value>usb_device</value>
+ </attribute>
+
+ <element name='bus'>
+ <ref name='uint'/>
+ </element>
+ <element name='device'>
+ <ref name='uint'/>
+ </element>
+
+ <element name='product'>
+ <attribute name='id'>
+ <ref name='hexuint'/>
+ </attribute>
+
+ <choice>
+ <text/>
+ <empty/>
+ </choice>
+ </element>
+
+ <element name='vendor'>
+ <attribute name='id'>
+ <ref name='hexuint'/>
+ </attribute>
+
+ <choice>
+ <text/>
+ <empty/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='capusbinterface'>
+ <attribute name='type'>
+ <value>usb</value>
+ </attribute>
+
+ <element name='number'>
+ <ref name='uint'/>
+ </element>
+ <element name='class'>
+ <ref name='uint'/>
+ </element>
+ <element name='subclass'>
+ <ref name='uint'/>
+ </element>
+ <element name='protocol'>
+ <ref name='uint'/>
+ </element>
+
+ <optional>
+ <element name='description'>
+ <text/>
+ </element>
+ </optional>
+ </define>
+
+ <define name='capnet'>
+ <attribute name='type'>
+ <value>net</value>
+ </attribute>
+
+ <element name='interface'>
+ <text/>
+ </element>
+ <optional>
+ <element name='address'>
+ <ref name='mac'/>
+ </element>
+ </optional>
+
+ <zeroOrMore>
+ <ref name='subcapnet'/>
+ </zeroOrMore>
+ </define>
+
+ <define name='subcapnet'>
+ <element name='capability'>
+ <choice>
+ <ref name='subcapnet80203'/>
+ <ref name='subcapnet80211'/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='subcapnet80203'>
+ <attribute name='type'>
+ <value>80203</value>
+ </attribute>
+ </define>
+
+ <define name='subcapnet80211'>
+ <attribute name='type'>
+ <value>80211</value>
+ </attribute>
+ </define>
+
+
+ <define name='capscsihost'>
+ <attribute name='type'>
+ <value>scsi_host</value>
+ </attribute>
+
+ <element name='host'>
+ <ref name='uint'/>
+ </element>
+ </define>
+
+ <define name='capscsi'>
+ <attribute name='type'>
+ <value>scsi</value>
+ </attribute>
+
+ <element name='host'>
+ <ref name='uint'/>
+ </element>
+ <element name='bus'>
+ <ref name='uint'/>
+ </element>
+ <element name='target'>
+ <ref name='uint'/>
+ </element>
+ <element name='lun'>
+ <ref name='uint'/>
+ </element>
+
+ <element name='type'>
+ <text/>
+ </element>
+ </define>
+
+ <define name='capstorage'>
+ <attribute name='type'>
+ <value>storage</value>
+ </attribute>
+
+ <element name='block'>
+ <ref name='path'/>
+ </element>
+
+ <optional>
+ <element name='bus'>
+ <text/>
+ </element>
+ </optional>
+ <optional>
+ <element name='drive_type'>
+ <text/>
+ </element>
+ </optional>
+ <optional>
+ <element name='model'>
+ <text/>
+ </element>
+ </optional>
+ <optional>
+ <element name='vendor'>
+ <text/>
+ </element>
+ </optional>
+
+ <choice>
+ <ref name='capstorageremoveable'/>
+ <ref name='capstoragefixed'/>
+ </choice>
+
+ <optional>
+ <element name='capability'>
+ <attribute name='type'>
+ <value>hotpluggable</value>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+ <define name='capstorageremoveable'>
+ <element name='capability'>
+ <attribute name='type'>
+ <value>removable</value>
+ </attribute>
+ <element name='media_available'>
+ <choice>
+ <value>1</value>
+ <value>0</value>
+ </choice>
+ </element>
+
+ <element name='media_size'>
+ <ref name='uint'/>
+ </element>
+ </element>
+ </define>
+
+ <define name='capstoragefixed'>
+ <element name='size'>
+ <ref name='uint'/>
+ </element>
+ </define>
+
+ <define name='uuid'>
+ <choice>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{32}</param>
+ </data>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
+ </data>
+ </choice>
+ </define>
+
+ <define name='uint'>
+ <data type='string'>
+ <param name="pattern">[0-9]+</param>
+ </data>
+ </define>
+
+ <define name='hexuint'>
+ <data type='string'>
+ <param name="pattern">(0x)?[0-9a-f]+</param>
+ </data>
+ </define>
+
+ <define name='mac'>
+ <data type='string'>
+ <param name="pattern">([a-fA-F0-9]{2}:){5}[a-fA-F0-9]{2}</param>
+ </data>
+ </define>
+
+ <define name='path'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
+ </data>
+ </define>
+
+</grammar>
diff -r 8eb4d4028b98 docs/schemas/storagepool.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/storagepool.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,371 @@
+<!-- A Relax NG schema for the libvirt node device XML format -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- We handle only document defining a domain -->
+ <start>
+ <ref name='pool'/>
+ </start>
+
+
+ <define name='pool'>
+ <element name='pool'>
+ <choice>
+ <ref name='pooldir'/>
+ <ref name='poolfs'/>
+ <ref name='poolnetfs'/>
+ <ref name='poollogical'/>
+ <ref name='pooldisk'/>
+ <ref name='pooliscsi'/>
+ <ref name='poolscsi'/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='pooldir'>
+ <attribute name='type'>
+ <value>dir</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcedir'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='poolfs'>
+ <attribute name='type'>
+ <value>fs</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcefs'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='poolnetfs'>
+ <attribute name='type'>
+ <value>netfs</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcenetfs'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='poollogical'>
+ <attribute name='type'>
+ <value>logical</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcelogical'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='pooldisk'>
+ <attribute name='type'>
+ <value>disk</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcedisk'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='pooliscsi'>
+ <attribute name='type'>
+ <value>iscsi</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourceiscsi'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='poolscsi'>
+ <attribute name='type'>
+ <value>scsi</value>
+ </attribute>
+ <ref name='commonmetadata'/>
+ <ref name='sizing'/>
+ <ref name='sourcescsi'/>
+ <ref name='target'/>
+ </define>
+
+ <define name='commonmetadata'>
+ <element name='name'>
+ <ref name='name'/>
+ </element>
+ <optional>
+ <element name='uuid'>
+ <ref name='uuid'/>
+ </element>
+ </optional>
+ </define>
+
+ <define name='sizing'>
+ <optional>
+ <element name='capacity'>
+ <ref name='uint'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='allocation'>
+ <ref name='uint'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='available'>
+ <ref name='uint'/>
+ </element>
+ </optional>
+ </define>
+
+ <define name='permissions'>
+ <optional>
+ <element name='permissions'>
+ <element name='mode'>
+ <ref name='uint'/>
+ </element>
+ <element name='owner'>
+ <ref name='uint'/>
+ </element>
+ <element name='group'>
+ <ref name='uint'/>
+ </element>
+ <optional>
+ <element name='label'>
+ <text/>
+ </element>
+ </optional>
+ </element>
+ </optional>
+ </define>
+
+ <define name='target'>
+ <element name='target'>
+ <optional>
+ <element name='path'>
+ <ref name='path'/>
+ </element>
+ </optional>
+ <ref name='permissions'/>
+ </element>
+ </define>
+
+ <define name='sourceinfohost'>
+ <element name='host'>
+ <attribute name='name'>
+ <text/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+ <define name='sourceinfodev'>
+ <element name='device'>
+ <attribute name='path'>
+ <choice>
+ <ref name='path'/>
+ <ref name='name'/>
+ </choice>
+ </attribute>
+ <choice>
+ <empty/>
+ <ref name='devextents'/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='devextents'>
+ <oneOrMore>
+ <element name='freeExtent'>
+ <attribute name='start'>
+ <ref name='uint'/>
+ </attribute>
+ <attribute name='end'>
+ <ref name='uint'/>
+ </attribute>
+ </element>
+ </oneOrMore>
+ </define>
+
+ <define name='sourceinfodir'>
+ <element name='dir'>
+ <attribute name='path'>
+ <ref name='path'/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+ <define name='sourceinfoadapter'>
+ <element name='adapter'>
+ <attribute name='name'>
+ <text/>
+ </attribute>
+ <empty/>
+ </element>
+ </define>
+
+ <define name='sourceinfoname'>
+ <element name='name'>
+ <text/>
+ </element>
+ </define>
+
+ <define name='sourcefmtfs'>
+ <optional>
+ <element name='format'>
+ <attribute name='type'>
+ <choice>
+ <value>auto</value>
+ <value>ext2</value>
+ <value>ext3</value>
+ <value>ext4</value>
+ <value>ufs</value>
+ <value>iso9660</value>
+ <value>udf</value>
+ <value>gfs</value>
+ <value>gfs2</value>
+ <value>vfat</value>
+ <value>hfs+</value>
+ <value>xfs</value>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+
+ <define name='sourcefmtnetfs'>
+ <optional>
+ <element name='format'>
+ <attribute name='type'>
+ <choice>
+ <value>auto</value>
+ <value>nfs</value>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+
+ <define name='sourcefmtdisk'>
+ <optional>
+ <element name='format'>
+ <attribute name='type'>
+ <choice>
+ <value>none</value>
+ <value>dos</value>
+ <value>dvh</value>
+ <value>gpt</value>
+ <value>mac</value>
+ <value>bsd</value>
+ <value>pc98</value>
+ <value>sun</value>
+ <value>lvm2</value>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+
+ <define name='sourcefmtlogical'>
+ <optional>
+ <element name='format'>
+ <attribute name='type'>
+ <choice>
+ <value>auto</value>
+ <value>lvm2</value>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+
+ <define name='sourcedir'>
+ <optional>
+ <element name='source'>
+ <empty/>
+ </element>
+ </optional>
+ </define>
+ <define name='sourcefs'>
+ <element name='source'>
+ <ref name='sourceinfodev'/>
+ <ref name='sourcefmtfs'/>
+ </element>
+ </define>
+
+ <define name='sourcenetfs'>
+ <element name='source'>
+ <ref name='sourceinfohost'/>
+ <ref name='sourceinfodir'/>
+ <ref name='sourcefmtnetfs'/>
+ </element>
+ </define>
+
+ <define name='sourcelogical'>
+ <element name='source'>
+ <ref name='sourceinfoname'/>
+ <optional>
+ <ref name='sourceinfodev'/>
+ </optional>
+ <ref name='sourcefmtlogical'/>
+ </element>
+ </define>
+
+ <define name='sourcedisk'>
+ <element name='source'>
+ <ref name='sourceinfodev'/>
+ <ref name='sourcefmtdisk'/>
+ </element>
+ </define>
+
+ <define name='sourceiscsi'>
+ <element name='source'>
+ <ref name='sourceinfohost'/>
+ <ref name='sourceinfodev'/>
+ </element>
+ </define>
+
+ <define name='sourcescsi'>
+ <element name='source'>
+ <ref name='sourceinfoname'/>
+ </element>
+ </define>
+
+
+ <define name='name'>
+ <data type='string'>
+ <param name="pattern">[a-zA-Z0-9_\+\-]+</param>
+ </data>
+ </define>
+ <define name='uuid'>
+ <choice>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{32}</param>
+ </data>
+ <data type='string'>
+ <param name="pattern">[a-fA-F0-9]{8}\-([a-fA-F0-9]{4}\-){3}[a-fA-F0-9]{12}</param>
+ </data>
+ </choice>
+ </define>
+
+ <define name='uint'>
+ <data type='string'>
+ <param name="pattern">[0-9]+</param>
+ </data>
+ </define>
+
+ <define name='path'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\+\-/%]+</param>
+ </data>
+ </define>
+
+
+</grammar>
diff -r 8eb4d4028b98 docs/schemas/storagevol.rng
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/schemas/storagevol.rng Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,187 @@
+<!-- A Relax NG schema for the libvirt node device XML format -->
+<grammar xmlns="http://relaxng.org/ns/structure/1.0"
+ datatypeLibrary="http://www.w3.org/2001/XMLSchema-datatypes">
+ <!-- We handle only document defining a domain -->
+ <start>
+ <ref name='vol'/>
+ </start>
+
+
+ <define name='vol'>
+ <element name='volume'>
+ <element name='name'>
+ <ref name='name'/>
+ </element>
+ <optional>
+ <element name='key'>
+ <text/>
+ </element>
+ </optional>
+ <ref name='source'/>
+ <ref name='sizing'/>
+ <ref name='target'/>
+ <optional>
+ <ref name='backingStore'/>
+ </optional>
+ </element>
+ </define>
+
+ <define name='sizing'>
+ <optional>
+ <element name='capacity'>
+ <ref name='uint'/>
+ </element>
+ </optional>
+ <optional>
+ <element name='allocation'>
+ <ref name='uint'/>
+ </element>
+ </optional>
+ </define>
+
+ <define name='permissions'>
+ <optional>
+ <element name='permissions'>
+ <element name='mode'>
+ <ref name='uint'/>
+ </element>
+ <element name='owner'>
+ <ref name='uint'/>
+ </element>
+ <element name='group'>
+ <ref name='uint'/>
+ </element>
+ <optional>
+ <element name='label'>
+ <text/>
+ </element>
+ </optional>
+ </element>
+ </optional>
+ </define>
+
+ <define name='target'>
+ <element name='target'>
+ <optional>
+ <element name='path'>
+ <ref name='path'/>
+ </element>
+ </optional>
+ <ref name='format'/>
+ <ref name='permissions'/>
+ </element>
+ </define>
+
+ <define name='backingStore'>
+ <element name='backingStore'>
+ <element name='path'>
+ <ref name='path'/>
+ </element>
+ <ref name='format'/>
+ <ref name='permissions'/>
+ </element>
+ </define>
+
+
+ <define name='source'>
+ <element name='source'>
+ <zeroOrMore>
+ <ref name='sourcedev'/>
+ </zeroOrMore>
+ </element>
+ </define>
+
+ <define name='sourcedev'>
+ <element name='device'>
+ <attribute name='path'>
+ <ref name='path'/>
+ </attribute>
+ <choice>
+ <empty/>
+ <ref name='devextents'/>
+ </choice>
+ </element>
+ </define>
+
+ <define name='devextents'>
+ <oneOrMore>
+ <element name='extent'>
+ <attribute name='start'>
+ <ref name='uint'/>
+ </attribute>
+ <attribute name='end'>
+ <ref name='uint'/>
+ </attribute>
+ </element>
+ </oneOrMore>
+ </define>
+
+ <define name='formatdev'>
+ <choice>
+ <value>none</value>
+ <value>auto</value>
+ <value>ext2</value>
+ <value>ext3</value>
+ <value>ext4</value>
+ <value>ufs</value>
+ <value>iso9660</value>
+ <value>udf</value>
+ <value>gfs</value>
+ <value>gfs2</value>
+ <value>vfat</value>
+ <value>hfs+</value>
+ <value>xfs</value>
+ </choice>
+
+ </define>
+
+
+ <define name='formatfile'>
+ <choice>
+ <value>raw</value>
+ <value>dir</value>
+ <value>bochs</value>
+ <value>cloop</value>
+ <value>cow</value>
+ <value>dmg</value>
+ <value>iso</value>
+ <value>qcow</value>
+ <value>qcow2</value>
+ <value>vmdk</value>
+ <value>vpc</value>
+ </choice>
+ </define>
+
+ <define name='format'>
+ <optional>
+ <element name='format'>
+ <attribute name='type'>
+ <choice>
+ <ref name='formatfile'/>
+ <ref name='formatdev'/>
+ </choice>
+ </attribute>
+ </element>
+ </optional>
+ </define>
+
+ <define name='name'>
+ <data type='string'>
+ <param name="pattern">[a-zA-Z0-9_\+\-\.]+</param>
+ </data>
+ </define>
+
+ <define name='uint'>
+ <data type='string'>
+ <param name="pattern">[0-9]+</param>
+ </data>
+ </define>
+
+ <define name='path'>
+ <data type='string'>
+ <param name="pattern">/[a-zA-Z0-9_\+\-\./%]+</param>
+ </data>
+ </define>
+
+
+</grammar>
diff -r 8eb4d4028b98 libvirt.spec.in
--- a/libvirt.spec.in Wed Jan 21 15:47:23 2009 +0000
+++ b/libvirt.spec.in Wed Jan 21 16:28:43 2009 +0000
@@ -354,6 +354,16 @@ fi
%{_datadir}/libvirt/networks/default.xml
%endif
+%dir %{_datadir}/libvirt/
+%dir %{_datadir}/libvirt/schemas/
+
+%{_datadir}/libvirt/schemas/domain.rng
+%{_datadir}/libvirt/schemas/network.rng
+%{_datadir}/libvirt/schemas/storagepool.rng
+%{_datadir}/libvirt/schemas/storagevol.rng
+%{_datadir}/libvirt/schemas/nodedev.rng
+%{_datadir}/libvirt/schemas/capability.rng
+
%dir %{_localstatedir}/run/libvirt/
%dir %{_localstatedir}/lib/libvirt/
@@ -410,7 +420,6 @@ fi
%attr(0755, root, root) %{_sbindir}/libvirtd
%endif
-%doc docs/*.rng
%doc docs/*.xml
%files devel
diff -r 8eb4d4028b98 mingw32-libvirt.spec.in
--- a/mingw32-libvirt.spec.in Wed Jan 21 15:47:23 2009 +0000
+++ b/mingw32-libvirt.spec.in Wed Jan 21 16:28:43 2009 +0000
@@ -80,6 +80,15 @@ rm -rf $RPM_BUILD_ROOT
%{_mingw32_libdir}/libvirt.la
%{_mingw32_libdir}/pkgconfig/libvirt.pc
+%dir %{_mingw32_datadir}/libvirt/
+%dir %{_mingw32_datadir}/libvirt/schemas/
+%{_mingw32_datadir}/libvirt/schemas/domain.rng
+%{_mingw32_datadir}/libvirt/schemas/network.rng
+%{_mingw32_datadir}/libvirt/schemas/storagepool.rng
+%{_mingw32_datadir}/libvirt/schemas/storagevol.rng
+%{_mingw32_datadir}/libvirt/schemas/nodedev.rng
+%{_mingw32_datadir}/libvirt/schemas/capability.rng
+
%{_mingw32_datadir}/locale/*/LC_MESSAGES/libvirt.mo
%dir %{_mingw32_includedir}/libvirt
diff -r 8eb4d4028b98 tests/Makefile.am
--- a/tests/Makefile.am Wed Jan 21 15:47:23 2009 +0000
+++ b/tests/Makefile.am Wed Jan 21 16:28:43 2009 +0000
@@ -41,8 +41,17 @@ EXTRA_DIST = \
test-lib.sh \
qemuxml2argvdata \
nodeinfodata \
+ capabilityschematest \
+ capabilityschemadata \
+ networkschematest \
domainschematest \
- domainschemadata
+ domainschemadata \
+ storagepoolschematest \
+ storagepoolschemadata \
+ storagevolschematest \
+ storagevolschemadata \
+ nodedevschematest \
+ nodedevschemadata
noinst_PROGRAMS = virshtest conftest \
nodeinfotest statstest qparamtest
@@ -55,7 +64,14 @@ if WITH_QEMU
noinst_PROGRAMS += qemuxml2argvtest qemuxml2xmltest
endif
-test_scripts = domainschematest
+test_scripts = \
+ capabilityschematest \
+ networkschematest \
+ storagepoolschematest \
+ storagevolschematest \
+ domainschematest \
+ nodedevschematest
+
if WITH_LIBVIRTD
test_scripts += \
test_conf.sh \
diff -r 8eb4d4028b98 tests/capabilityschemadata/caps-qemu-kvm.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/capabilityschemadata/caps-qemu-kvm.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,111 @@
+<capabilities>
+
+ <host>
+ <cpu>
+ <arch>i686</arch>
+ </cpu>
+ </host>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='i686'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu</emulator>
+ <machine>pc</machine>
+ <machine>isapc</machine>
+ <domain type='qemu'>
+ </domain>
+ <domain type='kvm'>
+ <emulator>/usr/bin/qemu-kvm</emulator>
+ </domain>
+ </arch>
+ <features>
+ <pae/>
+ <nonpae/>
+ <acpi default='on' toggle='yes'/>
+ <apic default='on' toggle='no'/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='x86_64'>
+ <wordsize>64</wordsize>
+ <emulator>/usr/bin/qemu-system-x86_64</emulator>
+ <machine>pc</machine>
+ <machine>isapc</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ <features>
+ <acpi default='on' toggle='yes'/>
+ <apic default='on' toggle='no'/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='mips'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-mips</emulator>
+ <machine>mips</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='mipsel'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-mipsel</emulator>
+ <machine>mips</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='sparc'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-sparc</emulator>
+ <machine>sun4m</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='ppc'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/qemu-system-ppc</emulator>
+ <machine>g3bw</machine>
+ <machine>mac99</machine>
+ <machine>prep</machine>
+ <domain type='qemu'>
+ </domain>
+ </arch>
+ </guest>
+
+ <guest>
+ <os_type>xen</os_type>
+ <arch name='i686'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/xenner</emulator>
+ <machine>xenner</machine>
+ <domain type='kvm'>
+ </domain>
+ </arch>
+ <features>
+ <pae/>
+ <nonpae/>
+ <acpi default='on' toggle='yes'/>
+ <apic default='on' toggle='no'/>
+ </features>
+ </guest>
+
+</capabilities>
+
+
diff -r 8eb4d4028b98 tests/capabilityschemadata/caps-test.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/capabilityschemadata/caps-test.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,71 @@
+<capabilities>
+
+ <host>
+ <cpu>
+ <arch>i686</arch>
+ <features>
+ <pae/>
+ <nonpae/>
+ </features>
+ </cpu>
+ <topology>
+ <cells num='2'>
+ <cell id='0'>
+ <cpus num='8'>
+ <cpu id='0'/>
+ <cpu id='2'/>
+ <cpu id='4'/>
+ <cpu id='6'/>
+ <cpu id='8'/>
+ <cpu id='10'/>
+ <cpu id='12'/>
+ <cpu id='14'/>
+ </cpus>
+ </cell>
+ <cell id='1'>
+ <cpus num='8'>
+ <cpu id='1'/>
+ <cpu id='3'/>
+ <cpu id='5'/>
+ <cpu id='7'/>
+ <cpu id='9'/>
+ <cpu id='11'/>
+ <cpu id='13'/>
+ <cpu id='15'/>
+ </cpus>
+ </cell>
+ </cells>
+ </topology>
+ </host>
+
+ <guest>
+ <os_type>hvm</os_type>
+ <arch name='i686'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/test-hv</emulator>
+ <domain type='test'>
+ </domain>
+ </arch>
+ <features>
+ <pae/>
+ <nonpae/>
+ </features>
+ </guest>
+
+ <guest>
+ <os_type>xen</os_type>
+ <arch name='i686'>
+ <wordsize>32</wordsize>
+ <emulator>/usr/bin/test-hv</emulator>
+ <domain type='test'>
+ </domain>
+ </arch>
+ <features>
+ <pae/>
+ <nonpae/>
+ </features>
+ </guest>
+
+</capabilities>
+
+
diff -r 8eb4d4028b98 tests/capabilityschematest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/capabilityschematest Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
+
+DOMAINDIRS="capabilityschemadata xencapsdata"
+
+
+n=0
+f=0
+for dir in $DOMAINDIRS
+do
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
+
+ for xml in $XML
+ do
+ n=`expr $n + 1`
+ printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
+ result=`xmllint --relaxng $srcdir/../docs/schemas/capability.rng --noout $xml 2>&1`
+ ret=$?
+ if test $ret = 0; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo $result
+ f=`expr $f + 1`
+ fi
+ done
+done
+echo "Validated $n files, $f failed"
+
+ret=0
+test $f != 0 && ret=255
+exit $ret
diff -r 8eb4d4028b98 tests/domainschematest
--- a/tests/domainschematest Wed Jan 21 15:47:23 2009 +0000
+++ b/tests/domainschematest Wed Jan 21 16:28:43 2009 +0000
@@ -1,6 +1,7 @@
#!/bin/sh
test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
DOMAINDIRS="domainschemadata qemuxml2argvdata sexpr2xmldata xmconfigdata xml2sexprdata"
@@ -14,7 +15,7 @@ do
do
n=`expr $n + 1`
printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
- result=`xmllint --relaxng $srcdir/../docs/libvirt.rng --noout $xml 2>&1`
+ result=`xmllint --relaxng $srcdir/../docs/schemas/domain.rng --noout $xml 2>&1`
ret=$?
if test $ret = 0; then
echo "OK"
diff -r 8eb4d4028b98 tests/networkschematest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/networkschematest Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
+
+DIRS="../qemud"
+
+n=0
+f=0
+for dir in $DIRS
+do
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
+
+ for xml in $XML
+ do
+ n=`expr $n + 1`
+ printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
+ result=`xmllint --relaxng $srcdir/../docs/schemas/network.rng --noout $xml 2>&1`
+ ret=$?
+ if test $ret = 0; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo $result
+ f=`expr $f + 1`
+ fi
+ done
+done
+echo "Validated $n files, $f failed"
+
+ret=0
+test $f != 0 && ret=255
+exit $ret
diff -r 8eb4d4028b98 tests/nodedevschemadata/DVD_GCC_4247N.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/DVD_GCC_4247N.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,17 @@
+<device>
+ <name>DVD_GCC_4247N</name>
+ <parent>pci_8086_27df_scsi_host_scsi_device_lun0</parent>
+ <capability type='storage'>
+ <block>/dev/sr0</block>
+ <bus>scsi</bus>
+ <drive_type>cdrom</drive_type>
+ <model>RW/DVD GCC-4247N</model>
+ <vendor>HL-DT-ST</vendor>
+ <capability type='removable'>
+ <media_available>0</media_available>
+ <media_size>0</media_size>
+ </capability>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/computer.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/computer.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,18 @@
+<device>
+ <name>computer</name>
+ <capability type='system'>
+ <hardware>
+ <vendor>LENOVO</vendor>
+ <version>ThinkPad T60p</version>
+ <serial>123123</serial>
+ <uuid>12345678-1234-1234-9596-a088b277d677</uuid>
+ </hardware>
+ <firmware>
+ <vendor>LENOVO</vendor>
+ <version>79ETE1WW (2.21 )</version>
+ <release_date>02/05/2008</release_date>
+ </firmware>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/net_00_13_02_b9_f9_d3.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,11 @@
+<device>
+ <name>net_00_13_02_b9_f9_d3</name>
+ <parent>pci_8086_4227</parent>
+ <capability type='net'>
+ <interface>eth0</interface>
+ <address>00:13:02:b9:f9:d3</address>
+ <capability type='80211'/>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/net_00_15_58_2f_e9_55.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,11 @@
+<device>
+ <name>net_00_15_58_2f_e9_55</name>
+ <parent>pci_8086_109a</parent>
+ <capability type='net'>
+ <interface>eth1</interface>
+ <address>00:15:58:2f:e9:55</address>
+ <capability type='80203'/>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_1002_71c4.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/pci_1002_71c4.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,14 @@
+<device>
+ <name>pci_1002_71c4</name>
+ <parent>pci_8086_27a1</parent>
+ <capability type='pci'>
+ <domain>0</domain>
+ <bus>1</bus>
+ <slot>0</slot>
+ <function>0</function>
+ <product id='0x71c4'>M56GL [Mobility FireGL V5200]</product>
+ <vendor id='0x1002'>ATI Technologies Inc</vendor>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,9 @@
+<device>
+ <name>pci_8086_27c5_scsi_host</name>
+ <parent>pci_8086_27c5</parent>
+ <capability type='scsi_host'>
+ <host>0</host>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_0.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,9 @@
+<device>
+ <name>pci_8086_27c5_scsi_host_0</name>
+ <parent>pci_8086_27c5</parent>
+ <capability type='scsi_host'>
+ <host>1</host>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_device_lun0.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,13 @@
+<device>
+ <name>pci_8086_27c5_scsi_host_scsi_device_lun0</name>
+ <parent>pci_8086_27c5_scsi_host</parent>
+ <capability type='scsi'>
+ <host>0</host>
+ <bus>0</bus>
+ <target>0</target>
+ <lun>0</lun>
+ <type>disk</type>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/pci_8086_27c5_scsi_host_scsi_host.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,9 @@
+<device>
+ <name>pci_8086_27c5_scsi_host_scsi_host</name>
+ <parent>pci_8086_27c5_scsi_host</parent>
+ <capability type='scsi_host'>
+ <host>0</host>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,14 @@
+<device>
+ <name>storage_serial_SATA_HTS721010G9SA00_MPCZ12Y0GNGWSE</name>
+ <parent>pci_8086_27c5_scsi_host_scsi_device_lun0</parent>
+ <capability type='storage'>
+ <block>/dev/sda</block>
+ <bus>scsi</bus>
+ <drive_type>disk</drive_type>
+ <model>HTS721010G9SA00</model>
+ <vendor>ATA</vendor>
+ <size>100030242816</size>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,12 @@
+<device>
+ <name>usb_device_1d6b_1_0000_00_1d_0</name>
+ <parent>pci_8086_27c8</parent>
+ <capability type='usb_device'>
+ <bus>2</bus>
+ <device>1</device>
+ <product id='0x0001'>1.1 root hub</product>
+ <vendor id='0x1d6b'>Linux Foundation</vendor>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschemadata/usb_device_1d6b_1_0000_00_1d_0_if0.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,12 @@
+<device>
+ <name>usb_device_1d6b_1_0000_00_1d_0_if0</name>
+ <parent>usb_device_1d6b_1_0000_00_1d_0</parent>
+ <capability type='usb'>
+ <number>0</number>
+ <class>9</class>
+ <subclass>0</subclass>
+ <protocol>0</protocol>
+ </capability>
+</device>
+
+
diff -r 8eb4d4028b98 tests/nodedevschematest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/nodedevschematest Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
+
+DIRS="nodedevschemadata"
+
+n=0
+f=0
+for dir in $DIRS
+do
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
+
+ for xml in $XML
+ do
+ n=`expr $n + 1`
+ printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
+ result=`xmllint --relaxng $srcdir/../docs/schemas/nodedev.rng --noout $xml 2>&1`
+ ret=$?
+ if test $ret = 0; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo $result
+ f=`expr $f + 1`
+ fi
+ done
+done
+echo "Validated $n files, $f failed"
+
+ret=0
+test $f != 0 && ret=255
+exit $ret
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-dir.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-dir.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,17 @@
+<pool type='dir'>
+ <name>virtimages</name>
+ <uuid>70a7eb15-6c34-ee9c-bf57-69e8e5ff3fb2</uuid>
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ </source>
+ <target>
+ <path>/var/lib/libvirt/images</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>0</owner>
+ <group>0</group>
+ </permissions>
+ </target>
+</pool>
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-disk.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-disk.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,22 @@
+<pool type='disk'>
+ <name>sda</name>
+ <uuid>e3509a62-1b4c-e20b-94bd-9168963f9b97</uuid>
+ <capacity>100027630080</capacity>
+ <allocation>100027597824</allocation>
+ <available>0</available>
+ <source>
+ <device path='/dev/sda'>
+ <freeExtent start='370137600' end='567544320'/>
+ <freeExtent start='987033600' end='1044610560'/>
+ </device>
+ <format type='dos'/>
+ </source>
+ <target>
+ <path>/dev</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>0</owner>
+ <group>0</group>
+ </permissions>
+ </target>
+</pool>
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-fs.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-fs.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,20 @@
+<pool type='fs'>
+ <name>images</name>
+ <uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ <device path='/dev/sda6'/>
+ <format type='ext3'/>
+ </source>
+ <target>
+ <path>/mnt</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>0</owner>
+ <group>0</group>
+ </permissions>
+ </target>
+</pool>
+
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-iscsi.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-iscsi.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,10 @@
+<pool type='iscsi'>
+ <name>virtimages</name>
+ <source>
+ <host name="iscsi.example.com"/>
+ <device path="demo-target"/>
+ </source>
+ <target>
+ <path>/dev/disk/by-path</path>
+ </target>
+</pool>
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-logical.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-logical.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,19 @@
+<pool type='logical'>
+ <name>HostVG</name>
+ <uuid>1c13165a-d0f4-3aee-b447-30fb38789091</uuid>
+ <capacity>99891544064</capacity>
+ <allocation>99220455424</allocation>
+ <available>671088640</available>
+ <source>
+ <name>HostVG</name>
+ <format type='lvm2'/>
+ </source>
+ <target>
+ <path>/dev/HostVG</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>0</owner>
+ <group>0</group>
+ </permissions>
+ </target>
+</pool>
diff -r 8eb4d4028b98 tests/storagepoolschemadata/pool-netfs.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschemadata/pool-netfs.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,21 @@
+<pool type='netfs'>
+ <name>nfsimages</name>
+ <uuid>7641d5a8-af11-f730-a34e-0a7dfcede71f</uuid>
+ <capacity>0</capacity>
+ <allocation>0</allocation>
+ <available>0</available>
+ <source>
+ <host name='localhost'/>
+ <dir path='/var/lib/libvirt/images'/>
+ <format type='nfs'/>
+ </source>
+ <target>
+ <path>/mnt</path>
+ <permissions>
+ <mode>0700</mode>
+ <owner>0</owner>
+ <group>0</group>
+ </permissions>
+ </target>
+</pool>
+
diff -r 8eb4d4028b98 tests/storagepoolschematest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagepoolschematest Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
+
+DIRS="storagepoolschemadata"
+
+n=0
+f=0
+for dir in $DIRS
+do
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
+
+ for xml in $XML
+ do
+ n=`expr $n + 1`
+ printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
+ result=`xmllint --relaxng $srcdir/../docs/schemas/storagepool.rng --noout $xml 2>&1`
+ ret=$?
+ if test $ret = 0; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo $result
+ f=`expr $f + 1`
+ fi
+ done
+done
+echo "Validated $n files, $f failed"
+
+ret=0
+test $f != 0 && ret=255
+exit $ret
diff -r 8eb4d4028b98 tests/storagevolschemadata/vol-logical.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagevolschemadata/vol-logical.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,21 @@
+<volume>
+ <name>Swap</name>
+ <key>r4xkCv-MQhr-WKIT-R66x-Epn2-e8hG-1Z5gY0</key>
+ <source>
+ <device path='/dev/sda2'>
+ <extent start='31440502784' end='33520877568'/>
+ </device>
+ </source>
+ <capacity>2080374784</capacity>
+ <allocation>2080374784</allocation>
+ <target>
+ <path>/dev/HostVG/Swap</path>
+ <permissions>
+ <mode>060660</mode>
+ <owner>0</owner>
+ <group>6</group>
+ <label>system_u:object_r:fixed_disk_device_t:s0</label>
+ </permissions>
+ </target>
+</volume>
+
diff -r 8eb4d4028b98 tests/storagevolschemadata/vol-partition.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagevolschemadata/vol-partition.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,21 @@
+<volume>
+ <name>sda1</name>
+ <key>/dev/sda1</key>
+ <source>
+ <device path='/dev/sda'>
+ <extent start='32256' end='106928640'/>
+ </device>
+ </source>
+ <capacity>106896384</capacity>
+ <allocation>106896384</allocation>
+ <target>
+ <path>/dev/sda1</path>
+ <format type='none'/>
+ <permissions>
+ <mode>060660</mode>
+ <owner>0</owner>
+ <group>6</group>
+ <label>system_u:object_r:fixed_disk_device_t:s0</label>
+ </permissions>
+ </target>
+</volume>
diff -r 8eb4d4028b98 tests/storagevolschemadata/vol-qcow2.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagevolschemadata/vol-qcow2.xml Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,28 @@
+<volume>
+ <name>OtherDemo.img</name>
+ <key>/var/lib/libvirt/images/OtherDemo.img</key>
+ <source>
+ </source>
+ <capacity>5242880000</capacity>
+ <allocation>294912</allocation>
+ <target>
+ <path>/var/lib/libvirt/images/OtherDemo.img</path>
+ <format type='qcow2'/>
+ <permissions>
+ <mode>0100644</mode>
+ <owner>0</owner>
+ <group>0</group>
+ <label>unconfined_u:object_r:virt_image_t:s0</label>
+ </permissions>
+ </target>
+ <backingStore>
+ <path>/var/lib/libvirt/images/BaseDemo.img</path>
+ <format type='raw'/>
+ <permissions>
+ <mode>0100644</mode>
+ <owner>0</owner>
+ <group>0</group>
+ <label>unconfined_u:object_r:virt_image_t:s0</label>
+ </permissions>
+ </backingStore>
+</volume>
diff -r 8eb4d4028b98 tests/storagevolschematest
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/storagevolschematest Wed Jan 21 16:28:43 2009 +0000
@@ -0,0 +1,33 @@
+#!/bin/sh
+
+test -z "$srcdir" && srcdir=`pwd`
+test -z "$abs_srcdir" && abs_srcdir=`pwd`
+
+DIRS="storagevolschemadata"
+
+n=0
+f=0
+for dir in $DIRS
+do
+ XML=`find $abs_srcdir/$dir -name '*.xml'` || exit 1
+
+ for xml in $XML
+ do
+ n=`expr $n + 1`
+ printf "%4d) %.60s " $n $(basename $(dirname $xml))"/"$(basename $xml)
+ result=`xmllint --relaxng $srcdir/../docs/schemas/storagevol.rng --noout $xml 2>&1`
+ ret=$?
+ if test $ret = 0; then
+ echo "OK"
+ else
+ echo "FAILED"
+ echo $result
+ f=`expr $f + 1`
+ fi
+ done
+done
+echo "Validated $n files, $f failed"
+
+ret=0
+test $f != 0 && ret=255
+exit $ret
--
|: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :|
|: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :|
|: http://autobuild.org -o- http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|
3
2