Commit Graph

308 Commits

Author SHA1 Message Date
Jim Meyering
25b20b7103 eventtest.c: detect write failure and avoid dead stores
* tests/eventtest.c (mymain): Exit nonzero upon write failure.
This also avoids several dead stores of the form ret = safewrite...
2009-09-04 18:59:29 +02:00
Daniel P. Berrange
34d22c1ed5 Avoid polling on FDs with no events enabled
If a file descriptor with events=0 was added to the libvirtd
event loop, it would still be added to the poll() fds' array.
While it wouldn't see any POLLIN/OUT events, it'd still get
triggered for HANGUP/ERROR events which was not in compliance
with the libvirt events API contract.

* qemud/event.c: Don't poll on FDs with events=0
* tests/eventtest.c: Add test case to validate fix to event.c
2009-09-03 18:06:16 +01:00
Daniel P. Berrange
85d15b5143 Add support for setting disk drive serial numbers
* docs/schemas/domain.rng: Add <serial> element to disks
* src/domain_conf.h, src/domain_conf.c: XML parsing and
  formatting for disk serial numbers
* src/qemu_conf.c: Set serial number when launching guests
* tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.args,
  tests/qemuxml2argvdata/qemuxml2argv-disk-drive-shared.xml: Add
  serial number to XML test
2009-09-03 13:53:34 +01:00
Daniel P. Berrange
d823a05aef Support configuration of huge pages in guests
Add option to domain XML for

     <memoryBacking>
        <hugepages/>
     </memoryBacking>

* configure.in: Add check for mntent.h
* qemud/libvirtd_qemu.aug, qemud/test_libvirtd_qemu.aug, src/qemu.conf
  Add 'hugetlbfs_mount' config parameter
* src/qemu_conf.c, src/qemu_conf.h: Check for -mem-path flag in QEMU,
  and pass it when hugepages are requested.
  Load hugetlbfs_mount config parameter, search for mount if not given.
* src/qemu_driver.c: Free hugetlbfs_mount/path parameter in driver shutdown.
  Create directory for QEMU hugepage usage, chowning if required.
* docs/formatdomain.html.in: Document memoryBacking/hugepages elements
* docs/schemas/domain.rng: Add memoryBacking/hugepages elements to schema
* src/util.c, src/util.h, src/libvirt_private.syms: Add virFileFindMountPoint
  helper API
* tests/qemuhelptest.c: Add -mem-path constants
* tests/qemuxml2argvtest.c, tests/qemuxml2xmltest.c: Add tests for hugepage
  handling
* tests/qemuxml2argvdata/qemuxml2argv-hugepages.xml,
  tests/qemuxml2argvdata/qemuxml2argv-hugepages.args: Data files for
  hugepage tests
2009-09-03 13:51:55 +01:00
Daniel P. Berrange
8eacfd4cc2 Fix misc OOM bugs
* tests/testutils.c: Run test function twice, once to prime it for
  static allocations, once to count the non-static allocations.
* tests/testutilsqemu.c: Initialize variable correctl
* src/capabilities.c: Don't free machines variable upon failure
  since caller must do that
* src/xm_internal.c: Add missing check for OOM in building VIF
  config param
2009-09-03 13:14:46 +01:00
Daniel P. Berrange
2d6adabd53 Don't blindly reorder disk drives
Calling qsort() on the disks array causes disk to be
unneccessarily re-ordered, potentially breaking the
ability to boot if the boot disk gets moved later in
the list. The new algorithm will insert a new disk as
far to the end of the list as possible, while being
ordered correctly wrt other disks on the same bus.

* src/domain_conf.c, src/domain_conf.h: Remove disk sorting
  routines. Add API to insert a disk into existing list at
  the optimal position, without resorting disks
* src/libvirt_private.syms: Export virDomainDiskInsert
* src/xend_internal.c, src/xm_internal.c: Remove calls to
  qsort, use virDomainDiskInsert instead.
* src/qemu_driver.c: Remove calls to qsort, use virDoaminDiskInsert
  instead. Fix reordering bugs when hotunplugging disks and
  networks. Fix memory leak in disk/net unplug
2009-09-02 15:19:34 +01:00
Miloslav Trmač
eda3af2488 Attach encryption information to virStorageVolDef.
The XML allows <encryption format='unencrypted'/>, this implementation
canonicalizes the internal representation so that "vol->encryption" is
non-NULL iff the volume is encrypted.

Note that partial encryption information (e.g. specifying an encryption
format, but not the key/passphrase) is valid, libvirt will automatically
choose value for the missing information during volume creation.  The
user can read the volume XML, and use the unmodified <encryption> tag in
future operations (without having to be able to understand) its contents.

* docs/formatstorage.html, docs/formatstorage.html.in: Document
  storage volume encryption options
