[libvirt] [PATCH] xend driver: handle new-format sched-credit options
by john.levon@sun.com
# 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;
15 years, 10 months
[libvirt] FYI, .*ignore and gnulib updates
by Jim Meyering
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
15 years, 10 months
[libvirt] [PATCH] Fix recursive lock in xenstore driver
by john.levon@sun.com
# 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);
15 years, 10 months
[libvirt] [PATCH] Parse ipaddr for bridge network types
by john.levon@sun.com
# 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... ')))(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... </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... ')))(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... </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);
15 years, 10 months
[libvirt] Probs connecting QEMU hypervisor with URL ?
by Daniel Schwager
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
15 years, 10 months
[libvirt] [PATCH] Remove non-existent symbol from linker script
by john.levon@sun.com
# 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;
15 years, 10 months
[libvirt] [PATCH] Add a rule for generating .hgignore
by john.levon@sun.com
# 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
15 years, 10 months
[libvirt] PATCH: Add RNG schemas for capabilities, storage and node device XML
by Daniel P. Berrange
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 :|
15 years, 10 months
[libvirt] PATCH: Support setting QEMU disk driver type
by Daniel P. Berrange
The domain XML has long supported ability to set the disk driver type
but we only used it in Xen so far.
This patch adds support for QEMU usage. In this usage the driver name
is always going to be 'qemu' since all backends are in QEMU, no alternate
kernelspace / helper daemons as with Xen. The driver type will be one of
the valid QEMU disk formats.
eg
<driver name='qemu' type='qcow2'/>
The snprintf() stuff for building the disk parameter string was getting
rather out of hand, so I took the opportunity to switch it over to use
the virBuffer routines.
src/qemu_conf.c | 49 ++++++++---
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args | 1
tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml | 29 ++++++
tests/qemuxml2argvtest.c | 2
tests/qemuxml2xmltest.c | 1
5 files changed, 69 insertions(+), 13 deletions(-)
Daniel
diff --git a/src/qemu_conf.c b/src/qemu_conf.c
--- a/src/qemu_conf.c
+++ b/src/qemu_conf.c
@@ -48,6 +48,8 @@
#include "xml.h"
#include "nodeinfo.h"
+#define VIR_FROM_THIS VIR_FROM_QEMU
+
VIR_ENUM_DECL(virDomainDiskQEMUBus)
VIR_ENUM_IMPL(virDomainDiskQEMUBus, VIR_DOMAIN_DISK_BUS_LAST,
"ide",
@@ -862,6 +864,18 @@ int qemudBuildCommandLine(virConnectPtr
ADD_ARG_LIT(vm->def->os.bootloader);
}
+ for (i = 0 ; i < vm->def->ndisks ; i++) {
+ virDomainDiskDefPtr disk = vm->def->disks[i];
+
+ if (disk->driverName != NULL &&
+ !STREQ(disk->driverName, "qemu")) {
+ qemudReportError(conn, NULL, NULL, VIR_ERR_INTERNAL_ERROR,
+ _("unsupported driver name '%s' for disk '%s'"),
+ disk->driverName, disk->src);
+ goto error;
+ }
+ }
+
/* If QEMU supports -drive param instead of old -hda, -hdb, -cdrom .. */
if (qemuCmdFlags & QEMUD_CMD_FLAG_DRIVE) {
int bootCD = 0, bootFloppy = 0, bootDisk = 0;
@@ -884,8 +898,8 @@ int qemudBuildCommandLine(virConnectPtr
}
for (i = 0 ; i < vm->def->ndisks ; i++) {
- char opt[PATH_MAX];
- const char *media = NULL;
+ virBuffer opt = VIR_BUFFER_INITIALIZER;
+ char *optstr;
int bootable = 0;
virDomainDiskDefPtr disk = vm->def->disks[i];
int idx = virDiskNameToIndex(disk->dst);
@@ -912,7 +926,6 @@ int qemudBuildCommandLine(virConnectPtr
case VIR_DOMAIN_DISK_DEVICE_CDROM:
bootable = bootCD;
bootCD = 0;
- media = "media=cdrom,";
break;
case VIR_DOMAIN_DISK_DEVICE_FLOPPY:
bootable = bootFloppy;
@@ -924,18 +937,28 @@ int qemudBuildCommandLine(virConnectPtr
break;
}
- snprintf(opt, PATH_MAX, "file=%s,if=%s,%sindex=%d%s%s",
- disk->src ? disk->src : "", bus,
- media ? media : "",
- idx,
- bootable &&
- disk->device == VIR_DOMAIN_DISK_DEVICE_DISK
- ? ",boot=on" : "",
- disk->shared && ! disk->readonly
- ? ",cache=off" : "");
+ virBufferVSprintf(&opt, "file=%s", disk->src ? disk->src : "");
+ virBufferVSprintf(&opt, ",if=%s", bus);
+ if (disk->device == VIR_DOMAIN_DISK_DEVICE_CDROM)
+ virBufferAddLit(&opt, ",media=cdrom");
+ virBufferVSprintf(&opt, ",index=%d", idx);
+ if (bootable &&
+ disk->device == VIR_DOMAIN_DISK_DEVICE_DISK)
+ virBufferAddLit(&opt, ",boot=on");
+ if (disk->shared && !disk->readonly)
+ virBufferAddLit(&opt, ",cache=off");
+ if (disk->driverType)
+ virBufferVSprintf(&opt, ",fmt=%s", disk->driverType);
+
+ if (virBufferError(&opt)) {
+ virReportOOMError(conn);
+ goto error;
+ }
+
+ optstr = virBufferContentAndReset(&opt);
ADD_ARG_LIT("-drive");
- ADD_ARG_LIT(opt);
+ ADD_ARG(optstr);
}
} else {
for (i = 0 ; i < vm->def->ndisks ; i++) {
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
new file mode 100644
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.args
@@ -0,0 +1,1 @@
+LC_ALL=C PATH=/bin HOME=/home/test USER=test LOGNAME=test /usr/bin/qemu -S -M pc -m 214 -smp 1 -nographic -monitor pty -pidfile /nowhere/QEMUGuest1.pid -no-acpi -boot c -drive file=/dev/HostVG/QEMUGuest1,if=ide,index=0,boot=on,fmt=qcow2 -drive file=/dev/HostVG/QEMUGuest2,if=ide,media=cdrom,index=2,fmt=raw -net none -serial none -parallel none -usb
diff --git a/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
new file mode 100644
--- /dev/null
+++ b/tests/qemuxml2argvdata/qemuxml2argv-disk-drive-fmt-qcow.xml
@@ -0,0 +1,29 @@
+<domain type='qemu'>
+ <name>QEMUGuest1</name>
+ <uuid>c7a5fdbd-edaf-9455-926a-d65c16db1809</uuid>
+ <memory>219200</memory>
+ <currentMemory>219200</currentMemory>
+ <vcpu>1</vcpu>
+ <os>
+ <type arch='i686' machine='pc'>hvm</type>
+ <boot dev='hd'/>
+ </os>
+ <clock offset='utc'/>
+ <on_poweroff>destroy</on_poweroff>
+ <on_reboot>restart</on_reboot>
+ <on_crash>destroy</on_crash>
+ <devices>
+ <emulator>/usr/bin/qemu</emulator>
+ <disk type='block' device='disk'>
+ <driver name='qemu' type='qcow2'/>
+ <source dev='/dev/HostVG/QEMUGuest1'/>
+ <target dev='hda' bus='ide'/>
+ </disk>
+ <disk type='block' device='cdrom'>
+ <driver name='qemu' type='raw'/>
+ <source dev='/dev/HostVG/QEMUGuest2'/>
+ <target dev='hdc' bus='ide'/>
+ <readonly/>
+ </disk>
+ </devices>
+</domain>
diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
--- a/tests/qemuxml2argvtest.c
+++ b/tests/qemuxml2argvtest.c
@@ -194,6 +194,8 @@ mymain(int argc, char **argv)
QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("disk-drive-boot-cdrom", QEMUD_CMD_FLAG_DRIVE |
QEMUD_CMD_FLAG_DRIVE_BOOT);
+ DO_TEST("disk-drive-fmt-qcow", QEMUD_CMD_FLAG_DRIVE |
+ QEMUD_CMD_FLAG_DRIVE_BOOT);
DO_TEST("disk-usb", 0);
DO_TEST("graphics-vnc", 0);
DO_TEST("graphics-sdl", 0);
diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c
--- a/tests/qemuxml2xmltest.c
+++ b/tests/qemuxml2xmltest.c
@@ -97,6 +97,7 @@ mymain(int argc, char **argv)
DO_TEST("disk-many");
DO_TEST("disk-xenvbd");
DO_TEST("disk-usb");
+ DO_TEST("disk-drive-fmt-qcow");
DO_TEST("graphics-vnc");
DO_TEST("graphics-sdl");
DO_TEST("graphics-sdl-fullscreen");
--
|: 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 :|
15 years, 10 months
[libvirt] Re: kvm-81: save / restore does not work - missing incoming stdio feature
by Daniel Schwager
Hi Daniel,
I'm also VERY interesting in save/restore my Domains to disk - is
there a roadmap back to this feature - did you talk with the qemu
developers ?
Or should I try to contact them ?
regards
Danny
> From: Matthias Pfafferodt <matthias.pfafferodt <at> mapfa.de>
> Subject: Re: [libvirt] kvm: save / restore
>
> Hello Daniel,
>
> thnaks for your anser. Do you know the plans regarding save/restore in
kvm and
> libvirt? I would like to save my vm's at shutdown and restore at boot
time.
> At the moment this is not working and shutdown is used.
Am Thursday 18 December 2008 13:42:36 schrieb Daniel P. Berrange:
> On Wed, Dec 17, 2008 at 01:46:43PM +0100, Matthias Pfafferodt wrote:
> > Hallo,
> >
> > I use kvm-81 and libvirt 0.5.1. I can save a kvm donain but if I
want to
> > restore it I get the following error in the log file:
> >
> > unknown migration protocol: stdio
> >
> > I tried it using only kvm and got the same error.
> >
> > How can I save / restore a VM to / from a file?
>
> The new KVM release dropped support for the '-incoming stdio' syntax
> that libvirt was using so save/restore no longer works :-(
>
> Daniel
15 years, 10 months