Commit Graph

3266 Commits

Author SHA1 Message Date
Miloslav Trmač
2db2c5a186 Add virsh commands for secrets APIs
* src/virsh.c: Add virsh commands.
* docs/virsh.pod, virsh.1: Update documentation.
2009-09-11 14:54:57 +01:00
Miloslav Trmač
03d338608d Local file implementation of secret driver API
This implementation stores the secrets in an unencrypted text file,
for simplicity in implementation and debugging.

(Symmetric encryption, e.g. using gpgme, will not be difficult to add.
Because the TLS private key used by libvirtd is stored unencrypted,
encrypting the secrets file does not currently provide much additional
security.)

* include/libvirt/virterror.h, src/virterror.c (VIR_ERR_NO_SECRET): New
  error number.
* po/POTFILES.in, src/Makefile.am: Add secret_driver.
* bootstrap: Use gnulib's base64 module.
* src/secret_driver.c, src.secret_driver.h, src/libvirt_private.syms:
  Add local secret driver.
* qemud/qemud.c (qemudInitialize): Use the local secret driver.
2009-09-11 14:54:46 +01:00
Miloslav Trmač
b9a8bef477 Add an internal <secret> XML handling API
Add a <secret> XML handling API, separate from the local driver, to
avoid manually generating XML in other parts of libvirt.

* src/secret_conf.c, src/secret_conf.h: New files.
* po/POTFILES.in, src/Makefile.am: Add secret_conf.
2009-09-11 14:54:40 +01:00
Miloslav Trmač
ecc5c82985 Mask out flags used internally for virSecretGetValue
Add a VIR_SECRET_GET_VALUE_INTERNAL_CALL flag value, replacing the
originally separate libvirt_internal_call parameter.  The flag is used
to differentiate external virSecretGetValue() calls from internal calls
by libvirt drivers that need to use the secret even if it is private.

* src/libvirt_internal.h Remove VIR_DOMAIN_XML_FLAGS_MASK
* src/driver.h Add VIR_SECRET_GET_VALUE_FLAGS_MASK constant and
  VIR_SECRET_GET_VALUE_INTERNAL_CALL. Re-add the
  VIR_DOMAIN_XML_FLAGS_MASK constant
* src/libvirt.c (virSecretGetValue): Don't allow the user to specify
  internal flags.
2009-09-10 15:54:54 +01:00
Daniel P. Berrange
fcd4e26943 Fix use of dlopen modules
Remove the bogus dependancy between node_device.c & storage_backend.c
by moving the virWaitForDevices into util.h where it can be shared
safely

* src/storage_backend_disk.c, src/storage_backend_logical.c,
  src/storage_backend_mpath.c, src/storage_backend_scsi.c: Replace
  virStorageBackendWaitForDevices with virFileWaitForDevices
* src/storage_backend.c, src/storage_backend.h: Remove
  virStorageBackendWaitForDevices, virWaitForDevices
* src/util.h, src/util.c: Add virFileWaitForDevices
* configure.in: Move xmlrpc check further down after pkgconfig
  is detected
* src/Makefile.am: Add missing XMLRPC_CFLAGS/LIBS to opennebula
* src/libvirt_private.syms: Add many missing exports
2009-09-10 15:42:08 +01:00
Miloslav Trmač
7ec20935bd Consolidate "cont" into qemudMonitorSendCont()
The interface allows qemudMonitorSendCont() to report errors that are
not overridden by its callers.

Also fix a potential infinite loop in qemuDomainCoreDump() if sending
cont repeatedly fails.

* src/qemu_driver.c (qemudMonitorSendCont): New function.
  (qemudAutostartConfigs): Reset error before each call to
  qemudStartVMDaemon().
  (qemudInitCpus, qemudDomainResume, qemudDomainCoreDump,
  qemudDomainRestore, qemudDomainMigratePerform,
  qemudDomainMigrateFinish2): Use qemudMonitorSendCont().
2009-09-10 15:30:53 +01:00
Miloslav Trmač
78811ae572 Add <usage> to <secret> docs
* docs/formatsecret.html.in, docs/formatsecret.html: Document <usage
  type='volume'>, replacing stand-alone <volume>.
* docs/schemas/secret.rng: Update schema to require <usage
  type='volume'>
2009-09-10 15:30:47 +01:00
Daniel P. Berrange
7887e00355 Cleanup sec driver error reporting to use virReportSystemError
* src/security_selinux.c: Use virReportSystemError whereever an
  errno is involved
* src/qemu_driver.c: Don't overwrite error message from the
  security driver
2009-09-10 14:34:07 +01:00
Daniel P. Berrange
0e9ae444bd Support relabelling of USB and PCI devices
* src/security.h: Driver API for relabelling host devices
* src/security_selinux.c: Implement relabelling of PCI and USB
  devices
