提交 3bbac7cd 编写于 作者: D Daniel Veillard

* TODO libvirt.spec.in: update

* configure.in include/libvirt/virterror.h src/Makefile.am
  src/conf.c src/conf.h src/virterror.c src/xen_internal.c:
  adding a subset of Xen config file parser, and serializer
* tests/Makefile.am tests/conftest.c tests/test_conf.sh
  tests/confdata/Makefile.am tests/confdata/fc4.conf
  tests/confdata/fc4.out: adding test program for config in and out
Daniel
上级 55bf7384
Tue Aug 29 23:28:31 CEST 2006 Daniel Veillard <veillard@redhat.com>
* TODO libvirt.spec.in: update
* configure.in include/libvirt/virterror.h src/Makefile.am
src/conf.c src/conf.h src/virterror.c src/xen_internal.c:
adding a subset of Xen config file parser, and serializer
* tests/Makefile.am tests/conftest.c tests/test_conf.sh
tests/confdata/Makefile.am tests/confdata/fc4.conf
tests/confdata/fc4.out: adding test program for config in and out
Tue Aug 29 13:14:20 EDT 2006 Daniel Berrange <berrange@redhat.com>
* src/xend_internal.c: Add handling of HTTP 500 error code
......
TODO:
- libvirt-proxy dropping root priviledge after initialization.
- check impact of HVM device rename
http://lists.xensource.com/archives/html/xen-devel/2006-08/msg00369.html
- Finish integration of vCPU and affinity APIs
......
......@@ -257,4 +257,4 @@ AC_OUTPUT(Makefile src/Makefile include/Makefile docs/Makefile \
include/libvirt/Makefile include/libvirt/libvirt.h \
python/Makefile python/tests/Makefile \
tests/Makefile proxy/Makefile \
tests/virshdata/Makefile)
tests/virshdata/Makefile tests/confdata/Makefile)
......@@ -45,7 +45,8 @@ typedef enum {
VIR_FROM_XML, /* Error in the XML code */
VIR_FROM_DOM, /* Error when operating on a domain */
VIR_FROM_RPC, /* Error in the XML-RPC code */
VIR_FROM_PROXY /* Error in the proxy code */
VIR_FROM_PROXY, /* Error in the proxy code */
VIR_FROM_CONF /* Error in the configuration file handling */
} virErrorDomain;
......@@ -106,7 +107,12 @@ typedef enum {
VIR_ERR_CALL_FAILED, /* not supported by the drivers */
VIR_ERR_XML_ERROR, /* an XML description is not well formed or broken */
VIR_ERR_DOM_EXIST,/* the domain already exist */
VIR_ERR_OPERATION_DENIED /* operation forbidden on read-only connections */
VIR_ERR_OPERATION_DENIED, /* operation forbidden on read-only connections */
VIR_ERR_OPEN_FAILED, /* failed to open a conf file */
VIR_ERR_READ_FAILED, /* failed to read a conf file */
VIR_ERR_PARSE_FAILED, /* failed to parse a conf file */
VIR_ERR_CONF_SYNTAX, /* failed to parse the syntax of a conf file */
VIR_ERR_WRITE_FAILED /* failed to write a conf file */
} virErrorNumber;
/**
......
......@@ -7,7 +7,7 @@ Group: Development/Libraries
Source: libvirt-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
URL: http://libvir.org/
BuildRequires: xen python python-devel
BuildRequires: python python-devel
Requires: xen
Requires: libxml2
Requires: readline
......@@ -107,6 +107,25 @@ rm -fr %{buildroot}
%doc docs/examples/python
%changelog
* Wed Aug 16 2006 Daniel Veillard <veillard@redhat.com> 0.1.4-1
- vCPUs and affinity support
- more complete XML, console and boot options
- specific features support
- enforced read-only connections
- various improvements, bug fixes
* Wed Aug 2 2006 Jeremy Katz <katzj@redhat.com> - 0.1.3-6
- add patch from pvetere to allow getting uuid from libvirt
* Wed Aug 2 2006 Jeremy Katz <katzj@redhat.com> - 0.1.3-5
- build on ia64 now
* Thu Jul 27 2006 Jeremy Katz <katzj@redhat.com> - 0.1.3-4
- don't BR xen, we just need xen-devel
* Thu Jul 27 2006 Daniel Veillard <veillard@redhat.com> 0.1.3-3
- need rebuild since libxenstore is now versionned
* Mon Jul 24 2006 Mark McLoughlin <markmc@redhat.com> - 0.1.3-2
- Add BuildRequires: xen-devel
......
......@@ -25,7 +25,8 @@ libvirt_la_SOURCES = \
sexpr.c sexpr.h \
virterror.c \
driver.h \
proxy_internal.c proxy_internal.h
proxy_internal.c proxy_internal.h \
conf.c conf.h
bin_PROGRAMS = virsh
......
此差异已折叠。
/**
* conf.h: parser for a subset of the Python encoded Xen configuration files
*
* Copyright (C) 2006 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
* Daniel Veillard <veillard@redhat.com>
*/
#ifndef __VIR_CONF_H__
#define __VIR_CONF_H__
#ifdef __cplusplus
extern "C" {
#endif
/**
* virConfType:
* one of the possible type for a value from the configuration file
*
* TODO: we probably need a float too.
*/
typedef enum {
VIR_CONF_NONE = 0, /* undefined */
VIR_CONF_LONG = 1, /* a long int */
VIR_CONF_STRING = 2, /* a string */
VIR_CONF_LIST = 3 /* a list */
} virConfType;
/**
* virConfValue:
* a value from the configuration file
*/
typedef struct _virConfValue virConfValue;
typedef virConfValue *virConfValuePtr;
struct _virConfValue {
virConfType type; /* the virConfType */
virConfValuePtr next; /* next element if in a list */
long l; /* long integer */
char *str; /* pointer to 0 terminated string */
virConfValuePtr list; /* list of a list */
};
/**
* virConfPtr:
* a pointer to a parsed configuration file
*/
typedef struct _virConf virConf;
typedef virConf *virConfPtr;
virConfPtr virConfReadFile (const char *filename);
virConfPtr virConfReadMem (const char *memory,
int len);
int virConfFree (virConfPtr conf);
virConfValuePtr virConfGetValue (virConfPtr conf,
const char *setting);
int virConfWriteFile (const char *filename,
virConfPtr conf);
int virConfWriteMem (char *memory,
int *len,
virConfPtr conf);
#ifdef __cplusplus
}
#endif
#endif /* __VIR_CONF_H__ */
......@@ -539,6 +539,36 @@ __virErrorMsg(virErrorNumber error, const char *info)
else
errmsg = "operation %s forbidden for read only access";
break;
case VIR_ERR_OPEN_FAILED:
if (info == NULL)
errmsg = "failed to open configuration file for reading";
else
errmsg = "failed to open %s for reading";
break;
case VIR_ERR_READ_FAILED:
if (info == NULL)
errmsg = "failed to read configuration file";
else
errmsg = "failed to read configuration file %s";
break;
case VIR_ERR_PARSE_FAILED:
if (info == NULL)
errmsg = "failed to parse configuration file";
else
errmsg = "failed to parse configuration file %s";
break;
case VIR_ERR_CONF_SYNTAX:
if (info == NULL)
errmsg = "configuration file syntax error";
else
errmsg = "configuration file syntax error: %s";
break;
case VIR_ERR_WRITE_FAILED:
if (info == NULL)
errmsg = "failed to write configuration file";
else
errmsg = "failed to write configuration file: %s";
break;
}
return (errmsg);
}
/*
* xen_internal.c: direct access to Xen hypervisor level
*
* Copyright (C) 2005 Red Hat, Inc.
* Copyright (C) 2005, 2006 Red Hat, Inc.
*
* See COPYING.LIB for the License of this software
*
......
......@@ -17,11 +17,11 @@ LDADDS = \
@LIBXML_LIBS@ \
$(LIBVIRT)
EXTRA_DIST = xmlrpcserver.py
EXTRA_DIST = xmlrpcserver.py test_conf.sh
noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest
noinst_PROGRAMS = xmlrpctest xml2sexprtest sexpr2xmltest virshtest conftest
TESTS = xml2sexprtest sexpr2xmltest virshtest
TESTS = xml2sexprtest sexpr2xmltest virshtest test_conf.sh
valgrind:
$(MAKE) check TESTS_ENVIRONMENT="valgrind --quiet"
......@@ -54,5 +54,10 @@ virshtest_SOURCES = \
virshtest_LDFLAGS =
virshtest_LDADD = $(LDADDS)
conftest_SOURCES = \
conftest.c
conftest_LDFLAGS =
conftest_LDADD = $(LDADDS)
$(LIBVIRT):
-@(cd $(top_builddir)/src && $(MAKE) MAKEFLAGS+=--silent)
EXTRA_DIST = $(wildcard *.in) $(wildcard *.out)
kernel="/boot/vmlinuz-2.6.15-1.2054_FC5xenU"
ramdisk="/boot/initrd-2.6.15-1.2054_FC5xenU.img"
memory=128 # should be enough
name="fc4"
vif = [ 'mac=aa:00:00:00:00:11, bridge=xenbr0' ]
disk = ['file:/xen/fc4.img,sda1,w']
root = "/dev/sda1"
extra = "ro selinux=0 3"
# just for testing ...
tst = [ 1, 2, [ 3, 4 ], 5]
kernel = "/boot/vmlinuz-2.6.15-1.2054_FC5xenU"
ramdisk = "/boot/initrd-2.6.15-1.2054_FC5xenU.img"
memory = 128 # should be enough
name = "fc4"
vif = [ "mac=aa:00:00:00:00:11, bridge=xenbr0" ]
disk = [ "file:/xen/fc4.img,sda1,w" ]
root = "/dev/sda1"
extra = "ro selinux=0 3"
# just for testing ...
tst = [ 1, 2, [ 3, 4 ], 5 ]
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include "conf.h"
int main(int argc, char **argv) {
int ret;
virConfPtr conf;
int len = 10000;
char buffer[10000];
if (argc != 2) {
fprintf(stderr, "Usage: %s conf_file\n", argv[0]);
exit(1);
}
conf = virConfReadFile(argv[1]);
if (conf == NULL) {
fprintf(stderr, "Failed to process %s\n", argv[1]);
exit(2);
}
ret = virConfWriteMem(&buffer[0], &len, conf);
if (ret < 0) {
fprintf(stderr, "Failed to serialize %s back\n", argv[1]);
exit(3);
}
printf("%s", buffer);
virConfFree(conf);
exit(0);
}
#!/bin/bash
NOK=0
for f in confdata/*.conf
do
./conftest $f > conftest.$$
outfile=`echo $f | sed s+\.conf+\.out+`
diff $outfile conftest.$$ > /dev/null
if [ $? != 0 ]
then
echo "$f FAILED"
NOK=1
else
echo "$f OK"
fi
done
rm -f conftest.$$
exit $NOK
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册