* src/socketcompat.h: Remove file.
* src/remote_internal.c: Don't include socketcompat.h.
* qemud/qemud.h: Likewise.
* qemud/remote_protocol.x: Likewise, but do include <arpa/inet.h>
for htonl.
* src/remote_internal.c: Likewise, but do include <errno.h>.
* qemud/remote_protocol.c: Regenererate.
* qemud/remote_protocol.h: Regenererate.
* src/Makefile.am (REMOTE_DRIVER_SOURCES): Remove socketcompat.h.
* src/storage_backend.c (backends): Add a NULL terminator.
(virStorageBackendForType): Use NULL terminator rather than
warning-provoking (possibly 0) array size.
<sources> tags properly, and I didn't put the <source> tag into the
proper place, so I totally changed the output of the discovery XML.
Fix this up to do the right thing.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* include/libvirt/libvirt.h include/libvirt/libvirt.h.in
src/libvirt.c src/libvirt_sym.version: new libvirt event entry
points, big patch provided by Ben Guthro
* Makefile.am configure.in src/driver.h src/event.c src/event.h
src/internal.h src/libvirt.c src/libvirt_sym.version src/lxc_driver.c
src/openvz_driver.c src/qemu_conf.h src/qemu_driver.c
src/remote_internal.c src/storage_backend_fs.c src/test.c
qemud/event.c qemud/event.h qemud/mdns.c qemud/qemud.c
qemud/qemud.h qemud/remote.c qemud/remote_dispatch_localvars.h
qemud/remote_dispatch_proc_switch.h qemud/remote_dispatch_prototypes.h
qemud/remote_protocol.c qemud/remote_protocol.h
qemud/remote_protocol.x proxy/Makefile.am python/generator.py:
Not much is left untouched by the patch adding the events support
* docs/libvirt-api.xml docs/libvirt-refs.xml
docs/html/libvirt-libvirt.html: regenerated the docs
* examples/domain-events/events-c/Makefile.am
examples/domain-events/events-c/event-test.c: a test example
* AUTHORS: added Ben Guthro
daniel
findPoolSources. Given danpb's last feedback, I completely removed the XML
parsing and did it all with structures. The result should (hopefully) be a lot
easier on the eyes, and is a little more generic.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
cleanup patch, add a ".defaultFormat" member to .poolOptions. In
storage_conf.c, if virXPathString(/pool/source/format/@type) returns NULL, then
set the pool type to .defaultFormat; otherwise, lookup the type via
formatFromString.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
<pool type='logical'>
<source>
<name>MyVG</name>
<device name='/dev/sdb'/>
...
However, dumping out the XML for this same storage pool (with, say, virsh
pool-dumpxml), gives:
<pool type='logical'>
<source>
<name>MyVG</name>
<device name='/dev/sdb'>
</device>
To make this more idempotent, do the <device name='/dev/sdb'/> form by default,
and only do the <device>...</device> form if .nfreeExtent is defined for the
storage pool.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
and virStorage*ToString implementations to the generic VIR_ENUM_IMPL, there were
a couple of places that didn't properly set errors when they failed. This patch
fixes these places up.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
storage XML to libvirtd, which was saved in /etc/libvirt/storage. On subsequent
stop/start of libvirtd, because of another bug , an
error wasn't being set properly in an error path, so libvirtd was SEGV'ing in
storage_conf.c:virStoragePoolObjLoad when trying to dereference the NULL err
returned from virGetLastError(). Make this more robust against errors by always
doing "err ? err->message : NULL" in the printf. I looked around the tree and
found a couple of other places that weren't guarded, so this patch fixes them as
well.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* Makefile.maint (sync-vcs-ignore-files): New target.
Prompted by a patch from James Morris.
http://thread.gmane.org/gmane.comp.emulators.libvirt/8619/focus=8773
Add all (now-generated) .gitignore files.
* .gitignore: New file.
* build-aux/.gitignore: New file.
* docs/.gitignore: New file.
* docs/devhelp/.gitignore: New file.
* docs/examples/.gitignore: New file.
* docs/examples/python/.gitignore: New file.
* gnulib/lib/.gitignore: New file.
* gnulib/lib/arpa/.gitignore: New file.
* gnulib/lib/netinet/.gitignore: New file.
* gnulib/lib/sys/.gitignore: New file.
* gnulib/tests/.gitignore: New file.
* include/.gitignore: New file.
* include/libvirt/.gitignore: New file.
* po/.gitignore: New file.
* proxy/.gitignore: New file.
* python/.gitignore: New file.
* python/tests/.gitignore: New file.
* qemud/.gitignore: New file.
* src/.gitignore: New file.
* tests/.gitignore: New file.
* tests/confdata/.gitignore: New file.
* tests/sexpr2xmldata/.gitignore: New file.
* tests/virshdata/.gitignore: New file.
* tests/xencapsdata/.gitignore: New file.
* tests/xmconfigdata/.gitignore: New file.
* tests/xml2sexprdata/.gitignore: New file.
iSCSI volumes. This is implemented in the
virStorageBackendUpdateVolInfoFD function, so all future callers will
automatically benefit. This is a somewhat large patch because the
conversion of the virStorageBackendPartTableTypeToString necessitated
a change to the formatToString and formatFromString function pointers,
which caused fallout in other places in the storage stuff. The good
news is that most of these callers are now converted over to the
VIR_ENUM_IMPL, which means a lot of redundant code is now gone.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
POTFILES.in. Add it there, and then fix up one warning about included
c-ctypes.h that wasn't being used.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* src/storage_backend_logical.c: enable stop pool in logical backend
improve portability when deleting a pool and also call pvremove
patch by Chris Lalancette
Daniel
* src/network_conf.c src/network_conf.h src/qemu_driver.c: add
support for a domain name in network configurations, patch by
JJ Reynolds with bugfix raised by Dan
* src/openvz_conf.c: fix to small bug in openvzReadConfigParam
by Evgeniy Sokolov
Daniel
This patch adds an implementation of the version function to the LXC driver.
The providers use the hypervisor version in a field of one of the instances,
so we need to have something meaningful here. AFAICT, the only real option
we have (considering the limitations of the libvirt version information) is
to use the kernel version.
* src/qemu_conf.c: patch from Cole Robinson to report in the
capabilities only the ones where the emulators is actually found
* po/libvirt.pot: regenerated
* src/libvirt.c: small typo fix
Daniel
* src/storage_backend.h src/storage_backend_logical.c
src/storage_conf.c src/storage_conf.h src/virsh.c:
Applied patches from David Lively to add storage source
elements needed for storage pool
* docs/formatstorage.html docs/formatstorage.html.in: associated
documentation
Daniel
* src/util.c (virFileReadLimFP): New function.
(__virFileReadLimFD): New function.
* src/util.h (__virFileReadLimFD): Declare.
(virFileReadLimFD): Define.
(virFileReadAll): Rewrite to use virFileReadLimFP.
* src/qemu_conf.c: fix serial/telnet to use "server" option
rather than "listen"
* tests/qemuxml2argvdata/qemuxml2argv-serial-tcp-telnet.args:
fix the test case too
* src/domain_conf.c src/domain_conf.h src/qemu_conf.c
src/qemu_driver.c: patch from Guido Günther allowing to add
disk as USB devices
* docs/libvirt.rng: extend the schemas for the new value
* tests/qemuxml2argvdata/qemuxml2argv-disk-usb.args
tests/qemuxml2argvdata/qemuxml2argv-disk-usb.xml
tests/qemuxml2argvtest.c tests/qemuxml2xmltest.c: add a specific
test to the regression suite
Daniel
* src/domain_conf.c src/domain_conf.h src/qemu_conf.c
src/qemu_driver.c: Patch from Guido Günther allowing to pass
usb devices to qemu/kvm
* docs/libvirt.rng: add the new functionality to the grammar
* tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.args
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-address.xml
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.args
tests/qemuxml2argvdata/qemuxml2argv-hostdev-usb-product.xml
tests/qemuxml2argvtest.c tests/qemuxml2xmltest.c: adding examples
to the regression tests
* libvirt.spec.in: fix the licence tag
Daniel
Use inet_pton instead; pull in gnulib's module by the same name.
* src/network_conf.c (virNetworkDefParseXML): Use inet_pton,
rather than inet_aton.
* bootstrap (modules): Add inet_pton.
* gnulib/lib/inet_pton.c: New file, from gnulib.
the regression tests. The problem is that the xenDaemonFormatSxpr{Disk,Net}
functions are shared between domain creation time and attaching disk time.
Unfortunately, though, Xend expects something different during these two times.
During domain creation time, it wants the "(device" in front of the sexpr,
while during attach time it does not. To remedy this situation, I added a flag
to these two functions to differentiate between these two modes. With this
patch in place, all of the regression tests pass.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
code, a couple of bugs were introduced into the attach-disk and attach-interface
functionality. This patch fixes 3 bugs:
1) In xenDaemonAttachDevice(), there is a switch statement to determine which
of the xenDaemonFormatSxpr{Disk,Net} functions to call. Unfortunately, the case
statements are all missing the corresponding "break", so we always fall-through
to the default error case. This patch just adds the appropriate break statements.
2) (minor) In xenDaemonDomainDefineXML (that's a mouthful!), there is a stray
"fprintf". This is now converted to a proper virXendError().
3) xenDaemonFormatSxpr{Disk,Net} were adding an extra (device to the front of
the sexpr expressions that xend did not expect (this is Xend on RHEL 5.2).
Because of this, the attaches would fail. The patch fixes this by removing the
(device from the front, which makes attach-disk and attach-interface work again.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
part, this doesn't really concern libvirt, since for things like attach and
detach we just pass it through and let xend worry about whether it is supported
or not. The one place this breaks down is in the stats collecting code, where
we need to figure out the device number so we can go digging in /sys for the
statistics.
To remedy this, I've re-written xenLinuxDomainDeviceID() to use regular
expressions to figure out the device number from the name. The major advantage
is that now xenLinuxDomainDeviceID() looks fairly identical to
tools/python/xen/util/blkif.py (in the Xen sources), so that adding additional
devices in the future should be much easier. It also reduces the size of the
code, and, in my opinion, the code complexity.
With this patch in place, I was able to get block statistics both on older style
devices (/dev/xvda) and on the new, expanded devices (/dev/xvdaa).
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* src/virsh.c: Implement 'virsh edit', 'virsh net-edit' and
'virsh pool-edit' commands. These edit the XML for domains,
networks and storage pools respectively, and are the
equivalent of doing 'virsh dumpxml; vi foo.xml; virsh define'
* src/Makefile.am, src/.cvsignore: Auto-generate the net-edit
and pool-edit commands.
* docs/virsh.pod: Updated the documentation.
* src/domain_conf.c, src/network_conf.c, src/storage_conf.c:
Improve error messages from commands such as 'virsh define'
when the XML is not well-formed by passing libxml2 errors
back out through virterror.
docs/libvirt-refs.xml docs/html/libvirt-libvirt.html src/libvirt.c:
fixed somedocs and API entry point descriptions as suggested by
Charles Duffy and regenerated the API descriptions.
Daniel
Per subject; if autoport is in use for a host, the current
virDomainGraphicsDefFormat code always emits "port=-1", even if a port
is assigned to the host; this leaves no way for a client to find the VNC
port assigned to the host in question.
This patches fixes it by putting the vncport in place if there is one, and
only putting "-1" if we fail that test.
handling code. In particular, if you had a section of XML like:
<disk type='file' device='cdrom'>
<target dev='hdc' bus='ide'/>
<readonly/>
</disk>
This used to work with older libvirt, but now fails. This is because we are
actually passing the literal string (null) to the qemu command-line, which qemu
barfs on. This patch fixes it up by making it blank, which allows qemu to
continue on it's merry way.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* src/domain_conf.[ch] src/openvz_conf.[ch] src/openvz_driver.c:
patch from Evgeniy Sokolov doing the OpenVZ xml refactoring,
still needs to be ported to the new XML parsing code but
implements the new format.
Daniel
* src/virsh.c (cmdUndefine): Tell user to shutdown and then use name or UUID.
* tests/undefine: New test. Exercise virsh's undefine command.
* tests/Makefile.am (test_scripts): Add undefine.
* src/openvz_conf.c src/openvz_conf.h src/openvz_driver.c
Makefile.maint: patch from Evgeniy Sokolov cleaning up the
error function used and format check based on Jim's fedback.
Daniel
Allow check for containers support to be done without CLONE_NEWNET, and then
determine support on the fly by checking for iproute2 support and a
successful clone(CLONE_NEWNET). This lets us set a flag for later, as well
as not completely disable LXC support on a system without NETNS support.
release
* src/xm_internal.c: fix xm driver serialization escapes
* tests/xmconfigtest.c tests/xmconfigdata/test-escape-paths.cfg
tests/xmconfigdata/test-escape-paths.xml: add test for previous
problem
Daniel
* src/util.c (fread_file_lim): Use VIR_REALLOC_N, not VIR_ALLOC_N.
Bug introduced in 895d0fdf5b.
* tests/Makefile.am (test_scripts): Add read-bufsiz.
* tests/read-bufsiz: New test for the above.
fine, except that is subtly alters the semantics of malloc(), calloc(), and
realloc(). In particular, if you say:
foo = malloc(0);
glibc will happily return a non-NULL pointer to you. However, with the new
memory management stuff, if you say:
foo = VIR_ALLOC(0);
you will actually get a NULL pointer back. Personally, I think this is a
dangerous deviation from malloc() semantics that everyone is used to, and is
indeed causing problems with the remote driver. The short of it is that the
remote driver allocates memory on behalf of the remote side using VIR_ALLOC_N,
and this call is returning NULL so that the NULL checks elsewhere in the code
fire and return failure.
The attached patch fixes this situation by removing the 0 checks from the memory
allocation paths, and just lets them fall through to the normal malloc(),
calloc(), or realloc() routines, restoring old semantics.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
introduced into the qemudNetworkIfaceConnect() function. In particular, there
is a call:
if (VIR_ALLOC_N(vm->tapfds, vm->ntapfds+2) < 0)
goto no_memory;
However, the tapfds structure is used to track *all* of the tap fds, and is
called once for each network that is being attached to the domain. VIR_ALLOC_N
maps to calloc(). So the first network would work just fine, but if you had
more than one network, subsequent calls to this function would blow away the
stored fd's that were already there and fill them all in with zeros. This
causes multiple problems, from the qemu domains not starting properly to
improper cleanup on shutdown. The attached patch just changes the VIR_ALLOC_N()
to a VIR_REALLOC_N(), and everything is happy again.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
to only rely on sysfs for finding LUNs, given a session number. Along the way,
it also fixes the bug where we wouldn't find LUNs for older kernels (with the
block:sda format), and also fixes a race condition where we could try
to find the LUN before udev has finished connecting it.
This patch fixes a few different bugs:
1) We weren't finding LUNs on pre 2.6.24 kernels
2) libvirtd sysfs scanning was racing with udev, so we didn't always see LUNs
3) We weren't showing the 0'th LUN, although that can be a valid LUN
Signed-off-by: Chris Lalancette <clalance@redhat.com>
first logging in; we don't need to do it for logout. Move the sendtarget
command into the Login() function.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
--mode session" command. However, just running "iscsiadm --mode session" seems
to work on all version of iscsiadm commands back to FC-6, so just use that.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
*not* virStorageReportError() if the fork()/exec() process it spawned returned a
!= 0 exit code. Rather, it returns the exitcode in this case, and it is up to
the higher level to determine whether this is a fatal error or not. The use
case for this change is in the iSCSI stuff; older versions of iscsiadm tools
would return a failure when getting the session number, despite the command
succeeding.
Signed-off-by: Chris Lalancette <clalance@redhat.com>
* include/libvirt/libvirt.h.in, src/libvirt.c, src/driver.h,
src/libvirt_sym.version: New virDomainMemoryPeek API.
* qemud/remote.c, qemud/remote_protocol.x, src/remote_internal.c:
Support for remote.
* src/qemu_driver.c: QEMU driver implementation of API.
* src/test.c: Test driver (null) implementation of API.
* docs/hvsupport.html.in: Document API.
* libvirt.spec.in: New path /var/cache/libvirt for temporary
storage of memory images.
* qemud/libvirtd.init.in: Remove any old temp files in
/var/cache/libvirt on restarts.
* src/Makefile.am: make install creates /var/cache/libvirt.
* configure.in: Detect mkdir -p.
* src/lxc_driver.c: Make console element is output only. Always open new
PTY when starting a container.
Fix string overrun when storing console name in VM def struct
* configure.in: Document AC_SYS_LARGEFILE.
* docs/hvsupport.html.in: Document HV support for virDomainBlockPeek.
* include/libvirt/libvirt.h.in, src/driver.h, src/libvirt.c,
src/libvirt_sym.version: Add virDomainBlockPeek infrastructure.
* src/qemu_driver.c, src/test.c: Null versions of this call.
* src/xen_unified.c, src/xend_internal.c, src/xend_internal.h,
src/xm_internal.c, src/xm_internal.h: Xen implementation.
* tests/sexpr2xmldata/sexpr2xml-curmem.xml,
tests/sexpr2xmldata/sexpr2xml-no-source-cdrom.xml: XML output
has been reordered slightly in the Xen driver, but should be
functionally the same.
Mon May 12 23:32:21 PST 2008 David L. Leskovec <dlesko@linux.vnet.ibm.com>
* src/lxc_driver.c: Add sanity of tty pid before kill()
Ignore ECHILD errors during VM cleanup
Call functions to store tty pid and cleanup tty pid file
* src/lxc_conf.h: Add function to verify container process exists
Add facilities to manage storing the tty forward process pid
* src/lxc_conf.c: Add function to verify container process exists
Call function to verify container process during config load
Add facilities to manage storing the tty forward process pid
Call function to load tty pid during load config
* include/libvirt/libvirt.h.in: Add VIR_DEPRECATED macro.
* src/internal.h: Internal code is allowed to use deprecated
features, so override VIR_DEPRECATED here.
* include/libvirt/virterror.h: Deprecate the conn, dom and net
fields in the _virError structure.
Up to now, we've been avoiding ctype functions like isspace, isdigit,
etc. because they are locale-dependent. Now that we have the c-ctype
functions, we can start using *them*, to make the code more readable
with changes like these:
- /* This may not work on EBCDIC. */
- if ((*p >= 'a' && *p <= 'z') ||
- (*p >= 'A' && *p <= 'Z') ||
- (*p >= '0' && *p <= '9'))
+ if (c_isalnum(*p))
- while ((*cur >= '0') && (*cur <= '9')) {
+ while (c_isdigit(*cur)) {
Also, some macros in conf.c used names that conflicted with
standard meaning of "BLANK" and "SPACE", so I've adjusted them
to be in line with the definition of e.g., isblank.
In addition, I've wrapped those statement macros with do {...} while (0),
so that we can't forget the ";" after a use. There was one like that
already (fixed below). The missing semicolon would mess up automatic
indenting.
* src/buf.c (virBufferURIEncodeString):
* src/conf.c (IS_EOL, SKIP_BLANKS_AND_EOL, SKIP_BLANKS)
(virConfParseLong, virConfParseValue, virConfParseName)
(virConfParseSeparator, virConfParseStatement, IS_BLANK, IS_CHAR)
(IS_DIGIT, IS_SPACE, SKIP_SPACES):
* src/nodeinfo.c:
* src/qemu_conf.c (qemudParseInterfaceXML):
* src/qemu_driver.c (qemudDomainBlockStats):
* src/sexpr.c:
* src/stats_linux.c:
* src/util.c (virParseNumber, virDiskNameToIndex):
* src/uuid.c (hextobin, virUUIDParse):
* src/virsh.c:
* src/xml.c (parseCpuNumber, virParseCpuSet):
Mon May 12 23:32:21 PST 2008 David L. Leskovec <dlesko@linux.vnet.ibm.com>
* qemud/qemud.c: get siginfo with signals, distribute to drivers that
register a handler
* src/driver.h: add sighandler function to state driver table
* src/internal.h: define virStateSigDispatcher functions
* src/libvirt.c: add __virStateSigDispatcher function
* src/libvirt_sym.version: add __virStateSigDispatcher
* src/lxc_driver.c: add sig handler function, cleanup vm when sigchld
received from container process
* src/qemu_driver.c: NULL for sig handler (no handler) in state driver
* src/remote_internal.c: NULL for sig handler (no handler) in state driver
* src/storage_driver.c: NULL for sig handler (no handler) in state driver
# Convert uses of isspace to c_isspace, isdigit to c_isdigit, etc.
re=$(man isspace|grep is.....,.is|sed 's/ -.*//' \
|tr -s ', \n' \||sed 's/^|//;s/|$//')
git grep -l -E "$re"|grep -Ev 'Chan|gnulib' \
|xargs perl -pi -e 's/\b('"$re"')\b/c_$1/g'
# Remove all uses of to_uchar
git grep -l to_uchar|xargs perl -pi -e 's/to_uchar\((.*?)\)/$1/g'
* src/util.h (to_uchar): Remove definition.
(TOLOWER): Remove definition.
(__virMacAddrCompare): Use c_tolower, not TOLOWER.
Globally:
Where needed, change <ctype.h> to <c-ctype.h>.
Remove unnecessary inclusion of <ctype.h>.
Ensure the global changes are never needed again:
* Makefile.maint (sc_avoid_ctype_macros): Prohibit use of ctype
macros. Recommend c-ctype.h instead.
(sc_prohibit_c_ctype_without_use): New rule.
(sc_prohibit_ctype_h): New rule. Disallow use of <ctype.h>.
* src/storage_backend_fs.c (fileTypeInfo): Add "static" and two
"const" attributes.
(FileTypeInfo): Name the previously anonymous struct,
so the declaration of fileTypeInfo looks more conventional.
* src/xend_internal.c (sound_models): Mark as static, and
as an array of "const" entries.
These were relatively new additions to the list from here:
nm src/*.o|grep ' D '
* configure.in: Fix pkg-config detection of libxml2,
add -lgcrypt to gnutls lib.
* src/Makefile.am: If compiling --without-libvirtd then
don't compile any part of the storage driver.
* configure.in, src/hash.c, src/internal.h: Detect availability
of pthread library and compile out mutex code if not available.
* src/storage_driver.c, src/util.c: Ignore some missing
headers on MinGW.
Done using this command (also includes .c.in and .h.in files):
for i in $(g ls-files|grep -E '\.[ch](\.in)?$'|grep -v gnulib); do
expand -i $i > j && mv j $i;done
* src/util.c (fread_file_lim): New function.
(__virFileReadAll): Use fread_file_lim, rather than requiring
that stat.st_size provide a usable file size.
* tests/read-non-seekable: New test, for the above.
* tests/Makefile.am (test_scripts): Add read-non-seekable.
* tests/test-lib.sh (mkfifo_or_skip_): New helper function.
* docs//* src/conf.c src/hash.c src/libvirt.c src/proxy_internal.c
src/remote_internal.c src/virsh.c src/xen_internal.c
src/xend_internal.c src/xml.c: applied patch from Atsushi SAKAI
fixing a lot of typos
Daniel