* src/qemu_driver.c: Relabel USB/PCI devices before hotplug
2009-09-10 14:34:07 +01:00
Daniel P. Berrange
c42c1b8a5e Port QEMU driver to use USB/PCI device helpers
* src/qemu_driver.c: Remove usbfs/sysfs iterator code and call
  into generic helper APIs instead when setting device permissions
2009-09-10 14:34:07 +01:00
Daniel P. Berrange
ec31cd76c9 Add helper APIs for iterating over PCI device resource files
* src/pci.h, src/pci.c: Helper for iterating over PCI device
  resource files
* src/libvirt_private.syms: Export pciDeviceFileIterate
2009-09-10 14:34:07 +01:00
Daniel P. Berrange
1e060bf2d7 Add helper module for dealing with USB host devices
* src/Makefile.am: Add usb.h and usb.h to libvirt_util.la
* src/libvirt_private.syms: Export symbols
* src/usb.c, src/usb.h: Helper APIs for USB host devices
2009-09-10 14:34:06 +01:00
Daniel P. Berrange
cbe63e529d Fix more OOM handling bugs
* src/qemu_conf.c: Fix leak of values upon OOM
* src/xend_internal.c: Fix missing check for OOM failure
* tests/qemuargv2xmltest.c, tests/qemuxml2argvtest.c: Free
  stateDir upon exit to avoid leak
2009-09-10 14:30:00 +01:00
Daniel P. Berrange
755915ea4b Fix logging buffer overrun read
* src/logging.c: Fix buffer offset in logging read
2009-09-10 14:29:47 +01:00
Daniel P. Berrange
5c8d3d3bca Fix misc thread locking bugs / bogus warnings
Fix all thread locking bugs reported by object-locking test
case.

NB, some of the driver locking is getting too coarse. Driver
mutexes really need to be turned into RW locks instead to
significantly increase concurrency.

* src/lxc_driver.c: Fix useof driver when unlocked in the methods
  lxcDomainGetInfo, lxcSetSchedulerParameters, and
  lxcGetSchedulerParameters
* src/opennebula/one_driver.c: Fix missing unlock in oneDomainUndefine.
  Fix use of driver when unlocked in oneDomainGetInfo,
  oneGetOSType, oneDomainShutdown
* src/qemu_driver.c: Fix use of driver when unlocked in
  qemudDomainSavem, qemuGetSchedulerType, qemuSetSchedulerParameters
  and qemuGetSchedulerParameters
* src/storage_driver.c: Re-work storagePoolCreate to avoid bogus
  lock checking warning. Re-work storageVolumeCreateXMLFrom to
  remove a potential NULL de-reference & avoid bogus lock check
  warnings
* src/test.c: Remove testDomainAssignDef since it break lock chekc
  warnings.
* tests/object-locking.ml: Add oneDriverLock, oneDriverUnlock
  and one_driver_t methods/types to allow lock checking on the
   OpenNebula drivers
2009-09-10 14:26:56 +01:00
Mark McLoughlin
e52d608ddf Test that domain-specific qemu machine types are used correctly
* tests/testutilsqemu.c: add a machine types list for /usr/bin/kvm
  which doesn't have any aliases, while the guest has aliases

* tests/qemuxml2argvdata/qemuxml2argv-machine-aliases2.*,
  tests/qemuxml2argvtest.c: add a test using /usr/bin/kvm and make
  sure that 'pc' machine type doesn't get canonicalized using the
  aliases in the guest machine type list
2009-09-10 12:37:43 +01:00
Mark McLoughlin
6ab16aaf63 Simplify and fix qemudCanonicalizeMachine()
The algorithm is quite simple:

  If the emulator matches a guest's domain:
    if domain has machine type info:
      check the domain's machine type info
    else
      check the guest's default machine type info
  else if the emulator matches the guest's default emulator:
     check the guest's default machine type info

The previous implementation was incorrectly falling back to the default
machine type info if the domain's machine type info didn't have an
alias.

* src/qemu_driver.c: simplify and fix qemudCanonicalizeMachine()
2009-09-10 12:37:42 +01:00
Mark McLoughlin
3e14a8dc80 Probe machine types from kvm binary too
Currently we only probe the main qemu binary for machine types, but we
should also probe the kvm binary.

* src/qemu_conf.c: probe kvm binary machines in qemudCapsInitGuest()
2009-09-10 12:37:42 +01:00
Mark McLoughlin
f5dd3bcde9 Look up machine types from all domains in qemudGetOldMachines()
Rather than just looking at the default domain info, look at all
domains

