Commit Graph

5283 Commits

Author SHA1 Message Date
Stefan Berger
6eddbb0d3b This patch fixes a bug appearing on big endian machines where the returned XML is not the one that is expected (see test/nwfilterxml2xmltest). The problem is due to for example the casting of pointers to unsigned integers to void * and then back to 16 bit integers. 2010-09-22 06:24:19 -04:00
Eric Blake
9e3525df86 tests: silence qemuargv2xmltest noise
Before this patch, the testsuite was noisy:

TEST: qemuargv2xmltest
      ........................................ 40
      ................20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument '-unknown', adding to the qemu namespace
20:41:28.046: warning : qemuParseCommandLine:6565 : unknown QEMU argument 'parameter', adding to the qemu namespace
.                        57  OK
PASS: qemuargv2xmltest

It's not a real failure (which is why the test was completing
successfully), so much as an intentional warning to the user that use
of the qemu namespace has the potential for undefined effects that
leaked through the default logging behavior.  After this patch series,
all tests can access any logged data, and this particular test can
explicitly check for the presence or absence of the warning, such that
the test output becomes:

TEST: qemuargv2xmltest
      ........................................ 40
      .................                        57  OK
PASS: qemuargv2xmltest

* tests/testutils.h (virtTestLogContentAndReset): New prototype.
* tests/testutils.c (struct virtTestLogData): New struct.
(virtTestLogOutput, virtTestLogClose, virtTestLogContentAndReset):
New functions.
(virtTestMain): Always capture log data emitted during tests.
* tests/qemuargv2xmltest.c (testCompareXMLToArgvHelper, mymain):
Use flag to mark which tests expect noisy stderr.
(testCompareXMLToArgvFiles): Add parameter to test whether stderr
was appropriately silent.
2010-09-16 10:45:33 -06:00
Eric Blake
10c592801c tests: clean up qemuargv2xmltest
Since commit 107a7bd06b, the extraFlags argument was unused.

* tests/qemuargv2xmltest.c (DO_TEST): Drop extraFlags argument.
Adjust all callers.
2010-09-16 10:45:33 -06:00
Justin Clift
df1718cc73 docs: reworked the policykit patch submitted by Patrick Dignan
Tweaked the PolicyKit documentation improvement patch submitted
by Patrick Dignan.

Additionally, removed the reference to PolicyKit.conf, which is
no longer used by PolicyKit, plus added a link to the expanded
PolicyKit example page on the wiki.
2010-09-17 00:43:44 +10:00
Justin Clift
5bc4307597 docs: fix the xml validity errors regarding name and id
Got sick of seeing the "validity error : ID Objects already defined"
errors, which this patch addresses.
2010-09-17 00:41:08 +10:00
Eric Blake
8ae354f41b build: avoid non-portable IPv6 struct member, for MacOS X
* src/util/network.c (getIPv6Addr): Manually join s6_addr bytes,
instead of assuming s6_addr16 shorts.
Reported by Justin Clifton; solution suggested by Bruno Haible.
2010-09-15 14:50:51 -06:00
Justin Clift
58ba49ac70 virsh: change wexitstatus order to allow compilation on mac osx
This is the simple fix Daniel Veillard suggested last year:

  http://www.redhat.com/archives/libvir-list/2009-May/msg00459.html
2010-09-16 03:37:01 +10:00
Justin Clift
63d1b07f83 libvirtd: improve the error message displayed on tls client auth failure
This address BZ # 556599:

  https://bugzilla.redhat.com/show_bug.cgi?id=556599
2010-09-16 02:49:54 +10:00
Eric Blake
8a93dafc5f maint: silence warning from libtool
I got tired of seeing this.