* src/storage_conf.c, src/storage_conf.h: Hook up storage
  encryption XML handling
* tests/storagevolschemadata/vol-qcow2.xml: Test case for encryption
  schema changes
2009-09-01 18:27:38 +01:00
Daniel P. Berrange
da8b7c9f89 Add test for recently fixed crash with latest XenD
Test case for the fix applied in

  commit 14435163a0
  Author: Daniel Veillard <veillard@redhat.com>
  Date:   Fri Jun 26 18:14:16 2009 +0000

* tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.sexpr,
  tests/sexpr2xmldata/sexpr2xml-pv-vfb-type-crash.xml: Data
  files exhibiting the crash
* tests/sexpr2xmltest.c: Process new data files
2009-08-19 17:44:50 +01:00
Mark McLoughlin
d4528d9ac2 Detect KVM's PCI device assignment support
PCI device assignment is only supported in KVM's fork of qemu, so we
should really detect its availability and give a nice error if its
not supported.

* src/qemu_conf.[ch]: introduce QEMUD_CMD_FLAG_PCIDEVICE indicating
  that the -pcidevice command line option is available

* tests/*: update the tests
2009-08-14 08:31:11 +01:00
Amy Griffis
63fbcc6927 Consolidate code for parsing the logging env
* src/logging.c src/logging.h src/libvirt_private.syms:
  define new functions virLogSetFromEnv and virLogParseDefaultPriority
* qemud/qemud.c src/libvirt.c tests/eventtest.c: cleanup to use the
  unified functions
2009-08-06 15:55:07 +02:00
Amy Griffis
e542d52a7c Cleanup VIR_LOG_DEBUG parsing in eventtest
* tests/eventtest.c: don't covert high priority levels to debug level.
  Consider an invalid priority level setting a setup failure.
2009-08-06 15:50:40 +02:00
Daniel P. Berrange
dd6cd7dd63 Fix crashes in Xen capabilities code
* src/xen_internal.c: Don't free memory now owned by the virCapsPtr
   structure
* tests/testutilsxen.c: Fix up for change in internal API
2009-07-27 16:45:01 +01:00
Mark McLoughlin
38fd207e53 Add virCapsGuestMachine structure
A subsequent commit will add a "canonical" field to this structure,
this patch basically just prepares the way for that.

The new type is added, along with virCapabilitiesAlloc/FreeMachines()
helpers and a whole bunch of code to make the transition.

One quirk is that virCapabilitiesAddGuestDomain() and
virCapabilitiesAddGuest() take ownership of the machine list rather
than duping it. This makes sense to avoid needless copying.

* src/capabilities.h: add the virCapsGuestMachine struct and use it
  in virCapsGuestDomainInfo, add prototypes for new functions and
  update the AddGuest() prototypes

* src/capabilities.c: add code for allocating and freeing the new
  type, change the machines parameter to AddGuest() etc.

* src/libvirt_private.syms: export the new helpers

* src/qemu_conf.c: update all the machine type code to use the new
  struct

* src/xen_internal.c: ditto

* tests/testutilsqemu.c: ditto
2009-07-27 15:17:55 +01:00
Jim Meyering
20448818c4 avoid a make distcheck failure: distribute tests/interfaceschemadata/
* tests/Makefile.am (EXTRA_DIST): Add interfaceschemadata.
2009-07-22 16:24:17 +02:00
Mark McLoughlin
c23dae4e5c Assign names to qemu NICs and network backends
We need these so that we can remove the devices via the monitor.

* src/domain_conf.h: add nic_name and hostnet_name to virDomainNetDef

* src/domain_conf.c: free nic_name and hostnet_name

* src/qemu_conf.c: add qemuAssignNetNames(), use it if qemu has
  support for the param and pass the names on the command line

* tests/qemuxml2argv*: add a test for this
2009-07-22 11:34:06 +01:00
Mark McLoughlin
948897687e Add checks for some NIC hotplug related features added in qemu-0.10.0
Add QEMUD_CMD_FLAG_NET_NAME to indicate that '-net ...,name=foo' is
supported and QEMUD_CMD_FLAG_HOST_NET_ADD to indicate that the
'host_net_add' monitor command is available.

Set both these flags if the qemu version is greater than 0.10.0.
Checking via the '-help' output would not work for the monitor command
and even for the command line arg, it would be quite fragile.

* src/qemu_conf.h: add new flags as aliases of QEMUD_CMD_FLAG_0_10

* src/qemu_conf.c: set QEMUD_CMD_FLAG_0_10 for versions >= 0.10.0

* tests/qemuhelptest.c: set QEMUD_CMD_FLAG_0_10 for the appropriate
  qemu versions
2009-07-22 11:34:06 +01:00
Jim Meyering
07613d2020 remove all trailing blank lines
by running this command:
git ls-files -z | xargs -0 perl -pi -0777 -e 's/\n\n+$/\n/'
This is in preparation for a more strict make syntax-check
rule that will detect trailing blank lines.
2009-07-16 15:06:42 +02:00
Daniel Veillard
788c315165 netcf XML validation and input and output tests
* tests/interfaceschematest: test all XML data against the interface
  schemas
* tests/interfacexml2xmltest.c: parse and reserialize all XML data
  and check the output is identical
* tests/Makefile.am: hook up the tests
* tests/.gitignore: add ignore test
2009-07-15 20:16:36 +02:00
Daniel Veillard
19e57fd902 Add netcf XML schemas and test data
* docs/schemas/interface.rng: schemas for the interface XML files
  directly imported from netcf-0.1.0
* tests/interfaceschemadata/*.xml: set of test files from netcf-0.1.0
  changed to use single quote instead of double quote
2009-07-15 20:16:36 +02:00
Mark McLoughlin
62455ed872 Switch to using a unix socket for the qemu monitor
We keep support for the pty based monitor so that we can re-connect
to VMs started by older versions of libvirtd.

* src/domain_conf.c: handle formatting and parsing unix monitors

* src/qemu_driver.c: add qemudOpenMonitorUnix(), remove the monitor
  pty path searching from qemudFindCharDevicePTYs(), switch
  qemudStartVMDaemon() and qemuDomainXMLToNative() to using a unix
  monitor

* tests/qemuxml2argvtest.c: switch to using a unix monitor

* tests/qemuxml2argvdata/qemuxml2argv-*.args: update test data
2009-07-09 20:04:09 +01:00
Mark McLoughlin
05d377bdd2 Add the monitor type to the domain state XML
There are no functional changes in this patch apart from adding the
monitor type to the state XML.

The patch mostly consists of switching to use virDomainChrDef every
where to describe the monitor.

* src/domain_conf.h: replace monitorpath with monitor_chr

* src/domain_conf.c: handle parsing the monitor type and initializing
  monitor chr

* src/qemu_conf.[ch]: make qemudBuildCommandLine take a
  virDomainChrDefPtr and use that to build the -monitor parameter

* src/qemu_driver.c: split pty specific and common code from
  qemudOpenMonitor, have qemudStartVMDaemon() initialize monitor_chr

* tests/qemuxml2argvtest.c: update for qemudBuildCommandLine() change
2009-07-09 20:04:07 +01:00
Jim Meyering
fb98f4b10d remove all .cvsignore files 2009-07-08 16:17:51 +02:00
Jim Meyering
aef9746874 fix another failing "make distcheck" (qemuhelptest)
It failed in a non-srcdir build because those 5 sample output
files were not included in the distribution tarball.  Include them.
* tests/Makefile.am (qemuhelpdata, EXTRA_DIST): Include these:
kvm-74, kvm-86, qemu-0.10.5, qemu-0.9.1, qemu-kvm-0.10.5.
2009-07-08 16:00:05 +02:00
Daniel P. Berrange
561e60732f Make it easier to debug tests running programs
* tests/testutils.c: Don't discard stderr when running
	external programs during tests
2009-07-08 13:40:32 +01:00
Daniel P. Berrange
ad6d5acb42 Support <video> element for QEMU guests
* src/qemu_conf.c, src/qemu_conf.h: Use -vga or -std-vga
	when starting guests if video card is present
	* tests/qemuhelptest.c: Change to use constants instead
	of hardcoded hex numbers, and add VGA support
	* tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl-fullscreen.xml,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.args,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-sdl.xml,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.args,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-sasl.xml,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc-tls.xml,
	tests/qemuxml2argvdata/qemuxml2argv-graphics-vnc.xml,
	tests/qemuxml2argvdata/qemuxml2argv-input-xen.xml: Add <video>
	element for testing graphics adapter
	* tests/qemuxml2argvtest.c: Add QEMUD_CMD_FLAG_VGA flag
	* tests/qemuxml2xmltest.c: Add missing graphics-vnc-sasl/tls tests
2009-07-08 13:40:32 +01:00
Daniel Veillard
144276aa1a extend the configuration parser for VMX syntax
* qemud/qemud.c src/conf.c src/conf.h src/qemu_conf.c src/xen_unified.c
  src/xm_internal.c tests/conftest.c tests/xmconfigtest.c: extend
  the configuration parser for VMX syntax, patch by Matthias Bolte
Daniel
2009-06-19 12:34:30 +00:00
Cole Robinson
502278d5b2 Allow USB hostdev product to be 0x0000
Product = 0 is a valid value based on this bug report:

https://www.redhat.com/archives/libvir-list/2009-May/msg00368.html

Also, throw a less ambiguous error if vendor = 0.
2009-06-16 18:46:06 +00:00
Cole Robinson
659bd66529 Check that '-drive format=' is supported before adding to qemu cmdline.
Qemu < 0.10.0 did not support it, and virt-* tools now try to add this by
default, so it's extra important we ensure the option exists.
2009-06-16 15:17:10 +00:00
Cole Robinson
c9d9eddaa4 Add qemuhelptest to .*ignore files 2009-06-16 14:06:48 +00:00
Daniel Veillard
bf5d6f431e extract serial number from HAL storage backend
* src/node_device_hal.c src/node_device_conf.[ch]: add support
  for serial number in HAL storage backend, patch by Dave Allan
* docs/schemas/nodedev.rng
tests/nodedevschemadata/storage_serial_3600c0ff000d7a2a5d463ff4902000000.xml:
  update the schemas and add a test case, also by Dave Allan
Daniel
2009-06-11 14:25:19 +00:00
Mark McLoughlin
1fbe229b3c Add qemu help string parsing tests
Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-06-11 14:17:42 +00:00
Daniel Veillard
81d0ffbc3b NPIV implementation for node device create and destroy
* src/Makefile.am src/node_device.[ch] src/node_device_conf.[ch]
  src/node_device_hal.[ch] src/node_device_hal_linux.c
  src/qemu_driver.c src/remote_internal.c src/storage_backend.c
  src/virsh.c src/xen_unified.c tests/nodedevxml2xmltest.c
  po/POTFILES.in: implementation for node device create and destroy
  in NPIV support, patch by David Allan
Daniel
2009-06-02 15:12:53 +00:00
Daniel P. Berrange
8a1a2ac558 Fix Win32 portability problems with 'inteface' symbol clash 2009-05-29 14:29:22 +00:00
Daniel Veillard
525c3d40a9 PPC Qemu Machine Type update
* src/qemu_conf.c docs/schemas/domain.rng
  tests/capabilityschemadata/caps-qemu-kvm.xml: PPC Qemu Machine Type
  changed from g3bw to g3beige some time ago, patch by Thomas Baker
Daniel
2009-05-29 13:32:06 +00:00
Daniel Veillard
110c64209c fix storage volume inconsistencies in schema and doc
* docs/schemas/storagevol.rng docs/formatstorage.html[.in]
  tests/storagevolschemadata/vol-qcow2.xml: fix storage volume
  inconsistencies in schema and document, patch by Ryota Ozaki
daniel
2009-05-29 12:27:45 +00:00
Daniel P. Berrange
c31300e69f Fix misc bugs in ARGV -> XML convertor 2009-05-28 13:21:19 +00:00
Daniel P. Berrange
ad8a5e5daa Cleanup ocaml intermediate binaries 2009-05-27 12:07:43 +00:00
Daniel P. Berrange
107a7bd06b Test case for QEMU driver ARGV -> XML conversion 2009-05-21 14:22:51 +00:00
Daniel P. Berrange
6962a2dd7e Added an optional OCaml+CIL test program for mutex lock validation 2009-05-19 10:17:17 +00:00
Cole Robinson
af8600678d Update POTFILES, and s/write/safewrite/ to appease 'make syntax-check' 2009-05-12 20:44:29 +00:00
Daniel P. Berrange
37ede4d5f5 Add test case for exercising the event loop 2009-05-12 16:45:14 +00:00
Cole Robinson
a331653dad Add pidfile argument to __virExec
virExec will write out the pid of the daemonized process only. Use this
in the QEMU driver, rather than QEMU's pidfile, so we can catch errors we
might miss if the emulator bails early.
2009-05-11 13:50:38 +00:00
Daniel P. Berrange
1fbee8dadf Fix XM driver VIF config creation 2009-04-24 12:17:50 +00:00
Daniel P. Berrange
9a15c48d2d Switch to using virDomainDefPtr for building command line in QEMU driver 2009-04-19 14:50:01 +00:00
Mark McLoughlin
9fa79000ec qemu -drive takes format= not fmt=
Seems like a simple typo - it has been "format=" since the flag
was introduced, but we added it as "fmt=".

Signed-off-by: Mark McLoughlin <markmc@redhat.com>
2009-04-16 14:21:35 +00:00
Daniel P. Berrange
e4073623a6 Support PCI passthrough for Xen 2009-04-03 12:38:52 +00:00
Daniel P. Berrange
11b0ed46c5 Improve security label error reporting & verification (Dan Walsh) 2009-04-03 10:55:51 +00:00
Daniel P. Berrange
b02c0455d1 Fix localtime handling for newer XenD 2009-04-01 10:36:52 +00:00
Daniel P. Berrange
e4c65831e3 Misc fixes uncovered by OOM testing 2009-04-01 10:31:01 +00:00
Daniel P. Berrange
83a618f807 Add support for vifname= in XM config files 2009-04-01 10:16:05 +00:00