* src/qemu_conf.c: look at all domains in qemudGetOldMachines()
2009-09-10 12:37:42 +01:00
Mark McLoughlin
44646747a7 Split up qemudGetOldMachines()
We need to look at all the domain infos in guest capabilities, not
just the defaults.

In order to allow that, split out a qemudGetOldMachinesFromInfo()
from qemudGetOldMachines(). We'll make more use of it in the next
patch.

* src/qemu_conf.c: split out qemudGetOldMachinesFromInfo() from
  qemudGetOldMachines()
2009-09-10 12:37:42 +01:00
Mark McLoughlin
aa67241bde Test qemu machine aliases
* tests/testutilsqemu.c: make 'pc' an alias for qemu-system-x86_64

* tests/qemuxml2argvdata/qemuxml2argv-machine-aliases1.*,
  tests/qemuxml2argvtest.c: add a test which uses qemu-system-x86_64
  and make sure the machine type is canonicalized.
2009-09-10 12:37:42 +01:00
Mark McLoughlin
d4c032d0b7 Re-factor qemu test machine allocation code
* test/testutilsqemu.c: split out code to testQemuAllocMachines()
  and make use of the ARRAY_CARDINALITY macro
2009-09-10 12:37:42 +01:00
Mark McLoughlin
6e7ab46106 Canonicalize the qemu machine type in qemuxml2argvtest
This doesn't have any affect on the current tests because we don't have
any machine aliases in the current test data.

* src/qemu_conf.h, src/qemu_driver.c: expose qemudCanonicalizeMachine()
  for the tests

* tests/qemuxml2argvtest.c: canonicalize the machine type
2009-09-10 12:37:42 +01:00
Mark McLoughlin
d7ed2c18e1 Dump qemu driver capabilities if test debugging enabled
* src/testutils.[ch]: make testDebug externally available

* src/testutilsqemu.c: if VIR_TEST_DEBUG is set, dump the qemu
  driver capabilities to stderr
2009-09-10 12:37:42 +01:00
Mark McLoughlin
3fa4a82e6f Fix formatting of machine types in capabilities XML
* src/capabilities.c: fix machine type formatting in
  virCapabilitiesFormatXML()
2009-09-10 12:37:42 +01:00
Mark McLoughlin
110abb0343 Add qemu -help test data for qemu-kvm-0.11.0-rc2
* tests/qemuhelpdata/qemu-kvm-0.11.0-rc2: add data

* tests/qemuhelptest.c: add expected output
2009-09-10 12:37:35 +01:00
Mark McLoughlin
cebd575cd5 Add a more featureful qemu capabilities test data
Things added include

  - x86_64 host
  - Migration features
  - NUMA topology
  - Security model
  - Canonical machine types
  - Domain machine types
  - An arm guest
  - More machine types for mips, mipsel, sparc and ppc
  - An x86_64 xenner guest

This file was generated on a Fedora 12 machine using latest libvirt
and qemu-kvm-0.11.0-rc2

* tests/capabilityschemadata/caps-qemu-kvm.xml: add more features
  to test
2009-09-10 12:25:42 +01:00
Mark McLoughlin
22d990f138 Add arm arch to capabilities schema
* docs/schemas/capabilities.rng: add arm and sort arches
2009-09-10 12:25:42 +01:00
Mark McLoughlin
e45b13d248 Update capabilities schema to allow multiple machines per domain
* docs/schemas/capabilities.rng: allow multiple machines per domain
  just like they are allowed for guests
2009-09-10 12:25:42 +01:00
Mark McLoughlin
db4137ba02 Add esx and tcp migration uri transports to capabilities schema
* docs/schemas/capabilities.rng: include esx and tcp uri_transport
2009-09-10 12:25:42 +01:00
Chris Lalancette
100cae7359 Fix regression from "Avoid polling on FDs with no events"
After the mentioned patch was applied, I noticed that
shutting down a kvm guest from inside (i.e. poweroff) caused
the guest to shutdown, but not removed from the list of
active guests.  DanB pointed out that the problem is that
the virEventAddHandle() call in the qemu driver was asking
to watch for 0 events, not HANGUP | ERROR as it should.  Add
these events so that shutdown works again.

Signed-off-by: Chris Lalancette <clalance@redhat.com>
2009-09-10 13:15:26 +02:00
Jim Meyering
f238709304 qemu_driver.c: factor out more duplication
* src/qemu_driver.c (qemudDomainRestore): Use the new ...TypeToString
function here, too.
2009-09-10 11:56:50 +02:00
Ryota Ozaki
32456779a1 Close logfile fd after spawning qemu
* src/qemu_driver.c: avoid a leak of file descriptor when exec'ing qemu
2009-09-10 11:34:14 +02:00
Charles Duffy
8d4ed2ad3d Reintroduce support for lzop compression
lzop was removed due to some confusion over whether it provided functional
advantages distinct from xz. This has been addressed in the mailing list post
archived at http://permalink.gmane.org/gmane.comp.emulators.libvirt/16487, and
support for lzop is re-added here.