config.status: executing libtool commands
/bin/rm: cannot remove `libtoolT': No such file or directory
config.status: executing po-directories commands

While I was at it, there were a couple other unused variables.

* configure.ac (RM, MV, TAR): Drop; nothing in libvirt directly uses
this, and assigning RM interferes with libtool.
2010-09-14 09:17:41 -06:00
Soren Hansen
38ba6e16ea Rebuild network filter for UML guests on updates
When nwfilter support was added to UML, I didn't realise the UML driver
needed instrumentation to make updating nwfilters on the fly work. This
patch adds this bit of glue.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
2010-09-14 09:17:41 -06:00
Jiri Denemark
fc3247f211 virsh: Use virBuffer for generating XML
cmdAttachInterface and cmdAttachDisk still used vshRealloc and sprintf
for generating XML, which is hardly maintainable. Let's get rid of this
old code.
2010-09-14 17:03:39 +02:00
Eric Blake
249a5b35f2 build: use portable sed expressions
* src/Makefile.am (libvirt.def, libvirt_qemu.def): '\}' and '\t'
are not required by POSIX.  Use '}' and literal tab instead.
(install-data-local): Avoid sed -i.
* tests/read-bufsiz: Likewise.
Reported by Mitchell Hashimoto.
2010-09-14 08:42:10 -06:00
Justin Clift
3b167dfaef docs: improve wording for the dev guide
Wording tweak suggested by David Jorm, author of the libvirt App Dev Guide.
2010-09-14 03:33:02 +10:00
Jiri Denemark
50d65bef66 tests: Fix preprocessor indentation 2010-09-13 13:35:04 +02:00
Justin Clift
7ebe214942 docs: add the app dev guide
Added a workable initial page for the libvirt Application
Development Guide, giving the online viewable options +
the available download ones (pdf, epub, srpm).

Added a link to the PDF to the main Downloads page, plus
neatened the html tags throughout the page as they
were a bit of a mess.

Added --enable-compile-warnings=error to the autogen line,
as suggested by Eric Blake.
2010-09-11 01:36:38 +10:00
Daniel Veillard
9a8e152fef Libvirt release 0.8.4
update news, spec and french localizaton
2010-09-10 17:24:36 +02:00
Cole Robinson
18af6f4e64 buf: Fix possible infinite loop in EscapeString, VSnprintf
The current code will go into an infinite loop if the printf generated
string is >= 1000, AND exactly 1 character smaller than the amount of free
space in the buffer. When this happens, we are dropped into the loop body,
but nothing will actually change, because count == (buf->size - buf->use - 1),
and virBufferGrow returns unchanged if count < (buf->size - buf->use)

Fix this by removing the '- 1' bit from 'size'. The *nprintf functions handle
the NULL byte for us anyways, so we shouldn't need to manually accommodate
for it.

Here's a bug where we are actually hitting this issue:
https://bugzilla.redhat.com/show_bug.cgi?id=602772

v2: Eric's improvements: while -> if (), remove extra va_list variable,
    make sure we report buffer error if snprintf fails

v3: Add tests/virbuftest which reproduces the infinite loop before this
    patch, works correctly after
2010-09-10 10:05:43 -04:00
Guido Günther
8a70113a99 Fix block statistics with newer versions of Xen
Apparently the xen block device statistics moved from
"/sys/devices/xen-backend/vbd-%d-%d/statistics/%s"
to
"/sys/bus/xen-backend/devices/vbd-%d-%d/statistics/%s"

* src/xen/block_stats.c: try the extra path in case of failure to
  find the statistics in /sys
2010-09-10 15:57:35 +02:00
Jiri Denemark
dfec22cc60 virsh: Option for overriding disk type in attach-disk
Unless --driver tap|file option was given to attach-disk, virsh would
generate <disk type='block'> XML which might be fine for Xen but not for
other hypervisors. This patch introduces a new option --sourcetype which
can be used to explicitly set the type of disk source. The option
accepts either "file" or "block" types.
2010-09-10 13:46:42 +02:00
Daniel P. Berrange
690583f790 Fix dependancies for remote generated files
Very occasionally during a parallel make, dispatch.c would
be compiled before the generated remote headers had been
fully written. This would cause it to compile an empty
union, and result in really wierd runtime bugs that are
near impossible to diagnose.

* daemon/Makefile.am: Fix remote build deps
2010-09-10 11:14:59 +01:00
Daniel P. Berrange
7bdb05ea7c Ensure remote daemon unions are always non-zero length
If the remote daemon args/ret unions ever become zero length
(due to a build / Makefile bug) then bad stuff happens at
runtime. Add a compile time assertion to check for this kind
of problem

* daemon/remote.h: Ensure non-zero length unions
2010-09-10 11:14:51 +01:00
Daniel P. Berrange
48ab20999f Fix off-by-1 in QEMU boot arg array handling
A QEMU guest can have upto VIR_DOMAIN_BOOT_LAST boot entries
defined. When building the QEMU arg, each entry takes a
single byte. This means the array must be declared to be
VIR_DOMAIN_BOOT_LAST+1 bytes in length to allow for the
trailing null

* src/qemu/qemu_conf.c: Fix off-by-1 boot arg array size
2010-09-10 11:14:01 +01:00
Jiri Denemark
df990b445b bridge: Fix static-only DHCP configuration
For static-only DHCP, i.e. with no <range> but at least one <host>
element within <dhcp> element, we have to add "--dhcp-range IP,static"
option to dnsmasq to actually enable the service. Without this option,
dnsmasq will not respond to DHCP requests.
2010-09-10 09:34:18 +02:00
Luiz Capitulino
e70880c51b qemu: qemuMonitorJSONEjectMedia(): Fix arguments' type
QMP in QEMU 0.13 has been fixed to enforce type correctness,
this means that boolean types must be true or false, not
integers.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-09-09 16:29:40 -06:00
Luiz Capitulino
ffefe5fb86 qemu: qemuMonitorJSONMigrate(): Fix arguments' type
QMP in QEMU 0.13 has been fixed to enforce type correctness,
this means that boolean types must be true or false, not
integers.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
2010-09-09 16:29:27 -06:00
Soren Hansen
f68fd1472c Add nwfilter support to UML driver
Extend user-mode-linux driver to support nwfilter.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
2010-09-09 15:08:36 -06:00
Matthias Bolte
8eac26214d test: Don't overwrite storage volume target path and key
Only generate target path and key when they are not defined
in the XML config.
2010-09-09 22:05:47 +02:00
Daniel Veillard
6d57950932 Remove hack to get static binaries in DV environment 2010-09-09 17:06:00 +02:00
Justin Clift
fbb2bdc132 Moved my name up to the primary list, as I have commit rights now.
As recommended by Eric. :)
2010-09-09 00:13:19 +10:00
Matthias Bolte
5699034b65 esx: Use SessionIsActive when available
Before this commit SessionIsActive was not used because ESX(i)
doesn't implement it. vCenter supports SessionIsActive, so use
it here, but keep the fall back mechanism for ESX(i) and GSX.
2010-09-08 00:20:29 +02:00
Matthias Bolte
8fdb0b0c84 esx: Fall back to path as key when QueryVirtualDiskUuid isn't available
QueryVirtualDiskUuid is only available on an ESX(i) server. vCenter
returns an NotImplemented fault and a GSX server is missing the
VirtualDiskManager completely. Therefore only use QueryVirtualDiskUuid
with an ESX(i) server and fall back to path as storage volume key for
vCenter and GSX server.
2010-09-07 19:46:07 +02:00
Eric Blake
af32c355c3 mingw: match recent changes in spec file
* libvirt.spec.in (%file): List new installed files.
* configure.ac (with_init_script): Assume default of none when
cross-compiling.
2010-09-07 11:17:13 -06:00
Jiri Denemark
ad026e97bf build: Fix permissions of sysconfig files 2010-09-07 10:03:14 +02:00
Daniel Veillard
31d668f74e Update of localization files
- Updated dutch, spanish and russian, regenerated the po/pot files
2010-09-04 19:24:07 +02:00
Matthias Bolte
635f01ae28 esx: Use the VirtualDisk UUID as storage volume key
VirtualDisks are .vmdk file based. Other files in a datastore
like .iso or .flp files don't have a UUID attached, fall back
to the path as key for them.
2010-09-04 00:36:15 +02:00
Matthias Bolte
e5a3c0b35d esx: Add .vmdk storage volume creation 2010-09-03 23:17:38 +02:00
Jean-Baptiste Rouault
9a4b705f74 OpenVZ: add ethernet interface type support
This patch adds support for ethernet interface type to OpenVZ domains
as stated in this previous message: http://www.redhat.com/archives/libvir-
list/2010-July/msg00658.html
2010-09-03 14:05:44 -06:00
Eric Blake
2ce55fe77e build: avoid uninitialized variable warning
* src/vbox/vbox_tmpl.c (vboxAttachDrives): Capture return value.
2010-09-03 09:44:49 -06:00
Matthias Bolte
847689129c esx: Rework datastore path parsing and handling
Instead of splitting the path part of a datastore path into
directory and file name, keep this in one piece. An example:

  "[datastore] directory/file"

was split into this before:

  datastoreName = "datastore"
  directoryName = "directory"
  fileName = "file"

Now it's split into this:

  datastoreName = "datastore"
  directoryName = "directory"
  directoryAndFileName = "directory/file"

This simplifies code using esxUtil_ParseDatastorePath, because
directoryAndFileName is used more often than fileName. Also the
old approach expected the datastore path to reference an actual
file, but this isn't always correct, especially when listing
volumes. In that case esxUtil_ParseDatastorePath is used to parse
a path that references a directory. This fails for a vpx://
connection because the vCenter returns directory paths with a
trailing '/'. The new approach is robust against this and the
actual decision if the datastore path should reference a file or
a directory is up to the caller of esxUtil_ParseDatastorePath.

Update the tests accordingly.
2010-09-03 00:38:22 +02:00
Eric Blake
2af93cd43c vbox: factor a large function
* src/vbox/vbox_tmpl.c (vboxDomainDefineXML): Split...
(vboxSetBootDeviceOrder, vboxAttachDrives, vboxAttachSound)
(vboxAttachNetwork, vboxAttachSerial, vboxAttachParallel)
(vboxAttachVideo, vboxAttachDisplay, vboxAttachUSB): ...into new
helper functions.
2010-09-02 15:50:45 -06:00
Eric Blake
f694036f2d lxc: avoid large stacks with veth creation
* src/lxc/veth.h (vethCreate): Change prototype.
* src/lxc/veth.c (vethCreate): Always malloc veth2, and allocate
veth1 if needed.
(getFreeVethName): Adjust signature, and use virAsprintf.
* src/lxc/lxc_driver.c (lxcSetupInterfaces): Adjust caller.
2010-09-02 15:48:24 -06:00
Matthias Bolte
1504cc4f02 esx: Fix generator for string return values
Distinguish between strings as parameters (const char *)
and strings as return values (char **).
2010-09-02 12:36:11 +02:00
Eric Blake
a9afbf4fc5 openvz: use virAsprintf to avoid large stacks
* src/openvz/openvz_conf.c (openvzLocateConfFile): Alter
signature.
(openvzGetVPSUUID, openvzSetDefinedUUID)
(openvzWriteVPSConfigParam, openvzReadVPSConfigParam)
(openvzCopyDefaultConfig): Adjust callers.
2010-09-01 16:29:59 -06:00
Eric Blake
c6e8e26edf openvz: formatting cleanups
* src/openvz/openvz_conf.c: Whitespace fixes.
* src/openvz/openvz_driver.c: Likewise.
2010-09-01 16:18:22 -06:00
Eric Blake
ff82941604 network: use virAsprintf when appropriate
* src/conf/network_conf.c (virNetworkAllocateBridge): Avoid
limited buffer from snprintf.
2010-09-01 15:56:49 -06:00
Eric Blake
ff578973c7 build: add some modules
snprintf is currently implicitly picked up by getaddrinfo, but we
might as well make it explicit so that mingw doesn't break if
getaddrinfo changes to drop the dependency.

func doesn't matter for gcc compilation, but may help other compilers
cope with our use of __func__.

* bootstrap.conf (gnulib_modules): Add snprintf and func.
2010-09-01 12:22:59 -06:00
Ryan Harper
12a41822e1 virsh: remove driver check from attach-disk command
Virsh shouldn't check for driver support but rather let the backend handled this.
After removing the check, I can successfully attach file-based images to a qemu
VM with attach-disk.

% virsh attach-disk vm2 /images/test02.img vdc --driver qemu --type disk --subdriver raw
Disk attached successfully

This command generates the following XML:

<disk type='block' device='disk'>
      <driver name='qemu' type='raw'/>
      <source dev='/images/test02.img'/>
      <target dev='vdc' bus='virtio'/>
      <alias name='virtio-disk2'/>
      <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/>
</disk>

Signed-off-by: Ryan Harper <ryanh@us.ibm.com>
2010-08-31 16:06:16 -06:00
Soren Hansen
9c4f62ae61 Use global directory as UML's monitorDir for privileged connections
For privileged UML connections (uml:///system), we shouldn't use root's
home dir, but rather somewhere in /var/run/libvirt/uml-guest.

https://bugzilla.redhat.com/show_bug.cgi?id=499536

Signed-off-by: Soren Hansen <soren@linux2go.dk>
2010-08-31 10:28:57 -06:00
Soren Hansen
0a58eed3d9 Explicitly pass uml_dir argument to user-mode-linux
uml_dir overrides user-mode-linux's default of ~/.uml. This is needed
for a couple of different reasons:

libvirt expects this to default to virGetUserDirectory(geteuid()) +
'/.uml'. However, user-mode-linux actually uses the HOME environment
variable to determine where to look for the uml sockets, but if running
libvirtd under sudo (which I routinely do during development), $HOME is
pointing at my user's homedir, while my euid is 0, so libvirt looks in
/root.

Also (and this was my actual motivation for this patch), if HOME isn't
set at all, user-mode-linux utterly fails. Looking at the code, it seems
it's meant to emit a warning, but alas, it doesn't for some reason.
If running libvirtd from upstart, HOME is not set, so any system using
upstart will need this change.

Signed-off-by: Soren Hansen <soren@linux2go.dk>
2010-08-31 10:13:05 -06:00
Eric Blake
deaa9e3ebd maint: track moved file
* daemon/.gitignore: Move libvirt-guests.init...
* tools/.gitignore: ...to its new location.
2010-08-31 10:00:31 -06:00