From: Daniel Veillard Date: Thu, 16 Feb 2006 22:50:52 +0000 (+0000) Subject: * configure.in src/Makefile.am: adding dependency to libxml2 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=77e8b6c62c48b6346bbdb2df3e0d925852c6bf3e;p=libvirt.git * configure.in src/Makefile.am: adding dependency to libxml2 * include/libvirt.h* src/libvirt.c src/xend_internal.[ch] src/xml.[ch]: added XML parsing for Xen domain descriptions needed for creates, plugged in a converter to s-exp and xend call. Modified the virDomainCreateLinux() to reflect that XML based description. Seems to work. * python/tests/create.py: added a test case which seems to work not tested much yet * docs/*: regenerated Daniel --- diff --git a/ChangeLog b/ChangeLog index 5a4c6e035b..43722f88e1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,15 @@ +Thu Feb 16 17:47:00 EST 2006 Daniel Veillard + + * configure.in src/Makefile.am: adding dependency to libxml2 + * include/libvirt.h* src/libvirt.c src/xend_internal.[ch] + src/xml.[ch]: added XML parsing for Xen domain descriptions + needed for creates, plugged in a converter to s-exp and + xend call. Modified the virDomainCreateLinux() to reflect + that XML based description. Seems to work. + * python/tests/create.py: added a test case which seems to work + not tested much yet + * docs/*: regenerated + Wed Feb 15 08:20:23 EST 2006 Daniel Veillard * configure.in libvirt.spec.in include/libvirt.h.in python/Makefile.am diff --git a/configure.in b/configure.in index 38162d2645..75d62ce280 100644 --- a/configure.in +++ b/configure.in @@ -90,6 +90,50 @@ then dnl search for the Xen store library AC_SEARCH_LIBS(xs_read, [xenstore], [], [AC_MSG_ERROR([Xen store library not found])]) +dnl ========================================================================== +dnl find libxml2 library, borrowed from xmlsec +dnl ========================================================================== +LIBXML_MIN_VERSION="2.5.0" +LIBXML_CONFIG="xml2-config" +LIBXML_CFLAGS="" +LIBXML_LIBS="" +LIBXML_FOUND="no" +AC_ARG_WITH(libxml, [ --with-libxml=[PFX] libxml2 location]) +if test "z$with_libxml" = "zno" ; then + AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION) + AC_MSG_ERROR(libxml2 >= $LIBXML_MIN_VERSION is required for $XMLSEC_PACKAGE) +elif test "z$with_libxml" = "z" -a "z$PKG_CONFIG_ENABLED" = "zyes" ; then + PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_MIN_VERSION, + [LIBXML_FOUND=yes], + [LIBXML_FOUND=no]) +fi +AC_MSG_CHECKING(libxml2 $with_libxml $LIBXML_FOUND ) +if test "z$LIBXML_FOUND" = "zno" ; then + AC_MSG_CHECKING(for libxml2 libraries >= $LIBXML_MIN_VERSION) + if test "z$with_libxml" != "z" ; then + LIBXML_CONFIG=$with_libxml/bin/$LIBXML_CONFIG + fi + AC_MSG_CHECKING(libxml2 $with_libxml $LIBXML_CONFIG ) + if ! $LIBXML_CONFIG --version > /dev/null 2>&1 ; then + AC_MSG_ERROR(Could not find libxml2 anywhere (see config.log for details).) + fi + vers=`$LIBXML_CONFIG --version | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + minvers=`echo $LIBXML_MIN_VERSION | awk -F. '{ printf "%d", ($1 * 1000 + $2) * 1000 + $3;}'` + if test "$vers" -ge "$minvers" ; then + LIBXML_LIBS="`$LIBXML_CONFIG --libs`" + LIBXML_CFLAGS="`$LIBXML_CONFIG --cflags`" + LIBXML_FOUND="yes" + AC_MSG_RESULT(yes ('$LIBXML_VERSION')) + else + AC_MSG_ERROR(You need at least libxml2 $LIBXML_MIN_VERSION for this version of $XMLSEC_PACKAGE) + fi +fi + +AC_SUBST(LIBXML_CFLAGS) +AC_SUBST(LIBXML_LIBS) +AC_SUBST(LIBXML_CONFIG) +AC_SUBST(LIBXML_MIN_VERSION) + dnl virsh libraries AC_CHECK_LIB(curses, initscr, [VIRSH_LIBS="$VIRSH_LIBS -lcurses"], diff --git a/docs/APIchunk0.html b/docs/APIchunk0.html index 0fb26353b9..eb80b7a6bc 100644 --- a/docs/APIchunk0.html +++ b/docs/APIchunk0.html @@ -74,7 +74,8 @@

Letter U:

UTF-8
virDomainGetXMLDesc
Use
virDomainSave
virDomainSuspend
-

Letter X:

XML
virDomainGetXMLDesc
+

Letter X:

XML
virDomainCreateLinux
+virDomainGetXMLDesc
Xen
virGetVersion

Letter a:

about
virDomainGetInfo
access
_virDomainInfo
@@ -147,7 +148,6 @@
code
virGetVersion
collect
virConnectListDomains
command
_virDomainKernel
-virDomainCreateLinux
compiled
virGetVersion
connection
_virDomainInfo
virConnectClose
@@ -170,7 +170,8 @@ virDomainFree
deallocated
virDomainGetName
defined
virDomainCreateLinux
-
description
virDomainGetXMLDesc
+
description
virDomainCreateLinux
+virDomainGetXMLDesc
device
_virDomainKernel
disk
virDomainRestore
virDomainSave
@@ -212,8 +213,7 @@ virDomainShutdown
virDomainSuspend
virGetVersion
-
file
virDomainCreateLinux
-virDomainSave
+
file
virDomainSave
filename
_virDomainKernel
find
virDomainLookupByID
first
virConnectOpen
@@ -221,7 +221,6 @@
flags
virDomainGetXMLDesc
for
_virDomainInfo
virConnectGetVersion
-virDomainCreateLinux
virDomainGetID
virDomainGetName
virDomainLookupByName
diff --git a/docs/APIchunk1.html b/docs/APIchunk1.html index f681f48175..9e82b77187 100644 --- a/docs/APIchunk1.html +++ b/docs/APIchunk1.html @@ -32,12 +32,10 @@ virGetVersion

Letter i:

ignore
virDomainShutdown
image
_virDomainKernel
-virDomainCreateLinux
information
virDomainGetInfo
virGetVersion
informations
virDomainGetInfo
init
_virDomainKernel
-
initrd
virDomainCreateLinux
instance
virDomainDestroy
virDomainFree
virDomainGetXMLDesc
@@ -48,9 +46,7 @@ virDomainSave

Letter k:

kept
virDomainFree
kernel
_virDomainKernel
-virDomainCreateLinux
-
kilobytes
virDomainCreateLinux
-virDomainGetMaxMemory
+
kilobytes
virDomainGetMaxMemory
virDomainSetMaxMemory
knowing
virDomainShutdown

Letter l:

lack
virConnectGetVersion
@@ -63,7 +59,6 @@
limited
_virDomainInfo
virDomainGetInfo
line
_virDomainKernel
-virDomainCreateLinux
list
virConnectListDomains
listed
virDomainSave
long
_virDomainInfo
@@ -80,7 +75,6 @@ virDomainShutdown
virDomainSuspend
memory
_virDomainInfo
-virDomainCreateLinux
virDomainGetMaxMemory
virDomainSave
virDomainSetMaxMemory
@@ -149,12 +143,10 @@
output
virDomainSave

Letter p:

padding
_virDomainInfo
parameters
_virDomainKernel
-virDomainCreateLinux
partial
virDomainGetInfo
pass
virConnectOpen
virConnectOpenReadOnly
-
path
virDomainCreateLinux
-virDomainRestore
+
path
virDomainRestore
virDomainSave
physical
virDomainGetMaxMemory
virDomainSetMaxMemory
diff --git a/docs/APIchunk2.html b/docs/APIchunk2.html index b8f369ec8d..245035d236 100644 --- a/docs/APIchunk2.html +++ b/docs/APIchunk2.html @@ -19,7 +19,6 @@ virDomainShutdown
shutdown
virDomainDestroy
size
virConnectListDomains
-virDomainCreateLinux
virDomainGetMaxMemory
virDomainSetMaxMemory
software
virConnectGetType
diff --git a/docs/APIfunctions.html b/docs/APIfunctions.html index 57e453b36e..e695f402ef 100644 --- a/docs/APIfunctions.html +++ b/docs/APIfunctions.html @@ -2,8 +2,7 @@ List of function manipulating types in libvirt

List of function manipulating types in libvirt

Type int *:

virConnectListDomains

Type unsigned int:

virDomainCreateLinux
-

Type unsigned long:

virDomainCreateLinux
-virDomainSetMaxMemory
+

Type unsigned long:

virDomainSetMaxMemory

Type unsigned long *:

virConnectGetVersion
virGetVersion

Type virConnectPtr:

virConnectClose
diff --git a/docs/html/libvirt-libvirt.html b/docs/html/libvirt-libvirt.html index 228112f727..9419c7e9ca 100644 --- a/docs/html/libvirt-libvirt.html +++ b/docs/html/libvirt-libvirt.html @@ -21,7 +21,7 @@ The content of this structure is not made public by the API.

int	virConnectNumOfDomains		(virConnectPtr conn)
virConnectPtr	virConnectOpen		(const char * name)
virConnectPtr	virConnectOpenReadOnly	(const char * name)
-
virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * kernel_path,
const char * initrd_path,
const char * cmdline,
unsigned long memory,
unsigned int flags)
+
virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)
int	virDomainDestroy		(virDomainPtr domain)
int	virDomainFree			(virDomainPtr domain)
unsigned int	virDomainGetID		(virDomainPtr domain)
@@ -102,9 +102,9 @@ The content of this structure is not made public by the API.

This function should be called first to get a connection to the Hypervisor and xen store

name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virConnectOpenReadOnly

virConnectPtr	virConnectOpenReadOnly	(const char * name)

This function should be called first to get a restricted connection to the libbrary functionalities. The set of APIs usable are then restricted on the available methods to control the domains.

-
name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virDomainCreateLinux

virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * kernel_path,
const char * initrd_path,
const char * cmdline,
unsigned long memory,
unsigned int flags)
+
name:optional argument currently unused, pass NULL
Returns:a pointer to the hypervisor connection or NULL in case of error

Function: virDomainCreateLinux

virDomainPtr	virDomainCreateLinux	(virConnectPtr conn, 
const char * xmlDesc,
unsigned int flags)

Launch a new Linux guest domain, unimplemented yet, API to be defined. This would function requires priviledged access to the hypervisor.

-
conn:pointer to the hypervisor connection
kernel_path:the file path to the kernel image
initrd_path:an optional file path to an initrd
cmdline:optional command line parameters for the kernel
memory:the memory size in kilobytes
flags:an optional set of virDomainFlags
Returns:a new domain object or NULL in case of failure

Function: virDomainDestroy

int	virDomainDestroy		(virDomainPtr domain)
+
conn:pointer to the hypervisor connection
xmlDesc:an XML description of the domain
flags:an optional set of virDomainFlags
Returns:a new domain object or NULL in case of failure

Function: virDomainDestroy

int	virDomainDestroy		(virDomainPtr domain)

Destroy the domain object. The running instance is shutdown if not down already and all resources used by it are given back to the hypervisor. The data structure is freed and should not be used thereafter if the call does not return an error. This function may requires priviledged access

domain:a domain object
Returns:0 in case of success and -1 in case of failure.

Function: virDomainFree

int	virDomainFree			(virDomainPtr domain)

Free the domain object. The running instance is kept alive. The data structure is freed and should not be used thereafter.

diff --git a/docs/libvirt-api.xml b/docs/libvirt-api.xml index 450487ac42..f19b6cada7 100644 --- a/docs/libvirt-api.xml +++ b/docs/libvirt-api.xml @@ -162,10 +162,7 @@ Launch a new Linux guest domain, unimplemented yet, API to be defined. This would function requires priviledged access to the hypervisor. - - - - + diff --git a/docs/libvirt-refs.xml b/docs/libvirt-refs.xml index af83e808a8..ac86df8cbd 100644 --- a/docs/libvirt-refs.xml +++ b/docs/libvirt-refs.xml @@ -149,7 +149,6 @@ - @@ -427,6 +426,7 @@ + @@ -588,7 +588,6 @@ - @@ -631,6 +630,7 @@ + @@ -703,7 +703,6 @@ - @@ -722,7 +721,6 @@ - @@ -824,7 +822,6 @@ - @@ -836,9 +833,6 @@ - - - @@ -862,10 +856,8 @@ - - @@ -897,7 +889,6 @@ - @@ -932,7 +923,6 @@ - @@ -1051,7 +1041,6 @@ - @@ -1061,7 +1050,6 @@ - @@ -1222,7 +1210,6 @@ - diff --git a/include/libvirt.h b/include/libvirt.h index 10f271b4f5..b6951868b6 100644 --- a/include/libvirt.h +++ b/include/libvirt.h @@ -200,10 +200,7 @@ int virConnectNumOfDomains (virConnectPtr conn); * Domain creation and destruction */ virDomainPtr virDomainCreateLinux (virConnectPtr conn, - const char *kernel_path, - const char *initrd_path, - const char *cmdline, - unsigned long memory, + const char *xmlDesc, unsigned int flags); virDomainPtr virDomainLookupByName (virConnectPtr conn, const char *name); diff --git a/include/libvirt.h.in b/include/libvirt.h.in index aa7e0221e2..6655c388e5 100644 --- a/include/libvirt.h.in +++ b/include/libvirt.h.in @@ -200,10 +200,7 @@ int virConnectNumOfDomains (virConnectPtr conn); * Domain creation and destruction */ virDomainPtr virDomainCreateLinux (virConnectPtr conn, - const char *kernel_path, - const char *initrd_path, - const char *cmdline, - unsigned long memory, + const char *xmlDesc, unsigned int flags); virDomainPtr virDomainLookupByName (virConnectPtr conn, const char *name); diff --git a/include/libvirt/libvirt.h b/include/libvirt/libvirt.h index 10f271b4f5..b6951868b6 100644 --- a/include/libvirt/libvirt.h +++ b/include/libvirt/libvirt.h @@ -200,10 +200,7 @@ int virConnectNumOfDomains (virConnectPtr conn); * Domain creation and destruction */ virDomainPtr virDomainCreateLinux (virConnectPtr conn, - const char *kernel_path, - const char *initrd_path, - const char *cmdline, - unsigned long memory, + const char *xmlDesc, unsigned int flags); virDomainPtr virDomainLookupByName (virConnectPtr conn, const char *name); diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index aa7e0221e2..6655c388e5 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -200,10 +200,7 @@ int virConnectNumOfDomains (virConnectPtr conn); * Domain creation and destruction */ virDomainPtr virDomainCreateLinux (virConnectPtr conn, - const char *kernel_path, - const char *initrd_path, - const char *cmdline, - unsigned long memory, + const char *xmlDesc, unsigned int flags); virDomainPtr virDomainLookupByName (virConnectPtr conn, const char *name); diff --git a/python/tests/create.py b/python/tests/create.py new file mode 100755 index 0000000000..c31eaa4831 --- /dev/null +++ b/python/tests/create.py @@ -0,0 +1,46 @@ +#!/usr/bin/python -u +import libvirt +import sys + +conn = libvirt.openReadOnly(None) +if conn == None: + print 'Failed to open connection to the hypervisor' + sys.exit(1) + +xmldesc=""" + test + + linux + /boot/vmlinuz-2.6.15-1.43_FC5guest + /boot/initrd-2.6.15-1.43_FC5guest.img + root=/dev/sda1 ro selinux=0 3 + + 131072 + 1 + + + + + + + + +