* libvirt.spec.in: add dependancy on lzop
* src/qemu.conf: update documentation of save_image_format
* src/qemu_driver.c: re-add lzop compression option
2009-09-10 11:13:33 +02:00
Daniel Veillard
c5a305584f Deprecate lzma and lzop in favor of xz, add dep
* src/qemu_driver.c: drop lzma and lzop images compression options
  as they are deprecated by xz
* libvirt.spec.in: add requires for xz/bzip2/gzip as they are needed
  to implement the compression options
2009-09-09 16:44:44 +02:00
Maximilian Wilhelm
56ad465675 Check for libssh2 >= 1.0 for phy driver
* configure.in: phyp driver uses libssh2_session_block_directions()
  which is only available in libssh2 >= 1.0, so check for this symbol
  too when configuring
2009-09-09 16:21:38 +02:00
Jim Meyering
aec22258ef qemu_driver.c: factor out duplication in compression-type handling
* src/qemu_driver.c (QEMUD_SAVE_FORMAT_LAST): Define.
(qemudSaveCompressionTypeFromString): Declare.
(qemudSaveCompressionTypeToString): Declare.
(qemudDomainSave): Use those functions rather than open-coding them.
Use "cat >> '%s' ..." in place of equivalent
"dd of='%s' oflag=append conv=notrunc ...".
2009-09-09 12:11:34 +02:00
Jim Meyering
1aec7d8606 also allow use of XZ for Qemu image compression
* src/qemu_driver.c (enum qemud_save_formats) [QEMUD_SAVE_FORMAT_XZ]:
New member.
[QEMUD_SAVE_FORMAT_LZMA]: Mark as deprecated.
Use an explicit value for each member.
(qemudDomainSave, qemudDomainRestore): Handle the new member.
* src/qemu.conf: Mention xz, too.
2009-09-09 12:11:34 +02:00
Jim Meyering
5965de2f4d openvz_conf.c: remove dead store to "p"; use strchrnul
* src/openvz_conf.c (openvzReadNetworkConf): Replace open-coded
while loop with equivalent use of strchrnul.
* bootstrap (modules): Add strchrnul.
2009-09-09 12:11:34 +02:00
Jim Meyering
30506b9216 build: update gnulib submodule to latest 2009-09-09 12:11:29 +02:00
Daniel Veillard
4ae51ca54e Remove some tabs used for indent 2009-09-08 17:32:57 +02:00
Matthias Bolte
6fcac926fb Avoid another leak in src/xend_internal.c
* src/xend_internal.c: in xenDaemonLookupByID() if virGetDomain fails
  free up the name
2009-09-08 16:51:26 +02:00
Daniel Veillard
657326cfe3 Updated a number of localizations and regenerated 2009-09-08 16:14:08 +02:00
Daniel Veillard
f54de34ba4 Add flags and requires for Multipath storage
* libvirt.spec.in: the new multipath module requires device-mapper
  and device-mapper-devel for build
2009-09-08 16:07:54 +02:00
Dave Allan
ee8a06f833 Multipath storage support module
* configure.in src/Makefile.am src/storage_backend.[ch]
  src/storage_conf.[ch] src/storage_backend_mpath.[ch] po/POTFILES.in:
  add a new module for storage multipath, it requires device-mapper
2009-09-08 15:47:45 +02:00
Matthias Bolte
1128cc939d Avoid a leak in xenDaemonLookupByID
* src/xend_internal.c: free name in xenDaemonLookupByID() if
  virGetDomain() fails
2009-09-08 14:42:10 +02:00
Miloslav Trmač
f125d3265a Add a missing comment
* src/libvirt_private.syms: Add a missing comment for
  storage_encryption_conf.h entries
2009-09-08 13:33:35 +02:00
Miloslav Trmač
ca8a932c87 Fix a pasto in storage_encryption_conf.c
* src/storage_encryption_conf.c: small typo fix in top comment
2009-09-08 13:30:45 +02:00
Jim Meyering
f7d5b4d613 xm_internal.c: remove four useless comparisons after strchr
* src/xm_internal.c (xenXMDomainConfigParse): After t=strchr...
don't test *t; it's known.  This was *not* detected by clang,
but I spotted it since once instance was in the vicinity of the
dead increment of "data".
2009-09-07 18:14:41 +02:00
Jim Meyering
aecae56071 xm_internal.c: remove dead increment of "data"
* src/xm_internal.c (xenXMDomainConfigParse): Don't increment it.
2009-09-07 18:14:41 +02:00